Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
385 | savelij | 1 | |
2 | .SNA, .snap or .snapshot |
||
3 | (Mirage Microdrive format used by many emulators) |
||
4 | |||
5 | This format is the most well-supported of all snapshot formats (though Z80 is |
||
6 | close on its heels) but has a drawback: |
||
7 | |||
8 | As the program counter is pushed onto the stack so that a RETN instruction can |
||
9 | restart the program, 2 bytes of memory are overwritten. This will usually not |
||
10 | matter; the game (or whatever) will have stack space that can be used for this. |
||
11 | However, if this space is all in use when the snap is made, memory below the |
||
12 | stack space will be corrupted. According to Rui Ribeiro, the effects of this can |
||
13 | sometimes be avoided by replacing the corrupted bytes with zeros; e.g. take the |
||
14 | PC from the, stack pointer, replace that word with 0000 and then increment SP. |
||
15 | This worked with snapshots of Batman, Bounder and others which had been saved at |
||
16 | critical points. Theoretically, this problem could cause a complete crash |
||
17 | on a real Spectrum if the stack pointer happened to be at address 16384; |
||
18 | the push would try and write to the ROM. How different emulators handle this |
||
19 | is not something I know... |
||
20 | |||
21 | When the registers have been loaded, a RETN command is required to start the |
||
22 | program. IFF2 is short for interrupt flip-flop 2, and for all practical purposes |
||
23 | is the interrupt-enabled flag. Set means enabled. |
||
24 | |||
25 | Offset Size Description |
||
26 | ------------------------------------------------------------------------ |
||
27 | |||
28 | 1 8 word HL',DE',BC',AF' |
||
29 | 9 10 word HL,DE,BC,IY,IX |
||
30 | 19 1 byte Interrupt (bit 2 contains IFF2, 1=EI/0=DI) |
||
31 | 20 1 byte R |
||
32 | 21 4 words AF,SP |
||
33 | 25 1 byte IntMode (0=IM0/1=IM1/2=IM2) |
||
34 | 26 1 byte BorderColor (0..7, not used by Spectrum 1.7) |
||
35 | 27 49152 bytes RAM dump 16384..65535 |
||
36 | ------------------------------------------------------------------------ |
||
37 | Total: 49179 bytes |
||
38 | |||
39 | .SNA (128Kb version) (SP_EMU) |
||
40 | |||
41 | This is simply the SNA format extended to include the extra memory banks of the |
||
42 | 128K/+2 machines, and fixes the problem with the PC being pushed onto the stack |
||
43 | - now it is located in an extra variable in the file (and is not pushed onto the |
||
44 | stack at all). The first 49179 bytes of the snapshot are otherwise exactly as |
||
45 | described above, so the full description is: |
||
46 | |||
47 | Offset Size Description |
||
48 | ------------------------------------------------------------------------ |
||
49 | |||
50 | 27 16Kb bytes RAM bank 5 \ |
||
51 | 16411 16Kb bytes RAM bank 2 } - as standard 48Kb SNA file |
||
52 | 32795 16Kb bytes RAM bank n / (currently paged bank) |
||
53 | 49179 2 word PC |
||
54 | 49181 1 byte port 7FFD setting |
||
55 | 49182 1 byte TR-DOS rom paged (1) or not (0) |
||
56 | 49183 16Kb bytes remaining RAM banks in ascending order |
||
57 | ... |
||
58 | ------------------------------------------------------------------------ |
||
59 | Total: 131103 or 147487 bytes |
||
60 | |||
61 | The third RAM bank saved is always the one currently paged, even if this is |
||
62 | page 5 or 2 - in this case, the bank is actually included twice. The remaining |
||
63 | RAM banks are saved in ascending order - e.g. if RAM bank 4 is paged in, the |
||
64 | snapshot is made up of banks 5, 2 and 4 to start with, and banks 0, 1, 3, 6 |
||
65 | and 7 afterwards. If RAM bank 5 is paged in, the snapshot is made up of |
||
66 | banks 5, 2 and 5 again, followed by banks 0, 1, 3, 4, 6 and 7. |