Prev: CEEC Up: Map Next: CF77
CEF0: Move the rainbow lifts
Used by the routines at CEDC, CEE1 and CF77.
Input
HL Position to move the lifts to.
CEF0 LD DE,$CEE8 Copy the current screen positions to DE.
CEF3 LD BC,$0008
CEF6 LDIR
CEF8 LD HL,$CEE7 Get the current tick count for the lifts. (CEE7)
CEFB INC (HL) Increment the tick count.
CEFC LD A,(HL) Put the count in A.
CEFD LD HL,$CEE6 Re-point HL at the current attribute.
CF00 BIT 7,A Is bit 7 set? ie: lifts need moving.
CF02 JR NZ,$CF0E Jump forward if it is.
CF04 INC (HL)
CF05 LD A,(HL)
CF06 CP $08
CF08 JR NZ,$CF19
CF0A LD (HL),$01
CF0C JR $CF19
CF0E BIT 0,A
CF10 JR Z,$CF19
CF12 DEC (HL)
CF13 LD A,(HL)
CF14 AND A
CF15 JR NZ,$CF19
CF17 LD (HL),$07
CF19 LD A,($CEE6)
CF1C LD HL,($CEE8)
CF1F LD BC,($CEEA)
CF23 LD DE,$0020
CF26 PUSH BC
CF27 PUSH HL
CF28 LD (HL),A
CF29 ADD HL,DE
CF2A INC A
CF2B CP $08
CF2D JR NZ,$CF31
CF2F LD A,$01
CF31 DJNZ $CF28
CF33 POP HL
CF34 POP BC
CF35 INC L
CF36 INC L
CF37 INC L
CF38 DEC C
CF39 JR NZ,$CF26
CF3B LD HL,$CEE7
CF3E BIT 7,(HL)
CF40 RET NZ
CF41 LD A,(HL)
CF42 AND $70
CF44 RRCA
CF45 RRCA
CF46 DEC HL
CF47 LD B,(HL)
CF48 SLA B
CF4A SUB B
CF4B OR $20
CF4D AND $2E
CF4F CALL $DB01
CF52 LD DE,($C872)
CF56 LD HL,$CEEC
CF59 LD A,E
CF5A CP (HL)
CF5B RET NZ
CF5C LD A,D
CF5D INC HL
CF5E LD B,(HL)
CF5F DEC B
CF60 CP B
CF61 RET C
CF62 INC HL
CF63 LD B,(HL)
CF64 CP B
CF65 RET NC
CF66 LD A,($C876)
CF69 AND A
CF6A RET NZ
CF6B LD A,($C874) Get some flags. (C874)
CF6E BIT 5,A Is bit 5 (Dan is safe) set?
CF70 RET NZ Return if it is.
CF71 LD HL,$C87F
CF74 SET 0,(HL)
CF76 RET
Prev: CEEC Up: Map Next: CF77