Speculator Filetypes ==================== Speculator recognises three filetypes: &700 - SpecROM ROM Image &701 - SpecTape Tape file &702 - SpecSnap Full memory snapshot &700 - SpecROM -------------- &4000 bytes long, loaded into the Spectrum's memory map at &0000 to &3FFF. &701 - SpecTape --------------- Tape file, identical to the standard .TAP tape file, with two expections: A standard .TAP file is this format: {}... A Speculator tape file is this format: {}... So, for example, the command SAVE "ROM" CODE 0,2 would produce: |------ Spectrum-generated data -------| |---------| .TAP: 13 00 00 03 52 4f 4d 7x20 02 00 00 00 00 80 f1 04 00 ff f3 af a3 SpecTape: 11 00 00 03 52 4f 4d 7x20 02 00 00 00 00 80 02 00 ff f2 af ^^^^^...... first block is 19 bytes in a .TAP file (17 bytes+flag+checksum) but in a SpecTape file it is the actual data length (17 bytes). ^^... flag byte (A reg, 00 for headers, ff for data blocks) ^^ first byte of header, indicating a code block file name ..^^^^^^^^^^^^^ header info ..............^^^^^^^^^^^^^^^^^ checksum of header .........................^^ length of second block ........................^^^^^ flag byte ...........................................^^ first two bytes of rom .................................^^^^^ checksum (checkbittoggle would be a better name!).............^^ A .TAP file can be converted to a SpecTape file by decrementing the length by two, and omitting the checksum byte at the end of each block. Speculator expects SpecTape files to be in a directory called Programs within !Spectrum, and cycles through all recognisable files in this directory. Speculator can be easily patched to make it reference a different directory. The following is for Speculator v1.30, and will make Speculator reference the directory . 003148 ".Programs" change to "SpecTape:" 003174 "adfs:::::" change to "SpecTape:" 0031E4 change to SWINV Add to the !Boot file: Set SpecTape$Path .Programs. (or whatever path you wish to use) &702 - SpecSnap -------------- Full memory dump snapshot of the full Spectrum memory, prefixed with 256 bytes of workspace data with holds the register contents and a other variables. &00-&03 : A register &04-&07 : F register &08-&0B : B register &0C-&0F : C register &10-&13 : D register &14-&17 : E register &18-&1B : H register &1C-&1F : L register &20-&23 : PC register &24-&27 : RMA address of the Speculator that saved this shapshot - ignored on loading &28-&2B : SP register &2C-&2F : ? &30-&8B : ? &8C : ? &8D : ? &8E : Sound flag - &FF=off, &00=on &8F : Saved escape flag, to restore on exit &90-&93 : SWI intercept vector? &94-&97 : pseudo-R register - initialised with TIME at startup &98-&9B : ? &9C-&9F : ? &A0 : toggled on interupts &A1-&A3 : ? &A4-&A7 : IM 0, 1 or 2 &A8-&AB : Scandir index for scanning SpecTape directory &AC-&AF : Currently open file PTR &B0-&B3 : Currently open SpecTape handle &B4-&B7 : ? &B8-&BB : Saved ARM SP to restore on exit &BC : &BD : &BE : I &BF : IFF - if non-zero, INTs are enabled &C0-&C7 : RGB values for border colour &C8-&CB &CC-&CF &D0-&D3 &D4-&D7 &D8-&DB &DC-&DF &E0-&E7 : Keyboard matrix keypressed bitmap &E8-&EB &EC : A' &ED : F' &EE &EF &F0 : B' &F1 : C' &F2 : &F3 : &F4 : D' &F5 : E' &F6 : H' &F7 : L' &F8-&F7 : IX &FC-&FF : IY &100 : Start of 64K memory dump Where a register occupies more space than the register size, the unused high bytes are zero. For example, &00 hold the A register and &01, &02 and &03 hold zero. Loading a snapshot with a register holding an oversized value can have unexpected effects. RawNotes -------- 000000F0 : 17 B' 000000F1 : 4B C' 000000F2 : 00 000000F3 : 00 000000F4 : 00 D' 000000F5 : 06 E' 000000F6 : 10 H' 000000F7 : 7F L' 000000F8 : 00 00 00 00 IX 000000FC : 3A 5C 00 00 IY 00000100 : F3 AF 11 FF Start of memory dump 00000000 : 00 00 00 00 A ->r3 00000004 : 44 00 00 00 F ->r4 00000008 : 00 00 00 00 B ->r5 0000000C : 00 00 00 00 C ->r6 00000010 : 5C 00 00 00 D ->r7 00000014 : A8 00 00 00 E ->r8 00000018 : 5C 00 00 00 H ->r9 0000001C : B9 00 00 00 L ->r10 00000020 : F9 15 00 00 PC ->r11 00000024 : 44 B1 8B 01 ->r12 rma address of the instatiation that saved this snapshot 00000028 : 4A FF 00 00 SP ->r13 0000002C : 02 9C 89 21 00000030 : 84 40 B0 E1 01 9E 89 31 02 9E 89 21 80 90 85 E4 01 0C 80 E2 24 44 A0 E1 : „@°á.‰1.‰!€…ä..€â$D á 00000048 : 00 90 DC E7 09 4C 84 E1 84 40 B0 E1 01 90 A0 31 02 90 A0 21 84 40 B0 E1 : .Üç.L„á„@°á. 1. !„@°á 00000060 : 01 92 89 31 02 92 89 21 84 40 B0 E1 01 94 89 31 02 94 89 21 84 40 B0 E1 : .’‰1.’‰!„@°á.”‰1.”‰!„@°á 00000078 : 01 96 89 31 02 96 89 21 84 40 B0 E1 01 98 89 31 02 98 89 21 84 40 FF 00 : .–‰1.–‰!„@°á.˜‰1.˜‰!„@ÿ. 00000090 : EC 0C 7C EA 00000094 : BB 38 01 00 TIME of startup 00000098 : 84 40 B0 E1 07 9C 89 31 02 9C 89 21 01 00 00 00 : ì.|ê»8..„@°á.œ‰1.œ‰!.... 000000A8 : 00 00 00 00 02 9E 89 21 00 00 00 00 01 0C 80 E2 00 00 00 00 00 90 3F FF : .....‰!......€â.....?ÿ 000000C0 : 00 00 00 40 00 0F 00 40 0F 00 00 40 0F 0F 00 40 F0 00 00 40 F0 0F 00 40 : ...@...@...@...@ğ..@ğ..@ 000000D8 : FF 00 00 40 FF 0F 00 40 000000E0 : FF FF FF FF FF FF FF FF Keyboard map 000000E8 : F8 B1 8B 01 00 44 00 00 000000F0 : 17 B' 000000F1 : 4B C' 000000F2 : 00 000000F3 : 00 000000F4 : 00 D' 000000F5 : 06 E' 000000F6 : 10 H' 000000F7 : 7F L' 000000F8 : 00 00 00 00 IX 000000FC : 3A 5C 00 00 IY 00000100 : F3 AF 11 FF Start of memory dump mem-4=IY mem-8=IX mem-9=L' mem-10=H' mem-11=E' mem-12=D' mem-13 mem-14 mem-15=C' mem-16=B' mem-17 mem-18 mem-19=F' mem-20=A' mem-24 - set to 'L' (&4C) on startup mem-32 - keyboard map? mem-32+7 - end of keyboard map mem-65 iff - if nonzero, F=F OR 4 on LD A,I mem-66 - I reg mem-72 = external (arm) SP mem-76 = filetype of tape file mem-80 = file handle for loading mem-84 = PTR for file handle mem-88 = scandir index for loading mem-92 - Interrupt Mode - set to 1 on startup mem-96 - toggled on interupts mem-100 = after setting up screen, SWI &C0000,?,thisbyte AND &17,&17 - set to 5 on startup mem-104 = mem-108 = R reg in a fashion mem-112 = swi intercept vector? mem-113 = prevous escape flag mem-114 = sound flag - &FF=off SWI &C0000 logs OUT &FE calls OUT 254,n does SWI &C0000,[mem-100],n AND &17,[mem-100] EOR (n AND &17) R5=B, R6=C, R3=A, R4=F, R8=E, R7=D, R10=L, R9=H Workspace: 0: r3 4: r4 8: r5 .. r11 (PC) r12 ignored r13 (SP) z80mem-108: TIME of startup