10

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?

14

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.

  • 4
    you 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 – scruss Jan 1 '17 at 15:28
13

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
    please state the reason for downvoting my answer. – EL Dendo Apr 6 '17 at 22:40
  • 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. – JAL Apr 8 '17 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 Apr 9 '17 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. – mnem Apr 9 '17 at 20:10
  • 3
    When 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 – JeremyP Apr 10 '17 at 9:38
7

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...

  • With what programming language can I make it with? – LilVinny Jan 1 '17 at 8:09
  • 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 Jan 1 '17 at 10:36
5

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.

1

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.

1

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:

enter image description here (click for big)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.