moa/README.md

105 lines
4.4 KiB
Markdown
Raw Normal View History

Moa
===
###### *Started September 26, 2021*
2021-11-24 22:37:09 +00:00
Moa is an emulator/simulator for computers using various 68000 and Z80 CPUs and
peripherals. The original idea was to emulate the computer I had built as part
2021-11-28 18:32:03 +00:00
of the [Computie project](https://jabberwocky.ca/projects/computie/).
2021-11-24 22:37:09 +00:00
Currently it can simulate Computie (68000) and the TRS-80 Model I (Z80), and I'm
working on supporting the Macintosh 512k and Sega Genesis.
2021-11-28 18:32:03 +00:00
For more detail, check out this post about how I started the project:
[Making a 68000 Emulator in Rust](https://jabberwocky.ca/posts/2021-11-making_an_emulator.html)
2021-12-06 03:41:23 +00:00
Computie
--------
2021-11-28 18:32:03 +00:00
2021-11-24 22:37:09 +00:00
For Computie, it can do everything the 68k-SMT board can do, including run the
monitor program and load the Computie OS kernel and boot it from the
CompactFlash card. To run it:
```
cargo run -p moa-console --bin moa-computie
```
It will open two PTYs: one for the serial terminal, and one for the SLIP
connection. Once open, it will try to launch both `pyserial-miniterm` as a
separate process and connect to the Computie PTY. It will also launch
`slattach` with the associated setup commands to create the SLIP device on the
host, and set up host routing. The exact commands in
`src/machines/computie.rs` might need to be adjusted to work on different
hosts.
2021-12-06 03:41:23 +00:00
TRS-80
------
2021-11-24 22:37:09 +00:00
For the TRS-80, it can run Level I or Level II Basic, but it doesn't yet
support a cassette tape drive or floppy drive. I haven't tested it that
thoroughly either, so any help with it would be welcome. I mostly made it to
test the Z80 cpu implementation in a simpler computer before I used in the
Genesis emulator. The frontend uses the
[`minifb`](https://github.com/emoon/rust_minifb) rust crate to open a window
and render the characters to screen, as well as accept input from the keyboard.
```
2021-12-06 03:41:23 +00:00
cargo run -p moa-minifb --release --bin moa-trs-80
2021-11-24 22:37:09 +00:00
```
By default it will start Level I Basic. To use the other rom, add the option
`--rom binaries/trs80/level2.rom`
2021-12-06 03:41:23 +00:00
![alt text](images/trs-80-level-ii-basic.png)
2021-12-06 03:53:23 +00:00
The characters are being drawn pixel by pixel (6x8) using characters I drew
using [this handy website](https://maxpromer.github.io/LCD-Character-Creator/).
They aren't a perfect match of the characters used by the TRS-80
2021-12-06 03:41:23 +00:00
Sega Genesis/MegaDrive
----------------------
It can be run with:
2021-11-24 22:37:09 +00:00
```
2021-12-06 03:41:23 +00:00
cargo run -p moa-minifb --release --bin moa-genesis -- <ROM FILE>
2021-11-24 22:37:09 +00:00
```
2021-12-06 03:41:23 +00:00
The Genesis emulator is a work in progress. It can play a few games but some
games won't run because the bank switching for the Z80 coprocessor is not
working yet, and some games will hang waiting for the Z80 to respond. For the
video processor, the window layer is not drawn and the layer priority is not
handled. The horizontal scroll also doesn't work on a line-by-line basis so it
tends to be quite jerky as you move, with the sprites and cells misaligned
until you've moved one complete cell over (8x8 pixels).
On the Sonic 2 title screen, the colours for Tails are wonky, probably because
there's some trickery going on to get more than 16 colours per line, but the
emulator currently renders the whole frame at once instead of line by line, so
changes that should be made while the screen is updating don't show up
![alt text](images/sega-genesis-sonic2-title.png)
2021-12-06 03:53:23 +00:00
The game play is mostly working but the bottom of the clouds should be a
different colour, probably because highlight/shadow colours are not yet
supported. The time in the upper left corner also doesn't seem to progress
2021-12-06 03:42:11 +00:00
![alt text](images/sega-genesis-sonic2-start.png)
2021-12-06 03:41:23 +00:00
2021-12-06 03:53:23 +00:00
I'm not yet sure why the clouds in the background are cut off suddenly. They
change in a glitchy way when you move around
2021-12-06 03:42:11 +00:00
![alt text](images/sega-genesis-sonic2-bridge.png)
2021-12-06 03:41:23 +00:00
There are some graphics glitches in Earthworm Jim, but it's almost playable if it
wasn't for the 'jump' button, which only makes him jump a few pixels
2021-12-06 03:42:11 +00:00
![alt text](images/sega-genesis-earthworm-jim.png)
2021-12-06 03:41:23 +00:00
General Options
---------------
2021-11-24 22:37:09 +00:00
By default, the minifb frontend will scale the window by 2. This can be
changed with the `--scale [1,2,4]` option.
The `-d` or `--debugger` option will make the emulator start the debugger
before running. There is a simple built-in debugger for stepping through
the rom instructions being emulated. The state of the CPU registers will
be displayed after each instruction, breakpoints can be set, memory contents
can be examined, and memory locations can be modified. This has helped a lot
with tracking down errors in the emulator itself.