Random
Points?
Yes, it appears that you are awarded random point values
for things like smashing oil barrels and the occasional
fireball. Below is a random number generator that
uses two timers. Okay, so
it's not really "random". But the delay
from when you start your game all the way to when the
first points are awarded is going to happen at different
times.
;----------------------------------------------------
;
Get Random Number
;----------------------------------------------------
; Combine timers (6018) += (6019) +
(601A)
;----------------------------------------------------
L0057: LD A,(06018h)
; Get the number
LD
HL,0601Ah
; HL = General Purpose Timer
ADD
A,(HL)
; Add a free running timer
LD
HL,06019h
; HL = General Purpose Timer
ADD
A,(HL)
; Add another free running
timer
LD
(06018h),A
; Then use the result as a
random number
RET
; Return
Here the
"random" number will be analyzed and the points
will be awarded...
;----------------------------------------------------
;
Award Random Point Amount
;----------------------------------------------------
; 300
points 25% chance
; 500
points 50% chance
; 800
points 25% chance
;----------------------------------------------------
L1DF5: LD
A,(06018h)
; Get Random
Number
RRA
; 50% chance for 500
points
JR C,L1E08
; Award 500 Points
RRA
; 25% chance for 800
points
JR C,L1E10
; Award 800 Points
;----------------------------------------------------
;
Award 300 Points (25% chance)
;----------------------------------------------------
L1E00: LD
B,07Dh
; B = 300
sprite
LD DE,00003h
; Routine =
Award Points, 300 pts
JR L1E15
; Go award points
;----------------------------------------------------
;
Award 500 Points
;----------------------------------------------------
L1E08: LD
B,07Eh
; B = 500
sprite
LD DE,00005h
; Routine = Award
Points, 500 pts
JR L1E15
; Go award points
;----------------------------------------------------
;
Award 800 Points
;----------------------------------------------------
L1E10: LD
B,07Fh
; B = 800
sprite
LD DE,00008h
; Routine = Award
Points, 800 pts
L1E15: CALL
L309F
; Schedule Award
Points Routine (using DE)
LD HL,(06343h)
; Get pointer to X
position
LD A,(HL)
; A = Prize X
position (use for Point sprite)
LD (HL),000h
; Erase Prize once
collected
INC
L
; Go to Y position
INC
L
; Go to Y position
INC
L
; Go to Y position
LD C,(HL)
; C = Y
position (use for Point sprite)
JR L1E36
;
Go program Award Sprite
back to
D2K |