@40Crisis
This is amazing. I would never of thought that emulating another home computer on the CPC would of been possible.
A few questions:
1) Does the CPC have to be 128kb to emulate a 48kb machine?
2) Does the emulator work with RAM expansions?
3) If the RAM expansion is 256kb could it also emulate a 128kb machine?
4) Does the CPC also emulate the beeper or would it disregard that sound?
5) Are there speed differences between an original spectrum game and the emulated version on a CPC?
Great work and it would be interesting to see other games emulated.
This has me wondering if the CPC could emulate an MSX 1.....
First of all, my zx spectrum rom emulation is partial, and at the moment
only emulates the features needed by zx basic parts from the supported zx games.
For instance, Maziacs doesn't have zx basic graphics functions emulation, because it doesn't use it.
For Ant Attack I only need to add the circle basic function emulation.
A complete zx spectrum basic emulator is available: ZXM. It only emulates zx basic programs in black and white
output. It has less memory than a real 48k Spectrum because the emulation code is for 64K CPC.
It's a nice piece of software and this is one of the program that convinced me it's was possible
to emulate a 48K spectrum on a CPC.
1)
It depends on the zx spectrum program you want to emulate.
The two games emulators I wrote for CPC ( Maziacs and Ant Attack ) uses zx basic and assembly.
Zx basic use means that you need to have 16 KB zx spectrum rom loaded in memory at location 0.
Then you need to had emulation code (about 6 KB) plus 16K CPC screen memory (which can be optimized if necessary to 12288 bytes by tweeking
CRTC registers to have linear screen memory).
For example my first emulator for zx maziacs fits in 64K CPC memory because the zx game
doesn't use full 48K ram available on speccy.
Ant Attack emulator didn't fit in 64k because it makes use of full 48K Ram. Only the zx spectrum display memory
(6912 bytes) was available. I use it to put emulation code. So I need 16K extra memory for CPC screen.
2)
I think it should if expansion uses standard memory bank addressing.
3)
Yes, it's perfectly possible if the emulator supports it, which is not the case
4)
The zx spectrum beeper sound is emulating at runtime (no sound records) in a very similar way to the zx.
5)
Most of zx spectrum machine code runs unchanged on the CPC. Only parts contening I/O need to be emulated
(graphics output, controls input and sound output).
When possible, I tried to write code as fast as possible on the CPC to get close to spectrum speed.
The main problem is the graphics, On the CPC you have to read/write twice memory compared to speccy graphic memory.
The zx spectrum beeper sound could be also CPU intensive to emulate but wastes nearly the same as it does on a speccy.
Maziacs emulated on CPC is as fast as on the zx. Luckily the zx game waits about 60% of the available CPU time to slow it down.
This is probably because zx graphic display is very fast. Graphics background of the maze, covering nearly full screen, are displayed using zx graphics attributes (on byte write =
64 pixels displayed). This was hard to emulate on the CPC but I could do it displaying tiles using the stack.
Ant Attack emulator is a bit slower due to optimisation I explained above in this topics.
Regarding MSX emulation:
MSX has a hardware graphic chip for displaying sprites that CPC lacks.
Sound chip is the same that the CPC one.
Emulation is probably possible but will be probably much slower.