mode7: starfield works

This commit is contained in:
Vince Weaver 2017-12-31 13:57:52 -05:00
parent ce4eafc474
commit 6af4836f26
2 changed files with 43 additions and 13 deletions

View File

@ -221,8 +221,8 @@ int main(int argc, char **argv) {
if ((dx.i<0) || (dy.i<0) || (dx.i>=40) || if ((dx.i<0) || (dy.i<0) || (dx.i>=40) ||
(dy.i>=40)) { (dy.i>=40)) {
printf("%i: out of range %d,%d\n", // printf("%i: out of range %d,%d\n",
i,dx.i,dy.i); // i,dx.i,dy.i);
random_star(i); random_star(i);
} }
else { else {
@ -232,11 +232,11 @@ int main(int argc, char **argv) {
// } // }
color_equals(color); color_equals(color);
printf("plot %i: (%d,%d,%d) %d,%d = %d\n", // printf("plot %i: (%d,%d,%d) %d,%d = %d\n",
i, // i,
stars[i].x.i,stars[i].y.i, // stars[i].x.i,stars[i].y.i,
stars[i].z, // stars[i].z,
dx.i,dy.i,color); // dx.i,dy.i,color);
basic_plot(dx.i,dy.i); basic_plot(dx.i,dy.i);
} }
@ -255,8 +255,17 @@ int main(int argc, char **argv) {
if (ch=='q') exit(0); if (ch=='q') exit(0);
usleep(10000); usleep(10000);
sleep(25); while(1) {
exit(1); ch=grsim_input();
if (ch!=0) break;
usleep(10000);
}
if (ch=='q') exit(0);
// repeat_until_keypressed();
// sleep(25);
// exit(1);
} }

View File

@ -221,14 +221,37 @@ plot_write:
plot_star_continue: plot_star_continue:
;============================== ;==============================
ldx XX ldx XX
dex dex
bmi starfield_keyboard bmi move_stars
; bpl draw_stars ; bpl draw_stars
jmp draw_stars jmp draw_stars
;=============================
; Move stars
move_stars:
ldy #(NUMSTARS-1)
move_stars_loop:
clc
lda star_z,Y
adc #1
sta star_z,Y
and #64
beq move_loop_skip
jsr random_star
move_loop_skip:
dey
bpl move_stars_loop
starfield_keyboard: starfield_keyboard:
jsr get_key ; get keypress ; 6 jsr get_key ; get keypress ; 6
@ -250,10 +273,8 @@ skipskip:
;================== ;==================
; loop forever ; loop forever
;================== ;==================
blah:
jmp blah
; jmp starfield_loop ; 3 jmp starfield_loop ; 3
; matches scroll_row1 - row3 ; matches scroll_row1 - row3