Prev: CEC6 Up: Map Next: CF15
CEDB: Compare the candidate with the next undrawn object
IY is each other undrawn object in turn. If the end of the list is reached nothing has to be drawn before the candidate, and it is drawn by render_obj_no1.
C collects the comparison. On the Z axis (base +$03, height +$06): 0 if the candidate's base is at or above IY's top, 2 if IY's base is at or above the candidate's top, otherwise 1.
Input
IX the candidate
DE the next entry to compare with
compare_next_obj CEDB LD A,(DE) end of the list: nothing is behind the candidate
CEDC INC DE
CEDD CP $FF
CEDF JP Z,render_obj_no1
CEE2 BIT 7,A already drawn: skip
CEE4 JR NZ,compare_next_obj
CEE6 CALL get_ptr_object IY = this object; $5BCF points just past its entry
CEE9 LD ($5BCF),DE
CEED PUSH HL
CEEE POP IY
CEF0 PUSH IX
CEF2 POP BC
CEF3 AND A the candidate itself: skip
CEF4 SBC HL,BC
CEF6 JR Z,compare_next_obj
CEF8 LD C,$00 L = IY's top
CEFA LD A,(IY+$03)
CEFD ADD A,(IY+$06)
CF00 LD L,A candidate's base at or above IY's top: Z code 0
CF01 LD A,(IX+$03)
CF04 SUB L
CF05 JR NC,compare_along_y
CF07 LD A,(IX+$03) L = the candidate's top
CF0A ADD A,(IX+$06)
CF0D LD L,A
CF0E LD A,(IY+$03) IY's base at or above it: Z code 2
CF11 SUB L
CF12 JR C,z_code_overlap
CF14 INC C
Prev: CEC6 Up: Map Next: CF15