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?
-
9What do you mean by "used in the terminal"?– Ken GoberCommented Jan 1, 2017 at 2:51
-
1Are you looking for some sort of emulator?– Chenmunka ♦Commented Jan 1, 2017 at 10:58
-
An emulator, that looks like this: c64-wiki.com/images/thumb/e/e8/screenshot003.jpg/…– LilVinnyCommented Jan 3, 2017 at 20:50
-
1The specific phrase "the terminal" generally indicates a (GUI-mode) Linux user :-)– daveCommented Apr 29, 2019 at 22:39
9 Answers
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.
-
4you may also be able to run Vice's x64 with the
-console
option, but I can't see any way to get the debugger/monitor to talk to the console– scrussCommented Jan 1, 2017 at 15:28
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)
-
2
-
I would say that this is a borderline link-only answer, which are generally frowned upon on Stack Exchange. Please edit your answer to include details from the linked page here.– JALCommented Apr 8, 2017 at 19:05
-
2@ELDendo You can add a link to it, but the answer has to make sense on its own too. You've done this, which is great! You can add the link back if you like. (If I'm reading the question correctly, this is also the only answer that answers the full question, providing instructions on how to create one as well as providing a download for one.)– wizzwizz4 ♦Commented Apr 9, 2017 at 7:56
-
2@ELDendo The reason why link-only answers are discouraged is answers on this site are intended to stand the test of time and links eventually go dead. The idea is to at least provide enough information in your answer to still give someone a good jumping-off point if / when the link goes dead in the future.– mnemCommented Apr 9, 2017 at 20:10
-
3When I write an answer with a link, I always ask myself "if I took the link away, would the answer still add any value?" If the answer is no, I try to change it so the answer is yes. In this case, it was a bit harsh because your answer "yes ED64" did actually answer the question asked. Also, the most upvoted answer is also a link only answer and not even to an emulator. I think your modified answer is great btw. +1– JeremyPCommented Apr 10, 2017 at 9:38
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...
-
-
2@Sailormanenzo Any. C, C++, Python, Ruby, Perl; even Brainf*** if you really want to. C or C++ is probably a good idea though.– wizzwizz4 ♦Commented Jan 1, 2017 at 10:36
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?
If that's the case, than the SDL port of VICE can be used from just the CLI and using the framebuffer:
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)
And for the looks of it, somebody did that using a Raspberry Pi, and arrived at this result, in comparison with a real Commodore:
"or any other emulator" would include emulators like SIMH that are meant to emulate old mainframe/minicomputer systems that were supposed to be used with literal terminals - these will either run in a terminal natively, or easily allow you to connect a serial communications program running in a terminal to their emulated serial ports.
Also it should be possible with some emulators for CP/M machines, there were a lot of real world CP/M and MP/M machines that were used wth terminals as their primary user interface.
There is an 8bit computers emulation framework: https://floooh.github.io/tiny8bit/
It contains really competent C64 emulator in the framework, which can be built with ASCII (xterm-256color) and Sixel frontends.
Forgive the very late reply, but there was one I wrote a few years back that does: https://github.com/luxocrates/viciious