mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-10-25 14:26:11 +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
|
; HLIN Y, V2 AT A
|
||||||
|
|
||||||
lda #40
|
lda #39
|
||||||
sta V2
|
sta V2
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
|
@ -83,13 +83,13 @@ static void random_star(int i) {
|
|||||||
stars[i].x.i=random_table[random_pointer++];
|
stars[i].x.i=random_table[random_pointer++];
|
||||||
if (random_pointer>255) random_pointer=0;
|
if (random_pointer>255) random_pointer=0;
|
||||||
|
|
||||||
stars[i].x.f=random_table[random_pointer++];
|
// stars[i].x.f=random_table[random_pointer++];
|
||||||
if (random_pointer>255) random_pointer=0;
|
// if (random_pointer>255) random_pointer=0;
|
||||||
|
|
||||||
stars[i].y.i=random_table[random_pointer++];
|
stars[i].y.i=random_table[random_pointer++];
|
||||||
if (random_pointer>255) random_pointer=0;
|
if (random_pointer>255) random_pointer=0;
|
||||||
stars[i].y.f=random_table[random_pointer++];
|
// stars[i].y.f=random_table[random_pointer++];
|
||||||
if (random_pointer>255) random_pointer=0;
|
// if (random_pointer>255) random_pointer=0;
|
||||||
|
|
||||||
// double_to_fixed( (drand48()-0.5)*spreadx,&stars[i].x);
|
// double_to_fixed( (drand48()-0.5)*spreadx,&stars[i].x);
|
||||||
// double_to_fixed( (drand48()-0.5)*spready,&stars[i].y);
|
// 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 */
|
/* 0 to 63 corresponding to */
|
||||||
stars[i].z=random_table[random_pointer++]&0x3f;
|
stars[i].z=random_table[random_pointer++]&0x3f;
|
||||||
if (random_pointer>255) random_pointer=0;
|
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);
|
// double_to_fixed( ((drand48())*spreadz)+0.1,&stars[i].z);
|
||||||
// print_fixed(&stars[i].x);
|
// print_fixed(&stars[i].x);
|
||||||
|
@ -27,19 +27,49 @@ NUMSTARS EQU 16
|
|||||||
;===============
|
;===============
|
||||||
lda #0
|
lda #0
|
||||||
sta DRAW_PAGE
|
sta DRAW_PAGE
|
||||||
|
sta RANDOM_POINTER
|
||||||
|
|
||||||
|
ldy #NUMSTARS
|
||||||
|
init_stars:
|
||||||
|
jsr random_star
|
||||||
|
dey
|
||||||
|
bpl init_stars
|
||||||
|
|
||||||
|
;===========================
|
||||||
|
;===========================
|
||||||
|
; Main Loop
|
||||||
|
;===========================
|
||||||
|
;===========================
|
||||||
|
|
||||||
starfield_loop:
|
starfield_loop:
|
||||||
|
|
||||||
|
;===============
|
||||||
|
; clear screen
|
||||||
|
;===============
|
||||||
|
jsr clear_top
|
||||||
|
|
||||||
;===============
|
;===============
|
||||||
; draw stars
|
; draw stars
|
||||||
;===============
|
;===============
|
||||||
|
|
||||||
draw_stars:
|
|
||||||
ldx #NUMSTARS
|
ldx #NUMSTARS
|
||||||
|
|
||||||
|
draw_stars:
|
||||||
|
txa
|
||||||
|
tay
|
||||||
|
|
||||||
|
; calculate color
|
||||||
|
|
||||||
|
lda #$ff
|
||||||
|
sta COLOR
|
||||||
|
|
||||||
|
; calculate x and y
|
||||||
|
|
||||||
lda #20
|
lda #20
|
||||||
ldy #20
|
ldy #20
|
||||||
|
|
||||||
|
;================================
|
||||||
|
; plot routine
|
||||||
;================================
|
;================================
|
||||||
; put address in GBASL/GBASH
|
; put address in GBASL/GBASH
|
||||||
; Xcoord in A, Ycoord in Y
|
; 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
|
ldy #0
|
||||||
lda #$ff
|
ora COLOR
|
||||||
sta (GBASL),Y
|
sta (GBASL),Y
|
||||||
|
|
||||||
|
|
||||||
|
;==============================
|
||||||
|
|
||||||
dex
|
dex
|
||||||
bne draw_stars
|
bpl draw_stars
|
||||||
|
|
||||||
|
|
||||||
starfield_keyboard:
|
starfield_keyboard:
|
||||||
@ -90,6 +141,37 @@ skipskip:
|
|||||||
jmp starfield_loop ; 3
|
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
|
; External modules
|
||||||
;===============================================
|
;===============================================
|
||||||
|
@ -95,6 +95,7 @@ LAST_SPACEY_I EQU $88
|
|||||||
LAST_MAP_COLOR EQU $89
|
LAST_MAP_COLOR EQU $89
|
||||||
DRAW_SKY EQU $8A
|
DRAW_SKY EQU $8A
|
||||||
COLOR_MASK EQU $8B
|
COLOR_MASK EQU $8B
|
||||||
|
RANDOM_POINTER EQU $8C
|
||||||
|
|
||||||
SHIPY EQU $E4
|
SHIPY EQU $E4
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user