diff --git a/gr-sim/Makefile b/gr-sim/Makefile index 789b7550..52cc4db6 100644 --- a/gr-sim/Makefile +++ b/gr-sim/Makefile @@ -9,6 +9,7 @@ SDL_INCLUDE= `sdl-config --cflags` all: gr-sim.a make -C 6502_test make -C fade + make -C hgr make -C kaleido_sparkle make -C lz4 make -C mode7_demo @@ -24,8 +25,8 @@ gr_fast_clear.o: gr_fast_clear.c gr-sim.h #### -gr-sim.a: 6502_emulate.o tfv_utils.o gr-sim.o gr_fast_clear.o - $(AR) crs gr-sim.a 6502_emulate.o tfv_utils.o gr-sim.o gr_fast_clear.o +gr-sim.a: 6502_emulate.o tfv_utils.o gr-sim.o gr_fast_clear.o hgr-sim.o + $(AR) crs gr-sim.a 6502_emulate.o tfv_utils.o gr-sim.o gr_fast_clear.o hgr-sim.o ### @@ -39,6 +40,9 @@ gr-sim.o: gr-sim.c gr-sim.h apple2_font.h tfv_utils.o: tfv_utils.c tfv_utils.h $(CC) $(CFLAGS) -c tfv_utils.c +hgr-sim.o: hgr-sim.c gr-sim.h + $(CC) $(CFLAGS) $(SDL_INCLUDE) -c hgr-sim.c + clean: rm -f *~ *.o *.a diff --git a/gr-sim/gr-sim.h b/gr-sim/gr-sim.h index ba4812a0..2fd61b07 100644 --- a/gr-sim/gr-sim.h +++ b/gr-sim/gr-sim.h @@ -117,4 +117,8 @@ void clear_bottom(void); void clear_screens_notext(void); void clear_all(void); +int hgr(void); +int hplot(int xx, int yy); +int hplot_to(int xx, int yy); +int hcolor_equals(int color); diff --git a/gr-sim/hgr-sim.c b/gr-sim/hgr-sim.c new file mode 100644 index 00000000..5dd26a49 --- /dev/null +++ b/gr-sim/hgr-sim.c @@ -0,0 +1,107 @@ +#include + +#include "gr-sim.h" +#include "tfv_zp.h" +#include "6502_emulate.h" + +static void color_shift(void) { + // F47E + a=a<<1; + if (a>=0xc0) goto done_color_shift; + + a=ram[HGR_BITS]; + a=a^0x7f; + ram[HGR_BITS]=a; + +done_color_shift: + ; // rts +} + +static void bkgnd(void) { + // F3F6 + a=ram[HGR_PAGE]; + ram[HGR_SHAPE+1]=a; + y=0; + ram[HGR_SHAPE]=y; +bkgnd_loop: + a=ram[HGR_BITS]; + + ram[y_indirect(HGR_SHAPE,y)]=a; + + color_shift(); + + y++; + if (y==0) { + } + else { + goto bkgnd_loop; + } + ram[HGR_SHAPE+1]+=1; + a=ram[HGR_SHAPE+1]; + a&=0x1f; // see if $40 or $60 + if (a!=0) { + goto bkgnd_loop; + } + // rts +} + +static void hclr(void) { + // F3F2 + a=0; // black background + ram[HGR_BITS]=a; + bkgnd(); + +} + +static void sethpg(void) { + // F3EA + ram[HGR_PAGE]=a; + soft_switch(HIRES); // LDA SW.HIRES + soft_switch(TXTCLR); // LDA SW.TXTCLR + + hclr(); + +} + +int hgr(void) { + + // F3E2 + a=0x20; // HIRES Page 1 at $2000 + soft_switch(LOWSCR); // BIT SW.LOWSCR Use PAGE1 ($C054) + soft_switch(MIXSET); // BIT SW.MIXSET (Mixed text) + sethpg(); + + return 0; +} + +int hgr2(void) { + + // F3D8 + soft_switch(HISCR); // BIT SW.HISCR Use PAGE2 ($C055) + soft_switch(MIXCLR); // BIT SW.MIXCLR + a=0x40; // HIRES Page 2 at $4000 + sethpg(); + + return 0; +} + + +int hplot(int xx, int yy) { + + return 0; +} + +int hplot_to(int xx, int yy) { + + return 0; +} + +int hcolor_equals(int color) { + + return 0; +} + + + + + diff --git a/gr-sim/hgr/Makefile b/gr-sim/hgr/Makefile new file mode 100644 index 00000000..eace8f4e --- /dev/null +++ b/gr-sim/hgr/Makefile @@ -0,0 +1,24 @@ +CC = gcc +CFLAGS = -Wall -O2 -I.. -g +LFLAGS = -lm + +SDL_LIBS= `sdl-config --libs` +SDL_INCLUDE= `sdl-config --cflags` +GR_SIM = ../gr-sim.a + +all: lines + + +### + +lines: lines.o $(GR_SIM) + $(CC) $(LFLAGS) $(SDL_LIBS) -o lines lines.o $(GR_SIM) + +lines.o: lines.c + $(CC) $(CFLAGS) -c lines.c + +#### + + +clean: + rm -f *~ *.o lines diff --git a/gr-sim/hgr/lines.c b/gr-sim/hgr/lines.c new file mode 100644 index 00000000..e038083c --- /dev/null +++ b/gr-sim/hgr/lines.c @@ -0,0 +1,37 @@ +#include +#include +#include + +#include "gr-sim.h" + +int main(int argc, char **argv) { + + int yy,ch; + + grsim_init(); + + home(); + + hgr(); + + + /* Put lines on screen */ + for(yy=0;yy<100;yy++) { + hcolor_equals(yy%8); + hplot(yy,yy); + hplot_to(200,yy); + } + + while(1) { + grsim_update(); + + ch=grsim_input(); + + if (ch=='q') break; + + usleep(100000); + + } + + return 0; +} diff --git a/gr-sim/tfv/TODO b/gr-sim/tfv/TODO index 4cf8ef85..bfd05d18 100644 --- a/gr-sim/tfv/TODO +++ b/gr-sim/tfv/TODO @@ -1,11 +1,19 @@ Soon: ++ Battle Sequence +--> Sprites for all enemies +--> Randomize enemy you fight +--> Different backgrounds based on location +--> Print enemy attack name on screen +--> Menu +--> Magic +--> Limit breaks +--> Run away + Enable getting back on spaceship (with animation) + Better collision detection on Spaceship land + Better collision detection/walk on+off in College Park + Hook up art for all possible locations + Working conversation + Riding animals -+ Battle Sequence + End sequence Credits: diff --git a/tfv/art/jc_office.png b/tfv/art/jc_office.png index d48c17fd..938807c4 100644 Binary files a/tfv/art/jc_office.png and b/tfv/art/jc_office.png differ