With the toolchain up and running it was very easy to write C and assembly program which can read/write files, write text to the console and so on.
Linker
The linker was written from scratch. It may have been easier to use the linker in SDCC, but I knew it was quite easy to write my own. The linker has some features that made the demo development easier:- Sections can be aligned at 256 byte addresses
- Fine tuning of section ordering
- Linking to other pieces of code already in memory
- Custom size and address space restrictions
Emulator
I used Asbjørn Djupdal's emulator for a while, but I needed an emulator which supported my hardware modification. I also wanted sound support and to use SDL instead of X11.I ended up writing my own emulator. For Z80 emulation I used the emulator by Marat Fayzyllin (the same as in Asbjørn's emulator), but a newer version. The AY-emulator was was taken from the MAME project.
Timing-wise the emulator is fairly accurate, but not 100% cycle-exact:
- All instructions use the same number of cycles as on real hardware, even the undocumented ones.
- The graphics system emulator not 100% cycle-exact but it supports changing the palette on HSYNC and setting the scroll anywhere on a scanline.
- The floppy emulator has reasonable correct timing. The emulated floppy spins at 300 RPM. It only supports 400k disks though, and has no write support.
- Cycle counter
- Print the current raster line
- Toggle log levels for several subsystems
- Breakpoints
- Write text to the host console
Ingen kommentarer:
Legg inn en kommentar