Prev: E47A Up: Map Next: E581
E4F1: Handler: Lift Masks
Used by the routine at InitialiseGame.
Writes FF into the display file at each lift that is not on sub-row 00. Called from the game loop after Handler_Lifts.
Handler_LiftMasks E4F1 LD IX,($5BE4) Point IX at ReferenceLifts.
Walk the lift table painting a mask under each moving lift.
Handler_LiftMasks_Loop E4F5 LD A,(IX+$00) Return if this lift entry is the terminator (FF).
E4F8 CP $FF
E4FA RET Z
E4FB LD A,(IX+$05) Jump to Handler_LiftMasks_NextLift if this lift has no vertical movement.
E4FE CP $00
E500 JR Z,Handler_LiftMasks_NextLift
E502 LD C,(IX+$00) C=the lift horizontal co-ordinate.
E505 LD B,(IX+$01) B=the lift vertical co-ordinate.
E508 LD A,(IX+$03) Jump to Handler_LiftMasks_SubRowThree if the lift is on sub-row 03.
E50B CP $03
E50D JR Z,Handler_LiftMasks_SubRowThree
E50F CP $02 Jump to Handler_LiftMasks_SubRowTwo if the lift is on sub-row 02.
E511 JR Z,Handler_LiftMasks_SubRowTwo
E513 CP $01 Jump to Handler_LiftMasks_SubRowOne if the lift is on sub-row 01.
E515 JR Z,Handler_LiftMasks_SubRowOne
E517 DEC B Move one row up for sub-row 00.
E518 CALL $0DD9 Call CL_SET.
Handler_LiftMasks_SetFourRows E51B LD D,$04 D=04 (four pixel rows of mask).
Handler_LiftMasks_NextPixelRow E51D LD B,(IX+$07) B=the lift width.
E520 LD A,$FF A=FF (solid mask byte).
E522 LD HL,($5C84) HL=*DF_CC.
E525 INC H Increment H by one.
E526 LD ($5C84),HL Write HL to *DF_CC.
E529 DEC H Decrease H by one.
Handler_LiftMasks_WriteRowLoop E52A LD (HL),A Write the mask byte into the display file.
E52B INC HL Advance one column.
E52C DJNZ Handler_LiftMasks_WriteRowLoop Decrease the width counter by one and loop back to Handler_LiftMasks_WriteRowLoop until this pixel row is masked.
E52E DEC D Move on to the next pixel row.
E52F JR NZ,Handler_LiftMasks_NextPixelRow Jump to Handler_LiftMasks_NextPixelRow until all four rows are masked.
Handler_LiftMasks_NextLift E531 LD DE,$0010 Move IX on to the next sixteen-byte lift entry.
E534 ADD IX,DE
E536 JR Handler_LiftMasks_Loop Jump to Handler_LiftMasks_Loop.
Mask from two pixel rows further down (sub-row 02).
Handler_LiftMasks_SubRowTwo E538 CALL $0DD9 Call CL_SET.
E53B LD HL,($5C84) HL=*DF_CC.
E53E INC H Increment H by four.
E53F INC H
E540 INC H
E541 INC H
E542 LD ($5C84),HL Write HL to *DF_CC.
E545 JR Handler_LiftMasks_SetFourRows Jump to Handler_LiftMasks_SetFourRows.
Mask from one pixel row further down (sub-row 03).
Handler_LiftMasks_SubRowThree E547 CALL $0DD9 Call CL_SET.
E54A LD HL,($5C84) HL=*DF_CC.
E54D INC H Increment H by two.
E54E INC H
E54F LD ($5C84),HL Write HL to *DF_CC.
E552 JR Handler_LiftMasks_SetFourRows Jump to Handler_LiftMasks_SetFourRows.
Mask from three pixel rows further down (sub-row 01).
Handler_LiftMasks_SubRowOne E554 PUSH BC Stash the lift co-ordinates on the stack.
E555 CALL $0DD9 Call CL_SET.
E558 LD HL,($5C84) HL=*DF_CC.
E55B LD A,H H+=06.
E55C ADD A,$06
E55E LD H,A
E55F LD ($5C84),HL Write HL to *DF_CC.
E562 LD D,$02 D=02 (two pixel rows of mask).
Handler_LiftMasks_ShortRow E564 LD HL,($5C84) HL=*DF_CC.
E567 INC H Increment H by one.
E568 LD ($5C84),HL Write HL to *DF_CC.
E56B DEC H Decrease H by one.
E56C LD A,$FF A=FF (solid mask byte).
E56E LD B,(IX+$07) B=the lift width.
Handler_LiftMasks_ShortRowLoop E571 LD (HL),A Write the mask byte into the display file.
E572 INC HL Advance one column.
E573 DJNZ Handler_LiftMasks_ShortRowLoop Decrease the width counter by one and loop back to Handler_LiftMasks_ShortRowLoop until this pixel row is masked.
E575 DEC D Move on to the next pixel row.
E576 JR NZ,Handler_LiftMasks_ShortRow Jump to Handler_LiftMasks_ShortRow until both rows are masked.
E578 POP BC Restore the lift co-ordinates from the stack.
E579 DEC B Move one row up.
E57A CALL $0DD9 Call CL_SET.
E57D LD D,$02 D=02 (two more pixel rows of mask).
E57F JR Handler_LiftMasks_NextPixelRow Jump to Handler_LiftMasks_NextPixelRow.
Prev: E47A Up: Map Next: E581