14

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?

4

9 Answers 9

18

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.

1
  • 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, 2017 at 15:28
17

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)

8
  • 2
    please state the reason for downvoting my answer.
    – EL Dendo
    Apr 6, 2017 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, 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
    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.
    – mnem
    Apr 9, 2017 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, 2017 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...

2
  • With what programming language can I make it with?
    – LilVinny
    Jan 1, 2017 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, 2017 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.

3

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.

2

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)

2

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

0

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.

0

Forgive the very late reply, but there was one I wrote a few years back that does: https://github.com/luxocrates/viciious

1
  • Never too late to answer!
    – bjb
    Aug 17, 2023 at 17:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .