![]() |
Routines |
| Prev: 40645 | Up: Map | Next: 40743 |
|
Used by the routine at Action_LoadGame.
|
||||
| LoadTape | 40667 | PUSH IX | Stash IX, HL, DE and BC on the stack. | |
| 40669 | PUSH HL | |||
| 40670 | PUSH DE | |||
| 40671 | PUSH BC | |||
|
Print "LOADING...Start Tape.".
|
||||
| 40672 | LD HL,40645 | HL=Messaging_LoadingPressPlay. | ||
| 40675 | CALL PrintStringAndNewline | Call PrintStringAndNewline. | ||
| 40678 | LD IX,40840 | Load the starting address into IX at Table_ItemLocations. | ||
| 40682 | LD DE,385 | Set the block length in DE to 385 bytes. | ||
| 40685 | LD A,255 | Set A to 255 which indicates this is a data block. | ||
| 40687 | SCF | Set the carry flag to indicate this is loading. | ||
| 40688 | CALL 1366 | Call LD_BYTES. | ||
| 40691 | JR C,LoadTape_0 | Jump to LoadTape_0 if the block loaded without error (carry flag set). | ||
|
Print "Status file not found.".
|
||||
| 40693 | LD HL,19 | HL=Messaging_StatusFileNotFound. | ||
|
The tape load failed.
|
||||
| 40696 | CALL PrintCompressedStringAndNewline | Print "Status file not found." and leave the game state unchanged. | ||
| 40699 | JR LoadTape_Return | |||
|
There is nothing to unpack when no state bytes were saved.
|
||||
| LoadTape_0 | 40701 | LD A,(48081) | Jump to LoadTape_Return if there are no saved state bytes. | |
| 40704 | OR A | |||
| 40705 | JR Z,LoadTape_Return | |||
|
Write the packed bytes at SavedStateBytes back through the addresses in Table_SavedStateAddresses.
|
||||
| 40707 | LD B,A | The addresses are listed in Table_SavedStateAddresses and the copies sit at SavedStateBytes. | ||
| 40708 | LD IX,47865 | |||
| 40712 | LD DE,41172 | |||
| 40715 | JR LoadTape_1 | Start with the first address. | ||
|
The next saved address.
|
||||
| RestoreState_Loop | 40717 | INC IX | Advance to the next saved address. | |
| 40719 | INC IX | |||
| 40721 | INC DE | |||
| LoadTape_1 | 40722 | LD L,(IX+0) | Write that byte back into the game. | |
| 40725 | LD H,(IX+1) | |||
| 40728 | LD A,(DE) | |||
| 40729 | LD (HL),A | |||
| 40730 | DJNZ RestoreState_Loop | Repeat until every saved byte is restored. | ||
|
Describe the room the save returned to.
|
||||
| 40732 | LD E,0 | Show the room as the player last saw it. | ||
| 40734 | CALL Handler_RoomExits | Call Handler_RoomExits. | ||
| LoadTape_Return | 40737 | POP BC | Restore BC, DE, HL and IX from the stack. | |
| 40738 | POP DE | |||
| 40739 | POP HL | |||
| 40740 | POP IX | |||
| 40742 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 40645 | Up: Map | Next: 40743 |