mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-29 21:31:53 +00:00
hgr: vgi: an agi-like interpreter
This commit is contained in:
parent
093e15268d
commit
d3b9a84820
49
graphics/hgr/vgi/Makefile
Normal file
49
graphics/hgr/vgi/Makefile
Normal file
@ -0,0 +1,49 @@
|
||||
include ../../../Makefile.inc
|
||||
|
||||
DOS33 = ../../../utils/dos33fs-utils/dos33
|
||||
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
||||
LINKERSCRIPTS = ../../../linker_scripts
|
||||
EMPTYDISK = ../../../empty_disk/empty.dsk
|
||||
|
||||
all: vgi.dsk make_boxes_asm
|
||||
|
||||
vgi.dsk: HELLO VGI
|
||||
cp $(EMPTYDISK) vgi.dsk
|
||||
$(DOS33) -y vgi.dsk SAVE A HELLO
|
||||
$(DOS33) -y vgi.dsk BSAVE -a 0xC00 VGI
|
||||
|
||||
|
||||
###
|
||||
|
||||
HELLO: hello.bas
|
||||
$(TOKENIZE) < hello.bas > HELLO
|
||||
|
||||
|
||||
###
|
||||
|
||||
VGI: vgi.o
|
||||
ld65 -o VGI vgi.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||
|
||||
vgi.o: clock.data \
|
||||
vgi.s vgi_clearscreen.s vgi_rectangle.s
|
||||
ca65 -o vgi.o vgi.s -l vgi.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
clock.data: make_boxes_asm clock.vgi
|
||||
echo "clock_data:" > clock.data
|
||||
./make_boxes_asm < clock.vgi >> clock.data
|
||||
|
||||
###
|
||||
|
||||
make_boxes_asm: make_boxes_asm.o
|
||||
$(CC) -o make_boxes_asm make_boxes_asm.o $(LFLAGS)
|
||||
|
||||
make_boxes_asm.o: make_boxes_asm.c
|
||||
$(CC) $(CFLAGS) -c make_boxes_asm.c
|
||||
|
||||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO VGI make_boxes_asm *.data
|
23
graphics/hgr/vgi/clock.vgi
Normal file
23
graphics/hgr/vgi/clock.vgi
Normal file
@ -0,0 +1,23 @@
|
||||
; Clock from Myst
|
||||
0 255 ; white background
|
||||
1 1 6 0 90 140 191 ; ocean left
|
||||
1 1 6 140 90 279 191 ; ocean right
|
||||
1 4 1 157 121 208 191 ; tower shadow
|
||||
1 0 7 141 116 231 135 ; gear base
|
||||
1 0 7 180 17 213 121 ;
|
||||
1 7 0 156 20 209 126 ; tower
|
||||
1 7 0 145 9 212 20
|
||||
1 0 7 162 0 220 20
|
||||
1 5 0 172 91 187 123
|
||||
1 7 7 169 31 191 63 ; clock face tall
|
||||
1 7 7 165 39 194 60 ; clock face wide
|
||||
1 5 1 0 163 63 191 ; grass
|
||||
1 5 1 63 167 177 191 ; grass
|
||||
1 5 1 177 185 230 191 ; grass
|
||||
1 5 0 23 0 39 178 ; tree
|
||||
1 1 5 1 13 99 44 ; leaves
|
||||
1 5 0 0 0 20 188 ; tree
|
||||
1 0 5 66 0 81 187 ; tree
|
||||
1 1 5 66 1 99 19 ; leaves
|
||||
1 0 0 177 32 181 50 ; clock hand
|
||||
15
|
2
graphics/hgr/vgi/hello.bas
Normal file
2
graphics/hgr/vgi/hello.bas
Normal file
@ -0,0 +1,2 @@
|
||||
5 HOME
|
||||
10 PRINT CHR$(4);"CATALOG"
|
53
graphics/hgr/vgi/make_boxes_asm.c
Normal file
53
graphics/hgr/vgi/make_boxes_asm.c
Normal file
@ -0,0 +1,53 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
char buffer[1024];
|
||||
char *ptr;
|
||||
int type,color1,color2,x1,x2,y1,y2;
|
||||
int line=1;
|
||||
|
||||
while(1) {
|
||||
|
||||
ptr=fgets(buffer,1024,stdin);
|
||||
if (ptr==NULL) break;
|
||||
|
||||
if (buffer[0]==';') continue;
|
||||
|
||||
sscanf(buffer,"%d",&type);
|
||||
|
||||
switch(type) {
|
||||
case 0: /* clear screen */
|
||||
sscanf(buffer,"%d %d",&type,&color1);
|
||||
printf(".byte $%02X,",(type<<4)|2);
|
||||
printf("$%02X\n",color1);
|
||||
break;
|
||||
case 1: /* compact rectangle */
|
||||
sscanf(buffer,"%d %d %d %d %d %d %d",
|
||||
&type,
|
||||
&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);
|
||||
break;
|
||||
|
||||
case 15: /* end */
|
||||
printf(".byte $FF\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,"Unknown type %d\n",type);
|
||||
break;
|
||||
}
|
||||
|
||||
line++;
|
||||
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
78
graphics/hgr/vgi/vgi.s
Normal file
78
graphics/hgr/vgi/vgi.s
Normal file
@ -0,0 +1,78 @@
|
||||
; VGI
|
||||
|
||||
.include "zp.inc"
|
||||
.include "hardware.inc"
|
||||
|
||||
VGI_MAXLEN = 7
|
||||
|
||||
vgi_test:
|
||||
jsr HGR2
|
||||
|
||||
; get pointer to image data
|
||||
|
||||
lda #<clock_data
|
||||
sta VGIL
|
||||
lda #>clock_data
|
||||
sta VGIH
|
||||
|
||||
vgi_loop:
|
||||
|
||||
ldy #0
|
||||
data_smc:
|
||||
lda (VGIL),Y
|
||||
sta VGI_BUFFER,Y
|
||||
iny
|
||||
cpy #VGI_MAXLEN
|
||||
bne data_smc
|
||||
|
||||
lda TYPE
|
||||
and #$f
|
||||
|
||||
clc
|
||||
adc VGIL
|
||||
sta VGIL
|
||||
bcc no_oflo
|
||||
inc VGIH
|
||||
no_oflo:
|
||||
|
||||
lda 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
|
||||
.word vgi_simple_rectangle-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
.word all_done-1
|
||||
|
||||
all_done:
|
||||
jmp all_done
|
||||
|
||||
|
||||
.include "vgi_clearscreen.s"
|
||||
.include "vgi_rectangle.s"
|
||||
|
||||
.include "clock.data"
|
7
graphics/hgr/vgi/vgi_clearscreen.s
Normal file
7
graphics/hgr/vgi/vgi_clearscreen.s
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
vgi_clearscreen:
|
||||
|
||||
lda P0
|
||||
jsr BKGND0
|
||||
|
||||
jmp vgi_loop ; return
|
22
graphics/hgr/vgi/zp.inc
Normal file
22
graphics/hgr/vgi/zp.inc
Normal file
@ -0,0 +1,22 @@
|
||||
; zero page
|
||||
|
||||
HGR_X = $E0
|
||||
HGR_XH = $E1
|
||||
HGR_Y = $E2
|
||||
HGR_COLOR = $E4
|
||||
|
||||
VGI_BUFFER = $F0
|
||||
TYPE = $F0
|
||||
P0 = $F1
|
||||
P1 = $F2
|
||||
P2 = $F3
|
||||
P3 = $F4
|
||||
P4 = $F5
|
||||
P5 = $F6
|
||||
P6 = $F7
|
||||
VGIL = $F8
|
||||
VGIH = $F9
|
||||
|
||||
COLOR1 = $FE
|
||||
COLOR2 = $FF
|
||||
|
Loading…
x
Reference in New Issue
Block a user