mirror of https://github.com/falsovsky/z80.git
Fix a bug on getRandomX,Y,Speed
This commit is contained in:
parent
614693e097
commit
7a96559aed
|
@ -51,7 +51,6 @@ main
|
||||||
jr nz, main ; Repeat if not zero
|
jr nz, main ; Repeat if not zero
|
||||||
|
|
||||||
call increment_x ; Increment X position in each star
|
call increment_x ; Increment X position in each star
|
||||||
|
|
||||||
jr main_start ; Do it all over again
|
jr main_start ; Do it all over again
|
||||||
|
|
||||||
pop bc
|
pop bc
|
||||||
|
@ -96,22 +95,26 @@ ENDP
|
||||||
|
|
||||||
PROC
|
PROC
|
||||||
getRandomX
|
getRandomX
|
||||||
|
push hl
|
||||||
|
getRandomX_loop
|
||||||
ld hl, (xrandpos)
|
ld hl, (xrandpos)
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
cp $0
|
cp $0
|
||||||
jr z, getRandomX_reset
|
jr z, getRandomX_reset
|
||||||
inc hl
|
inc hl
|
||||||
ld (xrandpos), hl
|
ld (xrandpos), hl
|
||||||
|
pop hl
|
||||||
ret
|
ret
|
||||||
getRandomX_reset
|
getRandomX_reset
|
||||||
ld hl, xranddata
|
ld hl, xranddata
|
||||||
ld (xrandpos), hl
|
ld (xrandpos), hl
|
||||||
jr getRandomX
|
jr getRandomX_loop
|
||||||
ENDP
|
ENDP
|
||||||
|
|
||||||
PROC
|
PROC
|
||||||
getRandomY
|
getRandomY
|
||||||
push hl
|
push hl
|
||||||
|
getRandomY_loop
|
||||||
ld hl, (yrandpos)
|
ld hl, (yrandpos)
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
cp $0
|
cp $0
|
||||||
|
@ -123,12 +126,13 @@ getRandomY
|
||||||
getRandomY_reset
|
getRandomY_reset
|
||||||
ld hl, yranddata
|
ld hl, yranddata
|
||||||
ld (yrandpos), hl
|
ld (yrandpos), hl
|
||||||
jr getRandomY
|
jr getRandomY_loop
|
||||||
ENDP
|
ENDP
|
||||||
|
|
||||||
PROC
|
PROC
|
||||||
getRandomSpeed
|
getRandomSpeed
|
||||||
push hl
|
push hl
|
||||||
|
getRandomSpeed_loop
|
||||||
ld hl, (speedrandpos)
|
ld hl, (speedrandpos)
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
cp $0
|
cp $0
|
||||||
|
@ -140,7 +144,7 @@ getRandomSpeed
|
||||||
getRandomSpeed_reset
|
getRandomSpeed_reset
|
||||||
ld hl, speedranddata
|
ld hl, speedranddata
|
||||||
ld (speedrandpos), hl
|
ld (speedrandpos), hl
|
||||||
jr getRandomSpeed
|
jr getRandomSpeed_loop
|
||||||
ENDP
|
ENDP
|
||||||
|
|
||||||
PROC
|
PROC
|
||||||
|
@ -164,6 +168,7 @@ increment_x_update
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
increment_x_zero
|
increment_x_zero
|
||||||
|
push bc
|
||||||
inc hl ; Set to Y position
|
inc hl ; Set to Y position
|
||||||
|
|
||||||
push hl
|
push hl
|
||||||
|
@ -184,6 +189,7 @@ increment_x_zero
|
||||||
dec hl ; Get back to X position
|
dec hl ; Get back to X position
|
||||||
|
|
||||||
ld a, $0 ; X = 0
|
ld a, $0 ; X = 0
|
||||||
|
pop bc
|
||||||
jr increment_x_update
|
jr increment_x_update
|
||||||
ENDP
|
ENDP
|
||||||
|
|
||||||
|
@ -209,9 +215,9 @@ write_pixel_do_it
|
||||||
cp $1
|
cp $1
|
||||||
jr z, write_pixel_set
|
jr z, write_pixel_set
|
||||||
write_pixel_unset
|
write_pixel_unset
|
||||||
ld a, (hl)
|
;ld a, (hl)
|
||||||
xor c
|
;xor c
|
||||||
ld (hl), a
|
;ld (hl), a
|
||||||
jr write_pixel_end
|
jr write_pixel_end
|
||||||
write_pixel_set
|
write_pixel_set
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
|
|
Loading…
Reference in New Issue