From 8596cc17f7f9d67134da088936836e3219302481 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 23 Mar 2025 14:32:04 -0400 Subject: [PATCH] gr-sim: add double-lores support --- utils/gr-sim/dgr/Makefile | 24 +++++++++++++ utils/gr-sim/dgr/aha1.aux | Bin 0 -> 1024 bytes utils/gr-sim/dgr/aha1.main | Bin 0 -> 1024 bytes utils/gr-sim/dgr/aha1.png | Bin 0 -> 578 bytes utils/gr-sim/dgr/dgr_view.c | 61 ++++++++++++++++++++++++++++++++ utils/gr-sim/gr-sim.c | 67 ++++++++++++++++++++++++++++++++++++ utils/gr-sim/gr-sim.h | 1 + 7 files changed, 153 insertions(+) create mode 100644 utils/gr-sim/dgr/Makefile create mode 100644 utils/gr-sim/dgr/aha1.aux create mode 100644 utils/gr-sim/dgr/aha1.main create mode 100644 utils/gr-sim/dgr/aha1.png create mode 100644 utils/gr-sim/dgr/dgr_view.c diff --git a/utils/gr-sim/dgr/Makefile b/utils/gr-sim/dgr/Makefile new file mode 100644 index 00000000..4224d25f --- /dev/null +++ b/utils/gr-sim/dgr/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: dgr_view + + +### + +dgr_view: dgr_view.o $(GR_SIM) + $(CC) -o dgr_view dgr_view.o $(GR_SIM) $(LFLAGS) $(SDL_LIBS) + +dgr_view.o: dgr_view.c + $(CC) $(CFLAGS) -c dgr_view.c + +### + + +clean: + rm -f *~ *.o dgr_view diff --git a/utils/gr-sim/dgr/aha1.aux b/utils/gr-sim/dgr/aha1.aux new file mode 100644 index 0000000000000000000000000000000000000000..e5c60f8ef766e6acaf234cfeacfdde3b97c3acdf GIT binary patch literal 1024 zcmb`GzYc;h5XL`ZH#Mfg&BtJ5Dbda78|q6qvN&|S(Us^ER0lUg@Y;eBMZm-h^p5MF zU%&Q%js_SJss|LK#5C9fNY*|L5P!M1F^&_QlFqe^;~CCKANsAy7iwlFu9UI>+w+w_ z0m5EB_2}0^h$f#Gyfc69=-qrT(C^@VpRSJ^BBA5T#+S>uj-S5eT;)wE`GsGvJJefg zI$fk}Fng1yKK8BC?l$?le~=0`=K`y4UBB>2Bq0|;X)=_fk+ktah75Pw-}zZEfhckM zBOfH=Smvh4u3WMpk(=p%%_jx%z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUyGf+%aMF0Q*;~rpOPQCv`{Q#q2oSd8#&;8KD|6p53EpHd4W^Qj zd%R6cZ8aoMiF*4ubuS>+nt6bxx-6>Z;M700cjzsMhcWNtFjLBz)C_-k^w;(w*;~*j zvOj)+e$5mSO_p)X3D`vcG0mvOxPf~=_iP`5sSFOcV+ylb&f3A+5AATvDJcH>00HO` zRqM4o*suE-EH7jQDK87nU|)%AAYRA<5*CFgaFcFb1k>6;!cnAxhj3RxM~qrkQRkz$W6G8Vu66gKHdE<8d&^^abEkPd#;7Kk*tn&gsDD QE&u=k07*qoM6N<$f^IA4I{*Lx literal 0 HcmV?d00001 diff --git a/utils/gr-sim/dgr/dgr_view.c b/utils/gr-sim/dgr/dgr_view.c new file mode 100644 index 00000000..0ffc4dea --- /dev/null +++ b/utils/gr-sim/dgr/dgr_view.c @@ -0,0 +1,61 @@ +#include +#include +#include + +#include + +#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(LORES); + soft_switch(FULLGR); + soft_switch_write(CLRAN3); + soft_switch_write(SET80_COL); + soft_switch_write(EIGHTY_COLON); + + 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[0x10400],1024); + 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[0x00400],1024); + close(fd); + + + grsim_update(); + + while(1) { + ch=grsim_input(); + if (ch) break; + usleep(100000); + } + + return 0; +} diff --git a/utils/gr-sim/gr-sim.c b/utils/gr-sim/gr-sim.c index 5ee68154..cab7b25b 100644 --- a/utils/gr-sim/gr-sim.c +++ b/utils/gr-sim/gr-sim.c @@ -22,6 +22,12 @@ #define GR_X_SCALE 14 #define GR_Y_SCALE 8 +/* 80x48 double low-res mode */ +#define DGR_XSIZE 80 +#define DGR_YSIZE 48 +#define DGR_X_SCALE 7 +#define DGR_Y_SCALE 8 + /* 40 column only for now */ #define TEXT_XSIZE 40 #define TEXT_YSIZE 24 @@ -466,6 +472,64 @@ void draw_text(unsigned int *out_pointer,int text_start, int text_end) { } + +static void draw_dlores(unsigned int *out_pointer,int gr_start, int gr_end) { + + int i,j,yy,xx; + int gr_addr,gr_addr_hi; + int temp_col; + unsigned int *t_pointer; + + t_pointer=out_pointer+(gr_start*80*DGR_X_SCALE*DGR_Y_SCALE); + + /* do the top 40/48 if in graphics mode */ + for(yy=gr_start;yy>4; + } + else { + temp_col=ram[gr_addr+0x10000]&0x0f; + } + + for(i=0;i>4; + } + else { + temp_col=ram[gr_addr]&0x0f; + } + + for(i=0;i