From 773e5d914804646cad15112e8e55ba11b3b34b6e Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 1 Jul 2018 21:50:51 -0400 Subject: [PATCH] gr-sim: start adding hgr support --- gr-sim/Makefile | 8 +++- gr-sim/gr-sim.h | 4 ++ gr-sim/hgr-sim.c | 107 ++++++++++++++++++++++++++++++++++++++++++ gr-sim/hgr/Makefile | 24 ++++++++++ gr-sim/hgr/lines.c | 37 +++++++++++++++ gr-sim/tfv/TODO | 10 +++- tfv/art/jc_office.png | Bin 402 -> 5768 bytes 7 files changed, 187 insertions(+), 3 deletions(-) create mode 100644 gr-sim/hgr-sim.c create mode 100644 gr-sim/hgr/Makefile create mode 100644 gr-sim/hgr/lines.c 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 d48c17fd5aaf8c1698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