split-screen: adding Linux demo

This commit is contained in:
Vince Weaver 2018-07-02 15:21:46 -04:00
parent 1d2b4a582b
commit fff76cb454
6 changed files with 164 additions and 2 deletions

View File

@ -14,6 +14,7 @@ all: gr-sim.a
make -C lz4
make -C mode7_demo
make -C rasterbars
make -C split_screen
make -C starfield
make -C text
make -C tfv
@ -48,10 +49,12 @@ clean:
rm -f *~ *.o *.a
make -C 6502_test clean
make -C fade clean
make -C hgr clean
make -C kaleido_sparkle clean
make -C lz4 clean
make -C mode7_demo clean
make -C rasterbars clean
make -C split_screen
make -C starfield clean
make -C text clean
make -C tfv clean

View File

@ -65,6 +65,12 @@ static int text_page_1=0x00;
static int hires_on=0x00;
static int mixed_graphics=0xff;
static int plaid_mode=0;
void set_plaid(void) {
plaid_mode=1;
}
void soft_switch(unsigned short address) {
switch(address) {
@ -497,7 +503,11 @@ int grsim_update(void) {
/* get the proper modes */
if (text_mode) {
if (plaid_mode) {
draw_text(t_pointer,0,6);
draw_hires(t_pointer,48,112);
draw_lowres(t_pointer,28,48);
} else if (text_mode) {
draw_text(t_pointer,0,TEXT_YSIZE);
}
else {
@ -615,7 +625,7 @@ static void monitor_plot(void) {
int basic_plot(unsigned char xcoord, unsigned char ycoord) {
if (ycoord>40) {
if (ycoord>47) {
printf("Y too big %d\n",ycoord);
return -1;
}

View File

@ -34,6 +34,8 @@ int soft_switch_read(unsigned short address);
int vlin(int y1, int y2, int at);
int collision(int xx, int yy, int ground_color);
void set_plaid(void);
//void clear_top_a(void);
//void clear_top(int page);
//void clear_bottom(int page);

View File

@ -0,0 +1,25 @@
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: split_screen KATC.BIN
###
split_screen: split_screen.o $(GR_SIM)
$(CC) $(LFLAGS) $(SDL_LIBS) -o split_screen split_screen.o $(GR_SIM)
split_screen.o: split_screen.c
$(CC) $(CFLAGS) -c split_screen.c
####
KATC.BIN: kat.bmp
../../bmp2dhr/b2d kat.bmp hgr dither
clean:
rm -f *~ *.o split_screen image_load

BIN
gr-sim/split_screen/kat.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@ -0,0 +1,122 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include "../tfv_zp.h"
#include "gr-sim.h"
int main(int argc, char **argv) {
int yy,ch;
int i,fd;
grsim_init();
/* Text first */
text();
home();
ram[DISP_PAGE]=0x0;
ram[DRAW_PAGE]=0x0;
vtab(1); htab(1); move_cursor();
print(" * . ");
vtab(2); htab(1); move_cursor();
print(" * . T A L B O T . ");
vtab(3); htab(1); move_cursor();
print(" * F A N T A S Y ");
vtab(4); htab(1); move_cursor();
print(" * S E V E N ");
vtab(5); htab(1); move_cursor();
print(" . . . ");
vtab(6); htab(1); move_cursor();
print(" . ");
/* draw the moon */
vtab(1); htab(4); move_cursor(); print_inverse(" ");
vtab(2); htab(3); move_cursor(); print_inverse(" ");
vtab(3); htab(3); move_cursor(); print_inverse(" ");
vtab(4); htab(4); move_cursor(); print_inverse(" ");
while(1) {
grsim_update();
ch=grsim_input();
if (ch!=0) break;
usleep(100000);
}
/* gr part */
soft_switch(LORES); // LDA SW.LORES
soft_switch(TXTCLR); // LDA TXTCLR
soft_switch(MIXCLR);
color_equals(2);
for(i=28;i<48;i++) {
basic_hlin(0,39,i);
}
while(1) {
grsim_update();
ch=grsim_input();
if (ch!=0) break;
usleep(100000);
}
hgr();
/* Put horizontal lines on screen */
for(yy=64;yy<128;yy++) {
hcolor_equals(1);
hplot(0,yy);
hplot_to(279,yy);
}
fd=open("KATC.BIN",O_RDONLY);
if (fd<0) {
printf("Error opening!\n");
return -1;
}
read(fd,&ram[0x2000],0x2000);
close(fd);
while(1) {
grsim_update();
ch=grsim_input();
if (ch) break;
usleep(100000);
}
set_plaid();
while(1) {
grsim_update();
ch=grsim_input();
if (ch) break;
usleep(100000);
}
return 0;
}