![]() |
Routines |
| Prev: 40547 | Up: Map | Next: 40645 |
|
Used by the routines at Action_SaveGame and Action_OfferSave.
|
||||
| SaveGame | 40576 | PUSH IX | Stash IX, HL, DE and BC on the stack. | |
| 40578 | PUSH HL | |||
| 40579 | PUSH DE | |||
| 40580 | PUSH BC | |||
| 40581 | LD A,(48081) | A=*Count_SavedStateBytes. | ||
|
Skip packing the save when there are no state bytes.
|
||||
| 40584 | OR A | Jump to SaveGame_PrintSaving if there are no saved state bytes. | ||
| 40585 | JR Z,SaveGame_PrintSaving | |||
| 40587 | LD B,A | Set B to the number of state bytes to pack. | ||
| 40588 | LD IX,47865 | IX=Table_SavedStateAddresses. | ||
| 40592 | LD DE,41172 | DE=SavedStateBytes. | ||
| 40595 | JR SaveGame_StoreFlag | Jump to SaveGame_StoreFlag. | ||
|
The next saved address.
|
||||
| SaveGame_Copy | 40597 | INC IX | Move IX on to the next saved-state address. | |
| 40599 | INC IX | |||
| 40601 | INC DE | Move DE on to the next packed state byte. | ||
| SaveGame_StoreFlag | 40602 | LD L,(IX+0) | Fetch the state address from *IX into HL. | |
| 40605 | LD H,(IX+1) | |||
| 40608 | LD A,(HL) | Copy the state byte into the packed save buffer. | ||
| 40609 | LD (DE),A | |||
| 40610 | DJNZ SaveGame_Copy | Decrease the pack counter and loop back to SaveGame_Copy until every state byte is packed. | ||
|
Print "Press REC & PLAY on tape...
Then press any key.".
|
||||
| SaveGame_PrintSaving | 40612 | LD HL,40499 | HL=Messaging_Saving. | |
| 40615 | CALL PrintStringAndNewline | Call PrintStringAndNewline. | ||
| 40618 | CALL GetUserInput | Call GetUserInput. | ||
| 40621 | LD IX,40840 | IX=Table_ItemLocations. | ||
| 40625 | LD DE,385 | Set the block length in DE to 385 bytes. | ||
| 40628 | LD A,255 | Set A to 255 which indicates this is a data block. | ||
| 40630 | CALL 1218 | Call SA_BYTES. | ||
|
Print "Saving Complete...Stop Tape.".
|
||||
| 40633 | LD HL,40547 | HL=Messaging_StopTapeSavingComplete. | ||
| 40636 | CALL PrintStringAndNewline | Call PrintStringAndNewline. | ||
| 40639 | POP BC | Restore BC, DE, HL and IX from the stack. | ||
| 40640 | POP DE | |||
| 40641 | POP HL | |||
| 40642 | POP IX | |||
| 40644 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 40547 | Up: Map | Next: 40645 |