mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-12 15:30:55 +00:00
mode7: more starfield work
This commit is contained in:
parent
209198a57a
commit
d1a0ac9144
@ -183,7 +183,7 @@ clear_top_a:
|
||||
|
||||
; HLIN Y, V2 AT A
|
||||
|
||||
lda #40
|
||||
lda #39
|
||||
sta V2
|
||||
|
||||
lda #0
|
||||
|
@ -83,13 +83,13 @@ static void random_star(int i) {
|
||||
stars[i].x.i=random_table[random_pointer++];
|
||||
if (random_pointer>255) random_pointer=0;
|
||||
|
||||
stars[i].x.f=random_table[random_pointer++];
|
||||
if (random_pointer>255) random_pointer=0;
|
||||
// stars[i].x.f=random_table[random_pointer++];
|
||||
// if (random_pointer>255) random_pointer=0;
|
||||
|
||||
stars[i].y.i=random_table[random_pointer++];
|
||||
if (random_pointer>255) random_pointer=0;
|
||||
stars[i].y.f=random_table[random_pointer++];
|
||||
if (random_pointer>255) random_pointer=0;
|
||||
// stars[i].y.f=random_table[random_pointer++];
|
||||
// if (random_pointer>255) random_pointer=0;
|
||||
|
||||
// double_to_fixed( (drand48()-0.5)*spreadx,&stars[i].x);
|
||||
// double_to_fixed( (drand48()-0.5)*spready,&stars[i].y);
|
||||
@ -97,7 +97,7 @@ static void random_star(int i) {
|
||||
/* 0 to 63 corresponding to */
|
||||
stars[i].z=random_table[random_pointer++]&0x3f;
|
||||
if (random_pointer>255) random_pointer=0;
|
||||
if (stars[i].z>58) stars[i].z=0;
|
||||
// if (stars[i].z>58) stars[i].z=0;
|
||||
|
||||
// double_to_fixed( ((drand48())*spreadz)+0.1,&stars[i].z);
|
||||
// print_fixed(&stars[i].x);
|
||||
|
@ -27,19 +27,49 @@ NUMSTARS EQU 16
|
||||
;===============
|
||||
lda #0
|
||||
sta DRAW_PAGE
|
||||
sta RANDOM_POINTER
|
||||
|
||||
ldy #NUMSTARS
|
||||
init_stars:
|
||||
jsr random_star
|
||||
dey
|
||||
bpl init_stars
|
||||
|
||||
;===========================
|
||||
;===========================
|
||||
; Main Loop
|
||||
;===========================
|
||||
;===========================
|
||||
|
||||
starfield_loop:
|
||||
|
||||
;===============
|
||||
; clear screen
|
||||
;===============
|
||||
jsr clear_top
|
||||
|
||||
;===============
|
||||
; draw stars
|
||||
;===============
|
||||
|
||||
draw_stars:
|
||||
ldx #NUMSTARS
|
||||
|
||||
draw_stars:
|
||||
txa
|
||||
tay
|
||||
|
||||
; calculate color
|
||||
|
||||
lda #$ff
|
||||
sta COLOR
|
||||
|
||||
; calculate x and y
|
||||
|
||||
lda #20
|
||||
ldy #20
|
||||
|
||||
;================================
|
||||
; plot routine
|
||||
;================================
|
||||
; put address in GBASL/GBASH
|
||||
; Xcoord in A, Ycoord in Y
|
||||
@ -57,12 +87,33 @@ draw_stars:
|
||||
;===========
|
||||
;
|
||||
|
||||
lda TEMPY
|
||||
and #$1
|
||||
bne plot_odd
|
||||
plot_even:
|
||||
lda COLOR
|
||||
and #$f0
|
||||
sta COLOR
|
||||
lda (GBASL),Y
|
||||
and #$0f
|
||||
jmp plot_write
|
||||
plot_odd:
|
||||
lda COLOR
|
||||
and #$0f
|
||||
sta COLOR
|
||||
lda (GBASL),Y
|
||||
and #$f0
|
||||
|
||||
plot_write:
|
||||
ldy #0
|
||||
lda #$ff
|
||||
ora COLOR
|
||||
sta (GBASL),Y
|
||||
|
||||
|
||||
;==============================
|
||||
|
||||
dex
|
||||
bne draw_stars
|
||||
bpl draw_stars
|
||||
|
||||
|
||||
starfield_keyboard:
|
||||
@ -90,6 +141,37 @@ skipskip:
|
||||
jmp starfield_loop ; 3
|
||||
|
||||
|
||||
; matches scroll_row1 - row3
|
||||
star_x EQU $8A00
|
||||
star_y EQU $8B00
|
||||
star_z EQU $8C00
|
||||
|
||||
;===================
|
||||
; star number in Y
|
||||
; FIXME: increment at end?
|
||||
; X trashed
|
||||
random_star:
|
||||
; random x location
|
||||
ldx RANDOM_POINTER
|
||||
lda random_table,X
|
||||
inc RANDOM_POINTER
|
||||
sta star_x,Y
|
||||
|
||||
; random y location
|
||||
ldx RANDOM_POINTER
|
||||
lda random_table,X
|
||||
inc RANDOM_POINTER
|
||||
sta star_y,Y
|
||||
|
||||
; random z location
|
||||
ldx RANDOM_POINTER
|
||||
lda random_table,X
|
||||
inc RANDOM_POINTER
|
||||
and #$3f
|
||||
sta star_z,Y
|
||||
|
||||
rts
|
||||
|
||||
;===============================================
|
||||
; External modules
|
||||
;===============================================
|
||||
|
@ -95,6 +95,7 @@ LAST_SPACEY_I EQU $88
|
||||
LAST_MAP_COLOR EQU $89
|
||||
DRAW_SKY EQU $8A
|
||||
COLOR_MASK EQU $8B
|
||||
RANDOM_POINTER EQU $8C
|
||||
|
||||
SHIPY EQU $E4
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user