![]() |
Routines |
| Prev: 50747 | Up: Map | Next: 50852 |
|
|
||||
|
Whenever Maroc enters a new room (or moves from a tunnel to a new room), the room number is cross referenced against the current level/area using the lookup table at 50852.
The paired byte (1-9) indicates which level (29042) Maroc is on. Once identified, the level name is printed on the scroll.
|
||||
| 50807 | LD A,(60087) | Get room number | ||
| 50810 | CP 213 | There are 212 'standard' rooms in the game | ||
| 50812 | JR NC,50870 | If the room number is higher, we assume Maroc's in a vertical scrolling tunnel section, so skip the next bit as no scroll message is needed. | ||
| 50814 | LD B,9 | 9 pairs of bytes to check at 50852 | ||
| 50816 | LD HL,50852 | |||
| 50819 | LD C,A | Temporary store for room number in C register | ||
| 50820 | LD A,(HL) | Get first byte of data banks | ||
| 50821 | CP C | |||
| 50822 | JR C,50828 | If current room number > the first byte of the pair, level identified | ||
| 50824 | INC HL | Otherwise move to next pair of bytes | ||
| 50825 | INC HL | |||
| 50826 | DJNZ 50820 | |||
|
Level identified from room number
|
||||
| 50828 | DEC HL | Move pointer back 1 byte to the second byte of previous pair | ||
| 50829 | LD A,(HL) | |||
| 50830 | LD (60105),A | ...And store. | ||
| 50833 | LD HL,(60251) | Get address pointer to current game level text at 29042 | ||
| 50836 | CALL 58789 | Identify the address of the level text to print | ||
| 50839 | LD (60138),HL | ...and store. | ||
| 50842 | LD A,0 | Set the character counter to the start of the text (character position 0) | ||
| 50844 | LD (60361),A | ...and store. | ||
| 50847 | CALL 58764 | Clear the spell message text area on the scroll | ||
| 50850 | JR 50870 | Jump to initialize, set up and draw room items | ||
| Prev: 50747 | Up: Map | Next: 50852 |