# $(SYS).
EXELIST = ascii \
- diodemo \
- fire \
- gunzip65 \
- hello \
- mousedemo \
- nachtm \
- plasma \
- sieve \
- tgidemo
+ diodemo \
+ fire \
+ gunzip65 \
+ hello \
+ mousedemo \
+ nachtm \
+ plasma \
+ sieve \
+ tgidemo
# --------------------------------------------------------------------------
# Rules how to make each one of the binaries
hello: $(CRT0) hello.o $(CLIB)
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
+# The apple machines need the start address adjusted for the mandelbrot demo
+ifeq "$(SYS)" "apple2"
+mandelbrot: $(CRT0) mandelbrot.o $(CLIB)
+ @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
+else
+ifeq "$(SYS)" "apple2enh"
+mandelbrot: $(CRT0) mandelbrot.o $(CLIB)
+ @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
+else
mandelbrot: $(CRT0) mandelbrot.o $(CLIB)
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
+endif
+endif
mousedemo: $(CRT0) mousedemo.o $(CLIB)
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
sieve: $(CRT0) sieve.o $(CLIB)
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
+# The apple machines need the start address adjusted for the mandelbrot demo
+ifeq "$(SYS)" "apple2"
+tgidemo: $(CRT0) tgidemo.o $(CLIB)
+ @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
+else
+ifeq "$(SYS)" "apple2enh"
+tgidemo: $(CRT0) tgidemo.o $(CLIB)
+ @$(LD) -t $(SYS) -m $(basename $@).map --start-addr 0x4000 -o $@ $^
+else
tgidemo: $(CRT0) tgidemo.o $(CLIB)
@$(LD) -t $(SYS) -m $(basename $@).map -o $@ $^
-
+endif
+endif
# --------------------------------------------------------------------------
# Rule to make a disk with all samples. Needs the c1541 program that comes
/* Graphics definitions */
-#define GRAPHMODE TGI_MODE_320_200_2
+#if defined(__APPLE2__) || defined(__APPLE2ENH__)
+# define GRAPHMODE TGI_MODE_280_192_6
+#else
+# define GRAPHMODE TGI_MODE_320_200_2
+#endif
#define SCREEN_X (tgi_getmaxx()+1)
#define SCREEN_Y (tgi_getmaxy()+1)
#define MAXCOL (tgi_getmaxcolor()+1)
#define mulfp(_a,_b) ((((signed long)_a)*(_b))>>fpshift)
#define divfp(_a,_b) ((((signed long)_a)<<fpshift)/(_b))
+/* Workaround missing clock stuff */
+#if defined(__APPLE2__) || defined(__APPLE2ENH__)
+# define clock() 0
+# define CLK_TCK 1
+#endif
+
/* Use static local variables for speed */
#pragma staticlocals (1);
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
+#include <ctype.h>
#include <modload.h>
#include <tgi.h>
+#if defined(__APPLE2__) || defined(__APPLE2ENH__)
+# define TGI_MODE TGI_MODE_280_192_6
+# define PAL_BACK 0
+# define PAL_FORE 3
+# define COLOR_LIGHTRED 0 /* Dummy */
+#else
+# define TGI_MODE TGI_MODE_320_200_2
+# define PAL_BACK 0
+# define PAL_FORE 1
+#endif
/*****************************************************************************/
printf ("Warning: This program needs the TGI\n"
"driver on disk! Press 'y' if you have\n"
"it - any other key exits.\n");
- if (cgetc () != 'y') {
+ if (tolower (cgetc ()) != 'y') {
exit (EXIT_SUCCESS);
}
printf ("Ok. Please wait patiently...\n");
{
static const unsigned char Palette[2] = { COLOR_WHITE, COLOR_LIGHTRED };
unsigned char I;
- unsigned char Color = 1;
+ unsigned char Color = PAL_FORE;
unsigned X = XRes / 2;
unsigned Y = YRes / 2;
tgi_setpalette (Palette);
while (!kbhit ()) {
- tgi_setcolor (1);
+ tgi_setcolor (PAL_FORE);
tgi_line (0, 0, XRes-1, YRes-1);
tgi_line (0, YRes-1, XRes-1, 0);
tgi_setcolor (Color);
for (I = 10; I < 240; I += 10) {
tgi_circle (X, Y, I);
}
- Color ^= 0x01;
+ Color = Color == PAL_FORE ? PAL_BACK : PAL_FORE;
}
cgetc ();
unsigned char Color;
tgi_setpalette (Palette);
- Color = 0;
+ Color = PAL_BACK;
while (1) {
for (Y = 0; Y < YRes; Y += 10) {
for (X = 0; X < XRes; X += 10) {
tgi_setcolor (Color);
tgi_bar (X, Y, X+9, Y+9);
- Color ^= 0x01;
+ Color = Color == PAL_FORE ? PAL_BACK : PAL_FORE;
if (kbhit ()) {
cgetc ();
tgi_clear ();
return;
}
}
- Color ^= 0x01;
+ Color = Color == PAL_FORE ? PAL_BACK : PAL_FORE;
}
- Color ^= 0x01;
+ Color = Color == PAL_FORE ? PAL_BACK : PAL_FORE;
}
}
unsigned X, I;
tgi_setpalette (Palette);
- tgi_setcolor (1);
+ tgi_setcolor (PAL_FORE);
tgi_line (10, 10, 10, YRes-10);
tgi_lineto (XRes-10, YRes-10);
tgi_line (8, 12, 10, 10);
unsigned X;
tgi_setpalette (Palette);
- tgi_setcolor (1);
+ tgi_setcolor (PAL_FORE);
for (X = 0; X < YRes; X+=10) {
tgi_line (0, 0, YRes, X);
DoWarning ();
/* Load and initialize the driver */
- tgi_load (TGI_MODE_320_200_2);
+ tgi_load (TGI_MODE);
CheckError ("tgi_load");
tgi_init ();
CheckError ("tgi_init");
tgi_unload ();
/* Reset the border */
- bordercolor (Border);
+ (void) bordercolor (Border);
/* Done */
printf ("Done\n");
return EXIT_SUCCESS;
}
-
-