Added a 160x192x2 TGI (graphics) driver to the VIC-20 library.

The driver requires a special linker configuration: "vic20-tgi.cfg".
The VIC-20 computer needs at least 8K of expansion RAM!

"tgidemo.c" needed to be adjusted because the VIC-20's vertical (y) range is greater than its horizontal (x) range -- the opposite of most other platforms.  Also, the circle demo would jam on the VIC-20.
This commit is contained in:
Greg King
2020-07-08 05:55:30 -04:00
parent d1833cc441
commit 410e4502ee
11 changed files with 1253 additions and 23 deletions

View File

@@ -230,6 +230,20 @@ ovrldemo: overlaydemo.o
OVERLAYLIST := $(foreach I,1 2 3,multdemo.$I ovrldemo.$I)
# --------------------------------------------------------------------------
# TGI programs on the VIC-20 need a special ld65 configuration file.
ifeq ($(SYS),vic20)
mandelbrot.o: override CFLAGS += -D DYN_DRV=0
mandelbrot: mandelbrot.o
$(LD) $(LDFLAGS) -o $@ -C vic20-tgi.cfg -m $@.map $^ $(SYS).lib
# tgidemo needs at least 16K of RAM expansion.
tgidemo.o: override CFLAGS += -D DYN_DRV=0
tgidemo: tgidemo.o
$(LD) -D __HIMEM__=0x6000 $(LDFLAGS) -o $@ -C vic20-tgi.cfg -m $@.map $^ $(SYS).lib
endif
# --------------------------------------------------------------------------
# Rule to make a CBM disk with all samples. Needs the c1541 program that comes
# with the VICE emulator.

View File

@@ -70,9 +70,10 @@ static void DoCircles (void)
{
static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_ORANGE };
unsigned char I;
unsigned char Color = COLOR_FORE;
unsigned X = MaxX / 2;
unsigned Y = MaxY / 2;
unsigned char Color = COLOR_BACK;
const unsigned X = MaxX / 2;
const unsigned Y = MaxY / 2;
const unsigned Limit = (X < Y) ? Y : X;
tgi_setpalette (Palette);
tgi_setcolor (COLOR_FORE);
@@ -82,7 +83,7 @@ static void DoCircles (void)
while (!kbhit ()) {
Color = (Color == COLOR_FORE) ? COLOR_BACK : COLOR_FORE;
tgi_setcolor (Color);
for (I = 10; I < 240; I += 10) {
for (I = 10; I <= Limit; I += 10) {
tgi_ellipse (X, Y, I, tgi_imulround (I, AspectRatio));
}
}
@@ -132,7 +133,7 @@ static void DoDiagram (void)
tgi_setcolor (COLOR_FORE);
tgi_clear ();
/* Determine zero and aplitude */
/* Determine zero and amplitude */
YOrigin = MaxY / 2;
XOrigin = 10;
Amp = (MaxY - 19) / 2;
@@ -168,16 +169,17 @@ static void DoLines (void)
{
static const unsigned char Palette[2] = { TGI_COLOR_WHITE, TGI_COLOR_BLACK };
unsigned X;
const unsigned Min = (MaxX < MaxY) ? MaxX : MaxY;
tgi_setpalette (Palette);
tgi_setcolor (COLOR_FORE);
tgi_clear ();
for (X = 0; X <= MaxY; X += 10) {
tgi_line (0, 0, MaxY, X);
tgi_line (0, 0, X, MaxY);
tgi_line (MaxY, MaxY, 0, MaxY-X);
tgi_line (MaxY, MaxY, MaxY-X, 0);
for (X = 0; X <= Min; X += 10) {
tgi_line (0, 0, Min, X);
tgi_line (0, 0, X, Min);
tgi_line (Min, Min, 0, Min-X);
tgi_line (Min, Min, Min-X, 0);
}
cgetc ();