diff --git a/AppleCommander-ac-1.4.0.jar b/AppleCommander-ac-1.4.0.jar new file mode 100644 index 0000000..4d61bfc Binary files /dev/null and b/AppleCommander-ac-1.4.0.jar differ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1d175ea --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +# Builds circ demo + +# Requirements: +# 1. Gmake must be used. +# 2. The cc65 compiler must be properly setup. + +ifndef CC65_TARGET + CC65_TARGET:=apple2enh +endif + +CC=cl65 +CFLAGS=-O -t $(CC65_TARGET) -DTRACE +# The -S $6000 makes the start address $6000 so that both hi-res +# pages are available. +LDFLAGS=-t $(CC65_TARGET) +DISK_VOL=circ +DISK=$(DISK_VOL).dsk +PGM=circ +GRAF_DRVR=a2e.hi +DYN_GRAF_DRVR=a2e.hi.tgi +BASIC_AUX_TYPE=0x0801 +READ_TIME_LOAD_ADDR=0x0260 +AC=java -jar AppleCommander-ac-1.4.0.jar +SYS_LOAD_ADDR=0x2000 +BIN_LOAD_ADDR=0x0803 +MKDISK=$(AC) -pro140 $(DISK) $(DISK_VOL) + +######################################## + +all: $(DISK) + +$(DISK): $(PGM) + $(RM) $(DISK) + $(AC) -pro140 $(DISK) $(DISK_VOL) + $(AC) -as $(DISK) $(PGM) BIN < $(PGM) + $(AC) -p $(DISK) $(DYN_GRAF_DRVR) BIN < $(DYN_GRAF_DRVR) + +$(PGM): $(PGM).o $(GRAF_DRVR).o + $(CC) $(LDFLAGS) -o $@ $^ + +$(GRAF_DRVR).o: $(GRAF_DRVR).s + ca65 $^ + +$(GRAF_DRVR).s: $(GRAF_DRVR).tgi + co65 --code-label _a2e_hi $^ + +clean: + $(RM) *.o $(PGM) $(DISK) $(GRAF_DRVR).s + diff --git a/a2e.hi.tgi b/a2e.hi.tgi new file mode 100644 index 0000000..fd4e778 Binary files /dev/null and b/a2e.hi.tgi differ diff --git a/circ.c b/circ.c new file mode 100644 index 0000000..1f29de6 --- /dev/null +++ b/circ.c @@ -0,0 +1,93 @@ +#include +#include /* _heapadd */ +#include /* videomode */ +#include + +#ifdef TRACE +#define TRACE_MSG puts +#define TRACE_VAR printf +#else +#define TRACE_MSG +#define TRACE_VAR +#endif + +#define STR_SIZ 256 + +static void checkError(const char *message); + +/** + * References first byte in static graphics driver. + */ +extern char a2e_hi; + +const char *GRAPHICS_DRIVER = "a2e.hi.tgi"; +char response[STR_SIZ]; + +int main(void) +{ + unsigned char tgiErrorCode = TGI_ERR_OK; + + /* Make more heap memory available: $803 - $1fff. */ + //TRACE_MSG("_heapadd"); + //_heapadd((void *) 0x0803, 0x17FD); + + /* Make sure second hi-res page is available by putting the text mode + in 40 columns. */ + TRACE_MSG("videomode"); + videomode(VIDEOMODE_40COL); + +#if DYNAMIC_GRAPHICS_DRIVER + TRACE_VAR("tgi_load_driver: %s\n", tgi_stddrv); + tgi_load_driver(tgi_stddrv); + checkError("Failed to load graphics driver"); +#else + TRACE_MSG("tgi_install"); + tgi_install(tgi_static_stddrv); //a2e_hi + TRACE_MSG("After tgi_install"); + checkError("Failed to install graphics driver"); +#endif + + TRACE_MSG("tgi_init"); + tgi_init(); + TRACE_MSG("tgi_clear"); + tgi_clear(); + checkError("Failed to clear graphics screen"); + TRACE_MSG("tgi_setcolor"); + tgi_setcolor(TGI_COLOR_BLUE); + TRACE_MSG("tgi_setviewpage"); + tgi_setviewpage(0); + TRACE_MSG("tgi_setdrawpage"); + tgi_setdrawpage(1); + TRACE_MSG("tgi_circle"); + tgi_circle(50, 50, 40); + + fgets(response, STR_SIZ, stdin); + + TRACE_MSG("tgi_done"); + tgi_done(); + +#if DYNAMIC_GRAPHICS_DRIVER + TRACE_MSG("tgi_unload"); + tgi_unload(); +#else + TRACE_MSG("tgi_uninstall"); + tgi_uninstall(); +#endif + + return EXIT_SUCCESS; +} + +void checkError(const char* message) +{ + unsigned char errorCode; + + TRACE_MSG("Entering checkError"); + errorCode = tgi_geterror(); + TRACE_MSG("After tgi_geterror"); + if (errorCode != TGI_ERR_OK) { + fprintf(stderr, "%s: %d\n", message, errorCode); + exit(EXIT_FAILURE); + } + TRACE_MSG("Exiting checkError"); +} +