vgi-myst: move to own directory
This commit is contained in:
parent
1bd9028b9b
commit
80ab6fefbf
|
@ -0,0 +1,130 @@
|
|||
include ../../../Makefile.inc
|
||||
|
||||
DOS33 = ../../../utils/dos33fs-utils/dos33
|
||||
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
||||
LINKERSCRIPTS = ../../../linker_scripts
|
||||
EMPTYDISK = ../../../empty_disk/empty.dsk
|
||||
MAKEVGI = ./make_vgi_asm
|
||||
|
||||
all: vgi_myst.dsk make_vgi_asm
|
||||
|
||||
vgi_myst.dsk: HELLO VGI-MYST
|
||||
cp $(EMPTYDISK) vgi_myst.dsk
|
||||
$(DOS33) -y vgi_myst.dsk SAVE A HELLO
|
||||
$(DOS33) -y vgi_myst.dsk BSAVE -a 0xC00 VGI-MYST
|
||||
|
||||
###
|
||||
|
||||
HELLO: hello.bas
|
||||
$(TOKENIZE) < hello.bas > HELLO
|
||||
|
||||
|
||||
###
|
||||
|
||||
VGI-MYST: myst_vgi.o
|
||||
ld65 -o VGI-MYST myst_vgi.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||
|
||||
myst_vgi.o: clock.data rocket.data rocket_door.data red_book.data fireplace.data path.data \
|
||||
myst_vgi.s vgi_clearscreen.s vgi_rectangle.s vgi_circles.s vgi_lines.s \
|
||||
vgi_triangles.s
|
||||
ca65 -o myst_vgi.o myst_vgi.s -l myst_vgi.lst
|
||||
|
||||
###
|
||||
|
||||
VGI-TEST: test_vgi.o
|
||||
ld65 -o VGI-TEST test_vgi.o -C $(LINKERSCRIPTS)/apple2_4000.inc
|
||||
|
||||
test_vgi.o: new.data \
|
||||
test_vgi.s vgi_clearscreen.s vgi_rectangle.s vgi_circles.s vgi_lines.s \
|
||||
vgi_triangles.s
|
||||
ca65 -o test_vgi.o test_vgi.s -l test_vgi.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
COLOR-TEST: color_test.o
|
||||
ld65 -o COLOR-TEST color_test.o -C $(LINKERSCRIPTS)/apple2_4000.inc
|
||||
|
||||
color_test.o: color_test.data \
|
||||
color_test.s vgi_clearscreen.s vgi_rectangle.s vgi_circles.s vgi_lines.s \
|
||||
vgi_triangles.s
|
||||
ca65 -o color_test.o color_test.s -l color_test.lst
|
||||
|
||||
|
||||
|
||||
|
||||
###
|
||||
|
||||
clock.data: make_vgi_asm clock.vgi
|
||||
echo "clock_data:" > clock.data
|
||||
./make_vgi_asm < clock.vgi >> clock.data
|
||||
|
||||
###
|
||||
|
||||
path.data: make_vgi_asm path.vgi
|
||||
echo "path_data:" > path.data
|
||||
./make_vgi_asm < path.vgi >> path.data
|
||||
|
||||
###
|
||||
|
||||
rocket.data: make_vgi_asm rocket.vgi
|
||||
echo "rocket_data:" > rocket.data
|
||||
./make_vgi_asm < rocket.vgi >> rocket.data
|
||||
|
||||
###
|
||||
|
||||
rocket_door.data: make_vgi_asm rocket_door.vgi
|
||||
echo "rocket_door_data:" > rocket_door.data
|
||||
./make_vgi_asm < rocket_door.vgi >> rocket_door.data
|
||||
|
||||
|
||||
###
|
||||
|
||||
new.data: make_vgi_asm new.vgi
|
||||
echo "new_data:" > new.data
|
||||
./make_vgi_asm < new.vgi >> new.data
|
||||
|
||||
###
|
||||
|
||||
red_book.data: make_vgi_asm red_book.vgi
|
||||
echo "red_book_data:" > red_book.data
|
||||
./make_vgi_asm < red_book.vgi >> red_book.data
|
||||
|
||||
###
|
||||
|
||||
fireplace.data: make_vgi_asm fireplace.vgi
|
||||
echo "fireplace_data:" > fireplace.data
|
||||
./make_vgi_asm < fireplace.vgi >> fireplace.data
|
||||
|
||||
###
|
||||
|
||||
color_test.vgi: make_color_test
|
||||
./make_color_test > color_test.vgi
|
||||
|
||||
color_test.data: make_vgi_asm color_test.vgi
|
||||
echo "color_test_data:" > color_test.data
|
||||
./make_vgi_asm < color_test.vgi >> color_test.data
|
||||
|
||||
|
||||
###
|
||||
|
||||
make_vgi_asm: make_vgi_asm.o
|
||||
$(CC) -o make_vgi_asm make_vgi_asm.o $(LFLAGS)
|
||||
|
||||
make_vgi_asm.o: make_vgi_asm.c
|
||||
$(CC) $(CFLAGS) -c make_vgi_asm.c
|
||||
|
||||
###
|
||||
|
||||
make_color_test: make_color_test.o
|
||||
$(CC) -o make_color_test make_color_test.o $(LFLAGS)
|
||||
|
||||
make_color_test.o: make_color_test.c
|
||||
$(CC) $(CFLAGS) -c make_color_test.c
|
||||
|
||||
|
||||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO VGI-MYST VGI-DOOM COLOR-TEST \
|
||||
make_vgi_asm make_color_test *.data
|
|
@ -0,0 +1,79 @@
|
|||
; Clock from Myst
|
||||
CLS 255 ; white background
|
||||
RECT 1 6 0 90 140 191 ; ocean left
|
||||
RECT 1 6 140 90 279 191 ; ocean right
|
||||
DRECT 0x8 0x22 157 121 208 165 ; tower shadow
|
||||
DRECT 0x8 0x22 160 165 204 191 ; tower shadow
|
||||
; Gear Base
|
||||
RECT 4 0 141 116 209 129 ; gear base shade
|
||||
RECT 4 0 147 125 164 134 ; gear base shade left
|
||||
RECT 7 3 157 129 176 134 ; gear base left
|
||||
RECT 7 3 192 128 212 134 ; gear base center
|
||||
RECT 4 0 156 131 171 136 ; gear base shade left
|
||||
RECT 7 3 211 115 221 131 ; gear base right
|
||||
RECT 7 3 211 120 233 131 ; gear base right
|
||||
RECT 4 4 176 130 190 134 ; shade center
|
||||
RECT 4 4 193 134 213 137 ; shade center right
|
||||
RECT 4 4 212 129 230 134 ; shade center-right
|
||||
RECT 4 4 222 122 234 125 ; shade base right
|
||||
; Tower
|
||||
RECT 0 0 180 17 213 121 ; tower right
|
||||
DRECT 0x4c 0x33 156 20 209 126 ; tower
|
||||
DRECT 0x4c 0x33 145 9 212 20 ; left roof
|
||||
DRECT 0x4c 0x33 154 4 212 20 ; left roof
|
||||
DRECT 0x4c 0x33 162 0 220 20 ; right roof
|
||||
POINT 7 155 28
|
||||
LINETO 212 17 ; bottom line
|
||||
POINT 0 150 20
|
||||
LINETO 214 9 ; middle line
|
||||
POINT 0 146 13
|
||||
LINETO 219 0 ; top line
|
||||
RECT 0 0 214 0 219 23 ; right roof
|
||||
; Door
|
||||
FCIRC 7 180 98 12 ; doorway top
|
||||
RECT 7 7 168 96 192 127 ; doorway
|
||||
RECT 7 7 164 98 195 104 ; doorway cross
|
||||
RECT 7 7 177 83 182 88 ; doorway top
|
||||
FCIRC 5 180 98 8 ; door circle top
|
||||
RECT 5 5 172 96 188 123 ; door
|
||||
; clock face
|
||||
FCIRC 5 181 49 20 ; clock face ring
|
||||
FCIRC 7 181 49 18 ; clock face white
|
||||
CIRC 5 181 49 14 ; clock face inner
|
||||
POINT 0 181 49 ; clock hand origin
|
||||
LINETO 181 32 ; clock hand
|
||||
; marker switch
|
||||
RECT 5 5 148 110 156 120 ; marker switch
|
||||
RECT 2 2 149 106 155 109 ; top switch
|
||||
; puzzle
|
||||
RECT 0 4 60 152 120 178 ; black box
|
||||
RECT 0 4 70 147 109 152 ; black box (more)
|
||||
RECT 0 4 81 145 99 147 ; black box (more)
|
||||
POINT 7 104 173 ; edge (white)
|
||||
LINETO 104 161 ; lineto top
|
||||
POINT 5 60 152 ; top edge (orange)
|
||||
LINETO 104 161 ; right
|
||||
LINETO 118 151 ; more right
|
||||
LINETO 84 143 ; left
|
||||
LINETO 60 152 ; back to origin
|
||||
RECT 0 0 78 142 86 147 ; left shaft
|
||||
RECT 5 5 72 137 86 140 ; left knob
|
||||
RECT 5 5 75 146 85 151 ; left base
|
||||
RECT 0 0 90 145 97 152 ; right shaft
|
||||
RECT 5 5 88 141 101 145 ; right knob
|
||||
RECT 5 5 91 150 96 154 ; right base
|
||||
RECT 2 5 100 152 105 157 ; button
|
||||
; grass / trees
|
||||
RECT 5 1 0 163 63 191 ; grass left
|
||||
RECT 5 1 63 167 143 191 ; grass middle
|
||||
RECT 5 1 133 177 184 191 ; grass again
|
||||
RECT 5 1 177 185 230 191 ; grass right
|
||||
DRECT 0xA8 0xAA 28 0 39 178 ; middle tree
|
||||
DRECT 0x8 0x22 1 13 99 44 ; leaves
|
||||
DRECT 0xA8 0xAA 0 0 12 188 ; left tree
|
||||
DRECT 0xA8 0xAA 70 0 81 187 ; right tree
|
||||
RECT 0 0 39 183 67 186 ; shadow
|
||||
RECT 0 0 12 179 39 183 ; shadow
|
||||
DRECT 0x8 0x22 66 1 99 19 ; leaves
|
||||
DRECT 0x8 0x22 15 49 49 79 ; leaves
|
||||
END
|
|
@ -0,0 +1,137 @@
|
|||
; Fireplace from Myst
|
||||
;CLS 0xAA ; orange background
|
||||
; bricks bg
|
||||
RECT 6 4 0 0 46 192
|
||||
RECT 6 4 241 0 278 192
|
||||
; wood ends
|
||||
RECT 4 4 46 0 50 192 ; black bg
|
||||
VSTRP 0xA2 0xC4 53 0 236 192 ; woodgrain bg
|
||||
FCIRC 4 139 75 22 ; center circle
|
||||
FCIRC 5 139 79 22 ; center circle
|
||||
FCIRC 4 76 72 22 ; left circle
|
||||
FCIRC 5 75 76 22 ; left circle
|
||||
FCIRC 4 202 70 22 ; right circle
|
||||
FCIRC 5 208 76 22 ; right circle
|
||||
VSTRP 0xA2 0xC4 53 0 76 100 ; woodgrain fix left
|
||||
VSTRP 0xA2 0xC4 208 0 236 100 ; woodgrain fix right
|
||||
VSTRP 0xA2 0xC4 53 76 236 100 ; woodgrain fix bottom
|
||||
RECT 4 4 235 0 241 192 ; black right
|
||||
RECT 5 4 79 82 208 192 ; wood edging
|
||||
;RECT 4 4 79 0 207 76 ; black window
|
||||
RECT 7 7 83 89 201 192 ; panel
|
||||
RECT 4 7 85 89 200 93 ; shade
|
||||
; brick mortar
|
||||
POINT 7 24 0 ; L top
|
||||
LINETO 24 25
|
||||
LINETO 44 25
|
||||
POINT 7 24 57 ; l mid
|
||||
LINETO 24 89
|
||||
LINETO 46 89
|
||||
POINT 7 24 122 ; l bottom
|
||||
LINETO 24 153
|
||||
LINETO 46 153
|
||||
POINT 7 24 25
|
||||
LINETO 0 13
|
||||
POINT 7 46 58
|
||||
LINETO 24 57
|
||||
LINETO 0 51
|
||||
POINT 7 24 90
|
||||
LINETO 0 89
|
||||
POINT 7 44 123
|
||||
LINETO 24 123
|
||||
LINETO 0 130
|
||||
POINT 7 24 153
|
||||
LINETO 0 166
|
||||
POINT 7 44 186
|
||||
LINETO 24 185
|
||||
LINETO 13 191
|
||||
; vertical
|
||||
POINT 7 8 17
|
||||
LINETO 8 52
|
||||
POINT 7 8 90
|
||||
LINETO 8 126
|
||||
POINT 7 8 161
|
||||
LINETO 8 191
|
||||
; right brickwork
|
||||
POINT 7 279 18
|
||||
LINETO 255 26
|
||||
LINETO 241 26
|
||||
POINT 7 279 54
|
||||
LINETO 255 58
|
||||
LINETO 242 58
|
||||
POINT 7 279 90
|
||||
LINETO 240 90
|
||||
POINT 7 279 126
|
||||
LINETO 255 122
|
||||
LINETO 242 122
|
||||
POINT 7 279 162
|
||||
LINETO 255 152
|
||||
LINETO 241 152
|
||||
POINT 7 265 191
|
||||
LINETO 255 185
|
||||
LINETO 241 185
|
||||
; right vertical
|
||||
POINT 7 254 0
|
||||
LINETO 254 26
|
||||
POINT 7 254 58
|
||||
LINETO 254 90
|
||||
POINT 7 254 121
|
||||
LINETO 254 152
|
||||
POINT 7 254 187
|
||||
LINETO 254 191
|
||||
; button
|
||||
RECT 6 6 22 94 38 111 ; button back
|
||||
RECT 2 2 28 100 32 107 ; exit button
|
||||
; outside
|
||||
;RECT 5 5 88 18 198 71 ; outside orange
|
||||
POINT 4 86 35 ; lower line
|
||||
LINETO 110 42
|
||||
LINETO 164 42
|
||||
LINETO 199 34
|
||||
POINT 4 87 28 ; next line
|
||||
LINETO 114 36
|
||||
LINETO 161 37
|
||||
LINETO 198 27
|
||||
POINT 4 86 23
|
||||
LINETO 114 32
|
||||
LINETO 162 31
|
||||
LINETO 198 22
|
||||
POINT 4 100 18
|
||||
LINETO 114 23
|
||||
LINETO 165 23
|
||||
LINETO 180 16
|
||||
RECT 4 4 114 17 164 20 ; ceiling hole
|
||||
; pillars
|
||||
RECT 5 5 105 44 113 71 ; left pillar
|
||||
RECT 5 5 165 44 175 71 ; right pillar
|
||||
; chandelier
|
||||
POINT 6 137 19
|
||||
LINETO 140 29
|
||||
LINETO 145 32
|
||||
LINETO 149 31
|
||||
LINETO 149 24
|
||||
POINT 6 136 19
|
||||
LINETO 139 32
|
||||
LINETO 138 40
|
||||
LINETO 130 28
|
||||
LINETO 129 21
|
||||
; lights
|
||||
RECT 7 7 145 19 147 22
|
||||
RECT 7 7 142 24 144 27
|
||||
RECT 7 7 134 26 136 29
|
||||
RECT 7 7 128 19 130 22
|
||||
; recess
|
||||
RECT 4 4 116 44 163 49 ; recess
|
||||
; lights
|
||||
RECT 7 7 194 39 198 42 ; right light
|
||||
RECT 7 7 136 45 141 48 ; left light
|
||||
RECT 2 2 136 66 142 69 ; book light
|
||||
; black window
|
||||
RECT 4 4 79 0 206 18 ; black window
|
||||
RECT 4 4 79 71 207 76 ; black window
|
||||
RECT 4 4 79 0 87 76 ; black window
|
||||
RECT 4 4 198 0 207 76 ; black window
|
||||
; bars
|
||||
RECT 5 4 120 0 128 74 ; left bar
|
||||
RECT 5 4 160 0 168 74 ; right bar
|
||||
END
|
|
@ -0,0 +1,71 @@
|
|||
; HARDWARE LOCATIONS
|
||||
|
||||
KEYPRESS = $C000
|
||||
KEYRESET = $C010
|
||||
|
||||
; SOFT SWITCHES
|
||||
CLR80COL = $C000 ; PAGE0/PAGE1 normal
|
||||
SET80COL = $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead
|
||||
EIGHTYCOLOFF = $C00C
|
||||
EIGHTYCOLON = $C00D
|
||||
TBCOLOR = $C022 ; IIgs text foreground / background colors
|
||||
NEWVIDEO = $C029 ; IIgs graphics modes
|
||||
SPEAKER = $C030
|
||||
CLOCKCTL = $C034 ; bits 0-3 are IIgs border color
|
||||
SET_GR = $C050
|
||||
SET_TEXT = $C051
|
||||
FULLGR = $C052
|
||||
TEXTGR = $C053
|
||||
PAGE0 = $C054
|
||||
PAGE1 = $C055
|
||||
LORES = $C056 ; Enable LORES graphics
|
||||
HIRES = $C057 ; Enable HIRES graphics
|
||||
AN3 = $C05E ; Annunciator 3
|
||||
|
||||
PADDLE_BUTTON0 = $C061
|
||||
PADDLE_BUTTON1 = $C062
|
||||
PADDL0 = $C064
|
||||
PTRIG = $C070
|
||||
|
||||
; BASIC ROUTINES
|
||||
|
||||
|
||||
NORMAL = $F273
|
||||
HGR2 = $F3D8 ; clear PAGE2 to 0
|
||||
HGR = $F3E2 ; set hires page1 and clear $2000-$3fff
|
||||
BKGND0 = $F3F4 ; clear current page to A
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
HPLOT0 = $F457 ; plot at (Y,X), (A)
|
||||
COLOR_SHIFT = $F47E
|
||||
HLINRL = $F530 ; (X,A),(Y)
|
||||
HGLIN = $F53A ; line to (X,A),(Y)
|
||||
COLORTBL = $F6F6
|
||||
|
||||
|
||||
; MONITOR ROUTINES
|
||||
|
||||
HLINE = $F819 ; HLINE Y,$2C at A
|
||||
VLINE = $F828 ; VLINE A,$2D at Y
|
||||
CLRSCR = $F832 ; Clear low-res screen
|
||||
CLRTOP = $F836 ; clear only top of low-res screen
|
||||
SETCOL = $F864 ; COLOR=A
|
||||
ROM_TEXT2COPY = $F962 ; iigs
|
||||
TEXT = $FB36
|
||||
SETGR = $FB40 ; init lores and clear screen
|
||||
TABV = $FB5B ; VTAB to A
|
||||
ROM_MACHINEID = $FBB3 ; iigs
|
||||
BELL = $FBDD ; ring the bell
|
||||
BASCALC = $FBC1 ;
|
||||
VTAB = $FC22 ; VTAB to CV
|
||||
HOME = $FC58 ; Clear the text screen
|
||||
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
|
||||
GETLN = $FD6A
|
||||
GETLN1 = $FD6F
|
||||
CROUT1 = $FD8B
|
||||
SETINV = $FE80 ; INVERSE
|
||||
SETNORM = $FE84 ; NORMAL
|
||||
COUT = $FDED ; output A to screen
|
||||
COUT1 = $FDF0 ; output A to screen
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
5 HOME
|
||||
10 PRINT CHR$(4);"CATALOG"
|
||||
20 PRINT:PRINT "FOR THE SARCASTIC HI-RES MYST DEMO"
|
||||
30 PRINT "TYPE: BRUN VGI-MYST"
|
||||
70 PRINT:PRINT "NOTE: THERE IS ALSO A FULL-FEATURED"
|
||||
80 PRINT "LORES VERSION AVAILABLE FOR DOWNLOAD"
|
||||
90 PRINT "IF YOU WANT TO PLAY ON APPLE II"
|
|
@ -0,0 +1,457 @@
|
|||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MODE_ASM 0
|
||||
#define MODE_BIN 1
|
||||
|
||||
#define VGI_CLEARSCREEN 0
|
||||
#define VGI_RECTANGLE 1
|
||||
#define VGI_CIRCLE 2
|
||||
#define VGI_FILLED_CIRCLE 3
|
||||
#define VGI_POINT 4
|
||||
#define VGI_LINETO 5
|
||||
#define VGI_DITHER_RECTANGLE 6
|
||||
#define VGI_VERT_TRIANGLE 7
|
||||
#define VGI_HORIZ_TRIANGLE 8
|
||||
#define VGI_VSTRIPE_RECTANGLE 9
|
||||
#define VGI_LINE 10
|
||||
#define VGI_LINE_FAR 11
|
||||
#define VGI_END 15
|
||||
|
||||
/* non-encoded pseudo-values */
|
||||
#define VGI_VERT_TRIANGLE_SKIP 128+7
|
||||
|
||||
|
||||
static int output_bytes(int mode, unsigned char *bytes, int count) {
|
||||
|
||||
int i;
|
||||
|
||||
if (mode==MODE_ASM) {
|
||||
printf(".byte ");
|
||||
for(i=0;i<count;i++) {
|
||||
printf("$%02X",bytes[i]);
|
||||
if (i<count-1) {
|
||||
printf(",");
|
||||
}
|
||||
else {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
fwrite(bytes,1,count,stdout);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
char buffer[1024];
|
||||
unsigned char output[1024];
|
||||
char *ptr;
|
||||
int type,color1,color2,x1,x2,y1,y2,r,xl,xr,yt,yb;
|
||||
int line=1;
|
||||
int size=0;
|
||||
int skip=0;
|
||||
int mode=MODE_ASM;
|
||||
int lastx=0,lasty=0,lastcolor=0;
|
||||
int tempx,tempcolor;
|
||||
|
||||
if (argc>1) {
|
||||
if ((argv[1][0]=='-') && (argv[1][1]=='b')) {
|
||||
mode=MODE_BIN;
|
||||
}
|
||||
}
|
||||
|
||||
while(1) {
|
||||
|
||||
type=0;
|
||||
|
||||
ptr=fgets(buffer,1024,stdin);
|
||||
if (ptr==NULL) break;
|
||||
|
||||
if (buffer[0]==';') continue;
|
||||
|
||||
if (isalpha(buffer[0])) {
|
||||
if (!strncmp(buffer,"CLS",3)) {
|
||||
type=VGI_CLEARSCREEN;
|
||||
}
|
||||
if (!strncmp(buffer,"RECT",4)) {
|
||||
type=VGI_RECTANGLE;
|
||||
}
|
||||
if (!strncmp(buffer,"CIRC",4)) {
|
||||
type=VGI_CIRCLE;
|
||||
}
|
||||
if (!strncmp(buffer,"FCIRC",5)) {
|
||||
type=VGI_FILLED_CIRCLE;
|
||||
}
|
||||
if (!strncmp(buffer,"POINT",5)) {
|
||||
type=VGI_POINT;
|
||||
}
|
||||
if (!strncmp(buffer,"LINETO",6)) {
|
||||
type=VGI_LINETO;
|
||||
}
|
||||
else if (!strncmp(buffer,"LINEF",5)) {
|
||||
type=VGI_LINE_FAR;
|
||||
}
|
||||
else if (!strncmp(buffer,"LINE",4)) {
|
||||
type=VGI_LINE;
|
||||
}
|
||||
if (!strncmp(buffer,"DRECT",5)) {
|
||||
type=VGI_DITHER_RECTANGLE;
|
||||
}
|
||||
if (!strncmp(buffer,"VTRISK",6)) {
|
||||
type=VGI_VERT_TRIANGLE_SKIP;
|
||||
} else if (!strncmp(buffer,"VTRI",4)) {
|
||||
type=VGI_VERT_TRIANGLE;
|
||||
}
|
||||
if (!strncmp(buffer,"HTRI",4)) {
|
||||
type=VGI_HORIZ_TRIANGLE;
|
||||
}
|
||||
if (!strncmp(buffer,"VSTRP",5)) {
|
||||
type=VGI_VSTRIPE_RECTANGLE;
|
||||
}
|
||||
if (!strncmp(buffer,"END",3)) {
|
||||
type=VGI_END;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sscanf(buffer,"%i",&type);
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case VGI_CLEARSCREEN: /* clear screen */
|
||||
sscanf(buffer,"%*s %i",&color1);
|
||||
// printf(".byte $%02X,",(type<<4)|2);
|
||||
// printf("$%02X\n",color1);
|
||||
output[0]=(type<<4)|2;
|
||||
output[1]=color1;
|
||||
output_bytes(mode,output,2);
|
||||
size+=2;
|
||||
break;
|
||||
|
||||
case VGI_RECTANGLE: /* compact rectangle */
|
||||
sscanf(buffer,"%*s %i %i %i %i %i %i",
|
||||
&color1,&color2,
|
||||
&x1,&y1,&x2,&y2);
|
||||
// printf(".byte $%02X,",(type<<4)|6);
|
||||
// printf("$%02X,",(color1<<4)|color2);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X,",y1);
|
||||
// printf("$%02X,",x2-x1);
|
||||
// printf("$%02X\n",y2-y1);
|
||||
output[0]=(type<<4)|6;
|
||||
output[1]=(color1<<4)|color2;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output[4]=x2-x1;
|
||||
output[5]=y2-y1;
|
||||
output_bytes(mode,output,6);
|
||||
size+=6;
|
||||
break;
|
||||
|
||||
case VGI_CIRCLE: /* circle */
|
||||
sscanf(buffer,"%*s %i %i %i %i",
|
||||
&color1,
|
||||
&x1,&y1,&r);
|
||||
// printf(".byte $%02X,",(type<<4)|5);
|
||||
// printf("$%02X,",color1);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X,",y1);
|
||||
// printf("$%02X\n",r);
|
||||
output[0]=(type<<4)|5;
|
||||
output[1]=color1;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output[4]=r;
|
||||
output_bytes(mode,output,5);
|
||||
size+=5;
|
||||
break;
|
||||
|
||||
case VGI_FILLED_CIRCLE: /* filled circle */
|
||||
sscanf(buffer,"%*s %i %i %i %i",
|
||||
&color1,
|
||||
&x1,&y1,&r);
|
||||
// printf(".byte $%02X,",(type<<4)|5);
|
||||
// printf("$%02X,",color1);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X,",y1);
|
||||
// printf("$%02X\n",r);
|
||||
output[0]=(type<<4)|5;
|
||||
output[1]=color1;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output[4]=r;
|
||||
output_bytes(mode,output,5);
|
||||
size+=5;
|
||||
break;
|
||||
|
||||
case VGI_POINT: /* point */
|
||||
sscanf(buffer,"%*s %i %i %i",
|
||||
&color1,
|
||||
&x1,&y1);
|
||||
// printf(".byte $%02X,",(type<<4)|4);
|
||||
|
||||
lastx=x1;
|
||||
lasty=y1;
|
||||
lastcolor=color1;
|
||||
|
||||
if (x1>255) {
|
||||
x1=x1&0xff;
|
||||
color1|=128;
|
||||
}
|
||||
// printf("$%02X,",color1);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X\n",y1);
|
||||
output[0]=(type<<4)|4;
|
||||
output[1]=color1;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output_bytes(mode,output,4);
|
||||
size+=4;
|
||||
break;
|
||||
|
||||
case VGI_LINETO: /* line to */
|
||||
sscanf(buffer,"%*s %i %i",
|
||||
&x1,&y1);
|
||||
// printf(".byte $%02X,",(type<<4)|3);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X\n",y1);
|
||||
|
||||
tempx=lastx;
|
||||
tempcolor=lastcolor;
|
||||
|
||||
if (lastx>255) {
|
||||
tempx=tempx&0xff;
|
||||
tempcolor=tempcolor|128;
|
||||
}
|
||||
|
||||
if (x1>255) {
|
||||
output[0]=(VGI_LINE_FAR<<4)|6;
|
||||
output[1]=tempcolor;
|
||||
output[2]=tempx;
|
||||
output[3]=lasty;
|
||||
output[4]=(x1&0xff);
|
||||
output[5]=y1;
|
||||
output_bytes(mode,output,6);
|
||||
size+=6;
|
||||
#if 0
|
||||
fprintf(stderr,"ADJUSTING %d %d %d %d %d %d\n",
|
||||
output[0],
|
||||
output[1],
|
||||
output[2],
|
||||
output[3],
|
||||
output[4],
|
||||
output[5]);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
output[0]=(type<<4)|3;
|
||||
output[1]=x1;
|
||||
output[2]=y1;
|
||||
output_bytes(mode,output,3);
|
||||
size+=3;
|
||||
}
|
||||
lastx=x1;
|
||||
lasty=y1;
|
||||
|
||||
break;
|
||||
|
||||
case VGI_DITHER_RECTANGLE: /* dithered rectangle */
|
||||
sscanf(buffer,"%*s %i %i %i %i %i %i",
|
||||
&color1,&color2,
|
||||
&x1,&y1,&x2,&y2);
|
||||
// printf(".byte $%02X,",(type<<4)|7);
|
||||
// printf("$%02X,",color1);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X,",y1);
|
||||
// printf("$%02X,",x2-x1);
|
||||
// printf("$%02X,",y2-y1);
|
||||
// printf("$%02X\n",color2);
|
||||
output[0]=(type<<4)|7;
|
||||
output[1]=color1;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output[4]=x2-x1;
|
||||
output[5]=y2-y1;
|
||||
output[6]=color2;
|
||||
output_bytes(mode,output,7);
|
||||
size+=7;
|
||||
break;
|
||||
|
||||
case VGI_VERT_TRIANGLE: /* vertical triangle */
|
||||
sscanf(buffer,"%*s %i %i %i %i %i %i",
|
||||
&color1,
|
||||
&x1,&y1,&xl,&xr,&yb);
|
||||
// printf(".byte $%02X,",(type<<4)|7);
|
||||
// printf("$%02X,",(1<<4)|color1); /* skip=1 */
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X,",y1);
|
||||
// printf("$%02X,",xl);
|
||||
// printf("$%02X,",xr);
|
||||
// printf("$%02X\n",yb);
|
||||
output[0]=(type<<4)|7;
|
||||
output[1]=(1<<4)|color1;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output[4]=xl;
|
||||
output[5]=xr;
|
||||
output[6]=yb;
|
||||
output_bytes(mode,output,7);
|
||||
size+=7;
|
||||
break;
|
||||
|
||||
case VGI_VERT_TRIANGLE_SKIP: /* vertical triangle w skip*/
|
||||
sscanf(buffer,"%*s %i %i %i %i %i %i %i",
|
||||
&color1,
|
||||
&x1,&y1,&xl,&xr,&yb,&skip);
|
||||
// printf(".byte $%02X,",(VGI_VERT_TRIANGLE<<4)|7);
|
||||
// printf("$%02X,",(skip<<4)|color1);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X,",y1);
|
||||
// printf("$%02X,",xl);
|
||||
// printf("$%02X,",xr);
|
||||
// printf("$%02X\n",yb);
|
||||
output[0]=(VGI_VERT_TRIANGLE<<4)|7;
|
||||
output[1]=(skip<<4)|color1;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output[4]=xl;
|
||||
output[5]=xr;
|
||||
output[6]=yb;
|
||||
output_bytes(mode,output,7);
|
||||
size+=7;
|
||||
break;
|
||||
|
||||
case VGI_HORIZ_TRIANGLE: /* horizontal triangle */
|
||||
sscanf(buffer,"%*s %i %i %i %i %i %i",
|
||||
&color1,
|
||||
&x1,&y1,&yt,&yb,&xr);
|
||||
// printf(".byte $%02X,",(type<<4)|7);
|
||||
// printf("$%02X,",color1);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X,",y1);
|
||||
// printf("$%02X,",yt);
|
||||
// printf("$%02X,",yb);
|
||||
// printf("$%02X\n",xr);
|
||||
output[0]=(type<<4)|7;
|
||||
output[1]=color1;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output[4]=yt;
|
||||
output[5]=yb;
|
||||
output[6]=xr;
|
||||
output_bytes(mode,output,7);
|
||||
size+=7;
|
||||
break;
|
||||
|
||||
case VGI_VSTRIPE_RECTANGLE: /* vstriped rectangle */
|
||||
sscanf(buffer,"%*s %i %i %i %i %i %i",
|
||||
&color1,&color2,
|
||||
&x1,&y1,&x2,&y2);
|
||||
// printf(".byte $%02X,",(type<<4)|7);
|
||||
// printf("$%02X,",color1);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X,",y1);
|
||||
// printf("$%02X,",x2-x1);
|
||||
// printf("$%02X,",y2-y1);
|
||||
// printf("$%02X\n",color2);
|
||||
output[0]=(type<<4)|7;
|
||||
output[1]=color1;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output[4]=x2-x1;
|
||||
output[5]=y2-y1;
|
||||
output[6]=color2;
|
||||
output_bytes(mode,output,7);
|
||||
size+=7;
|
||||
break;
|
||||
|
||||
case VGI_LINE: /* line */
|
||||
case VGI_LINE_FAR: /* line far */
|
||||
sscanf(buffer,"%*s %i %i %i %i %i",
|
||||
&color1,
|
||||
&x1,&y1,&x2,&y2);
|
||||
// printf(".byte $%02X,",(type<<4)|6);
|
||||
|
||||
lastx=x2;
|
||||
lasty=y2;
|
||||
lastcolor=color1;
|
||||
|
||||
if (x1>255) {
|
||||
x1=x1&0xff;
|
||||
color1|=128;
|
||||
}
|
||||
// printf("$%02X,",color1);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X,",y1);
|
||||
// printf("$%02X,",x2);
|
||||
// printf("$%02X\n",y2);
|
||||
if (x2>255) {
|
||||
type=VGI_LINE_FAR;
|
||||
x2=x2&0xff;
|
||||
}
|
||||
|
||||
output[0]=(type<<4)|6;
|
||||
output[1]=color1;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output[4]=x2;
|
||||
output[5]=y2;
|
||||
output_bytes(mode,output,6);
|
||||
size+=6;
|
||||
break;
|
||||
|
||||
#if 0
|
||||
sscanf(buffer,"%*s %i %i %i %i %i",
|
||||
&color1,
|
||||
&x1,&y1,&x2,&y2);
|
||||
// printf(".byte $%02X,",(type<<4)|6);
|
||||
if (x1>255) {
|
||||
x1=x1&0xff;
|
||||
color1|=128;
|
||||
}
|
||||
if (x2<256) {
|
||||
fprintf(stderr,"Error! X2 too small %d on line %d\n",x2,line);
|
||||
}
|
||||
x2=x2&0xff;
|
||||
// printf("$%02X,",color1);
|
||||
// printf("$%02X,",x1);
|
||||
// printf("$%02X,",y1);
|
||||
// printf("$%02X,",x2);
|
||||
// printf("$%02X\n",y2);
|
||||
output[0]=(type<<4)|6;
|
||||
output[1]=color1;
|
||||
output[2]=x1;
|
||||
output[3]=y1;
|
||||
output[4]=x2;
|
||||
output[5]=y2;
|
||||
output_bytes(mode,output,6);
|
||||
size+=6;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case VGI_END: /* end */
|
||||
// printf(".byte $FF\n");
|
||||
output[0]=0xff;
|
||||
output_bytes(mode,output,1);
|
||||
size+=1;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,"Unknown type %i line %d\n",
|
||||
type,line);
|
||||
break;
|
||||
}
|
||||
|
||||
line++;
|
||||
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
fprintf(stderr,"Size is %d bytes\n",size);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
; Path from Myst
|
||||
CLS 255 ; white background
|
||||
RECT 1 5 0 85 140 191 ; ground left
|
||||
RECT 1 5 140 85 279 191 ; ground right
|
||||
; tower
|
||||
;DRECT 0x4c 0x33 216 22 235 33 ; tower
|
||||
DRECT 0x4c 216 216 22 235 33 ; tower
|
||||
;RECT 6 6 216 22 235 33 ; tower
|
||||
RECT 5 5 216 33 236 56 ; mountain
|
||||
VTRI 5 216 33 207 216 60 ; mountain
|
||||
; temple
|
||||
DRECT 0x4c 0x33 181 56 237 96 ; tower
|
||||
VTRI 0 204 53 186 225 60 ; triangle
|
||||
RECT 0 0 203 68 211 81 ; door
|
||||
LINE 7 189 68 189 82 ; columns
|
||||
LINE 7 197 67 197 84
|
||||
LINE 7 214 80 214 66
|
||||
LINE 7 224 78 223 65
|
||||
; marker switch
|
||||
RECT 5 5 209 76 217 86 ; marker switch
|
||||
; trees
|
||||
RECT 5 5 98 0 101 114 ; tree ?
|
||||
VTRISK 1 97 0 88 110 87 4 ; leaves?
|
||||
VTRISK 1 101 0 88 110 87 4 ; leaves?
|
||||
END
|
|
@ -0,0 +1,51 @@
|
|||
; Red Book from Myst
|
||||
CLS 0x80 ; white background
|
||||
VSTRP 0xA2 0xC4 15 0 55 192 ; woodgrain left
|
||||
VSTRP 0xA2 0xC4 237 0 270 192 ; woodgrain right
|
||||
RECT 5 4 56 53 233 60 ; top bar
|
||||
RECT 5 4 57 143 233 151 ; bottom bar
|
||||
VSTRP 0xA2 0xC4 58 152 231 191 ; bottom pannel
|
||||
RECT 5 5 69 83 221 134 ; bottom bar
|
||||
RECT 5 5 57 135 232 140 ; bottom lip
|
||||
VTRI 5 69 84 61 69 135 ; left triangle
|
||||
VTRI 5 219 84 219 228 135 ; right triangle
|
||||
POINT 4 67 94
|
||||
LINETO 223 94
|
||||
; upper
|
||||
VSTRP 0xA2 0xC4 68 1 231 54 ; toppannel
|
||||
POINT 4 68 54 ; left lines
|
||||
LINETO 70 32
|
||||
LINETO 79 12
|
||||
LINETO 87 0
|
||||
POINT 4 73 54
|
||||
LINETO 76 33
|
||||
LINETO 82 16
|
||||
LINETO 94 0
|
||||
POINT 4 216 53
|
||||
LINETO 216 37
|
||||
LINETO 208 17
|
||||
LINETO 196 0
|
||||
POINT 4 222 54
|
||||
LINETO 221 33
|
||||
LINETO 213 15
|
||||
LINETO 204 0
|
||||
POINT 4 234 53
|
||||
LINETO 230 34
|
||||
LINETO 222 12
|
||||
LINETO 216 0
|
||||
VTRI 4 69 32 69 84 0
|
||||
VTRI 4 230 32 216 230 0
|
||||
; light
|
||||
RECT 1 1 134 36 159 43 ; light
|
||||
RECT 1 5 134 43 159 53 ; light
|
||||
POINT 4 134 50
|
||||
LINETO 158 50
|
||||
; page
|
||||
RECT 2 2 175 89 201 135
|
||||
; book
|
||||
RECT 4 4 124 132 164 136 ; pages
|
||||
RECT 2 3 126 77 166 132 ; book cover
|
||||
RECT 4 4 127 76 133 132 ; left bar
|
||||
HTRI 4 156 76 75 84 166 ; l triangle top
|
||||
HTRI 4 158 131 123 132 166 ; l triangle bottom
|
||||
END
|
|
@ -0,0 +1,146 @@
|
|||
; Rocket from Myst
|
||||
CLS 255 ; white background
|
||||
RECT 1 6 0 122 140 191 ; ocean left
|
||||
RECT 1 6 140 122 279 191 ; ocean right
|
||||
; rock
|
||||
RECT 1 5 239 171 279 191 ; green/orange rock
|
||||
VTRI 4 228 162 226 245 171 ; black edge
|
||||
VTRI 4 228 162 224 244 185 ; black edge
|
||||
VTRI 4 232 191 224 244 184 ; upside down
|
||||
VTRI 4 255 165 245 255 171 ; black right edge
|
||||
VTRI 4 255 178 245 255 171 ; black right edge
|
||||
RECT 4 4 255 170 279 178 ; rock shade
|
||||
RECT 4 4 255 163 270 178 ; rock shade
|
||||
; base
|
||||
DRECT 0x8 0x22 86 124 193 191 ; green brick dock
|
||||
FCIRC 7 97 121 4 ; left platform
|
||||
FCIRC 7 180 121 4 ; right platform
|
||||
RECT 7 7 99 119 175 127 ; platform
|
||||
RECT 4 4 103 114 178 121 ; shady platform
|
||||
HTRI 4 95 120 115 120 102 ; left shady plat
|
||||
HTRI 4 185 120 115 120 175 ; right shady plat
|
||||
RECT 0 0 102 128 116 191 ; left shade
|
||||
RECT 0 0 156 126 169 191 ; center shade
|
||||
RECT 0 0 179 126 194 191 ; right shade
|
||||
RECT 3 3 89 137 93 146 ; left light
|
||||
RECT 3 3 186 139 190 147 ; right light
|
||||
; spaceship
|
||||
POINT 5 4 94 ; nosepipe
|
||||
LINETO 26 94 ;
|
||||
HTRI 4 25 94 84 105 43 ; noscone
|
||||
; draw deeper Z body
|
||||
HTRI 5 233 103 103 114 179 ; behind bottom fin
|
||||
; draw tails
|
||||
FCIRC 4 217 87 32 ; tails
|
||||
FCIRC 7 247 87 25 ; tails cutout
|
||||
RECT 4 4 231 59 263 64 ; top fin
|
||||
HTRI 4 255 58 54 58 222
|
||||
RECT 4 4 230 108 249 120 ; bottom fin
|
||||
RECT 4 4 240 111 278 115 ; bottom fin
|
||||
RECT 4 4 220 115 263 120 ; bottom fin
|
||||
; draw body
|
||||
RECT 5 5 44 84 234 101 ; body
|
||||
HTRI 5 44 84 77 84 69 ; left top
|
||||
HTRI 5 234 88 75 88 182 ; right top
|
||||
RECT 5 5 75 76 190 84 ; center top
|
||||
HTRI 7 223 84 84 88 234 ; right cutout
|
||||
RECT 5 5 44 101 185 106 ; next strip down
|
||||
HTRI 5 228 101 101 107 187 ; over bottom fin
|
||||
HTRI 5 44 106 106 113 74 ; left under
|
||||
RECT 5 5 74 106 185 113 ; next layer
|
||||
HTRI 5 74 113 113 100 102 ; next left
|
||||
HTRI 5 181 113 113 100 173 ; next right
|
||||
RECT 5 4 99 113 173 117 ; next layer
|
||||
; decorations
|
||||
RECT 4 4 234 88 239 101 ; nozzle
|
||||
HTRI 4 173 84 79 88 163 ; weird scoop
|
||||
HTRI 4 219 88 83 87 210 ; another scoop
|
||||
DRECT 0xcc 0xb3 67 80 74 110 ; left stripe
|
||||
DRECT 0xcc 0xb3 70 76 75 80 ; left stripe
|
||||
DRECT 0xcc 0xb3 70 106 75 114 ; left stripe
|
||||
DRECT 0xcc 0xb3 183 76 190 112 ; right stripe
|
||||
; door
|
||||
POINT 4 150 80
|
||||
LINETO 115 80
|
||||
LINETO 115 108
|
||||
LINETO 120 111
|
||||
LINETO 137 111
|
||||
POINT 7 138 81
|
||||
LINETO 138 109
|
||||
; door lines
|
||||
POINT 4 139 96
|
||||
LINETO 168 97
|
||||
POINT 4 139 100
|
||||
LINETO 165 100
|
||||
; marker switch
|
||||
RECT 6 6 148 116 158 124 ; base
|
||||
RECT 7 7 147 101 158 117 ; border
|
||||
RECT 5 1 150 103 155 113 ; woodgrain
|
||||
VTRI 6 154 95 148 158 101 ; top
|
||||
POINT 2 151 97 ; handle
|
||||
LINETO 155 97
|
||||
; walkway
|
||||
VTRI 1 128 129 101 109 191 ; left path green
|
||||
VTRI 3 129 129 109 129 191 ; left path white
|
||||
RECT 3 3 129 129 151 191 ; center path
|
||||
VTRI 1 153 129 170 179 191 ; right path green
|
||||
VTRI 3 152 129 152 170 191 ; right path white
|
||||
POINT 0 152 129 ; right gap
|
||||
LINETO 170 191 ; right gap
|
||||
POINT 0 129 129 ; left gap
|
||||
LINETO 109 191 ; left gap
|
||||
; left railing
|
||||
POINT 0 127 115 ; far left pole
|
||||
LINETO 128 133
|
||||
POINT 3 127 115 ; far left rope
|
||||
LINETO 122 129
|
||||
POINT 2 123 126 ; center left pole
|
||||
LINETO 123 147
|
||||
POINT 3 120 128 ; center left rope
|
||||
LINETO 116 144
|
||||
LINETO 109 154
|
||||
LINETO 99 158
|
||||
RECT 2 2 97 164 100 191 ; near pole
|
||||
FCIRC 2 98 161 4 ; near pole circle
|
||||
; right railing
|
||||
POINT 0 153 117 ; far right pole
|
||||
LINETO 152 132
|
||||
POINT 3 153 118 ; far right rope
|
||||
LINETO 157 129
|
||||
POINT 2 158 126 ; center right pole
|
||||
LINETO 157 141
|
||||
POINT 3 158 127 ; center right rope
|
||||
LINETO 162 142
|
||||
LINETO 168 154
|
||||
LINETO 178 160
|
||||
RECT 2 2 177 164 181 191 ; near pole
|
||||
FCIRC 2 179 161 4 ; near pole circle
|
||||
; wire pole
|
||||
RECT 6 6 174 88 179 126 ; pole
|
||||
RECT 6 6 174 73 179 80 ; insulator
|
||||
POINT 6 177 90 ; thinner pole
|
||||
LINETO 177 74 ; to top
|
||||
; shadow
|
||||
POINT 0 129 191
|
||||
LINETO 144 187
|
||||
POINT 0 139 188
|
||||
LINETO 132 180
|
||||
LINETO 130 170
|
||||
LINETO 129 157
|
||||
LINETO 134 149
|
||||
LINETO 139 143
|
||||
LINETO 135 138
|
||||
LINETO 134 132
|
||||
LINETO 138 126
|
||||
LINETO 131 127
|
||||
POINT 0 126 145
|
||||
LINETO 143 142
|
||||
; power wire
|
||||
POINT 6 279 54 ; from off screen
|
||||
LINETO 238 65
|
||||
LINETO 177 74
|
||||
LINETO 170 82
|
||||
LINETO 173 85
|
||||
LINETO 189 88
|
||||
LINETO 209 86
|
||||
END
|
|
@ -0,0 +1,54 @@
|
|||
; Rocket Door from Myst
|
||||
CLS 255 ; white background
|
||||
RECT 1 7 0 107 119 192 ; ocean left
|
||||
; platform
|
||||
VTRI 4 105 168 62 140 191 ; shady platform
|
||||
VTRI 7 95 174 62 114 191 ; white platform
|
||||
; nosepole
|
||||
POINT 5 26 82
|
||||
LINETO 38 84
|
||||
; ship
|
||||
RECT 5 5 153 0 278 192 ; left
|
||||
FCIRC 5 77 87 42 ; nose
|
||||
FCIRC 4 89 89 51 ; nose
|
||||
FCIRC 5 101 91 60 ; nose
|
||||
VTRI 5 154 0 65 154 47 ; left top
|
||||
VTRI 5 139 191 65 154 135 ; left bottom
|
||||
RECT 5 5 139 45 182 192 ; left
|
||||
; lines
|
||||
POINT 4 41 87 ; front top
|
||||
LINETO 79 94
|
||||
POINT 4 44 104 ; front bottom
|
||||
LINETO 71 120
|
||||
; lines
|
||||
POINT 4 267 0 ; top line
|
||||
LINETO 192 15
|
||||
POINT 4 279 178 ; center line
|
||||
LINETO 169 145
|
||||
POINT 4 243 191 ; bottom line
|
||||
LINETO 172 164
|
||||
; door
|
||||
POINT 7 175 191 ; door bottom right
|
||||
LINETO 172 180
|
||||
LINETO 168 128
|
||||
LINETO 174 73
|
||||
LINETO 191 16
|
||||
LINETO 111 35
|
||||
POINT 4 114 176 ; door outline
|
||||
LINETO 107 161
|
||||
LINETO 99 146
|
||||
LINETO 94 113
|
||||
LINETO 97 73
|
||||
LINETO 110 36
|
||||
LINETO 190 17
|
||||
POINT 4 99 144 ; on door bottom
|
||||
LINETO 127 159
|
||||
POINT 4 104 56 ; on door top
|
||||
LINETO 145 49
|
||||
; dark step
|
||||
VTRI 4 107 161 117 130 173 ; top half
|
||||
VTRI 4 130 191 117 130 173 ; left third
|
||||
VTRI 4 130 173 130 160 191 ; right third
|
||||
POINT 7 138 191
|
||||
LINETO 119 179
|
||||
END
|
|
@ -0,0 +1,303 @@
|
|||
; VGI_Circles
|
||||
|
||||
|
||||
XX = TEMP0
|
||||
MINUSXX = TEMP1
|
||||
YY = TEMP2
|
||||
MINUSYY = TEMP3
|
||||
D = TEMP4
|
||||
COUNT = TEMP5
|
||||
|
||||
;========================
|
||||
; VGI circle
|
||||
;========================
|
||||
|
||||
VGI_CCOLOR = P0
|
||||
VGI_CX = P1
|
||||
VGI_CY = P2
|
||||
VGI_CR = P3
|
||||
|
||||
vgi_circle:
|
||||
ldx VGI_CCOLOR
|
||||
lda COLORTBL,X
|
||||
sta HGR_COLOR
|
||||
|
||||
;===============================
|
||||
; draw circle
|
||||
;===============================
|
||||
; draw circle at (CX,CY) of radius R
|
||||
; signed 8-bit math so problems if R > 64?
|
||||
|
||||
; XX=0 YY=R
|
||||
; D=3-2*R
|
||||
; GOTO6
|
||||
|
||||
lda #0
|
||||
sta XX
|
||||
|
||||
lda VGI_CR
|
||||
sta YY
|
||||
|
||||
lda #3
|
||||
sec
|
||||
sbc VGI_CR
|
||||
sbc VGI_CR
|
||||
sta D
|
||||
|
||||
jmp do_plots
|
||||
|
||||
circle_loop:
|
||||
; X=X+1
|
||||
|
||||
inc XX
|
||||
|
||||
; IF D>0 THEN Y=Y-1:D=D+4*(X-Y)+10
|
||||
lda D
|
||||
bmi else
|
||||
|
||||
dec YY
|
||||
|
||||
lda XX
|
||||
sec
|
||||
sbc YY
|
||||
asl
|
||||
asl
|
||||
clc
|
||||
adc D
|
||||
adc #10
|
||||
jmp store_D
|
||||
|
||||
else:
|
||||
; ELSE D=D+4*X+6
|
||||
lda XX
|
||||
asl
|
||||
asl
|
||||
clc
|
||||
adc D
|
||||
adc #6
|
||||
store_D:
|
||||
sta D
|
||||
|
||||
do_plots:
|
||||
; setup constants
|
||||
|
||||
lda XX
|
||||
eor #$FF
|
||||
sta MINUSXX
|
||||
inc MINUSXX
|
||||
|
||||
lda YY
|
||||
eor #$FF
|
||||
sta MINUSYY
|
||||
inc MINUSYY
|
||||
|
||||
; HPLOT CX+X,CY+Y
|
||||
; HPLOT CX-X,CY+Y
|
||||
; HPLOT CX+X,CY-Y
|
||||
; HPLOT CX-X,CY-Y
|
||||
; HPLOT CX+Y,CY+X
|
||||
; HPLOT CX-Y,CY+X
|
||||
; HPLOT CX+Y,CY-X
|
||||
; HPLOT CX-Y,CY-X
|
||||
|
||||
; calc X co-ord
|
||||
|
||||
lda #7
|
||||
sta COUNT
|
||||
pos_loop:
|
||||
lda COUNT
|
||||
and #$4
|
||||
lsr
|
||||
tay
|
||||
|
||||
lda COUNT
|
||||
lsr
|
||||
bcc xnoc
|
||||
iny
|
||||
xnoc:
|
||||
lda VGI_CX
|
||||
clc
|
||||
adc XX,Y
|
||||
tax
|
||||
|
||||
; calc y co-ord
|
||||
|
||||
lda COUNT
|
||||
lsr
|
||||
eor #$2
|
||||
tay
|
||||
|
||||
lda VGI_CY
|
||||
clc
|
||||
adc XX,Y
|
||||
|
||||
ldy #0
|
||||
|
||||
jsr HPLOT0 ; plot at (Y,X), (A)
|
||||
|
||||
dec COUNT
|
||||
bpl pos_loop
|
||||
|
||||
|
||||
; IFY>=XTHEN4
|
||||
lda YY
|
||||
cmp XX
|
||||
bcs circle_loop
|
||||
|
||||
jmp vgi_loop
|
||||
|
||||
|
||||
|
||||
|
||||
;========================
|
||||
; VGI circle
|
||||
;========================
|
||||
; VGI_CCOLOR = P0
|
||||
; VGI_CX = P1
|
||||
; VGI_CY = P2
|
||||
; VGI_CR = P3
|
||||
|
||||
vgi_filled_circle:
|
||||
ldx VGI_CCOLOR
|
||||
lda COLORTBL,X
|
||||
sta HGR_COLOR
|
||||
|
||||
;===============================
|
||||
; draw filled circle
|
||||
;===============================
|
||||
; draw filled circle at (CX,CY) of radius R
|
||||
; signed 8-bit math so problems if R > 64?
|
||||
|
||||
|
||||
; XX=0 YY=R
|
||||
; D=3-2*R
|
||||
; GOTO6
|
||||
|
||||
lda #0
|
||||
sta XX
|
||||
|
||||
lda VGI_CR
|
||||
sta YY
|
||||
|
||||
lda #3
|
||||
sec
|
||||
sbc VGI_CR
|
||||
sbc VGI_CR
|
||||
sta D
|
||||
|
||||
jmp do_filled_plots
|
||||
|
||||
filled_circle_loop:
|
||||
; X=X+1
|
||||
|
||||
inc XX
|
||||
|
||||
; IF D>0 THEN Y=Y-1:D=D+4*(X-Y)+10
|
||||
lda D
|
||||
bmi filled_else
|
||||
|
||||
dec YY
|
||||
|
||||
lda XX
|
||||
sec
|
||||
sbc YY
|
||||
asl
|
||||
asl
|
||||
clc
|
||||
adc D
|
||||
adc #10
|
||||
jmp store_filled_D
|
||||
|
||||
filled_else:
|
||||
; ELSE D=D+4*X+6
|
||||
lda XX
|
||||
asl
|
||||
asl
|
||||
clc
|
||||
adc D
|
||||
adc #6
|
||||
store_filled_D:
|
||||
sta D
|
||||
|
||||
do_filled_plots:
|
||||
; setup constants
|
||||
|
||||
lda XX
|
||||
eor #$FF
|
||||
sta MINUSXX
|
||||
inc MINUSXX
|
||||
|
||||
lda YY
|
||||
eor #$FF
|
||||
sta MINUSYY
|
||||
inc MINUSYY
|
||||
|
||||
; HPLOT CX+X,CY+Y
|
||||
; HPLOT CX-X,CY+Y
|
||||
; HPLOT CX+X,CY-Y
|
||||
; HPLOT CX-X,CY-Y
|
||||
; HPLOT CX+Y,CY+X
|
||||
; HPLOT CX-Y,CY+X
|
||||
; HPLOT CX+Y,CY-X
|
||||
; HPLOT CX-Y,CY-X
|
||||
|
||||
|
||||
|
||||
|
||||
lda #3
|
||||
sta COUNT
|
||||
filled_pos_loop:
|
||||
|
||||
; calc left side
|
||||
|
||||
; calc X co-ord
|
||||
|
||||
lda COUNT
|
||||
ora #$1
|
||||
eor #$2
|
||||
tay
|
||||
lda VGI_CX
|
||||
clc
|
||||
adc XX,Y
|
||||
tax
|
||||
|
||||
; calc y co-ord
|
||||
|
||||
ldy COUNT
|
||||
lda VGI_CY
|
||||
clc
|
||||
adc XX,Y
|
||||
|
||||
ldy #0
|
||||
|
||||
; pha ; save Y value for later
|
||||
|
||||
jsr HPLOT0 ; plot at (Y,X), (A)
|
||||
|
||||
|
||||
; calc right side
|
||||
lda COUNT
|
||||
and #$2
|
||||
eor #$2
|
||||
tay
|
||||
lda XX,Y
|
||||
asl
|
||||
|
||||
ldy #0
|
||||
ldx #0
|
||||
|
||||
jsr HLINRL ; plot relative (X,A), (Y)
|
||||
; so in our case (0,XX*2),0
|
||||
|
||||
|
||||
|
||||
dec COUNT
|
||||
bpl filled_pos_loop
|
||||
|
||||
|
||||
; IFY>=XTHEN4
|
||||
lda YY
|
||||
cmp XX
|
||||
bcs filled_circle_loop
|
||||
|
||||
jmp vgi_loop
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
vgi_clearscreen:
|
||||
|
||||
lda P0
|
||||
jsr BKGND0
|
||||
|
||||
jmp vgi_loop ; return
|
|
@ -0,0 +1,72 @@
|
|||
; VGI library
|
||||
|
||||
VGI_MAXLEN = 7
|
||||
|
||||
;==================================
|
||||
; play_vgi
|
||||
;==================================
|
||||
play_vgi:
|
||||
|
||||
vgi_loop:
|
||||
|
||||
ldy #0
|
||||
data_smc:
|
||||
lda (VGIL),Y
|
||||
sta VGI_BUFFER,Y
|
||||
iny
|
||||
cpy #VGI_MAXLEN
|
||||
bne data_smc
|
||||
|
||||
lda VGI_TYPE
|
||||
and #$f
|
||||
|
||||
clc
|
||||
adc VGIL
|
||||
sta VGIL
|
||||
bcc no_oflo
|
||||
inc VGIH
|
||||
no_oflo:
|
||||
|
||||
lda VGI_TYPE
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
|
||||
; look up action in jump table
|
||||
asl
|
||||
tax
|
||||
lda vgi_rts_table+1,X
|
||||
pha
|
||||
lda vgi_rts_table,X
|
||||
pha
|
||||
rts ; "jump" to subroutine
|
||||
|
||||
vgi_rts_table:
|
||||
.word vgi_clearscreen-1 ; 0 = clearscreen
|
||||
.word vgi_simple_rectangle-1 ; 1 = simple rectangle
|
||||
.word vgi_circle-1 ; 2 = plain circle
|
||||
.word vgi_filled_circle-1 ; 3 = filled circle
|
||||
.word vgi_point-1 ; 4 = dot
|
||||
.word vgi_lineto-1 ; 5 = line to
|
||||
.word vgi_dithered_rectangle-1 ; 6 = dithered rectangle
|
||||
.word vgi_vertical_triangle-1 ; 7 = vertical triangle
|
||||
.word vgi_horizontal_triangle-1 ; 8 = horizontal triangle
|
||||
.word vgi_vstripe_rectangle-1 ; 9 = vstripe rectangle
|
||||
.word vgi_line-1 ;10 = line
|
||||
.word vgi_line_far-1 ;11 = line far
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1 ; 15 = done
|
||||
|
||||
all_done:
|
||||
rts
|
||||
|
||||
|
||||
.include "vgi_clearscreen.s"
|
||||
.include "vgi_circles.s"
|
||||
.include "vgi_rectangle.s"
|
||||
.include "vgi_lines.s"
|
||||
.include "vgi_triangles.s"
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
; VGI Lines
|
||||
|
||||
;========================
|
||||
; VGI point
|
||||
;========================
|
||||
vgi_point:
|
||||
jsr vgi_point_common
|
||||
jmp vgi_loop
|
||||
|
||||
|
||||
;========================
|
||||
; VGI point common
|
||||
;========================
|
||||
|
||||
VGI_PCOLOR = P0 ; if high bit set, then PX=PX+256
|
||||
VGI_PX = P1
|
||||
VGI_PY = P2
|
||||
|
||||
vgi_point_common:
|
||||
ldy #0
|
||||
|
||||
lda VGI_PCOLOR
|
||||
bpl vgi_point_color
|
||||
iny
|
||||
vgi_point_color:
|
||||
and #$7f
|
||||
tax
|
||||
lda COLORTBL,X
|
||||
sta HGR_COLOR
|
||||
|
||||
ldx VGI_PX
|
||||
lda VGI_PY
|
||||
|
||||
jsr HPLOT0 ; plot at (Y,X), (A)
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
;========================
|
||||
; VGI line to
|
||||
;========================
|
||||
VGI_LX = P0
|
||||
VGI_LY = P1
|
||||
|
||||
vgi_lineto:
|
||||
ldx #0
|
||||
ldy VGI_LY
|
||||
lda VGI_LX
|
||||
|
||||
jsr HGLIN ; line to (X,A),(Y)
|
||||
|
||||
jmp vgi_loop
|
||||
|
||||
|
||||
;========================
|
||||
; VGI LINE
|
||||
;========================
|
||||
; VGI_LX = P0
|
||||
; VGI_LY = P1
|
||||
VGI_LX2 = P3
|
||||
VGI_LY2 = P4
|
||||
|
||||
vgi_line:
|
||||
jsr vgi_point_common
|
||||
|
||||
ldx #0
|
||||
ldy VGI_LY2
|
||||
lda VGI_LX2
|
||||
|
||||
jsr HGLIN ; line to (X,A),(Y)
|
||||
|
||||
jmp vgi_loop
|
||||
|
||||
;========================
|
||||
; VGI LINE FAR
|
||||
;========================
|
||||
; assume second x-coord is > 256
|
||||
; VGI_LX = P0
|
||||
; VGI_LY = P1
|
||||
; VGI_LX2 = P3
|
||||
; VGI_LY2 = P4
|
||||
|
||||
vgi_line_far:
|
||||
jsr vgi_point_common
|
||||
|
||||
ldx #1
|
||||
ldy VGI_LY2
|
||||
lda VGI_LX2
|
||||
|
||||
jsr HGLIN ; line to (X,A),(Y)
|
||||
|
||||
jmp vgi_loop
|
||||
|
|
@ -0,0 +1,462 @@
|
|||
; VGI Rectangle
|
||||
|
||||
; VGI Rectangle test
|
||||
|
||||
COLOR_MODE = TEMP0
|
||||
OTHER_MASK = TEMP1
|
||||
XRUN = TEMP2
|
||||
|
||||
div7_table = $9000
|
||||
mod7_table = $9100
|
||||
|
||||
USE_FAST = 1
|
||||
|
||||
|
||||
|
||||
.if (USE_FAST=0)
|
||||
|
||||
; slow
|
||||
;=================================
|
||||
; Simple Rectangle
|
||||
;=================================
|
||||
VGI_RCOLOR = P0
|
||||
VGI_RX1 = P1
|
||||
VGI_RY1 = P2
|
||||
VGI_RXRUN = P3
|
||||
VGI_RYRUN = P4
|
||||
|
||||
vgi_simple_rectangle:
|
||||
|
||||
simple_rectangle_loop:
|
||||
|
||||
lda VGI_RCOLOR
|
||||
|
||||
asl ; nibble swap by david galloway
|
||||
adc #$80
|
||||
rol
|
||||
asl
|
||||
adc #$80
|
||||
rol
|
||||
|
||||
sta VGI_RCOLOR
|
||||
|
||||
and #$f
|
||||
tax
|
||||
|
||||
lda COLORTBL,X
|
||||
sta HGR_COLOR
|
||||
|
||||
ldx VGI_RX1 ; X1 into X
|
||||
lda VGI_RY1 ; Y1 into A
|
||||
ldy #0 ; always 0
|
||||
jsr HPOSN ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
|
||||
lda VGI_RXRUN ; XRUN into A
|
||||
ldx #0 ; always 0
|
||||
ldy #0 ; relative Y is 0
|
||||
jsr HLINRL ; (X,A),(Y)
|
||||
|
||||
inc VGI_RY1
|
||||
dec VGI_RYRUN
|
||||
bne simple_rectangle_loop
|
||||
|
||||
jmp vgi_loop
|
||||
|
||||
|
||||
|
||||
;=================================
|
||||
; Dithered Rectangle
|
||||
;=================================
|
||||
; VGI_RCOLOR = P0
|
||||
; VGI_RX1 = P1
|
||||
; VGI_RY1 = P2
|
||||
; VGI_RXRUN = P3
|
||||
; VGI_RYRUN = P4
|
||||
VGI_RCOLOR2 = P5
|
||||
|
||||
vgi_dithered_rectangle:
|
||||
|
||||
dithered_rectangle_loop:
|
||||
lda COUNT
|
||||
and #$1
|
||||
beq even_color
|
||||
odd_color:
|
||||
lda VGI_RCOLOR
|
||||
jmp save_color
|
||||
even_color:
|
||||
lda VGI_RCOLOR2
|
||||
save_color:
|
||||
sta HGR_COLOR
|
||||
|
||||
inc COUNT
|
||||
|
||||
ldx VGI_RX1 ; X1 into X
|
||||
lda VGI_RY1 ; Y1 into A
|
||||
ldy #0 ; always 0
|
||||
jsr HPOSN ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
|
||||
lda VGI_RXRUN ; XRUN into A
|
||||
ldx #0 ; always 0
|
||||
ldy #0 ; relative Y is 0
|
||||
jsr HLINRL ; (X,A),(Y)
|
||||
|
||||
inc VGI_RY1
|
||||
dec VGI_RYRUN
|
||||
bne dithered_rectangle_loop
|
||||
|
||||
jmp vgi_loop
|
||||
|
||||
|
||||
|
||||
.else
|
||||
|
||||
|
||||
|
||||
|
||||
; FAST
|
||||
;=================================
|
||||
; Simple Rectangle
|
||||
;=================================
|
||||
VGI_RCOLOR = P0
|
||||
VGI_RX1 = P1
|
||||
VGI_RY1 = P2
|
||||
VGI_RXRUN = P3
|
||||
VGI_RYRUN = P4
|
||||
VGI_RCOLOR2 = P5 ; only for dither
|
||||
|
||||
;==================================
|
||||
; VGI Simple Rectangle
|
||||
;==================================
|
||||
|
||||
vgi_simple_rectangle:
|
||||
lda #0
|
||||
sta COLOR_MODE
|
||||
|
||||
simple_rectangle_loop:
|
||||
|
||||
lda COLOR_MODE
|
||||
beq simple_colors
|
||||
bmi striped_colors
|
||||
bpl handle_dither
|
||||
|
||||
|
||||
simple_colors:
|
||||
|
||||
lda VGI_RCOLOR
|
||||
|
||||
asl ; nibble swap by david galloway
|
||||
adc #$80
|
||||
rol
|
||||
asl
|
||||
adc #$80
|
||||
rol
|
||||
|
||||
sta VGI_RCOLOR
|
||||
|
||||
and #$f
|
||||
tax
|
||||
|
||||
lda COLORTBL,X
|
||||
sta HGR_COLOR
|
||||
jmp done_colors
|
||||
|
||||
handle_dither:
|
||||
|
||||
lda COUNT
|
||||
and #$1
|
||||
beq deven_color
|
||||
dodd_color:
|
||||
lda VGI_RCOLOR
|
||||
jmp dsave_color
|
||||
deven_color:
|
||||
lda VGI_RCOLOR2
|
||||
dsave_color:
|
||||
sta HGR_COLOR
|
||||
|
||||
inc COUNT
|
||||
jmp done_colors
|
||||
striped_colors:
|
||||
|
||||
; don't need to do anything here?
|
||||
|
||||
done_colors:
|
||||
|
||||
; get ROW into (GBASL)
|
||||
|
||||
ldx VGI_RX1 ; X1 into X
|
||||
lda VGI_RY1 ; Y1 into A
|
||||
ldy #0 ; always 0
|
||||
jsr HPOSN ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
; Y is already the RX1/7
|
||||
|
||||
; adjust color if in striped mode
|
||||
lda COLOR_MODE
|
||||
bpl not_striped
|
||||
|
||||
jsr swap_colors
|
||||
|
||||
not_striped:
|
||||
|
||||
; copy the XRUN
|
||||
|
||||
lda VGI_RXRUN
|
||||
sta XRUN
|
||||
|
||||
inc XRUN ; needed because we compare with beq/bne
|
||||
|
||||
|
||||
; check if narrow corner case where begin and end same block
|
||||
; if RX%7 + XRUN < 8
|
||||
|
||||
ldx VGI_RX1
|
||||
lda mod7_table,X
|
||||
clc
|
||||
adc XRUN
|
||||
cmp #8
|
||||
bcs not_corner
|
||||
|
||||
corner:
|
||||
; want to use MASK of left_mask, MOD7 and 7-XRUN
|
||||
|
||||
lda mod7_table,X
|
||||
tax
|
||||
|
||||
lda (GBASL),Y
|
||||
eor HGR_BITS
|
||||
and left_masks,X
|
||||
ldx XRUN
|
||||
and right_masks,X
|
||||
eor (GBASL),Y
|
||||
sta (GBASL),Y
|
||||
|
||||
jmp done_row ; that's all
|
||||
|
||||
not_corner:
|
||||
|
||||
; see if not starting on boundary
|
||||
ldx VGI_RX1
|
||||
lda mod7_table,X
|
||||
beq draw_run
|
||||
|
||||
; handle not full left border
|
||||
|
||||
tax
|
||||
lda (GBASL),Y
|
||||
eor HGR_BITS
|
||||
and left_masks,X
|
||||
eor (GBASL),Y
|
||||
sta (GBASL),Y
|
||||
|
||||
iny ; move to next
|
||||
|
||||
; adjust RUN length by 7- mod7
|
||||
txa ; load mod7
|
||||
eor #$ff
|
||||
sec
|
||||
adc #7
|
||||
eor #$ff
|
||||
sec
|
||||
adc XRUN
|
||||
sta XRUN
|
||||
|
||||
; lda HGR_BITS ; cycle colors for next
|
||||
; jsr COLOR_SHIFT
|
||||
|
||||
jsr swap_colors
|
||||
|
||||
;no_shift:
|
||||
|
||||
; draw common
|
||||
draw_run:
|
||||
lda XRUN
|
||||
cmp #7
|
||||
bcc draw_right ; blt
|
||||
|
||||
lda HGR_BITS ; get color
|
||||
sta (GBASL),Y ; store out
|
||||
; jsr COLOR_SHIFT ; shift colors
|
||||
|
||||
iny ; move to next block
|
||||
|
||||
jsr swap_colors
|
||||
|
||||
lda XRUN ; take 7 off the run
|
||||
sec
|
||||
sbc #7
|
||||
sta XRUN
|
||||
|
||||
jmp draw_run
|
||||
|
||||
; draw rightmost
|
||||
draw_right:
|
||||
|
||||
beq done_row
|
||||
|
||||
; lda HGR_BITS
|
||||
; jsr COLOR_SHIFT
|
||||
|
||||
; see if not starting on boundary
|
||||
ldx XRUN
|
||||
tax
|
||||
|
||||
lda (GBASL),Y
|
||||
eor HGR_BITS
|
||||
and right_masks,X
|
||||
eor (GBASL),Y
|
||||
sta (GBASL),Y
|
||||
|
||||
done_row:
|
||||
|
||||
inc VGI_RY1
|
||||
dec VGI_RYRUN
|
||||
;bne simple_rectangle_loop
|
||||
beq done_done
|
||||
jmp simple_rectangle_loop
|
||||
|
||||
done_done:
|
||||
jmp vgi_loop
|
||||
|
||||
|
||||
|
||||
;==========================
|
||||
; swap colors
|
||||
;==========================
|
||||
swap_colors:
|
||||
|
||||
lda COLOR_MODE
|
||||
bmi swap_colors_striped
|
||||
|
||||
lda HGR_BITS ; get color
|
||||
jsr COLOR_SHIFT ; shift colors
|
||||
|
||||
rts
|
||||
|
||||
swap_colors_striped:
|
||||
|
||||
tya
|
||||
and #1
|
||||
bne swap_odd
|
||||
|
||||
lda VGI_RCOLOR
|
||||
jmp swap_done
|
||||
|
||||
swap_odd:
|
||||
lda VGI_RCOLOR2
|
||||
swap_done:
|
||||
sta HGR_BITS
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;=================================
|
||||
; Dithered Rectangle
|
||||
;=================================
|
||||
; VGI_RCOLOR = P0
|
||||
; VGI_RX1 = P1
|
||||
; VGI_RY1 = P2
|
||||
; VGI_RXRUN = P3
|
||||
; VGI_RYRUN = P4
|
||||
; VGI_RCOLOR2 = P5
|
||||
|
||||
vgi_dithered_rectangle:
|
||||
lda #1
|
||||
sta COLOR_MODE
|
||||
|
||||
lda #0
|
||||
sta COUNT
|
||||
|
||||
jmp simple_rectangle_loop
|
||||
|
||||
|
||||
;=================================
|
||||
; Vertical Striped Rectangle
|
||||
;=================================
|
||||
; VGI_RCOLOR = P0
|
||||
; VGI_RX1 = P1
|
||||
; VGI_RY1 = P2
|
||||
; VGI_RXRUN = P3
|
||||
; VGI_RYRUN = P4
|
||||
; VGI_RCOLOR2 = P5
|
||||
|
||||
vgi_vstripe_rectangle:
|
||||
lda #128
|
||||
sta COLOR_MODE
|
||||
|
||||
lda #0
|
||||
sta COUNT
|
||||
|
||||
jmp simple_rectangle_loop
|
||||
|
||||
|
||||
.endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;=====================
|
||||
; make /7 %7 tables
|
||||
;=====================
|
||||
|
||||
vgi_init:
|
||||
|
||||
vgi_make_tables:
|
||||
|
||||
ldy #0
|
||||
lda #0
|
||||
ldx #0
|
||||
div7_loop:
|
||||
sta div7_table,Y
|
||||
|
||||
inx
|
||||
cpx #7
|
||||
bne div7_not7
|
||||
|
||||
clc
|
||||
adc #1
|
||||
ldx #0
|
||||
div7_not7:
|
||||
iny
|
||||
bne div7_loop
|
||||
|
||||
|
||||
ldy #0
|
||||
lda #0
|
||||
mod7_loop:
|
||||
sta mod7_table,Y
|
||||
clc
|
||||
adc #1
|
||||
cmp #7
|
||||
bne mod7_not7
|
||||
lda #0
|
||||
mod7_not7:
|
||||
iny
|
||||
bne mod7_loop
|
||||
|
||||
rts
|
||||
|
||||
left_masks:
|
||||
.byte $FF,$FE,$FC,$F8, $F0,$E0,$C0
|
||||
|
||||
right_masks:
|
||||
.byte $81,$83,$87, $8F,$9F,$BF,$FF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
; VGI Triangles
|
||||
|
||||
SKIP = TEMP0
|
||||
|
||||
;========================
|
||||
; VGI vertical triangle
|
||||
;========================
|
||||
|
||||
VGI_TCOLOR = P0
|
||||
VGI_VX = P1
|
||||
VGI_VY = P2
|
||||
VGI_TXL = P3
|
||||
VGI_TXR = P4
|
||||
VGI_TYB = P5
|
||||
|
||||
vgi_vertical_triangle:
|
||||
lda VGI_TCOLOR
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
sta SKIP
|
||||
|
||||
lda VGI_TCOLOR
|
||||
and #$f
|
||||
tax
|
||||
lda COLORTBL,X
|
||||
sta HGR_COLOR
|
||||
|
||||
vtri_loop:
|
||||
ldy #0
|
||||
ldx VGI_VX
|
||||
lda VGI_VY
|
||||
|
||||
jsr HPLOT0 ; plot at (Y,X), (A)
|
||||
|
||||
|
||||
ldx #0
|
||||
ldy VGI_TYB
|
||||
lda VGI_TXL
|
||||
|
||||
jsr HGLIN ; line to (X,A),(Y)
|
||||
|
||||
lda VGI_TXL
|
||||
clc
|
||||
adc SKIP
|
||||
sta VGI_TXL
|
||||
; inc VGI_TXL
|
||||
; lda VGI_TXL
|
||||
cmp VGI_TXR
|
||||
bcc vtri_loop
|
||||
|
||||
done_vtri:
|
||||
jmp vgi_loop ; bra
|
||||
|
||||
|
||||
|
||||
;========================
|
||||
; VGI horizontal triangle
|
||||
;========================
|
||||
|
||||
; VGI_TCOLOR = P0
|
||||
; VGI_VX = P1
|
||||
; VGI_VY = P2
|
||||
VGI_THYT = P3
|
||||
VGI_THYB = P4
|
||||
VGI_THXR = P5
|
||||
|
||||
vgi_horizontal_triangle:
|
||||
|
||||
ldx VGI_TCOLOR
|
||||
lda COLORTBL,X
|
||||
sta HGR_COLOR
|
||||
|
||||
htri_loop:
|
||||
ldy #0
|
||||
ldx VGI_VX
|
||||
lda VGI_VY
|
||||
|
||||
jsr HPLOT0 ; plot at (Y,X), (A)
|
||||
|
||||
|
||||
ldx #0
|
||||
ldy VGI_THYT
|
||||
lda VGI_THXR
|
||||
|
||||
jsr HGLIN ; line to (X,A),(Y)
|
||||
|
||||
inc VGI_THYT
|
||||
lda VGI_THYT
|
||||
cmp VGI_THYB
|
||||
bcc htri_loop
|
||||
|
||||
done_htri:
|
||||
jmp vgi_loop
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
; zero page
|
||||
|
||||
TEMP0 = $10
|
||||
TEMP1 = $11
|
||||
TEMP2 = $12
|
||||
TEMP3 = $13
|
||||
TEMP4 = $14
|
||||
TEMP5 = $15
|
||||
|
||||
;; Zero page addresses
|
||||
|
||||
HGR_BITS = $1C
|
||||
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
|
||||
ORNAMENT_L = $60
|
||||
ORNAMENT_H = $61
|
||||
SAMPLE_L = $62
|
||||
SAMPLE_H = $63
|
||||
|
||||
LOOP = $64
|
||||
MB_ADDR_L = $65
|
||||
MB_ADDR_H = $66
|
||||
MB_VALUE = $67
|
||||
DONE_PLAYING = $68
|
||||
DONE_SONG = $69
|
||||
PT3_TEMP = $6A
|
||||
APPLEII_MODEL = $6B
|
||||
|
||||
AY_REGISTERS = $50
|
||||
A_FINE_TONE = $50
|
||||
A_COARSE_TONE = $51
|
||||
B_FINE_TONE = $52
|
||||
B_COARSE_TONE = $53
|
||||
C_FINE_TONE = $54
|
||||
C_COARSE_TONE = $55
|
||||
NOISE = $56
|
||||
ENABLE = $57
|
||||
PT3_MIXER_VAL = $57
|
||||
A_VOLUME = $58
|
||||
B_VOLUME = $59
|
||||
C_VOLUME = $5A
|
||||
ENVELOPE_FINE = $5B
|
||||
ENVELOPE_COARSE = $5C
|
||||
ENVELOPE_SHAPE = $5D
|
||||
|
||||
PATTERN_L = $5E
|
||||
PATTERN_H = $5F
|
||||
|
||||
|
||||
|
||||
HGR_X = $E0
|
||||
HGR_XH = $E1
|
||||
HGR_Y = $E2
|
||||
HGR_COLOR = $E4
|
||||
HGR_PAGE = $E6
|
||||
|
||||
VGI_BUFFER = $F0
|
||||
VGI_TYPE = $F0
|
||||
P0 = $F1
|
||||
P1 = $F2
|
||||
P2 = $F3
|
||||
P3 = $F4
|
||||
P4 = $F5
|
||||
P5 = $F6
|
||||
P6 = $F7
|
||||
VGIL = $F8
|
||||
VGIH = $F9
|
||||
|
||||
OUTL = $FC
|
||||
OUTH = $FD
|
||||
|
||||
COLOR1 = $FE
|
||||
COLOR2 = $FF
|
||||
|
Loading…
Reference in New Issue