mode7: some more demo work

This commit is contained in:
Vince Weaver 2018-01-08 00:50:18 -05:00
parent f33c20fd8f
commit 0233210271
6 changed files with 61 additions and 27 deletions

View File

@ -6,7 +6,7 @@ SDL_LIBS= `sdl-config --libs`
SDL_INCLUDE= `sdl-config --cflags`
all: fade fixed_point rainbow sparkle starfield starfield_fixed kaleido \
tfv mode7_demo text tfv_multiply
tfv mode7_demo text tfv_multiply rasterbars
@ -150,6 +150,12 @@ kaleido.o: kaleido.c
$(CC) $(CFLAGS) -c kaleido.c
rasterbars: rasterbars.o gr-sim.o
$(CC) $(LFLAGS) $(SDL_LIBS) -o rasterbars rasterbars.o gr-sim.o
rasterbars.o: rasterbars.c
$(CC) $(CFLAGS) -c rasterbars.c
sparkle: sparkle.o gr-sim.o
$(CC) $(LFLAGS) $(SDL_LIBS) -o sparkle sparkle.o gr-sim.o
@ -175,6 +181,7 @@ gr-sim.o: gr-sim.c gr-sim.h apple2_font.h
clean:
rm -f *~ *.o gr-sim rainbow sparkle starfield starfield_fixed kaleido \
tfv text mode7_demo fade fixed_point tfv_multiply
tfv text mode7_demo fade fixed_point tfv_multiply \
rasterbars

45
gr-sim/rasterbars.c Normal file
View File

@ -0,0 +1,45 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include "gr-sim.h"
int main(int argc, char **argv) {
int ch,i=0;
int y=0;
grsim_init();
gr();
while(1) {
gr();
i++;
y=8.0*sin(i*2.0*3.14/16.0);
printf("%d %d\n",i,y);
color_equals(1); // red
hlin(0,0,40,y+18);
color_equals(11); // pink
hlin(0,0,40,6);
color_equals(9); // orange
hlin(0,0,40,7);
color_equals(13); // yellow
hlin(0,0,40,8);
grsim_update();
ch=grsim_input();
if (ch=='q') exit(0);
usleep(50000);
if (i>15) i=0;
}
return 0;
}

View File

@ -27,7 +27,7 @@ mode7_demo.o: mode7_demo.s mode7_demo_backgrounds.inc \
../asm_routines/gr_fade.s \
../asm_routines/gr_copy.s \
../asm_routines/gr_scroll.s \
mode7.s
mode7.s starfield_demo.s
ca65 -o mode7_demo.o mode7_demo.s -l mode7_demo.lst

View File

@ -92,6 +92,7 @@ island_demo:
star_demo:
; initialize
jsr starfield_demo
rts
@ -175,6 +176,7 @@ title_routine:
.include "../asm_routines/gr_copy.s"
.include "../asm_routines/gr_scroll.s"
.include "../asm_routines/gr_offsets.s"
.include "../asm_routines/gr_plot.s"
.include "mode7.s"
@ -182,10 +184,10 @@ title_routine:
;===============================================
; Variables
; More routines
;===============================================
.include "deater.scrolltext"
.include "a2.scrolltext"
.include "starfield_demo.s"

View File

@ -1,5 +1,3 @@
.include "zp.inc"
;===========
; CONSTANTS
;===========
@ -10,6 +8,7 @@ NUMSTARS EQU 16
;=====================
; Starfield
;=====================
starfield_demo:
;================================
; Clear screen and setup graphics
@ -18,10 +17,6 @@ NUMSTARS EQU 16
jsr clear_screens ; clear top/bottom of page 0/1
jsr set_gr_page0
; Initialize the 2kB of multiply lookup tables
jsr init_multiply_tables
;===============
; Init Variables
;===============
@ -282,22 +277,6 @@ random_star:
rts ; 6
;===============================================
; External modules
;===============================================
.include "../asm_routines/pageflip.s"
.include "../asm_routines/gr_setpage.s"
.include "../asm_routines/keypress.s"
.include "../asm_routines/gr_putsprite.s"
.include "../asm_routines/gr_offsets.s"
.include "../asm_routines/gr_fast_clear.s"
.include "../asm_routines/gr_plot.s"
.include "../asm_routines/multiply_fast.s"
.include "sprites.inc"
;======================
; some "random" numbers
;======================

View File

@ -98,6 +98,7 @@ COLOR_MASK EQU $8B
KEY_COUNT EQU $8C
KEY_OFFSET EQU $8D
DRAW_BLUE_SKY EQU $8E
RANDOM_POINTER EQU $8F
SHIPY EQU $E4