mirror of
https://github.com/gungwald/circ.git
synced 2025-03-19 04:31:48 +00:00
First check-in
This commit is contained in:
parent
4871f38936
commit
12851946f7
BIN
AppleCommander-ac-1.4.0.jar
Normal file
BIN
AppleCommander-ac-1.4.0.jar
Normal file
Binary file not shown.
49
Makefile
Normal file
49
Makefile
Normal file
@ -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
|
||||
|
BIN
a2e.hi.tgi
Normal file
BIN
a2e.hi.tgi
Normal file
Binary file not shown.
93
circ.c
Normal file
93
circ.c
Normal file
@ -0,0 +1,93 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* _heapadd */
|
||||
#include <apple2enh.h> /* videomode */
|
||||
#include <tgi.h>
|
||||
|
||||
#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");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user