Draws pixels from bytes, sometimes not all

This commit is contained in:
Pedro de Oliveira 2014-08-17 09:03:39 +01:00
parent fe9a4892e5
commit 5aa99ea9a6
3 changed files with 33 additions and 51 deletions

View File

@ -19,7 +19,7 @@ LINHA11 EQU $4860
; Color - 1 Byte
STAR_SIZE EQU $4
MAX_STARS EQU 10
STARS DS STAR_SIZE * MAX_STARS, 0
;STARS DS STAR_SIZE * MAX_STARS, 0
INCLUDE "starrnd.asm"
@ -29,47 +29,28 @@ start
push bc
call clear_screen
;call INITIALIZE_STARS
ld c, 32
main
ld de, frames
ld a, (de)
ld d, 0
ld e, a
ld hl, LINHA9
add hl, de
ld a, (hl)
set 0,a
ld (hl), a
halt
ld de, StarRnd
ld c, MAX_STARS
main
push bc
ld a, (de)
ld c, a
inc de
ld a, (de)
ld b, a
call Get_Pixel_Address
ld a, (hl)
set 0, a
ld (hl), a
pop bc
inc de
dec c
jr nz, main
pop bc
ret
PROC
INITIALIZE_STARS
push bc
ld b, MAX_STARS
ld hl, STARS
INITIALIZE_STARS_LOOP
ld a, 10
ld (hl),a
inc hl
ld a, 15
ld (hl),a
inc hl
ld a, 1
ld (hl),a
inc hl
djnz INITIALIZE_STARS_LOOP
pop bc
ret
ENDP
PROC
; Get screen address
; B = Y pixel position

View File

@ -10,12 +10,13 @@ NumStars = 10
f = open('starrnd.asm', 'w')
f.write("StarRnd db %i\n" % (3 * NumStars))
f.write("StarRnd\n")
for x in range(NumStars):
x = random.randint(0,256)
y = random.randint(0,192)
z = random.randint(0,10)
f.write("db %i, %i, %i\n" % (x ,y ,z))
x = random.randint(0,256 - 1)
y = random.randint(0,192 - 1)
#z = random.randint(0,10)
#f.write("\t\tdb %i, %i, %i\n" % (x ,y ,z))
f.write("\t\tdb %i, %i\n" % (y ,x))
f.close()

View File

@ -1,11 +1,11 @@
StarRnd db 30
db 214, 156, 0
db 85, 103, 3
db 79, 28, 5
db 176, 161, 9
db 13, 143, 9
db 218, 63, 4
db 55, 13, 7
db 213, 60, 3
db 75, 192, 2
db 163, 167, 10
StarRnd
db 16, 61
db 146, 24
db 77, 8
db 131, 131
db 138, 154
db 52, 4
db 108, 162
db 58, 94
db 127, 101
db 144, 6