![]() |
Routines |
| Prev: 9884 | Up: Map | Next: 9906 |
|
Clear the play-area pixels under the actor and return with the Z flag set, or return with it unset if the actor is off-screen.
|
||||||||
| ClearTerrainUnderActor | 98AE | LD H,(IX+$03) | Fetch the high byte of the world X. | |||||
| 98B1 | LD L,(IX+$02) | Fetch the low byte of the world X. | ||||||
| 98B4 | LD DE,($607A) | Fetch Jetman_Position. | ||||||
| 98B8 | AND A | Subtract the scroll position. | ||||||
| 98B9 | SBC HL,DE | |||||||
| 98BB | LD DE,$0078 | Add a 78 tolerance. | ||||||
| 98BE | ADD HL,DE | |||||||
| 98BF | LD A,H | Fetch the high byte of the gap. | ||||||
| 98C0 | AND %00011111 | Keep only bits 0-4. | ||||||
| 98C2 | RET NZ | Return if the actor is not on this screen. | ||||||
|
Build the pixel mask for the fine scroll position.
|
||||||||
| 98C3 | EX DE,HL | Switch the gap into DE. | ||||||
| 98C4 | LD A,($607A) | Fetch Jetman_Position. | ||||||
| 98C7 | AND %00000111 | Keep only bits 0-2. | ||||||
| 98C9 | LD B,A | Store the fine scroll in B. | ||||||
| 98CA | LD A,$00 | A=00. | ||||||
| 98CC | LD HL,$00FF | HL=00FF. | ||||||
| 98CF | JR Z,ClearTerrainUnderActor_StoreMask | Jump to ClearTerrainUnderActor_StoreMask if there is no fine scroll. | ||||||
| ClearTerrainUnderActor_ShiftMask | 98D1 | ADD HL,HL | Shift the mask left by one pixel. | |||||
| 98D2 | RLA | |||||||
| 98D3 | DJNZ ClearTerrainUnderActor_ShiftMask | Decrease the fine-scroll counter by one and loop back to ClearTerrainUnderActor_ShiftMask until the shift is done. | ||||||
| ClearTerrainUnderActor_StoreMask | 98D5 | EX DE,HL | Store the mask in DE and the overflow in C. | |||||
| 98D6 | LD C,A | |||||||
|
Work out the screen column under the actor.
|
||||||||
| 98D7 | LD A,($607A) | Fetch Jetman_Position. | ||||||
| 98DA | RRA | Divide the scroll by 08. | ||||||
| 98DB | RRA | |||||||
| 98DC | RRA | |||||||
| 98DD | AND %00011111 | Keep only bits 0-4. | ||||||
| 98DF | LD L,A | Store the scroll column in L. | ||||||
|
Work out the actor's column relative to the scroll column.
|
||||||||
| 98E0 | LD A,(IX+$02) | Fetch the low byte of the world X. | ||||||
| 98E3 | RRA | Divide it by 08. | ||||||
| 98E4 | RRA | |||||||
| 98E5 | RRA | |||||||
| 98E6 | AND %00011111 | Keep only bits 0-4. | ||||||
| 98E8 | SUB L | Subtract the scroll column. | ||||||
| 98E9 | ADD A,$0E | Add 0E. | ||||||
| 98EB | AND %00011111 | Keep only bits 0-4. | ||||||
| 98ED | LD HL,$50C0 | HL=50C0. | ||||||
| 98F0 | ADD A,L | Point HL at that screen column. | ||||||
| 98F1 | LD L,A | |||||||
| 98F2 | LD B,$08 | Set a pixel row counter in B for 08 loops. | ||||||
|
Clear the masked pixels one pixel row at a time.
|
||||||||
| ClearTerrainUnderActor_MaskRow | 98F4 | PUSH HL | Stash the row start on the stack. | |||||
| 98F5 | LD A,E | Mask the first screen byte. | ||||||
| 98F6 | AND (HL) | |||||||
| 98F7 | LD (HL),A | |||||||
| 98F8 | INC L | |||||||
| 98F9 | LD A,C | Mask the middle screen byte. | ||||||
| 98FA | AND (HL) | |||||||
| 98FB | LD (HL),A | |||||||
| 98FC | INC L | |||||||
| 98FD | LD A,D | Mask the third screen byte. | ||||||
| 98FE | AND (HL) | |||||||
| 98FF | LD (HL),A | |||||||
| 9900 | POP HL | Restore the row start from the stack. | ||||||
| 9901 | INC H | Move down one pixel row. | ||||||
| 9902 | DJNZ ClearTerrainUnderActor_MaskRow | Decrease the row counter by one and loop back to ClearTerrainUnderActor_MaskRow until the column is cleared. | ||||||
| 9904 | XOR A | Return with the Z flag set. | ||||||
| 9905 | RET | |||||||
| Prev: 9884 | Up: Map | Next: 9906 |