![]()  | 
Routines | 
| Prev: 33977 | Up: Map | Next: 34166 | 
| 
 | 
||||
| SaveGame | 33996 | PUSH IX | Stash IX and DE on the stack. | |
| 33998 | PUSH DE | |||
| 33999 | LD DE,46827 | Call ThreeByteCopy with DE=46827 and HL=$C9E2. | ||
| 34002 | LD HL,51682 | |||
| 34005 | CALL ThreeByteCopy | |||
| 34008 | LD A,1 | Write 1 to WaitCoutdown. | ||
| 34010 | LD (46849),A | |||
| 34013 | LD HL,45890 | HL="start tape then press any key" | ||
| 34016 | CALL PrintMsg | Call PrintMsg. | ||
| 34019 | CALL DebounceAnyKey | Call DebounceAnyKey. | ||
| 
 
Save "flags".
 
 | 
||||
| 34022 | LD A,255 | Set the save as a "data block". | ||
| 34024 | LD IX,46827 | Set the start address to; 46827. | ||
| 34028 | LD DE,29 | Set the block length to; 29 bytes. | ||
| 34031 | CALL 1218 | Call SA_BYTES. | ||
| 
 
Save "objects".
 
 | 
||||
| 34034 | LD A,255 | Set the save as a "data block". | ||
| 34036 | LD IX,49435 | Set the start address to; Objects. | ||
| 34040 | LD DE,1557 | Set the block length to; 1557 bytes. | ||
| 34043 | CALL 1218 | Call SA_BYTES. | ||
| 
 
Save ...
 
 | 
||||
| 34046 | LD A,255 | Set the save as a "data block". | ||
| 34048 | LD IX,51844 | Set the start address to; 51844. | ||
| 34052 | LD DE,191 | Set the block length to; 0191 bytes. | ||
| 34055 | CALL 1218 | Call SA_BYTES. | ||
| 
 
Save "locations".
 
 | 
||||
| 34058 | LD A,255 | Set the save as a "data block". | ||
| 34060 | LD IX,47754 | Set the start address to; Locations. | ||
| 34064 | LD DE,1497 | Set the block length to; 1497 bytes. | ||
| 34067 | CALL 1218 | Call SA_BYTES. | ||
| 
 
Begin verification.
 
 | 
||||
| 34070 | LD HL,45988 | HL="rewind and prepare tape for verification -- then hit any key" | ||
| 34073 | CALL PrintMsg | Call PrintMsg. | ||
| 34076 | CALL DebounceAnyKey | Call DebounceAnyKey. | ||
| 
 
Verify "flags".
 
 | 
||||
| 34079 | LD A,255 | Set the load as a "data block". | ||
| 34081 | AND A | Reset the carry flag. | ||
| 34082 | LD IX,46827 | Set the start address to; 46827. | ||
| 34086 | LD DE,29 | Set the block length to; 29 bytes. | ||
| 34089 | CALL VerifyBlock | Call VerifyBlock. | ||
| 
 
Verify "objects".
 
 | 
||||
| 34092 | LD A,255 | Set the load as a "data block". | ||
| 34094 | AND A | Reset the carry flag. | ||
| 34095 | LD IX,49435 | Set the start address to; Objects. | ||
| 34099 | LD DE,1557 | Set the block length to; 1557 bytes. | ||
| 34102 | CALL VerifyBlock | Call VerifyBlock. | ||
| 
 
Verify ...
 
 | 
||||
| 34105 | LD A,255 | Set the load as a "data block". | ||
| 34107 | AND A | Reset the carry flag. | ||
| 34108 | LD IX,51844 | Set the start address to; 51844. | ||
| 34112 | LD DE,191 | Set the block length to;0191 bytes. | ||
| 34115 | CALL VerifyBlock | Call VerifyBlock. | ||
| 
 
Verify "locations".
 
 | 
||||
| 34118 | LD A,255 | Set the load as a "data block". | ||
| 34120 | AND A | Reset the carry flag. | ||
| 34121 | LD IX,47754 | Set the start address to; Locations. | ||
| 34125 | LD DE,1497 | Set the block length to; 1497 bytes. | ||
| 34128 | CALL VerifyBlock | Call VerifyBlock. | ||
| 
 
Success!
 
 | 
||||
| SaveGame_Done | 34131 | DI | Disable interrupts. | |
| 34132 | POP DE | Restore DE and IX from the stack. | ||
| 34133 | POP IX | |||
| 34135 | JP 33459 | Jump to 33459. | ||
| 
 
Verify block.
 
 | 
||||
| VerifyBlock | 34138 | CALL 1366 | Call LD_BYTES. | |
| 34141 | RET C | Return if the carry flag is set. | ||
| 34142 | LD A,1 | Write 1 to WaitCoutdown. | ||
| 34144 | LD (46849),A | |||
| 34147 | LD HL,45953 | HL="tape error - hit any key to continue[0x15]" | ||
| 34150 | CALL PrintMsg | Call PrintMsg. | ||
| 
 
This is almost a carbon copy of WaitForKey.
 
 | 
||||
| VerifyBlock_WaitForKey | 34153 | XOR A | Read from the keyboard port. | |
| 34154 | IN A,(254) | |||
| 34156 | AND %00011111 | A pressed key from any line will set its respective bit; bit 0 (outer key) to bit 4 (inner key). Hence keep only bits 0-4 for the check. | ||
| 34158 | CP 31 | Loop back to VerifyBlock_WaitForKey until any key has been pressed. | ||
| 34160 | JR Z,VerifyBlock_WaitForKey | |||
| 34162 | POP DE | Restore DE from the stack. | ||
| 34163 | JP SaveGame_Done | Jump to SaveGame_Done. | ||
| Prev: 33977 | Up: Map | Next: 34166 |