mirror of https://github.com/falsovsky/z80.git
Update
This commit is contained in:
parent
6ec4e4ee71
commit
a81933f16b
|
@ -7,10 +7,12 @@ last_k EQU $5c08 ; Last pressed key
|
||||||
clr_screen EQU $0daf ; ROM routine to clear the screen
|
clr_screen EQU $0daf ; ROM routine to clear the screen
|
||||||
|
|
||||||
; Star Structure
|
; Star Structure
|
||||||
; X - 1 Byte - $00 - $ff
|
; X - 1 Byte $00 - $20
|
||||||
; Y - 1 Byte - $00 - $bf
|
; Xbit - 1 Byte $7 - $0
|
||||||
|
; Y - 1 Byte $00 - $bf
|
||||||
|
; ----------
|
||||||
; Z - 1 Byte
|
; Z - 1 Byte
|
||||||
; Color - 1 Byte
|
; ZLoop - 1Byte
|
||||||
STAR_SIZE EQU $4
|
STAR_SIZE EQU $4
|
||||||
MAX_STARS EQU 10
|
MAX_STARS EQU 10
|
||||||
|
|
||||||
|
@ -26,17 +28,23 @@ start
|
||||||
ld hl, StarRnd
|
ld hl, StarRnd
|
||||||
ld c, MAX_STARS
|
ld c, MAX_STARS
|
||||||
main
|
main
|
||||||
push bc
|
|
||||||
ld a, (hl)
|
|
||||||
ld d, a
|
|
||||||
inc hl
|
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
ld e, a
|
ld e, a
|
||||||
call calculate_screen_address
|
inc hl
|
||||||
ld a, (de)
|
|
||||||
set 0, a
|
ld a, (hl)
|
||||||
ld (de), a
|
ld d, a
|
||||||
pop bc
|
|
||||||
|
push hl
|
||||||
|
|
||||||
|
call get_screen_address
|
||||||
|
ld b, a
|
||||||
|
ld a, (hl)
|
||||||
|
;set b, a
|
||||||
|
or b
|
||||||
|
ld (hl), a
|
||||||
|
|
||||||
|
pop hl
|
||||||
inc hl
|
inc hl
|
||||||
dec c
|
dec c
|
||||||
jr nz, main
|
jr nz, main
|
||||||
|
@ -45,29 +53,37 @@ main
|
||||||
ret
|
ret
|
||||||
|
|
||||||
PROC
|
PROC
|
||||||
;Input:
|
; Calculate the high byte of the screen addressand store in H reg.
|
||||||
; D = Y Coordinate
|
; On Entry: D reg = X coord, E reg = Y coord
|
||||||
; E = X Coordinate
|
; On Exit: HL = screen address, A = pixel postion
|
||||||
;
|
get_screen_address
|
||||||
;Output:
|
ld a,e
|
||||||
; DE = Screen Address
|
and %00000111
|
||||||
;
|
ld h,a
|
||||||
calculate_screen_address
|
ld a,e
|
||||||
ld a,d
|
rra
|
||||||
rla
|
rra
|
||||||
rla
|
rra
|
||||||
and 224
|
and %00011000
|
||||||
or e
|
or h
|
||||||
ld e,a
|
or %01000000
|
||||||
|
ld h,a
|
||||||
|
; Calculate the low byte of the screen address and store in L reg.
|
||||||
ld a,d
|
ld a,d
|
||||||
rra
|
rra
|
||||||
rra
|
rra
|
||||||
or 128
|
|
||||||
rra
|
rra
|
||||||
xor d
|
and %00011111
|
||||||
and 248
|
ld l,a
|
||||||
xor d
|
ld a,e
|
||||||
ld d,a
|
rla
|
||||||
|
rla
|
||||||
|
and %11100000
|
||||||
|
or l
|
||||||
|
ld l,a
|
||||||
|
; Calculate pixel postion and store in A reg.
|
||||||
|
ld a,d
|
||||||
|
and %00000111
|
||||||
ret
|
ret
|
||||||
ENDP
|
ENDP
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue