From e8edf44d4c2f041838c1407e0fb30f7e5febe952 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 22 Feb 2023 15:15:12 -0500 Subject: [PATCH] hgr_viewer: overhaul to allow making slideshows easier --- graphics/hgr_viewer/Makefile | 59 ++--- graphics/hgr_viewer/hires_plain.s | 98 -------- graphics/hgr_viewer/make_hgr_viewer.c | 243 ++++++++++++++++++++ graphics/hgr_viewer/plain/Makefile | 132 ----------- graphics/hgr_viewer/plain/make_slideshow.sh | 1 + graphics/hgr_viewer/wait_keypress.s | 5 - 6 files changed, 257 insertions(+), 281 deletions(-) delete mode 100644 graphics/hgr_viewer/hires_plain.s create mode 100644 graphics/hgr_viewer/make_hgr_viewer.c delete mode 100644 graphics/hgr_viewer/plain/Makefile create mode 100755 graphics/hgr_viewer/plain/make_slideshow.sh delete mode 100644 graphics/hgr_viewer/wait_keypress.s diff --git a/graphics/hgr_viewer/Makefile b/graphics/hgr_viewer/Makefile index 5ae86492..e036463d 100644 --- a/graphics/hgr_viewer/Makefile +++ b/graphics/hgr_viewer/Makefile @@ -7,7 +7,18 @@ PNG_TO_RLE = ../../utils/gr-utils/png2rle EMPTY_DISK = ../../empty_disk/empty.dsk TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft -all: hires_plain.dsk hires_jiskey.dsk +all: hires_plain.dsk make_hgr_viewer + + +### + +make_hgr_viewer: make_hgr_viewer.o + $(CC) $(LFLAGS) -o make_hgr_viewer make_hgr_viewer.o + +make_hgr_viewer.o: make_hgr_viewer.c + $(CC) $(CFLAGS) -c make_hgr_viewer.c + +### hires_special.dsk: HELLO HIRES_SPECIAL \ special/bbl.hgr.zx02 special/bbl2.hgr.zx02 \ @@ -82,41 +93,6 @@ hires_special.dsk: HELLO HIRES_SPECIAL \ -#### - -hires_plain.dsk: HELLO HIRES_PLAIN \ - ./plain/gp.hgr.zx02 ./plain/peddle.hgr.zx02 \ - ./plain/gp.hgr.zx02 ./plain/peddle3.hgr.zx02 \ - ./plain/45.hgr.zx02 ./plain/45b2d.hgr.zx02 \ - ./plain/45zoom.hgr.zx02 ./plain/zebra.hgr.zx02 \ - ./plain/Fm2JZOJWAAEVX0l_a2.hgr.zx02 \ - ./plain/FmH3w6vXwAAd1pF_a2.hgr.zx02 \ - ./plain/FULUd0EXEAgPCeG_a2.hgr.zx02 \ - ./plain/FllGu1OWIAAAG8O_a2.hgr.zx02 \ - ./plain/FpLVqVDaIAk9jtc_a2.hgr.zx02 \ - ./plain/FXeGzxKXgAEnsbj_a2.hgr.zx02 \ - ./plain/FmDIeJZXkAA4IiP_a2.hgr.zx02 - cp $(EMPTY_DISK) hires_plain.dsk - $(DOS33) -y hires_plain.dsk SAVE A HELLO - $(DOS33) -y hires_plain.dsk BSAVE -a 0x0c00 HIRES_PLAIN HIRES - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/gp.hgr.zx02 GP.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/peddle.hgr.zx02 PEDDLE.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/peddle3.hgr.zx02 PEDDLE3.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/45.hgr.zx02 FORTY5.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/45b2d.hgr.zx02 FORTY5B2D.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/45zoom.hgr.zx02 FORTY5Z.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/zebra.hgr.zx02 ZEB.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/Fm2JZOJWAAEVX0l_a2.hgr.zx02 FM2J.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/FmH3w6vXwAAd1pF_a2.hgr.zx02 FMH3.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/FULUd0EXEAgPCeG_a2.hgr.zx02 FULU.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/FllGu1OWIAAAG8O_a2.hgr.zx02 FLLG.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/FpLVqVDaIAk9jtc_a2.hgr.zx02 FPLV.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/FXeGzxKXgAEnsbj_a2.hgr.zx02 FXEG.ZX02 - $(DOS33) -y hires_plain.dsk BSAVE -a 0xa000 ./plain/FmDIeJZXkAA4IiP_a2.hgr.zx02 FMDI.ZX02 - - - - #### hires_jiskey.dsk: HELLO HIRES_JISKEY \ @@ -145,15 +121,6 @@ hires_special.o: hires_special.s hires_main.s zx02_optim.s \ #### -HIRES_PLAIN: hires_plain.o - ld65 -o HIRES_PLAIN hires_plain.o -C ../../linker_scripts/apple2_c00.inc - -hires_plain.o: hires_plain.s hires_main.s zx02_optim.s \ - zp.inc hardware.inc - ca65 -o hires_plain.o hires_plain.s -l hires_plain.lst - -#### - HIRES_JISKEY: hires_jiskey.o ld65 -o HIRES_JISKEY hires_jiskey.o -C ../../linker_scripts/apple2_c00.inc @@ -171,5 +138,5 @@ HELLO: hello.bas clean: - rm -f *~ *.o *.lst HIRES_PLAIN HIRES_SPECIAL HIRES_JISKEY HELLO + rm -f *~ *.o *.lst HIRES_SPECIAL HIRES_JISKEY HELLO diff --git a/graphics/hgr_viewer/hires_plain.s b/graphics/hgr_viewer/hires_plain.s deleted file mode 100644 index 5aff5011..00000000 --- a/graphics/hgr_viewer/hires_plain.s +++ /dev/null @@ -1,98 +0,0 @@ -; Some nice hires images - -.include "hires_main.s" - -MAX_FILES = 14 - -filenames_low: - .byte gp_filename - .byte >peddle_filename - .byte >peddle3_filename - .byte >forty5_filename - .byte >forty5b_filename - .byte >forty5z_filename - .byte >zeb_filename - .byte >fm2j_filename - .byte >fmh3_filename - .byte >fulu_filename - .byte >fllg_filename - .byte >fplv_filename - .byte >fxeg_filename - .byte >fmdi_filename - - - -; filename to open is 30-character Apple text: -gp_filename: ; .byte "GP.ZX02",0 - .byte 'G'|$80,'P'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -peddle_filename: ; .byte "PEDDLE.ZX02",0 - .byte 'P'|$80,'E'|$80,'D'|$80,'D'|$80,'L'|$80,'E'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -peddle3_filename: ; .byte "PEDDLE3.ZX02",0 - .byte 'P'|$80,'E'|$80,'D'|$80,'D'|$80,'L'|$80,'E'|$80,'3'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -forty5_filename: ; .byte "45.ZX02",0 - .byte 'F'|$80,'O'|$80,'R'|$80,'T'|$80,'Y'|$80,'5'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -forty5b_filename: ; .byte "45B2D.ZX02",0 - .byte 'F'|$80,'O'|$80,'R'|$80,'T'|$80,'Y'|$80,'5'|$80,'B'|$80,'2'|$80,'D'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -forty5z_filename: ; .byte "45Z.ZX02",0 - .byte 'F'|$80,'O'|$80,'R'|$80,'T'|$80,'Y'|$80,'5'|$80,'Z'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -zeb_filename: ; .byte "ZEB.ZX02",0 - .byte 'Z'|$80,'E'|$80,'B'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -fm2j_filename: ; .byte "FM2J.ZX02",0 - .byte 'F'|$80,'M'|$80,'2'|$80,'J'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -fmh3_filename: ; .byte "FMH3.ZX02",0 - .byte 'F'|$80,'M'|$80,'H'|$80,'3'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -fulu_filename: ; .byte "FULU.ZX02",0 - .byte 'F'|$80,'U'|$80,'L'|$80,'U'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -fllg_filename: ; .byte "FLLG.ZX02",0 - .byte 'F'|$80,'L'|$80,'L'|$80,'G'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -fplv_filename: ; .byte "FPLV.ZX02",0 - .byte 'F'|$80,'P'|$80,'L'|$80,'V'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -fxeg_filename: ; .byte "FXEG.ZX02",0 - .byte 'F'|$80,'X'|$80,'E'|$80,'G'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - -fmdi_filename: ; .byte "FMDI.ZX02",0 - .byte 'F'|$80,'M'|$80,'D'|$80,'I'|$80 - .byte '.'|$80,'Z'|$80,'X'|$80,'0'|$80,'2'|$80,$00 - - diff --git a/graphics/hgr_viewer/make_hgr_viewer.c b/graphics/hgr_viewer/make_hgr_viewer.c new file mode 100644 index 00000000..0622a301 --- /dev/null +++ b/graphics/hgr_viewer/make_hgr_viewer.c @@ -0,0 +1,243 @@ +/* TODO: bail if will over-write files */ + + +#include +#include +#include +#include + +#define MAX_FILES 1024 + +static char *png_filenames[MAX_FILES]; +static char *zx02_filenames[MAX_FILES]; +static char *labels[MAX_FILES]; + +/* Format: + +file_label FILE.ZX02 file.png + +*/ + +int main(int argc, char **argv) { + + char *result; + char string[BUFSIZ]; + int num_files=0; + int i,j,count,line=0; + char temp_png[BUFSIZ]; + char temp_zx02[BUFSIZ]; + char temp_label[BUFSIZ]; + char s_filename[BUFSIZ]; + char filename_base[BUFSIZ]; + + FILE *sss; + + /******************************************/ + /* parse command line */ + /******************************************/ + + if (argc>1) { + strcpy(filename_base,argv[1]); + } + else { + strcpy(filename_base,"hires_plain"); + } + sprintf(s_filename,"%s.s",filename_base); + + /******************************************/ + /* scan in data */ + /******************************************/ + + while(1) { + line++; + result=fgets(string,BUFSIZ,stdin); + if (result==NULL) { + break; + } + if (result[0]=='#') continue; + + count=sscanf(string,"%s %s %s",temp_label,temp_zx02,temp_png); + if (count!=3) { + fprintf(stderr,"WARNING! weird input line %d (%d)\n",line,count); + fprintf(stderr,"\t%s",string); + } + else { + labels[num_files]=strdup(temp_label); + png_filenames[num_files]=strdup(temp_png); + zx02_filenames[num_files]=strdup(temp_zx02); + + num_files++; + if (num_files>=MAX_FILES) { + fprintf(stderr,"ERROR! Too many files!\n"); + exit(-1); + } + } + } + + if (num_files==0) { + fprintf(stderr,"ERROR! No files found!\n"); + exit(-1); + } + + /******************************************/ + /* generate S file */ + /******************************************/ + + sss=fopen(s_filename,"w"); + if (sss==NULL) { + fprintf(stderr,"ERRROR opening %s\n",s_filename); + exit(-1); + } + + + fprintf(sss,"; Some nice hires images\n\n"); + fprintf(sss,".include \"../hires_main.s\"\n\n"); + fprintf(sss,"MAX_FILES = %d\n\n",num_files); + + fprintf(sss,"filenames_low:\n"); + for(i=0;i%s_filename\n",labels[i]); + } + fprintf(sss,"\n"); + + fprintf(sss,"; filename to open is 30-character Apple text:\n"); + + for(i=0;i HELLO\n\n"); + + fprintf(sss,"####\n\n"); + + fprintf(sss,"%s.dsk:\tHELLO HIRES\\\n",filename_base); + for(i=0;i %s.hgr\n",png_filenames[i],png_filenames[i]); + fprintf(sss,"\n"); + } + + fprintf(sss,"####\n\n"); + fprintf(sss,"clean:\n"); + fprintf(sss,"\trm -f *~ *.o *.lst\n\n"); + + fclose(sss); + + return 0; +} diff --git a/graphics/hgr_viewer/plain/Makefile b/graphics/hgr_viewer/plain/Makefile deleted file mode 100644 index 8fdd3889..00000000 --- a/graphics/hgr_viewer/plain/Makefile +++ /dev/null @@ -1,132 +0,0 @@ -include ../../../Makefile.inc - -ZX02 = ~/research/6502_compression/zx02.git/build/zx02 -PNG_TO_HGR = ../../../utils/hgr-utils/png2hgr - -all: 45zoom.hgr.zx02 45b2d.hgr.zx02 45.hgr.zx02 \ - gp.hgr.zx02 \ - peddle.hgr.zx02 peddle3.hgr.zx02 \ - zebra.hgr.zx02 \ - Fm2JZOJWAAEVX0l_a2.hgr.zx02 \ - FmH3w6vXwAAd1pF_a2.hgr.zx02 \ - FULUd0EXEAgPCeG_a2.hgr.zx02 \ - FllGu1OWIAAAG8O_a2.hgr.zx02 \ - FpLVqVDaIAk9jtc_a2.hgr.zx02 \ - FXeGzxKXgAEnsbj_a2.hgr.zx02 \ - FmDIeJZXkAA4IiP_a2.hgr.zx02 - -#### - -45.hgr.zx02: 45.hgr - $(ZX02) 45.hgr 45.hgr.zx02 - -45.hgr: 45years1.png - $(PNG_TO_HGR) 45years1.png > 45.hgr - -#### - -peddle3.hgr.zx02: peddle3.hgr - $(ZX02) peddle3.hgr peddle3.hgr.zx02 - -peddle3.hgr: peddle3.png - $(PNG_TO_HGR) peddle3.png > peddle3.hgr - -#### - -45zoom.hgr.zx02: 45zoom.hgr - $(ZX02) 45zoom.hgr 45zoom.hgr.zx02 - -#### - -45b2d.hgr.zx02: 45b2d.hgr - $(ZX02) 45b2d.hgr 45b2d.hgr.zx02 - -#### - -gp.hgr.zx02: gp.hgr - $(ZX02) gp.hgr gp.hgr.zx02 - -gp.hgr: gp.png - $(PNG_TO_HGR) gp.png > gp.hgr - -#### - -zebra.hgr.zx02: zebra.hgr - $(ZX02) zebra.hgr zebra.hgr.zx02 - -zebra.hgr: zebra.png - $(PNG_TO_HGR) zebra.png > zebra.hgr - - -#### - -Fm2JZOJWAAEVX0l_a2.hgr.zx02: Fm2JZOJWAAEVX0l_a2.hgr - $(ZX02) Fm2JZOJWAAEVX0l_a2.hgr Fm2JZOJWAAEVX0l_a2.hgr.zx02 - -Fm2JZOJWAAEVX0l_a2.hgr: Fm2JZOJWAAEVX0l_a2.png - $(PNG_TO_HGR) Fm2JZOJWAAEVX0l_a2.png > Fm2JZOJWAAEVX0l_a2.hgr - -#### - -FmH3w6vXwAAd1pF_a2.hgr.zx02: FmH3w6vXwAAd1pF_a2.hgr - $(ZX02) FmH3w6vXwAAd1pF_a2.hgr FmH3w6vXwAAd1pF_a2.hgr.zx02 - -FmH3w6vXwAAd1pF_a2.hgr: FmH3w6vXwAAd1pF_a2.png - $(PNG_TO_HGR) FmH3w6vXwAAd1pF_a2.png > FmH3w6vXwAAd1pF_a2.hgr - -#### - -FULUd0EXEAgPCeG_a2.hgr.zx02: FULUd0EXEAgPCeG_a2.hgr - $(ZX02) FULUd0EXEAgPCeG_a2.hgr FULUd0EXEAgPCeG_a2.hgr.zx02 - -FULUd0EXEAgPCeG_a2.hgr: FULUd0EXEAgPCeG_a2.png - $(PNG_TO_HGR) FULUd0EXEAgPCeG_a2.png > FULUd0EXEAgPCeG_a2.hgr - -#### - -FllGu1OWIAAAG8O_a2.hgr.zx02: FllGu1OWIAAAG8O_a2.hgr - $(ZX02) FllGu1OWIAAAG8O_a2.hgr FllGu1OWIAAAG8O_a2.hgr.zx02 - -FllGu1OWIAAAG8O_a2.hgr: FllGu1OWIAAAG8O_a2.png - $(PNG_TO_HGR) FllGu1OWIAAAG8O_a2.png > FllGu1OWIAAAG8O_a2.hgr - -#### - -FpLVqVDaIAk9jtc_a2.hgr.zx02: FpLVqVDaIAk9jtc_a2.hgr - $(ZX02) FpLVqVDaIAk9jtc_a2.hgr FpLVqVDaIAk9jtc_a2.hgr.zx02 - -FpLVqVDaIAk9jtc_a2.hgr: FpLVqVDaIAk9jtc_a2.png - $(PNG_TO_HGR) FpLVqVDaIAk9jtc_a2.png > FpLVqVDaIAk9jtc_a2.hgr - -#### - -FXeGzxKXgAEnsbj_a2.hgr.zx02: FXeGzxKXgAEnsbj_a2.hgr - $(ZX02) FXeGzxKXgAEnsbj_a2.hgr FXeGzxKXgAEnsbj_a2.hgr.zx02 - -FXeGzxKXgAEnsbj_a2.hgr: FXeGzxKXgAEnsbj_a2.png - $(PNG_TO_HGR) FXeGzxKXgAEnsbj_a2.png > FXeGzxKXgAEnsbj_a2.hgr - -#### - -FmDIeJZXkAA4IiP_a2.hgr.zx02: FmDIeJZXkAA4IiP_a2.hgr - $(ZX02) FmDIeJZXkAA4IiP_a2.hgr FmDIeJZXkAA4IiP_a2.hgr.zx02 - -FmDIeJZXkAA4IiP_a2.hgr: FmDIeJZXkAA4IiP_a2.png - $(PNG_TO_HGR) FmDIeJZXkAA4IiP_a2.png > FmDIeJZXkAA4IiP_a2.hgr - - - - - - - -#### - -peddle.hgr.zx02: peddle.hgr - $(ZX02) peddle.hgr peddle.hgr.zx02 - -#### - -clean: - rm -f *~ *.o *.lst - diff --git a/graphics/hgr_viewer/plain/make_slideshow.sh b/graphics/hgr_viewer/plain/make_slideshow.sh new file mode 100755 index 00000000..8a0daf0d --- /dev/null +++ b/graphics/hgr_viewer/plain/make_slideshow.sh @@ -0,0 +1 @@ +../make_hgr_viewer hires_plain < plain.data diff --git a/graphics/hgr_viewer/wait_keypress.s b/graphics/hgr_viewer/wait_keypress.s deleted file mode 100644 index 444d2074..00000000 --- a/graphics/hgr_viewer/wait_keypress.s +++ /dev/null @@ -1,5 +0,0 @@ -wait_until_keypress: - lda KEYPRESS ; 4 - bpl wait_until_keypress ; 3 - bit KEYRESET ; clear the keyboard buffer - rts ; 6