move some things from targettest to samples

This commit is contained in:
mrdudz
2022-02-05 16:55:57 +01:00
parent 98bc021c5a
commit 4e5b521903
37 changed files with 231 additions and 42 deletions

94
samples/apple2/Makefile Normal file
View File

@@ -0,0 +1,94 @@
# Run 'make SYS=<target>'; or, set a SYS env.
# var. to build for another target system.
SYS ?= apple2
# For this one see https://applecommander.github.io/
AC ?= ac.jar
# Just the usual way to find out if we're
# using cmd.exe to execute make rules.
ifneq ($(shell echo),)
CMD_EXE = 1
endif
ifdef CMD_EXE
NULLDEV = nul:
DEL = -del /f
RMDIR = rmdir /s /q
else
NULLDEV = /dev/null
DEL = $(RM)
RMDIR = $(RM) -r
endif
ifdef CC65_HOME
AS = $(CC65_HOME)/bin/ca65
CC = $(CC65_HOME)/bin/cc65
CL = $(CC65_HOME)/bin/cl65
LD = $(CC65_HOME)/bin/ld65
else
AS := $(if $(wildcard ../../bin/ca65*),../../bin/ca65,ca65)
CC := $(if $(wildcard ../../bin/cc65*),../../bin/cc65,cc65)
CL := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
LD := $(if $(wildcard ../../bin/ld65*),../../bin/ld65,ld65)
endif
EXELIST_apple2 = \
hgrshow \
hgrtest \
dhgrshow
ifneq ($(EXELIST_$(SYS)),)
samples: $(EXELIST_$(SYS))
else
samples: notavailable
endif
# empty target used to skip systems that will not work with any program in this dir
notavailable:
ifeq ($(MAKELEVEL),0)
@echo "info: apple2 tests not available for" $(SYS)
else
# suppress the "nothing to be done for 'samples' message
@echo > $(NULLDEV)
endif
disk: hgr.dsk dhgr.dsk
hgr.dsk: hgrshow hgrtest
cp prodos.dsk $@
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) -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 $^
clean:
@$(DEL) hgr.dsk dhgr.dsk 2>$(NULLDEV)
@$(DEL) hgrshow hgrshow.map 2>$(NULLDEV)
@$(DEL) hgrtest hgrtest.map 2>$(NULLDEV)
@$(DEL) dhgrshow dhgrshow.map 2>$(NULLDEV)

Binary file not shown.

BIN
samples/apple2/catface.dhgr Normal file

Binary file not shown.

BIN
samples/apple2/chips.hgr Normal file

Binary file not shown.

46
samples/apple2/dhgrshow.c Normal file
View File

@@ -0,0 +1,46 @@
// 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);
POKE (0xC05F, 0);
tgi_uninstall ();
videomode (old);
}

BIN
samples/apple2/gatsby.dhgr Normal file

Binary file not shown.

BIN
samples/apple2/girl.dhgr Normal file

Binary file not shown.

37
samples/apple2/hgrshow.c Normal file
View File

@@ -0,0 +1,37 @@
// 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 ();
}

26
samples/apple2/hgrtest.c Normal file
View File

@@ -0,0 +1,26 @@
// cl65 -t apple2 -C apple2-hgr.cfg hgrtest.c werner.s
#include <tgi.h>
#include <conio.h>
#pragma code-name (push, "LOWCODE")
void say (const char* text)
{
tgi_setcolor (TGI_COLOR_BLACK);
tgi_outtextxy (41, 33, text);
}
#pragma code-name (pop)
void main (void)
{
tgi_install (a2_hi_tgi);
tgi_init ();
cgetc ();
say ("Hi Dude !");
cgetc ();
tgi_uninstall ();
}

Binary file not shown.

BIN
samples/apple2/mariner.hgr Normal file

Binary file not shown.

BIN
samples/apple2/monarch.dhgr Normal file

Binary file not shown.

BIN
samples/apple2/rose.hgr Normal file

Binary file not shown.

Binary file not shown.

BIN
samples/apple2/venice.dhgr Normal file

Binary file not shown.

BIN
samples/apple2/werner.hgr Normal file

Binary file not shown.

2
samples/apple2/werner.s Normal file
View File

@@ -0,0 +1,2 @@
.segment "HGR"
.incbin "werner.hgr"

BIN
samples/apple2/winston.hgr Normal file

Binary file not shown.