Dynamite Dan | Routines |
Prev: C925 | Up: Map | Next: CA1E |
C92A | LD HL,($C870) | Get the frame count before the score should be updated. (C870) | ||
C92D | DEC HL | Decrease by 1 frame. | ||
C92E | LD A,L | Is it zero? | ||
C92F | OR H | |||
C930 | JR NZ,$C939 | Jump forward if not. | ||
Time to update the score.
|
||||
C932 | LD HL,$C86B | Point HL to the current amount to add to the score. (C86B) | ||
C935 | INC (HL) | Increase it by 1. | ||
C936 | LD HL,$0384 | Wait another 0180 frames to update the score. | ||
C939 | LD ($C870),HL | |||
Check for energy
|
||||
C93C | LD HL,$C86F | Decrement the frame count until an energy bar is lost. (C86F) | ||
C93F | DEC (HL) | |||
C940 | JR Z,$C95D | Jump forward if it is zero. | ||
If Dan only has one energy bar, sound a warning.
|
||||
C942 | LD A,($C86D) | Get the energy bar count. (C86D) | ||
C945 | CP $01 | Is there one left? | ||
C947 | JR NZ,$C956 | Jump forward if not. | ||
C949 | LD A,(HL) | Get the current frame count. | ||
C94A | AND $07 | Are bits 0 - 2 set? | ||
C94C | JR NZ,$C956 | Jump forward if not. | ||
C94E | LD A,$2E | Play a "energy low" sound effect. | ||
C950 | CALL $DB01 | |||
C953 | XOR A | Set the attribute on the remaining energy bar to 0. | ||
C954 | JR $C958 | |||
C956 | LD A,$07 | Otherwise, set it to 7. | ||
C958 | LD ($C8ED),A | |||
C95B | JR $C967 | Jump forward. | ||
Dan has lost one bar of energy.
|
||||
C95D | LD (HL),$C8 | Reset the frame count to C8. | ||
C95F | XOR A | Play a tick sound. | ||
C960 | CALL $DB01 | |||
C963 | LD HL,$C86D | Decrement the energy by 1. | ||
C966 | DEC (HL) | |||
C967 | LD HL,$C86E | Decrement the copy of this by 1. | ||
C96A | DEC (HL) | |||
C96B | JR NZ,$C997 | Jump forward if there is still energy left. | ||
Dan has run out of energy.
|
||||
C96D | LD (HL),$03 | Reset the frame count to 03. | ||
C96F | LD HL,$C86B | Point HL to the current amount to add to the score. (C86B) | ||
C972 | LD A,(HL) | Put the value in A. | ||
C973 | AND A | Is it zero? | ||
C974 | JR Z,$C997 | Jump forward if it is. | ||
C976 | DEC (HL) | Otherwise decrease the amount to add. | ||
C977 | LD A,($C87E) | Get the flags. (C87E) | ||
C97A | BIT 5,A | Has Dan got the aerosol (bit 5)? | ||
C97C | JR NZ,$C984 | Jump forward if not. | ||
C97E | LD HL,$DAC8 | Point the current sound action (DA8B) to a clicking effect. | ||
C981 | LD ($DA8B),HL | |||
Increase the score by 1
|
||||
C984 | LD HL,$C869 | Point HL to the end of the score. (C866) | ||
C987 | LD B,$04 | 4 digits to check. | ||
C989 | LD A,(HL) | Is the next digit 9? | ||
C98A | CP $09 | |||
C98C | JR NZ,$C995 | Jump forward if it isn't. | ||
Handle decimal overflow on the score.
|
||||
C98E | XOR A | Set the value to 0. | ||
C98F | LD (HL),A | |||
C990 | DEC HL | Move to the next digit. | ||
C991 | DJNZ $C989 | Loop while there are more digits to check. | ||
C993 | JR $C997 | Move forward - maximum score of 9,999 has been reached. | ||
No overflow, so increment the score.
|
||||
C995 | INC A | Add one to the score. | ||
C996 | LD (HL),A | |||
Update the energy display.
|
||||
C997 | LD HL,$5AA0 | Point HL to the attribute area with the energy. | ||
C99A | LD DE,$C8ED | Point DE to the energy bar attributes. (C8ED) | ||
C99D | LD A,($C86D) | Get the current energy (C86D) in A. | ||
C9A0 | LD B,A | Store it in B and C. | ||
C9A1 | LD C,A | |||
C9A2 | AND A | Is it 0? | ||
C9A3 | JR NZ,$C9B3 | Jump forward if it isn't. | ||
Dan has run out of energy, so lose a life.
|
||||
C9A5 | LD A,($C874) | Get the flags (C874) | ||
C9A8 | BIT 5,A | Is bit 5 (lose a life) set? | ||
C9AA | JR NZ,$C9C5 | Jump forward if it is. | ||
C9AC | LD (HL),$00 | Clear the last attribute of energy. | ||
C9AE | CALL $CD8A | Lose a life and jump forward. | ||
C9B1 | JR $C9C5 | |||
Dan has one less energy bar.
|
||||
C9B3 | LD A,(DE) | Get the attribute. | ||
C9B4 | LD (HL),A | Set it on screen. | ||
C9B5 | INC L | Move to the next column. | ||
C9B6 | INC DE | Move to the next attribute data. | ||
C9B7 | DJNZ $C9B3 | Loop while there is more to draw. | ||
C9B9 | LD A,$08 | Find out how many energy cells should be clear (8 - current energy) | ||
C9BB | SUB C | |||
C9BC | AND A | Are there any? | ||
C9BD | JR Z,$C9C5 | Jump forward if not. | ||
C9BF | LD B,A | Get the number of energy bars to clear. | ||
C9C0 | XOR A | Set the attribute to black on black. | ||
C9C1 | LD (HL),A | |||
C9C2 | INC L | Move to the next column. | ||
C9C3 | DJNZ $C9C1 | Loop while there is more to draw. | ||
Print the current score
|
||||
C9C5 | LD HL,$C866 | Point HL to the current score. (C866)s | ||
C9C8 | LD DE,$51B0 | Point DE to the position on screen. | ||
C9CB | CALL $EEF9 | Display the data. | ||
C9CE | LD A,($5AE7) | Copy back the attribute to the rest of the score. | ||
C9D1 | LD C,A | |||
C9D2 | LD HL,$5AE0 | |||
C9D5 | LD B,$08 | |||
C9D7 | LD A,(HL) | |||
C9D8 | LD (HL),C | |||
C9D9 | INC L | |||
C9DA | LD C,A | |||
C9DB | DJNZ $C9D7 | |||
Display the lives
|
||||
C9DD | LD BC,$0502 | |||
C9E0 | LD HL,$5A96 | |||
C9E3 | LD DE,$C8F5 | Point DE to the attributes for lives. | ||
C9E6 | LD A,($C86C) | Get the number of lives (C86C) | ||
C9E9 | CP $1A | Is it more than #$1A, the maximum? | ||
C9EB | JP NC,$0000 | If so, reset, either a bug or someone's been hacking. | ||
C9EE | CP $0B | Is it more than #$0B, taking up two rows? | ||
C9F0 | JR C,$C9F4 | Jump forward if it is. | ||
C9F2 | LD A,$0A | |||
C9F4 | EX AF,AF' | |||
C9F5 | EX AF,AF' | |||
C9F6 | AND A | |||
C9F7 | JR Z,$C9FC | |||
C9F9 | DEC A | |||
C9FA | JR $C9FF | |||
C9FC | LD DE,$3D00 | |||
C9FF | EX AF,AF' | |||
CA00 | PUSH BC | |||
CA01 | PUSH HL | |||
CA02 | LD A,(DE) | |||
CA03 | LD (HL),A | |||
CA04 | INC L | |||
CA05 | LD (HL),A | |||
CA06 | DEC L | |||
CA07 | LD BC,$0020 | |||
CA0A | ADD HL,BC | |||
CA0B | LD (HL),A | |||
CA0C | INC L | |||
CA0D | LD (HL),A | |||
CA0E | POP HL | |||
CA0F | INC L | |||
CA10 | INC L | |||
CA11 | INC DE | |||
CA12 | POP BC | |||
CA13 | DJNZ $C9F5 | |||
CA15 | DEC C | |||
CA16 | RET Z | |||
CA17 | LD HL,$5AD6 | |||
CA1A | LD B,$05 | |||
CA1C | JR $C9F5 |
Prev: C925 | Up: Map | Next: CA1E |