![]() |
Routines |
| Prev: 49989 | Up: Map | Next: 50112 |
|
Used by the routine at Action_Load.
Ask for a tape and read a previously saved game state back in.
|
||||
|
Print "LOADING. Start tape.".
|
||||
| LoadFromTape | 50048 | LD HL,48167 | Print "LOADING. Start tape.". | |
| 50051 | CALL PrintStringAndANewline | |||
| 50054 | LD IX,47560 | Point the load at the game state (GameState) for 316 bytes. | ||
| 50058 | LD DE,316 | |||
| 50061 | LD A,255 | Mark it as a data block and set the carry flag for "loading". | ||
| 50063 | SCF | |||
| 50064 | CALL 1366 | Call LD_BYTES. | ||
| 50067 | JR C,LoadFromTape_Success | Jump to LoadFromTape_Success when the load succeeded. | ||
|
Print "Tape error.".
|
||||
| 50069 | LD HL,48188 | Print "Tape error.". | ||
| 50072 | CALL PrintStringAndANewline | |||
| 50075 | RET | Return. | ||
| LoadFromTape_Success | 50076 | LD A,(47874) | Return when *47874 is zero, so there is no flag state to restore. | |
| 50079 | OR A | |||
| 50080 | RET Z | |||
| 50081 | LD B,A | Take the flag addresses and the saved bytes. | ||
| 50082 | LD IX,(47858) | |||
| 50086 | LD DE,47721 | |||
| 50089 | JR LoadFromTape_StoreFlag | |||
| LoadFromTape_Restore | 50091 | INC IX | Step to the next flag address and the next saved byte. | |
| 50093 | INC IX | |||
| 50095 | INC DE | |||
| LoadFromTape_StoreFlag | 50096 | LD L,(IX+0) | Write that saved byte back and repeat until every flag is restored. | |
| 50099 | LD H,(IX+1) | |||
| 50102 | LD A,(DE) | |||
| 50103 | LD (HL),A | |||
| 50104 | DJNZ LoadFromTape_Restore | |||
| 50106 | LD E,0 | Call Handler_DisplayRoom to show the restored room. | ||
| 50108 | CALL Handler_DisplayRoom | |||
| 50111 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 49989 | Up: Map | Next: 50112 |