gr-sim: start adding hgr support

This commit is contained in:
Vince Weaver 2018-07-01 21:50:51 -04:00
parent 83bb87e12c
commit 773e5d9148
7 changed files with 187 additions and 3 deletions

View File

@ -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

View File

@ -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);

107
gr-sim/hgr-sim.c Normal file
View File

@ -0,0 +1,107 @@
#include <stdio.h>
#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;
}

24
gr-sim/hgr/Makefile Normal file
View File

@ -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

37
gr-sim/hgr/lines.c Normal file
View File

@ -0,0 +1,37 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#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;
}

View File

@ -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:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 5.6 KiB