mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-04-18 19:40:32 +00:00
gr-sim: work on dhgr support
This commit is contained in:
parent
7840655f08
commit
5b2dc2184c
130
utils/gr-sim/dhgr/Makefile
Normal file
130
utils/gr-sim/dhgr/Makefile
Normal file
@ -0,0 +1,130 @@
|
||||
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: dhgr_view
|
||||
|
||||
|
||||
###
|
||||
|
||||
dhgr_view: dhgr_view.o $(GR_SIM)
|
||||
$(CC) -o dhgr_view dhgr_view.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
dhgr_view.o: dhgr_view.c
|
||||
|
||||
$(CC) $(CFLAGS) -c dhgr_view.c
|
||||
|
||||
###
|
||||
|
||||
image_load: image_load.o $(GR_SIM)
|
||||
$(CC) -o image_load image_load.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
image_load.o: image_load.c
|
||||
$(CC) $(CFLAGS) -c image_load.c
|
||||
|
||||
###
|
||||
|
||||
lines: lines.o $(GR_SIM)
|
||||
$(CC) -o lines lines.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
lines.o: lines.c
|
||||
$(CC) $(CFLAGS) -c lines.c
|
||||
|
||||
###
|
||||
|
||||
fireworks: fireworks.o $(GR_SIM)
|
||||
$(CC) -o fireworks fireworks.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
fireworks.o: fireworks.c
|
||||
$(CC) $(CFLAGS) -c fireworks.c
|
||||
|
||||
###
|
||||
|
||||
tunnel: tunnel.o $(GR_SIM)
|
||||
$(CC) -o tunnel tunnel.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
tunnel.o: tunnel.c
|
||||
$(CC) $(CFLAGS) -c tunnel.c
|
||||
|
||||
###
|
||||
|
||||
tunnel_small: tunnel_small.o $(GR_SIM)
|
||||
$(CC) -o tunnel_small tunnel_small.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
tunnel_small.o: tunnel_small.c
|
||||
$(CC) $(CFLAGS) -c tunnel_small.c
|
||||
|
||||
|
||||
|
||||
###
|
||||
|
||||
plasma_new: plasma_new.o $(GR_SIM)
|
||||
$(CC) -o plasma_new plasma_new.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
plasma_new.o: plasma_new.c
|
||||
$(CC) $(CFLAGS) -c plasma_new.c
|
||||
|
||||
###
|
||||
|
||||
plasma_test64: plasma_test64.o $(GR_SIM)
|
||||
$(CC) -o plasma_test64 plasma_test64.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
plasma_test64.o: plasma_test64.c
|
||||
$(CC) $(CFLAGS) -c plasma_test64.c
|
||||
|
||||
###
|
||||
|
||||
plasma_test: plasma_test.o $(GR_SIM)
|
||||
$(CC) -o plasma_test plasma_test.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
plasma_test.o: plasma_test.c
|
||||
$(CC) $(CFLAGS) -c plasma_test.c
|
||||
|
||||
|
||||
###
|
||||
|
||||
fw_purple: fw_purple.o $(GR_SIM)
|
||||
$(CC) -o fw_purple fw_purple.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
fw_purple.o: fw_purple.c
|
||||
$(CC) $(CFLAGS) -c fw_purple.c
|
||||
###
|
||||
|
||||
seven: seven.o $(GR_SIM)
|
||||
$(CC) -o seven seven.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
seven.o: seven.c
|
||||
$(CC) $(CFLAGS) -c seven.c
|
||||
|
||||
###
|
||||
|
||||
random16: random16.o $(GR_SIM)
|
||||
$(CC) -o random16 random16.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
random16.o: random16.c
|
||||
$(CC) $(CFLAGS) -c random16.c
|
||||
|
||||
####
|
||||
|
||||
scroll: scroll.o $(GR_SIM)
|
||||
$(CC) -o scroll scroll.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
scroll.o: scroll.c
|
||||
$(CC) $(CFLAGS) -c scroll.c
|
||||
|
||||
####
|
||||
|
||||
scroll-asm: scroll-asm.o $(GR_SIM)
|
||||
$(CC) -o scroll-asm scroll-asm.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS)
|
||||
|
||||
scroll-asm.o: scroll-asm.c
|
||||
$(CC) $(CFLAGS) -c scroll-asm.c
|
||||
|
||||
####
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o dhgr_view
|
61
utils/gr-sim/dhgr/dhgr_view.c
Normal file
61
utils/gr-sim/dhgr/dhgr_view.c
Normal file
@ -0,0 +1,61 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "gr-sim.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int ch,fd;
|
||||
|
||||
if (argc<2) {
|
||||
fprintf(stderr,"Usage: dhgr_view FILENAME.AUX FILENAME.MAIN\n");
|
||||
fprintf(stderr," where FILENAME AUX/MAIN are 8k AppleII DHIRES dumps\n\n");
|
||||
}
|
||||
|
||||
grsim_init();
|
||||
|
||||
home();
|
||||
|
||||
soft_switch(SET_GR);
|
||||
soft_switch(HIRES);
|
||||
soft_switch(FULLGR);
|
||||
soft_switch_write(AN3);
|
||||
soft_switch_write(EIGHTY_COLON);
|
||||
soft_switch_write(SET80_COL);
|
||||
|
||||
soft_switch(SET_PAGE2);
|
||||
|
||||
/* Load AUX RAM */
|
||||
fd=open(argv[1],O_RDONLY);
|
||||
if (fd<0) {
|
||||
printf("Error opening!\n");
|
||||
return -1;
|
||||
}
|
||||
read(fd,&ram[0x12000],8192);
|
||||
close(fd);
|
||||
|
||||
soft_switch(SET_PAGE1);
|
||||
|
||||
/* load MAIN RAM */
|
||||
fd=open(argv[2],O_RDONLY);
|
||||
if (fd<0) {
|
||||
printf("Error opening!\n");
|
||||
return -1;
|
||||
}
|
||||
read(fd,&ram[0x02000],8192);
|
||||
close(fd);
|
||||
|
||||
|
||||
grsim_update();
|
||||
|
||||
while(1) {
|
||||
ch=grsim_input();
|
||||
if (ch) break;
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -60,10 +60,14 @@ static int debug=0;
|
||||
#define FLASH 0xF3
|
||||
#define TEMP 0xFA
|
||||
|
||||
/* For these variables, off=0 and on=0xff */
|
||||
static int text_mode=0xff;
|
||||
static int text_page_1=0x00;
|
||||
static int hires_on=0x00;
|
||||
static int mixed_graphics=0xff;
|
||||
static int a3_state=0x00;
|
||||
static int eightycol_on=0x00;
|
||||
static int set80col=0x00; /* if on, PAGE2 maps AUX:2000 to MAIN:2000 */
|
||||
|
||||
static int plaid_mode=0;
|
||||
|
||||
@ -108,6 +112,32 @@ void soft_switch(unsigned short address) {
|
||||
}
|
||||
}
|
||||
|
||||
/* On apple IIe and newer some things only happen on write */
|
||||
void soft_switch_write(unsigned short address) {
|
||||
|
||||
switch(address) {
|
||||
|
||||
case SET80_COL: /* $c001 */
|
||||
set80col=0xff;
|
||||
break;
|
||||
|
||||
case EIGHTY_COLON: /* $c00d */
|
||||
eightycol_on=0xff;
|
||||
break;
|
||||
|
||||
case AN3: /* $c05e */
|
||||
a3_state=0xff;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* if not specifically handled, fall through */
|
||||
/* to regular access */
|
||||
soft_switch(address);
|
||||
// fprintf(stderr,"Unknown soft switch %x\n",address);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int soft_switch_read(unsigned short address) {
|
||||
|
||||
switch(address) {
|
||||
|
@ -30,6 +30,7 @@ int hlin_continue(int width);
|
||||
int hlin_double_continue(int width);
|
||||
int hlin_double(int page, int x1, int x2, int at);
|
||||
void soft_switch(unsigned short address);
|
||||
void soft_switch_write(unsigned short address);
|
||||
int soft_switch_read(unsigned short address);
|
||||
int vlin(int y1, int y2, int at);
|
||||
int collision(int xx, int yy, int ground_color);
|
||||
@ -76,8 +77,10 @@ int plot(unsigned char xcoord, unsigned char ycoord);
|
||||
/* Soft Switches */
|
||||
#define EIGHTYSTORE_OFF 0xc000 // page2 selects AUX ram
|
||||
#define EIGHTYSTORE_ON 0xc001 // page2 selects MAIN ram
|
||||
#define SET80_COL 0xc001
|
||||
#define EIGHTYCOL_OFF 0xc00c // Display 40 columns
|
||||
#define EIGHTYCOLO_ON 0xc00d // Display 80 columns
|
||||
#define EIGHTY_COLON 0xc00d // Display 80 columns
|
||||
#define ALTCHAR_OFF 0xc00e // Use primary charset
|
||||
#define ALTCHAR_ON 0xc00f // Use alternate charset
|
||||
#define EIGHTYSTORE_RD 0xc018 // Read 80stor switch (R7)
|
||||
@ -89,21 +92,26 @@ int plot(unsigned char xcoord, unsigned char ycoord);
|
||||
#define EIGHTYCOL_RD 0xc01f // Read 80col switch (1==on) (R7)
|
||||
#define TXTCLR 0xc050 // Display GR
|
||||
#define TEXT_OFF 0xc050 // Display GR
|
||||
#define SET_GR 0xc050 // Display GR
|
||||
#define TXTSET 0xc051 // Display Text
|
||||
#define TEXT_ON 0xc051 // Display Text
|
||||
#define MIXED_OFF 0xc052 // Mixed Text Off
|
||||
#define MIXCLR 0xc052 // Mixed Text Off
|
||||
#define FULLGR 0xc052 // Mixed Text Off
|
||||
#define MIXED_ON 0xc053 // Mixed Text On
|
||||
#define MIXSET 0xc053 // Mixed Text On
|
||||
#define PAGE2_OFF 0xc054 // Use Page 1
|
||||
#define LOWSCR 0xc054 // Use Page 1
|
||||
#define SET_PAGE1 0xc054
|
||||
#define PAGE2_ON 0xc055 // Use Page 2
|
||||
#define HISCR 0xc055 // Use Page 2
|
||||
#define SET_PAGE2 0xc055
|
||||
#define HIRES_OFF 0xc056 // lowres mode
|
||||
#define LORES 0xc056 // lowres mode
|
||||
#define HIRES_ON 0xc057 // hires mode
|
||||
#define HIRES 0xc057 // hires mode
|
||||
#define DHIRES_ON 0xc05e // double-hires on
|
||||
#define AN3 0xc05e // annunciator 3
|
||||
#define DHIRES_OFF 0xc05f // double-hires off
|
||||
#define DHIRES_RD 0xc07f // double-hires read
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user