Prev: AFE4 Up: Map Next: B035
B000: End of frame
Used by the routine at ret_from_tbl_jp.
Draws everything the object walk decided on and then burns whatever time is left, so the game runs at an even speed rather than at whatever speed the room happens to allow.
The time is counted in units of drawing. The renderer counts at $5BBE every object it draws and every rectangle it wipes, and this waits for six units less that count. One unit of waiting is 1280 turns of a 26-cycle loop, about 33,300 T-states, just under half a 50Hz frame. So a room where fewer than six things change runs at the same speed as one where six do, and a room busier than that runs slower -- the delay can only pad, never take time back.
end_of_frame B000 LD HL,($5BA2) the 16-bit frame counter
B003 INC HL
B004 LD ($5BA2),HL
B007 LD A,($5BA5) stir it into the random byte, with whatever memory it happens to address
B00A ADD A,(HL)
B00B ADD A,L
B00C ADD A,H
B00D LD ($5BA5),A
B010 LD HL,$5BB2 a frame has been played: the next room entry saves the charms' places back
B013 SET 0,(HL)
B015 CALL handle_pause SPACE pauses
B018 CALL init_cauldron_bubbles bubbles in the cauldron room
B01B CALL list_objects_to_draw list the objects flagged to be drawn
B01E CALL render_dynamic_objects wipe, draw in depth order into the buffer at screen_buffer, and copy the changes to the screen
B021 LD A,($5BC5) during the finale, a tone pitched by the last spark's height
B024 AND A
B025 CALL NZ,sound_pitch_from_a
B028 LD A,($5BBE) six units, less what this frame already used
B02B NEG
B02D ADD A,$06
B02F LD B,A none left to wait
B030 JP M,no_delay
B033 JR Z,no_delay
Prev: AFE4 Up: Map Next: B035