mirror of https://github.com/falsovsky/z80.git
Last for today
This commit is contained in:
parent
5aa99ea9a6
commit
80b8dd8ed5
|
@ -5,12 +5,6 @@ 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
|
|
||||||
LINHA9 EQU $4820
|
|
||||||
LINHA10 EQU $4840
|
|
||||||
LINHA11 EQU $4860
|
|
||||||
|
|
||||||
; Star Structure
|
; Star Structure
|
||||||
; X - 1 Byte - $00 - $ff
|
; X - 1 Byte - $00 - $ff
|
||||||
|
@ -19,7 +13,6 @@ LINHA11 EQU $4860
|
||||||
; Color - 1 Byte
|
; Color - 1 Byte
|
||||||
STAR_SIZE EQU $4
|
STAR_SIZE EQU $4
|
||||||
MAX_STARS EQU 10
|
MAX_STARS EQU 10
|
||||||
;STARS DS STAR_SIZE * MAX_STARS, 0
|
|
||||||
|
|
||||||
INCLUDE "starrnd.asm"
|
INCLUDE "starrnd.asm"
|
||||||
|
|
||||||
|
@ -30,21 +23,21 @@ start
|
||||||
|
|
||||||
call clear_screen
|
call clear_screen
|
||||||
|
|
||||||
ld de, StarRnd
|
ld hl, StarRnd
|
||||||
ld c, MAX_STARS
|
ld c, MAX_STARS
|
||||||
main
|
main
|
||||||
push bc
|
push bc
|
||||||
ld a, (de)
|
|
||||||
ld c, a
|
|
||||||
inc de
|
|
||||||
ld a, (de)
|
|
||||||
ld b, a
|
|
||||||
call Get_Pixel_Address
|
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
|
ld d, a
|
||||||
|
inc hl
|
||||||
|
ld a, (hl)
|
||||||
|
ld e, a
|
||||||
|
call calculate_screen_address
|
||||||
|
ld a, (de)
|
||||||
set 0, a
|
set 0, a
|
||||||
ld (hl), a
|
ld (de), a
|
||||||
pop bc
|
pop bc
|
||||||
inc de
|
inc hl
|
||||||
dec c
|
dec c
|
||||||
jr nz, main
|
jr nz, main
|
||||||
|
|
||||||
|
@ -52,34 +45,51 @@ main
|
||||||
ret
|
ret
|
||||||
|
|
||||||
PROC
|
PROC
|
||||||
; Get screen address
|
;Input:
|
||||||
; B = Y pixel position
|
; D = Y Coordinate
|
||||||
; C = X pixel position
|
; E = X Coordinate
|
||||||
; Returns address in HL
|
;
|
||||||
Get_Pixel_Address
|
;Output:
|
||||||
ld a,b ; Calculate Y2,Y1,Y0
|
; DE = Screen Address
|
||||||
and %00000111 ; Mask out unwanted bits
|
;
|
||||||
or %01000000 ; Set base address of screen
|
calculate_screen_address
|
||||||
ld h, a ; Store in H
|
ld a,d
|
||||||
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
|
rla
|
||||||
and %11100000 ; Mask out unwanted bits
|
rla
|
||||||
ld l, a ; Store in L
|
and 224
|
||||||
ld a, c ; Calculate X4,X3,X2,X1,X0
|
or e
|
||||||
rra ; Shift into position
|
ld e,a
|
||||||
|
ld a,d
|
||||||
rra
|
rra
|
||||||
rra
|
rra
|
||||||
and %00011111 ; Mask out unwanted bits
|
or 128
|
||||||
or l ; OR with Y5,Y4,Y3
|
rra
|
||||||
ld l, a ; Store in L
|
xor d
|
||||||
|
and 248
|
||||||
|
xor d
|
||||||
|
ld d,a
|
||||||
|
ret
|
||||||
|
ENDP
|
||||||
|
|
||||||
|
PROC
|
||||||
|
;Input:
|
||||||
|
; DE = Current screen address
|
||||||
|
;
|
||||||
|
;Output:
|
||||||
|
; DE = (Y + 1) screen address
|
||||||
|
;
|
||||||
|
increment_y
|
||||||
|
inc d
|
||||||
|
ld a,d
|
||||||
|
and 7
|
||||||
|
ret nz
|
||||||
|
ld a,e
|
||||||
|
add a,32
|
||||||
|
ld e,a
|
||||||
|
ret c
|
||||||
|
ld a,d
|
||||||
|
sub 8
|
||||||
|
ld d,a
|
||||||
ret
|
ret
|
||||||
ENDP
|
ENDP
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ for x in range(NumStars):
|
||||||
x = random.randint(0,256 - 1)
|
x = random.randint(0,256 - 1)
|
||||||
y = random.randint(0,192 - 1)
|
y = random.randint(0,192 - 1)
|
||||||
#z = random.randint(0,10)
|
#z = random.randint(0,10)
|
||||||
#f.write("\t\tdb %i, %i, %i\n" % (x ,y ,z))
|
#f.write("\t\tdb %i, %i, %i\n" % (y ,x ,z))
|
||||||
f.write("\t\tdb %i, %i\n" % (y ,x))
|
f.write("\t\tdb %i, %i\n" % (y ,x))
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
StarRnd
|
StarRnd
|
||||||
db 16, 61
|
db 68, 103
|
||||||
db 146, 24
|
db 121, 245
|
||||||
db 77, 8
|
db 158, 242
|
||||||
db 131, 131
|
db 62, 46
|
||||||
db 138, 154
|
db 149, 245
|
||||||
db 52, 4
|
db 138, 234
|
||||||
db 108, 162
|
db 145, 123
|
||||||
db 58, 94
|
db 137, 96
|
||||||
db 127, 101
|
db 45, 226
|
||||||
db 144, 6
|
db 30, 97
|
||||||
|
|
Loading…
Reference in New Issue