Prev: AE77 Up: Map Next: B0DC
AF5D: Play the game until we exit the room or lose a life
Used by the routine at AA65.
AF5D LD HL,$A45B
Check for TUNE ON / OFF, and toggle the status if pressed
AF60 LD A,$BF
AF62 IN A,($FE)
AF64 OR $E0
AF66 INC A
AF67 JR Z,$AF75
AF69 BIT 1,(HL)
AF6B RES 1,(HL)
AF6D JR Z,$AF77
AF6F LD A,(HL)
AF70 XOR $01
AF72 LD (HL),A
AF73 JR $AF77
AF75 SET 1,(HL)
AF77 LD HL,$A42A
AF7A LD A,(HL)
AF7B SUB $08
AF7D AND $18
AF7F LD (HL),A
Move conveyor belts
AF80 LD E,A
AF81 LD D,$00
AF83 LD IX,$7FD0
AF87 PUSH DE
AF88 CALL $B398
AF8B POP DE
AF8C LD A,$18
AF8E SUB E
AF8F LD E,A
AF90 CALL $B398
AF93 LD A,($A461)
AF96 LD ($A462),A
Advance all moving objects on by one frame
AF99 LD IX,$7E00
AF9D LD A,(IX+$00)
AFA0 OR (IX+$01)
AFA3 JR Z,$AFB9
AFA5 LD HL,$A462
AFA8 SRL (HL)
AFAA JR C,$AFB2
AFAC CALL $B82E
AFAF CALL $BAE5
AFB2 LD DE,$0021
AFB5 ADD IX,DE
AFB7 JR $AF9D
AFB9 LD A,($A439) Get game flags
AFBC BIT 2,A Are we moving automatically?
AFBE JR Z,$AFC7 Move on if so
AFC0 CALL $BD9E Update automatic movement by one frame
AFC3 AND A
AFC4 PUSH AF
AFC5 JR $B009
AFC7 CALL $BB17
AFCA JR NC,$AFE8
AFCC LD HL,$0210
AFCF LD ($A400),HL
AFD2 LD HL,($A40A)
AFD5 LD BC,($A408)
AFD9 ADD HL,BC
AFDA EX DE,HL
AFDB LD HL,($A406)
AFDE LD A,($A40F)
AFE1 LD C,A
AFE2 CALL $B7CC
AFE5 OR $FF
AFE7 SCF
AFE8 RET Z
AFE9 PUSH AF
Check for PAUSE. If A-G is pressed, loop around until it isn't
AFEA LD A,$FD
AFEC IN A,($FE)
AFEE CPL
AFEF AND $1F
AFF1 JR Z,$B009
AFF3 LD A,$32
AFF5 DJNZ $AFF5
AFF7 DEC A
AFF8 JR NZ,$AFF5
AFFA LD A,$02
AFFC IN A,($FE)
AFFE CPL
AFFF AND $1F
B001 JR Z,$AFF3
B003 XOR A Set FRAMES to 0
B004 LD ($5C78),A
B007 JR $AFEA
B009 LD A,$40
B00B LD ($A441),A
B00E LD IX,$7E00
B012 LD L,(IX+$00)
B015 LD H,(IX+$01)
B018 LD A,H
B019 OR L
B01A JR Z,$B031
B01C LD C,(IX+$07)
B01F LD B,(IX+$08)
B022 LD D,(IX+$06)
B025 BIT 7,D
B027 CALL $B3E4
B02A LD DE,$0021
B02D ADD IX,DE
B02F JR $B012
B031 LD IX,$7FD0
B035 LD B,$02
B037 PUSH BC
B038 LD A,(IX+$00)
B03B INC IX
B03D AND A
B03E JR Z,$B057
B040 LD ($A455),A
B043 LD L,(IX+$01)
B046 LD A,(IX+$02)
B049 ADD A,$C0
B04B LD H,A
B04C LD A,$08
B04E CALL $B409
B051 LD C,$03
B053 ADD IX,BC
B055 JR $B038
B057 POP BC
B058 DJNZ $B037
B05A LD HL,($A406)
B05D LD BC,$0210
B060 LD A,($A422)
B063 CP $30
B065 JR NZ,$B068
Special case for room 30 - display "Game over"
B067 INC B
B068 LD D,B
B069 OR B
B06A CALL $B3E4
B06D POP AF
B06E RET C
B06F LD A,$10
B071 LD ($A441),A
B074 LD A,($5C78) Get FRAMES variable
B077 AND A
B078 JR Z,$B074
B07A CALL $B440
B07D LD IX,$7E00
B081 LD L,(IX+$00)
B084 LD H,(IX+$01)
B087 LD A,H
B088 OR L
B089 JR Z,$B09F
B08B LD A,(IX+$08)
B08E INC A
B08F LD ($A455),A
B092 LD A,(IX+$07)
B095 CALL $B803
B098 LD DE,$0021
B09B ADD IX,DE
B09D JR $B081
B09F LD A,($A45B)
B0A2 BIT 2,A
B0A4 JR Z,$B0B1
B0A6 LD HL,$A42E
B0A9 LD A,($A42F)
B0AC ADD A,(HL)
B0AD LD (HL),A
B0AE CALL C,$B0DC
B0B1 LD HL,$A438
B0B4 LD A,($A440)
B0B7 ADD A,(HL)
B0B8 LD (HL),A
B0B9 SUB $7D
B0BB CALL NC,$B770
Check for ABORT (CAPS + SPACE). If pressed, restart the game, otherwise loop back
B0BE LD A,$7F
B0C0 IN A,($FE)
B0C2 RRA
B0C3 JP C,$AF5D
B0C6 LD A,$FE
B0C8 IN A,($FE)
B0CA RRA
B0CB JP C,$AF5D
B0CE LD A,$BF
B0D0 IN A,($FE)
B0D2 OR $EE
B0D4 INC A
B0D5 JP NZ,$AF5D
B0D8 POP HL
B0D9 JP $AA81
Prev: AE77 Up: Map Next: B0DC