2017-04-21 21:11:09 +00:00
|
|
|
# Cybernoid Music Disk
|
2017-04-21 21:09:07 +00:00
|
|
|
|
|
|
|
My motivation was to really push the MAME AY8910 emu code, as the Apple
|
|
|
|
Mockingboard music (Skyfox, Ultima) wasn't really exercising it that
|
|
|
|
hard.
|
|
|
|
|
|
|
|
So as a little R&D proj, I thought I'd convert Dave Rogers' Spectrum
|
|
|
|
128 Cybernoid routine (written in 1988).
|
|
|
|
|
|
|
|
Here's a summary of how I did it:
|
2017-04-21 21:23:28 +00:00
|
|
|
- I got cybernoid.ay from [here](http://www.worldofspectrum.org/projectay/gdmusic.htm)
|
2017-04-21 21:21:14 +00:00
|
|
|
- Split it into bin's with AYSplitR
|
2017-04-21 21:23:53 +00:00
|
|
|
- Disassembled with Inkland's dz80w [here](http://www.inkland.org.uk/dz80/index.htm)
|
2017-04-21 21:21:14 +00:00
|
|
|
- I wrote 6502 macros to replace the z80 opcodes
|
|
|
|
- For cybernoid, I hand converted the z80 code to 6502 (using the macros)
|
|
|
|
- I added a few extension to AppleWin's debugger to help debug the 6502 code (ACME symbol loading & ZP pointer support).
|
2017-04-21 21:09:07 +00:00
|
|
|
|
|
|
|
I use Skyfox's MB detection routine.
|
|
|
|
|
|
|
|
The Z80 regs are emulated with zero-page memory locations $F0..$F8
|
|
|
|
The playback routine is very inefficient, as it:
|
2017-04-21 21:21:14 +00:00
|
|
|
- saves the ZP memory
|
|
|
|
- restores the Z80 regs
|
|
|
|
- runs the IRQ handler
|
|
|
|
- saves the Z80 regs
|
|
|
|
- restores the ZP memory
|
2017-04-21 21:09:07 +00:00
|
|
|
|
|
|
|
This allows playback to work simultaneously with Applesoft & ProDOS. If
|
|
|
|
DOS3.3 doesn't disable IRQs around disk I/O, then it won't work on a
|
|
|
|
real Apple (under DOS3.3), but it'll still work on an emulator :-)
|
|
|
|
|
|
|
|
I profiled the IRQ handler and IIRC, it takes about 20% of the frame on
|
|
|
|
average. This is poor, but the code can easily be optimised. Remember
|
|
|
|
this was really just a proof of concept.
|
|
|
|
|
|
|
|
After this, I wrote a python script to do the Z80->6502, and quickly
|
|
|
|
converted Cybernoid-II.
|
|
|
|
|
|
|
|
Currently playback on real h/w produces noisy renditions of the tunes. I
|
|
|
|
have replaced my AY-register update routine with the slower one used by Skyfox
|
|
|
|
which gives better but not perfect results.
|
|
|
|
|
|
|
|
Tom
|
|
|
|
25 March 2006
|