mirror of https://github.com/falsovsky/z80.git
Moar stuff
This commit is contained in:
parent
9f92abab8f
commit
14eb356acf
|
@ -5,6 +5,7 @@ org $7530
|
||||||
tv_flag EQU $5c3c ; TV flags
|
tv_flag EQU $5c3c ; TV flags
|
||||||
last_k EQU $5c08 ; Last pressed key
|
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
|
||||||
|
frames EQU $5c78
|
||||||
|
|
||||||
; Video RAM
|
; Video RAM
|
||||||
LINHA9 EQU $4820
|
LINHA9 EQU $4820
|
||||||
|
@ -21,20 +22,31 @@ MAX_STARS EQU 10
|
||||||
STARS DS STAR_SIZE * MAX_STARS, 0
|
STARS DS STAR_SIZE * MAX_STARS, 0
|
||||||
|
|
||||||
start
|
start
|
||||||
xor a ; a = 0
|
xor a
|
||||||
ld (tv_flag), a ; Enables rst $10 output to the TV
|
ld (tv_flag), a
|
||||||
push bc ; Save BC on the stack
|
push bc
|
||||||
|
|
||||||
call clear_screen
|
call clear_screen
|
||||||
;call INITIALIZE_STARS
|
;call INITIALIZE_STARS
|
||||||
|
ld c, 32
|
||||||
ld hl, LINHA9+$FF
|
main
|
||||||
|
ld de, frames
|
||||||
|
ld a, (de)
|
||||||
|
ld d, 0
|
||||||
|
ld e, a
|
||||||
|
ld hl, LINHA9
|
||||||
|
add hl, de
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
set 0,a
|
set 0,a
|
||||||
ld (hl), a
|
ld (hl), a
|
||||||
|
|
||||||
pop bc ; Get BC out of the stack
|
halt
|
||||||
ret ; Exit to BASIC
|
|
||||||
|
dec c
|
||||||
|
jr nz, main
|
||||||
|
|
||||||
|
pop bc
|
||||||
|
ret
|
||||||
|
|
||||||
PROC
|
PROC
|
||||||
INITIALIZE_STARS
|
INITIALIZE_STARS
|
||||||
|
@ -56,6 +68,38 @@ INITIALIZE_STARS_LOOP
|
||||||
ret
|
ret
|
||||||
ENDP
|
ENDP
|
||||||
|
|
||||||
|
PROC
|
||||||
|
; Get screen address
|
||||||
|
; B = Y pixel position
|
||||||
|
; C = X pixel position
|
||||||
|
; Returns address in HL
|
||||||
|
Get_Pixel_Address
|
||||||
|
ld a,b ; Calculate Y2,Y1,Y0
|
||||||
|
and %00000111 ; Mask out unwanted bits
|
||||||
|
or %01000000 ; Set base address of screen
|
||||||
|
ld h, a ; Store in H
|
||||||
|
ld a, b ; Calculate Y7,Y6
|
||||||
|
rra ; Shift to position
|
||||||
|
rra
|
||||||
|
rra
|
||||||
|
and %00011000 ; Mask out unwanted bits
|
||||||
|
or h ; OR with Y2,Y1,Y0
|
||||||
|
ld h, a ; Store in H
|
||||||
|
ld a, b ; Calculate Y5,Y4,Y3
|
||||||
|
rla ; Shift to position
|
||||||
|
rla
|
||||||
|
and %11100000 ; Mask out unwanted bits
|
||||||
|
ld l, a ; Store in L
|
||||||
|
ld a, c ; Calculate X4,X3,X2,X1,X0
|
||||||
|
rra ; Shift into position
|
||||||
|
rra
|
||||||
|
rra
|
||||||
|
and %00011111 ; Mask out unwanted bits
|
||||||
|
or l ; OR with Y5,Y4,Y3
|
||||||
|
ld l, a ; Store in L
|
||||||
|
ret
|
||||||
|
ENDP
|
||||||
|
|
||||||
PROC
|
PROC
|
||||||
INCLUDE "clear.asm"
|
INCLUDE "clear.asm"
|
||||||
ENDP
|
ENDP
|
||||||
|
|
Loading…
Reference in New Issue