Generic Emulators
Barebone emulator, or “generic emulator”, is a customizable emulator of CPU + memory + serial terminal. You can configure it by simple config file. Let’s long story short…
First of all, prepare a config file, e.g. “mycomputer.emu”. Extension “.emu” is mandatory. File should contain this:
Format is really simple: Each line contains one directive. Lines with “;” at the same beginning are comments. Here are parameters:
parameter
value (case sensitive)
cpu
can be “I8080”, “Z80” or “C6502”
memory.ram.from
starting address for RAM (please follow the 0x… convention for hexadecimal numbers)
memory.ram.to
last address of RAM
memory.rom.from, memory.rom.to
Same as above, but for ROM (your source code should lays here)
serial
Type of serial port. You can select “6850” or “simple”. See below
serial.data, serial.control
For 6850 serial – two ports.
serial.in, serial.out
in and out ports for “simple serial port”
serial.status
“Simple port” status. Read only port. It returns “serial.status.available” when there is any data for read, and “serial.status.ready” if port is ready to send a data.
terminal.caps
1 sets terminal to caps lock (default value 0 means “no caps”)
serial.interrupt
value 1 means that terminal invoke CPU interrupt on keypress (=serial data is ready for read). Default 0 means “no interrupt”.
Two serial ports are available – 6850 is the standard ACIA circuit, “simple” is a generic serial port with no complicated functions, just read and send bytes.
How to use it? It’s simple, just tell which emulator should use by the “.engine” directive (without “.emu”), like this:
It’s a simple “hello” program, using the above configuration. Just save it as “test.z80” and click to “Emulate (F10)”. It should compile and run emulator with given configuration.
For 6502-based computer you can use this config file (e.g.”my6502.emu”):
Please notice the “serial.map” directive. It means that serial port is not mapped into “I/O” space (like Z80/8080 does), but into memory space. Serial.data and serial.control are addresses now.
6502 requires RAM in a bottom part of address space, ROM at the top.
Try this code:
Other processors and peripherals are on its way…
Last updated