Prev: 58490 Up: Map Next: 58753
58609: Handler: Lift Masks
Used by the routine at InitialiseGame.
Writes 255 into the display file at each lift that is not on sub-row 0. Called from the game loop after Handler_Lifts.
Handler_LiftMasks 58609 LD IX,(23524) Point IX at ReferenceLifts.
Walk the lift table painting a mask under each moving lift.
Handler_LiftMasks_Loop 58613 LD A,(IX+0) Return if this lift entry is the terminator (255).
58616 CP 255
58618 RET Z
58619 LD A,(IX+5) Jump to Handler_LiftMasks_NextLift if this lift has no vertical movement.
58622 CP 0
58624 JR Z,Handler_LiftMasks_NextLift
58626 LD C,(IX+0) C=the lift horizontal co-ordinate.
58629 LD B,(IX+1) B=the lift vertical co-ordinate.
58632 LD A,(IX+3) Jump to Handler_LiftMasks_SubRowThree if the lift is on sub-row 3.
58635 CP 3
58637 JR Z,Handler_LiftMasks_SubRowThree
58639 CP 2 Jump to Handler_LiftMasks_SubRowTwo if the lift is on sub-row 2.
58641 JR Z,Handler_LiftMasks_SubRowTwo
58643 CP 1 Jump to Handler_LiftMasks_SubRowOne if the lift is on sub-row 1.
58645 JR Z,Handler_LiftMasks_SubRowOne
58647 DEC B Move one row up for sub-row 0.
58648 CALL 3545 Call CL_SET.
Handler_LiftMasks_SetFourRows 58651 LD D,4 D=4 (four pixel rows of mask).
Handler_LiftMasks_NextPixelRow 58653 LD B,(IX+7) B=the lift width.
58656 LD A,255 A=255 (solid mask byte).
58658 LD HL,(23684) HL=*DF_CC.
58661 INC H Increment H by one.
58662 LD (23684),HL Write HL to *DF_CC.
58665 DEC H Decrease H by one.
Handler_LiftMasks_WriteRowLoop 58666 LD (HL),A Write the mask byte into the display file.
58667 INC HL Advance one column.
58668 DJNZ Handler_LiftMasks_WriteRowLoop Decrease the width counter by one and loop back to Handler_LiftMasks_WriteRowLoop until this pixel row is masked.
58670 DEC D Move on to the next pixel row.
58671 JR NZ,Handler_LiftMasks_NextPixelRow Jump to Handler_LiftMasks_NextPixelRow until all four rows are masked.
Handler_LiftMasks_NextLift 58673 LD DE,16 Move IX on to the next sixteen-byte lift entry.
58676 ADD IX,DE
58678 JR Handler_LiftMasks_Loop Jump to Handler_LiftMasks_Loop.
Mask from two pixel rows further down (sub-row 2).
Handler_LiftMasks_SubRowTwo 58680 CALL 3545 Call CL_SET.
58683 LD HL,(23684) HL=*DF_CC.
58686 INC H Increment H by four.
58687 INC H
58688 INC H
58689 INC H
58690 LD (23684),HL Write HL to *DF_CC.
58693 JR Handler_LiftMasks_SetFourRows Jump to Handler_LiftMasks_SetFourRows.
Mask from one pixel row further down (sub-row 3).
Handler_LiftMasks_SubRowThree 58695 CALL 3545 Call CL_SET.
58698 LD HL,(23684) HL=*DF_CC.
58701 INC H Increment H by two.
58702 INC H
58703 LD (23684),HL Write HL to *DF_CC.
58706 JR Handler_LiftMasks_SetFourRows Jump to Handler_LiftMasks_SetFourRows.
Mask from three pixel rows further down (sub-row 1).
Handler_LiftMasks_SubRowOne 58708 PUSH BC Stash the lift co-ordinates on the stack.
58709 CALL 3545 Call CL_SET.
58712 LD HL,(23684) HL=*DF_CC.
58715 LD A,H H+=6.
58716 ADD A,6
58718 LD H,A
58719 LD (23684),HL Write HL to *DF_CC.
58722 LD D,2 D=2 (two pixel rows of mask).
Handler_LiftMasks_ShortRow 58724 LD HL,(23684) HL=*DF_CC.
58727 INC H Increment H by one.
58728 LD (23684),HL Write HL to *DF_CC.
58731 DEC H Decrease H by one.
58732 LD A,255 A=255 (solid mask byte).
58734 LD B,(IX+7) B=the lift width.
Handler_LiftMasks_ShortRowLoop 58737 LD (HL),A Write the mask byte into the display file.
58738 INC HL Advance one column.
58739 DJNZ Handler_LiftMasks_ShortRowLoop Decrease the width counter by one and loop back to Handler_LiftMasks_ShortRowLoop until this pixel row is masked.
58741 DEC D Move on to the next pixel row.
58742 JR NZ,Handler_LiftMasks_ShortRow Jump to Handler_LiftMasks_ShortRow until both rows are masked.
58744 POP BC Restore the lift co-ordinates from the stack.
58745 DEC B Move one row up.
58746 CALL 3545 Call CL_SET.
58749 LD D,2 D=2 (two more pixel rows of mask).
58751 JR Handler_LiftMasks_NextPixelRow Jump to Handler_LiftMasks_NextPixelRow.
Prev: 58490 Up: Map Next: 58753