Prev: 60521 Up: Map Next: 60624
60539: Move Sam from the midstride or mid-action position and scroll the screen if necessary
Called from the main loop at 61483, and also used by the routines at 30146 and 62216.
60539 CALL 60521 Make a sound effect
60542 LD H,230 230=Sam
60544 CALL 60506 Move Sam from the midstride or mid-action position and update the SRB
This entry point is used by the routines at 25789, 31476 and 64338.
60547 LD DE,32766 32766 holds X, the x-coordinate of the leftmost column of the play area on screen
60550 LD L,1 Point HL at byte 1 of Sam's buffer
60552 LD A,(DE) A=X
60553 SUB (HL) Subtract Sam's x-coordinate
60554 JR Z,60560 Jump if they are equal
60556 CP 247 Is Sam's x-coordinate >= X+10?
60558 JR C,60572 Jump if so (no need to scroll right)
60560 LD A,(DE) A=X
60561 AND A Is X=0?
60562 JR Z,60587 Jump if so (no need to scroll right)
60564 CALL 60032 Update the display
60567 CALL 61838 Cycle a character buffer group forwards and scroll the screen right
60570 JR 60587
60572 CP 235 Is Sam's x-coordinate <= X+21?
60574 JR NC,60587 Jump if so (no need to scroll left)
60576 LD A,(DE) A=X
60577 CP 224 Is X=224?
60579 JR Z,60587 Jump if so (no need to scroll left)
60581 CALL 60032 Update the display
60584 CALL 61882 Cycle a character buffer group backwards and scroll the screen left
Now that any required horizontal scrolling has been done, it's time to check whether any vertical scrolling is required.
60587 LD DE,32767 32767 holds Y, the y-coordinate of the topmost row of the play area on screen
60590 LD HL,58882 Point HL at byte 2 of Sam's buffer
60593 LD A,(DE) A=Y-3
60594 SUB 3
60596 SUB (HL) Subtract Sam's y-coordinate
60597 CP 252 Is Sam's y-coordinate >= Y+2?
60599 JR C,60611 Jump if so (no need to scroll down)
60601 LD A,(DE) A=Y
60602 CP 2 Is Y=2?
60604 RET Z Return if so (no need to scroll down)
60605 CALL 60032 Update the display
60608 JP 59575 Scroll the screen down
60611 CP 240 Is Sam's y-coordinate <= Y+13?
60613 RET NC Return if so (no need to scroll up)
60614 LD A,(DE) A=Y
60615 CP 20 Is Y=20?
60617 RET Z Return if so (no need to scroll up)
60618 CALL 60032 Update the display
60621 JP 59516 Scroll the screen up
Prev: 60521 Up: Map Next: 60624