[tab width = 4] Save SPECTRA state in .z80 file Kio 2016-03-05 =============================== This file describes the enhancements made by zxsp to save the SPECTRA state in a .z80 file. SUMMARY ======= Snapshots containing state of a SPECTRA interface must be saved in version 3 of the .z80 file format. Bit 3 in byte "rldiremu" indicates presence of the SPECTRA interface. Bits 5-7 in byte "data" store bits 5-7 of the border color. NOTE: in version 1.45 bit 5 indicated compressed data. 2 Bytes are appended to the normal .z80 header to store the SPECTRA state. Memory pages 12, 13 and 14 are assigned to the rom slot and the SPECTRA ram. HEADER ====== // Z80 Version 1.45 Header uint8 a,f,c,b,l,h,pcl,pch,spl,sph,i,r; uint8 data Bit 0 : Bit 7 of the R-register Bit 1-3: Bits 0-2 of the border colour Bit 4 : 1 = Basic SamRom switched in Bit 5-7: Bits 5-7 of the border colour ***SPECTRA*** uint8 e,d,c2,b2,e2,d2,l2,h2,a2,f2; uint8 yl,yh,xl,xh,iff1,iff2; uint8 im; // Z80 version 2.01 enhanced header if pch=pcl=0: uint16 h2len; uint16 npc; uint8 model; uint8 port_7ffd_or_port_f4; uint8 if1paged_or_port_ff; uint8 rldiremu Bit 0: 1 = R register emulation on Bit 1: 1 = LDIR emulation on Bit 2: 1 = AY sound in use, even on 48K machines Bit 3: 1 = SPECTRA interface present ***SPECTRA*** Bit 6: 1 = (if bit 2 set) Fuller Audio Box emulation Bit 7: 1 = Modify hardware uint8 port_fffd uint8 soundreg[16] // Z80 version 3.0 enhanced header if pcl=pch=0 & h2len≥54: uint8 t_l,t_m,t_h uint8 spectator uint8 mgt_paged uint8 multiface_paged uint8 ram0,ram1 uint8 joy[10] uint8 stick[10] uint8 mgt_type uint8 disciple_inhibit_button_status uint8 disciple_inhibit_flag // warajewo/xzx extension if pcl=pch=0 & h2len≥55: uint8 port_1ffd // zxsp extension for SPECTRA interface. pcl=pch=0 & h2len≥57: uint8 spectra_bits Bit 0: new colour modes enabled ***SPECTRA*** Bit 1: RS232 enabled Bit 2: Joystick enabled Bit 3: IF1 rom hooks enabled Bit 4: rom paged in Bit 5: port 239: Comms out bit Bit 6: port 239: CTS out bit Bit 7: port 247: Data out bit uint8 spectra_port_7fdf last out to port 7FDF ***SPECTRA*** MEMORY PAGES ============ The page numbers are as follows: pg no. memory bank ------ ----------- 12 SPECTRA rom 13 SPECTRA ram[0] 14 SPECTRA ram[1] When writing a .z80 file, If a rom cartridge is inserted into the SPECTRA rom slot, then the rom should be saved in the .z80 file. If the SPECTRA shadow screen bit (port 7fdf bit 6) was ever set, then the SPECTRA ram should be saved in the .z80 file. When reading a .z80 file, page 12: load into SPECTRA rom page 13: load into SPECTRA ram[0] page 14: load into SPECTRA ram[1] zxsp 16/48k: page 8: also load into SPECTRA ram[0] if page 13 was not yet loaded zxsp +128k / +3 / +2A: page 5: also load into SPECTRA ram[0] if page 13 was not yet loaded page 7: also load into SPECTRA ram[1] if page 14 was not yet loaded