![]() |
Routines |
| Prev: ABD7 | Up: Map | Next: AC5F |
|
Used by the routine at 8184.
|
||||||||
|
This routine sees if the character is at the left or right of the screen, or 'in' was pressed, and switches rooms if appropriate.
|
||||||||
| AC06 | LD A,(IY+$05) | Get the current player's x co-ordinate. (BC6C) | ||||||
| AC09 | OR A | Is it zero? (far left) | ||||||
| AC0A | JR Z,$AC15 | Jump forward if it is. | ||||||
| AC0C | CP $F0 | Is it F0? (far right) | ||||||
| AC0E | JR Z,$AC15 | Jump forward if it is. | ||||||
| AC10 | CALL $ABD7 | Was the 'in' key pressed? | ||||||
| AC13 | OR A | |||||||
| AC14 | RET Z | Return if not. | ||||||
|
Player has moved off screen, so do something.
|
||||||||
| AC15 | LD A,(IY+$0F) | Put the current room in A. | ||||||
| AC18 | CALL $AC69 | Get the "next rooms" table for this room. | ||||||
| AC1B | EX DE,HL | Swap DE and HL, so the "next rooms" table is in DE. | ||||||
|
Loop through the entries in the room, seeing what can be done.
|
||||||||
| AC1C | LD A,(DE) | Get the next entry. | ||||||
| AC1D | CP $FF | Is this an 'end' marker? | ||||||
| AC1F | RET Z | Return if it is. | ||||||
| AC20 | LD B,A | Otherwise put the new room in B. | ||||||
| AC21 | INC DE | Put the co-ordinate table in A. | ||||||
| AC22 | LD A,(DE) | |||||||
| AC23 | INC DE | |||||||
| AC24 | INC DE | |||||||
| AC25 | CALL $AC5F | Get the co-ordinate table for this index. | ||||||
| AC28 | LD A,(HL) | Get the X co-ordinate. | ||||||
| AC29 | SUB (IY+$05) | Is it close enough to the current X co-ordinate? | ||||||
| AC2C | SUB $08 | |||||||
| AC2E | CP $F0 | |||||||
| AC30 | JR C,$AC1C | Jump back if not. | ||||||
|
The X co-ordinate is in range.
|
||||||||
| AC32 | INC HL | Get the Y co-ordinate. | ||||||
| AC33 | LD A,(HL) | Does it match the player's? | ||||||
| AC34 | CP (IY+$0A) | |||||||
| AC37 | JR NZ,$AC1C | Jump back if it doesn't. | ||||||
| AC39 | DEC DE | Jump back to the X co-ordinate placeholder. | ||||||
| AC3A | LD (IY+$0F),B | Set the new room to B. | ||||||
| AC3D | LD A,(DE) | |||||||
| AC3E | CALL $AC5F | Get the co-ordinate table for this index. | ||||||
| AC41 | LD A,(HL) | Get the X co-ordinate. | ||||||
| AC42 | OR A | Is it zero? | ||||||
| AC43 | JR NZ,$AC47 | No, must have not come in from the left. | ||||||
| AC45 | LD A,$02 | Otherwise set the co-ordinate to be far left. | ||||||
| AC47 | CP $F0 | Is it far right? | ||||||
| AC49 | JR NZ,$AC4D | No, must have come in from elsewhere. | ||||||
| AC4B | LD A,$EE | Otherwise set the co-ordinates to be far right. | ||||||
| AC4D | LD (IY+$05),A | Write new X co-ordinate to memory. | ||||||
| AC50 | INC HL | Get the Y co-ordinate. | ||||||
| AC51 | LD A,(HL) | |||||||
| AC52 | LD (IY+$0A),A | Set the new Y co-ordinate. | ||||||
| AC55 | CALL $B952 | Draw the room. | ||||||
| AC58 | CALL $ABD7 | Wait until the 'in' key is released before continuing. | ||||||
| AC5B | OR A | |||||||
| AC5C | JR NZ,$AC58 | |||||||
| AC5E | RET | Return. | ||||||
| Prev: ABD7 | Up: Map | Next: AC5F |