# For this one see https://applecommander.github.io/
AC ?= ac.jar
-CL = cl65
-CLFLAGS = -t apple2 -C apple2-hgr.cfg -Oirs
+CL ?= cl65
-hgrtest.dsk: hgrtest
+all: hgr.dsk dhgr.dsk
+
+hgr.dsk: hgrshow hgrtest
cp prodos.dsk $@
- java -jar $(AC) -cc65 $@ hgrtest bin <hgrtest
+ java -jar $(AC) -as $@ hgrshow <hgrshow
+ java -jar $(AC) -as $@ hgrtest <hgrtest
+ java -jar $(AC) -p $@ astronaut.hgr bin 0x2000 <astronaut.hgr
+ java -jar $(AC) -p $@ chips.hgr bin 0x2000 <chips.hgr
+ java -jar $(AC) -p $@ macrometer.hgr bin 0x2000 <macrometer.hgr
+ java -jar $(AC) -p $@ mariner.hgr bin 0x2000 <mariner.hgr
+ java -jar $(AC) -p $@ rose.hgr bin 0x2000 <rose.hgr
+ java -jar $(AC) -p $@ werner.hgr bin 0x2000 <werner.hgr
+ java -jar $(AC) -p $@ winston.hgr bin 0x2000 <winston.hgr
+
+hgrshow: hgrshow.c
+ $(CL) -Oirs -t apple2 --start-addr 0x4000 -m hgrshow.map $^
hgrtest: hgrtest.c werner.s
- $(CL) $(CLFLAGS) -m hgrtest.map $^
+ $(CL) -Oirs -t apple2 -C apple2-hgr.cfg -m hgrtest.map $^
+
+dhgr.dsk: dhgrshow
+ cp prodos.dsk $@
+ java -jar $(AC) -as $@ dhgrshow <dhgrshow
+ java -jar $(AC) -p $@ catface.dhgr bin 0x2000 <catface.dhgr
+ java -jar $(AC) -p $@ gatsby.dhgr bin 0x2000 <gatsby.dhgr
+ java -jar $(AC) -p $@ girl.dhgr bin 0x2000 <girl.dhgr
+ java -jar $(AC) -p $@ monarch.dhgr bin 0x2000 <monarch.dhgr
+ java -jar $(AC) -p $@ superman.dhgr bin 0x2000 <superman.dhgr
+ java -jar $(AC) -p $@ venice.dhgr bin 0x2000 <venice.dhgr
+
+dhgrshow: dhgrshow.c
+ $(CL) -Oirs -t apple2enh --start-addr 0x4000 -m dhgrshow.map $^
--- /dev/null
+// cl65 -t apple2enh --start-addr 0x4000 dhgrshow.c
+
+#include <tgi.h>
+#include <conio.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <peekpoke.h>
+
+void main (void)
+{
+ unsigned old;
+ DIR *dir;
+ struct dirent *ent;
+
+ old = videomode (VIDEOMODE_80x24);
+ tgi_install (a2e_hi_tgi);
+ tgi_init ();
+ POKE (0xC05E, 0);
+
+ dir = opendir (".");
+ while (ent = readdir (dir)) {
+ char *ext;
+ int hgr;
+
+ ext = strrchr (ent->d_name, '.');
+ if (!ext || strcasecmp (ext, ".dhgr"))
+ continue;
+
+ hgr = open(ent->d_name, O_RDONLY);
+ POKE (0xC055, 0);
+ read(hgr, (void*)0x2000, 0x2000);
+ POKE (0xC054, 0);
+ read(hgr, (void*)0x2000, 0x2000);
+ close(hgr);
+
+ if (cgetc () == '\r')
+ break;
+ }
+ closedir (dir);
+
+ tgi_uninstall ();
+ videomode (old);
+}
--- /dev/null
+// cl65 -t apple2 --start-addr 0x4000 hgrshow.c
+
+#include <tgi.h>
+#include <conio.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <dirent.h>
+
+void main (void)
+{
+ DIR *dir;
+ struct dirent *ent;
+
+ tgi_install (a2_hi_tgi);
+ tgi_init ();
+
+ dir = opendir (".");
+ while (ent = readdir (dir)) {
+ char *ext;
+ int hgr;
+
+ ext = strrchr (ent->d_name, '.');
+ if (!ext || strcasecmp (ext, ".hgr"))
+ continue;
+
+ hgr = open(ent->d_name, O_RDONLY);
+ read(hgr, (void*)0x2000, 0x2000);
+ close(hgr);
+
+ if (cgetc () == '\r')
+ break;
+ }
+ closedir (dir);
+
+ tgi_uninstall ();
+}