I was looking for a C64 type computer that can be used in the terminal. Can I code one or is there one on the interwebs?
If you wish to limit emulation to running Commodore BASIC v2 in the terminal, cbmbasic seems to be a transpilation of the BASIC ROM to portable (if almost unreadable) C.
It is certainly possible to write a emulator that run in a terminal. If the emulated system is text only then you can intercept the text input and output, and transfer it from/to the terminal.
on a c64 text is written to the screen by writing to a certain range in memory. You can intercept the write to that range and transfer the character code to the terminal.
When a key is pressed on the terminal you can put the keycode in the inputbuffer of your emulated c64.
since the c64 doesn't use ascii for it's screencodes a conversion table should be provided.
If the emulated system uses also graphics modes (like the c64) you can:
- do a partial emulation (only text mode)
- use some graphic terminal (I think you can use graphics in xterm but I never used nor tested that)
- use a graphic library above X-windows (or something equivalent). an X-window environment is in fact a graphic terminal.
I wrote a tutorial 'ED64 - HOW TO WRITE A COMMODORE 64 EMULATOR' and a simple c64 emulator in pascal. Chapter 4 and 5 use a simple terminal solution. (text only)
You can certainly code an emulator that works in a terminal - graphics will be tricky, but they're super-useful. I use my terminal-mode Apple II often when developing assembly code...
Well, since you asked for "any other emulation"...
It's not C64, but the Atari800 emulator (http://atari800.sourceforge.net/) for Atari 8-bit systems can run using "curses" for display. This lets you use it from the command-line without a graphical environment.
This will obviously limit your ability to do much with it beyond the hardware's text-based screen modes.
The tool exomizer from Magnus Lind also comes with a 6502 emulator, which according to the credits in the file was also written by Magnus. The tool (compiled into a program "testrun", pls. look for the source in the exomizer donwload) simulates the behavior of a 6502 machine program on the command line.
Given the lack of clarification in the question to "What do you mean by "used in the terminal"? it seems possible that for example within Linux terminology this is meant to be read as
> Is there a C64 emulator that can be run from the command line, that is: without X11?
you'll have to compile the SDL port. SDL can use the framebuffer device (which doesnt need X11) - the regular XAW/GTK ports can only work if X11 is present (src)