Prev: D4AC Up: Map Next: D5A0
D4B6: Handle Rex takes question
Used by the routine at D215.
D4B6 LD (IX+$0C),$00 Set question to not visble
D4BA PUSH IX Save IX and BC
D4BC PUSH BC
D4BD CALL $D5D7 Reset sound volume chanels
D4C0 CALL $D8A3 Copy screen display file into room graphic data buffer
D4C3 LD BC,$4E20 SET BC = 20.000
D4C6 CALL $C8DB Wait some time ~1s (128 t-states 20.000 times)
D4C9 LD IX,$AB41 Point IX to the text defintion for SPEED UP
D4CD LD B,$01 Set B to the number of rows to draw
D4CF CALL $A13E Draw the windows into the display file
D4D2 LD HL,$1CE8 Set A07D the Bonus Windows Loop Counter (7200 loops)
D4D5 LD ($A07D),HL
D4D8 CALL $A375 Set A a random number between 1-4
D4DB AND $03
D4DD INC A
D4DE LD ($A06F),A Set A06F to the number of bonus screen to show (0-speed up 1-shield loss 2-1000 bonus 3-energy loss 4-100 rapid shots)
D4E1 SLA A Set into IX the address of the text defintion corresponding to the number of bonus
D4E3 LD E,A
D4E4 LD D,$00
D4E6 LD HL,$D4AC
D4E9 ADD HL,DE
D4EA LD E,(HL)
D4EB INC HL
D4EC LD D,(HL)
D4ED PUSH DE
D4EE POP IX
D4F0 CALL $A307 Print the line of text into the windows
D4F3 INC IX Increment pointer for the next bonus line
D4F5 LD BC,($A07D) Set BC to the Bonus Windows Counter
D4F9 PUSH BC Save BC
D4FA CALL $A477 Check FIRE pressed
D4FD POP BC Restore BC
D4FE JP Z,$D52F If FIRE key pressed jump to handle the bonus selected
D501 DEC BC Decrement counter
D502 LD A,B Jump back and wait for keypressed if counter has not reached zero
D503 OR C
D504 JP NZ,$D4F9
D507 LD HL,($A07D) Reset loop counter (substract 200 loops to the previous counter)
D50A LD DE,$00C8
D50D AND A
D50E SBC HL,DE
D510 LD ($A07D),HL
D513 LD A,H If loop counter less than 256 then jump to handle the bonus on screen
D514 OR A
D515 JP Z,$D52F
D518 LD A,($A06F) Increment the bonus windows number
D51B INC A
D51C LD ($A06F),A
D51F CP $05 if bonus number equals 5 then point to the first bonus
D521 JP NZ,$D4F0
D524 LD IX,$AB41
D528 XOR A
D529 LD ($A06F),A
D52C JP $D4F0 Jump back and show the next bonus
handle bonus selected
D52F LD A,($A06F) Check bonus slected
D532 OR A is speed up?
D533 JP Z,$D55D Jump to handle speed up bonus
D536 CP $01 is shield loss?
D538 JP Z,$D56D Jump to handle shield loss
D53B CP $02 is 1000 bouns points?
D53D JP Z,$D578 Jump to handle bonus points
D540 CP $03 is energy loss?
D542 JP Z,$D584 handle energy loss
D545 CP $04 is rapid shots?
D547 JP Z,$D590 handle rapid shots
return to normal game
D54A LD BC,$4E20 Set BC to 20.000
D54D CALL $C8DB Wait some time ~1s (128 t-states 20.000 times)
D550 CALL $D5AE Reset sound data buffer
D553 POP BC Restore BC and IX
D554 POP IX
D556 CALL $A28A Copy room graphic buffer to display file
D559 CALL $C8BF Copy room color attribute buffer to attribute file
D55C RET
handle speed up
D55D LD A,$01 Set Rex fast speed
D55F LD ($A072),A
D562 LD A,$C8 Set speed up duration to 200
D564 LD ($A073),A
D567 LD HL,$AB41 Set HL to point to the bonus text definition address
D56A JP $D54A Jump back and return to normal game
handle shield loss
D56D LD L,$14 loss quantity to L = 20
D56F CALL $99CE Handle shield loss
D572 LD HL,$AB54 Set HL to point to the bonus text definition address
D575 JP $D54A Jump back and return to normal game
handle bonus points
D578 LD DE,$000A Set A to the bonus points obtained (*100)
D57B CALL $9A27 Increment score
D57E LD HL,$AB67 Set HL to point to the bonus text definition address
D581 JP $D54A Jump back and return to normal game
handle energy loss
D584 CALL $BA3D Handle double weapon energy loss
D587 CALL $A1A5 Draw HUD
D58A LD HL,$AB7A Set HL to point to the bonus text definition address
D58D JP $D54A Jump back and return to normal game
handle rapid shots
D590 LD A,$01 Set rapid shots
D592 LD ($A040),A
D595 LD A,$64 Set number of rapid shots
D597 LD ($A041),A
D59A LD HL,$AB8D Set HL to point to the bonus text definition address
D59D JP $D54A Jump back and return to normal game
Prev: D4AC Up: Map Next: D5A0