Allows emulation of ZX Spectrum 128K paging using the One Meg interface, 128K Snapshots must be manually modified before use.
This is my new SAM COUPE utility SNAPER for loading modified snapshots in format SNA(128kB) or original SNA(48kB). SNAPER is written in SAM BASIC and use only short machine code for copy data from Sam ram to 1MB external ram.
Is possible run 48kB snapshots in slow and fast speed(turbo 6MHz) and create/use new palette for all 16 ZX colours.
More info about this project:
Use internal memory 256 or 512 kB and ram paging in low 32kB and high 32kB of address space Z80 CPU. Practically is impossible port any software from ZX Spectrum 128 to SAM COUPE because ZX128 use only memory paging in last 16kB (in area 49152-65535).
However the possibility exists when using the One Meg to connect in high 32kB of address space external ram and use paging on two new ports 128 and 129. Port 128 set 16kB pages on address 32768-49151 and port 129 on address 49152-65535.
ZX Spectrum 128 contain ram with size 128kB and is divided to 8 pages with size 16kB. Layout of address space 64kB:
00000-16383 = ZX rom
16384-32767 = ram page 5 (used as videoram 1)
32768-49151 = ram page 2
49152-65535 = paging area with possibility set ram pages 0-7.
Page 7 contain second videoram.
Ram paging is on port 32765 on bits D0-D2. Next bits on this port are used for rom and videoram switching and possibility disable paging (switch to ZX48kB mode).
Part of original ZX128 software can be easy modified for run on SAM COUPE with 1MB external memory. I use yet only SNA48/128 files loading in this way :
Set on SAM COUPE graphic mode 1 (ZX mode)
Set ZX color palette
Load to internal SAM ram ZX ROM with 48 basic (my zx rom contain only small patch for possibility run zx snapshots)
Load ram 16384-32767 from zx snapshot to SAM ram
Load ram 32768-49151 from zx snapshot to external ram page 2
Load all ZX128 pages from snapshot to identical number of external ram pages
After full memory loading set all Z80 registers, disable SAM rom and connect from address 0 SAM ram with ZX rom and active write protect in low 16kB. My patch in ZX rom connect external ram in high 32kB of adress space, set on adress 32768-49151 external ram page 2 and in area 49152-65535 correct page for snapshot. Patch at end set correct stack pointer, and jump to starting address. It's all.
Original SNA files for ZX128 is impossible load and run. It's need some patches before use.
To modify SNA(128kB) files for SAM COUPE :
- As first you need ZX emulator for PC with new ZX ROM. ZX128 ROM 32kB must be replaced with new 32kB file (join 2x 16kB original ZX48 rom). And why ? We need on ZX emulator ignore ZX rom paging - sam coupe can emulate only one 16kB zx rom without paging. After create new rom file start emulator and set ZX128 mode. ZX will start to 48 basic with enable 128kB ram paging
- Load any snapshot or game from TAP file and goto debugger ideally at start address of game
- Find in game code all instructions for memory paging (use port 32765) and replace port number to 16513 (= port 129 in low address of port and 16384 on high address). ZX128 and +2A/+3 models use incomplete port addressing and this address will backward compatible with SAM COUPE and with ZX models
- Also value for writing to paging port can be rewritten to 0-7 only (reset all high bits)
- As last patch must be rewrittenports for music chip AY-3-8912 to new address. Original AY ports #FFFD and #BFFD access on SAM coupe to MIDI ports and slow down CPU. After rewrite this ports to address #FF01 and #BF01 will software backward compatible with AY chip on ZX and on SAM COUPE will CPU run at original speed.
- Run snapshot in ZX emulator, and save new modified game as SNA(128kB) snapshot for direct loading on SAM COUPE.
Warning! ZX Spectrum runs at 3.5MHz but Z80 code in external 1MB ram will run always at full speed 6.0 MHz (yes, it's faster than code in SAM COUPE internal ram at 4.8 MHz).
This way enable only run software using zx videoram 1 in page 5 and will work ram mirroring of ram page 2 and area 32768-49151. But videoram switching is impossible. Some ZX software don't use it.