Prev: CAB3 Up: Map Next: CAF3
CABA: Go into the next room
Used by the routines at screen_north and screen_south.
Gives the object its new room number and starts the room-entry walk: 3 in the top nibble of +$0C, three frames of walking straight in with the controls and the room's walls ignored, so the player clears the archway.
For the player -- type 16 to 79, both forms and both halves -- the rest of this frame is abandoned. The two return addresses on the stack, to move_player_apply and player_move_and_draw, are dropped, and both player records are copied to plyr_spr_1_scratchpad and plyr_spr_2_scratchpad: the player as he entered this room, which lose_life copies back when a life is lost, so he reappears at the door he came in by. The copies' types are replaced by 120, the first frame of the materialising sparkle, with the real types kept in +$10 for upd_127 to restore. Then the new room is built from game_loop.
Only the player reaches this code in this build, so the return for other types is never taken.
Input
A the new room number
exit_screen CABA LD (IX+$08),A new room
CABD LD A,(IX+$0C) the room-entry walk: three frames
CAC0 OR $30
CAC2 LD (IX+$0C),A
CAC5 LD A,(IX+$00) anything but the player: carry on
CAC8 SUB $10
CACA CP $40
CACC RET NC
CACD INC SP drop the returns to the rest of this frame
CACE INC SP
CACF INC SP
CAD0 INC SP
CAD1 PUSH IX both player records to the respawn copy
CAD3 POP HL
CAD4 LD DE,plyr_spr_1_scratchpad
CAD7 LD BC,$0040
CADA LDIR
CADC LD A,(plyr_spr_1_scratchpad) each copy's real type kept in its +$10
CADF LD (plyr_spr_1_tail),A
CAE2 LD A,(plyr_spr_2_scratchpad)
CAE5 LD (plyr_spr_2_tail),A
CAE8 LD A,$78 and replaced by the materialising sparkle
CAEA LD (plyr_spr_1_scratchpad),A
CAED LD (plyr_spr_2_scratchpad),A
CAF0 JP game_loop build the new room and start its frames
Prev: CAB3 Up: Map Next: CAF3