graphics: hgr: xw

This commit is contained in:
Vince Weaver 2022-05-18 20:30:49 -04:00
parent c3bd11a910
commit d7ebc52fcd
5 changed files with 202 additions and 0 deletions

39
graphics/hgr/xw/Makefile Normal file
View File

@ -0,0 +1,39 @@
include ../../../Makefile.inc
DOS33 = ../../../utils/dos33fs-utils/dos33
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
LINKER_SCRIPTS = ../../../linker_scripts
EMPTY_DISK = ../../../empty_disk/empty.dsk
all: xw.dsk
xw.dsk: HELLO XW XW.BAS
cp $(EMPTY_DISK) xw.dsk
$(DOS33) -y xw.dsk SAVE A HELLO
$(DOS33) -y xw.dsk SAVE A XW.BAS
$(DOS33) -y xw.dsk BSAVE -a 0x70 XW
###
HELLO: hello.bas
$(TOKENIZE) < hello.bas > HELLO
###
XW.BAS: xw.bas
$(TOKENIZE) < xw.bas > XW.BAS
###
XW: xw.o
ld65 -o XW xw.o -C $(LINKER_SCRIPTS)/apple2_70_zp.inc
xw.o: xw.s
ca65 -o xw.o xw.s -l xw.lst
###
clean:
rm -f *~ *.o *.lst XW

View File

@ -0,0 +1,2 @@
5 HOME
10 PRINT CHR$(4);"CATALOG"

9
graphics/hgr/xw/xw.bas Normal file
View File

@ -0,0 +1,9 @@
10 HIMEM:8162
20 POKE 232,226:POKE 233,31
30 FOR L=8162 TO 8175: READ B:POKE L,B:NEXT L
35 HGR:ROT=0:SCALE=5
40 FOR I=1 TO 5: XDRAW 1 AT I*25,100:ROT=I*4:NEXT I
90 END
100 DATA 1,0,4,0,137,164,55,63,156,164
101 DATA 37,45,6,0

127
graphics/hgr/xw/xw.s Normal file
View File

@ -0,0 +1,127 @@
; Tiny xw
; zero page locations
HGR_SHAPE = $1A
HGR_SHAPE2 = $1B
HGR_BITS = $1C
GBASL = $26
GBASH = $27
A5H = $45
XREG = $46
YREG = $47
; C0-CF should be clear
; D0-DF?? D0-D5 = HGR scratch?
HGR_DX = $D0 ; HGLIN
HGR_DX2 = $D1 ; HGLIN
HGR_DY = $D2 ; HGLIN
HGR_QUADRANT = $D3
HGR_E = $D4
HGR_E2 = $D5
HGR_X = $E0
HGR_X2 = $E1
HGR_Y = $E2
HGR_COLOR = $E4
HGR_HORIZ = $E5
HGR_PAGE = $E6
HGR_SCALE = $E7
HGR_SHAPE_TABLE = $E8
HGR_SHAPE_TABLE2= $E9
HGR_COLLISIONS = $EA
; soft-switch
PAGE1 = $C054
; ROM calls
HGR2 = $F3D8
HGR = $F3E2
HPOSN = $F411
XDRAW0 = $F65D
XDRAW1 = $F661
RESTORE = $FF3F
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
HCLR = $F3F2 ; A=0, Y=0 after, X unchanged
OUR_ROT=$E0
.zeropage
.globalzp rot_smc
; spinning dsr logo
dsr_spin:
jsr HGR2 ; Hi-res, full screen ; 3
; Y=0, A=0 after this call
sty HGR_SCALE ; 2 init scale to 0
;=========================================
; MAIN LOOP
;=========================================
main_loop:
inc HGR_SCALE ; 2 ; increment scale
inc rot_smc+1 ; 2 ; rotate
inc rot_smc+1 ; 2
;=======================
; xdraw
;=======================
xdraw:
; setup X and Y co-ords
ldy #0 ; XPOSH always 0 for us
ldx #110
lda #96
jsr HPOSN ; X= (y,x) Y=(a)
; after, A=COLOR.BITS
; Y = xoffset (140/7=20?)
; X = remainder?
jsr HCLR ; A=0 and Y=0 after, X=unchanged
ldx #<shape_dsr ; point to our shape
; ldy #>shape_dsr ; this is always zero since in zero page
rot_smc:
lda #$0 ; set rotation
jsr XDRAW0 ; XDRAW 1 AT X,Y
flip_page:
; flip draw page $20/$40
lda HGR_PAGE
eor #$60
sta HGR_PAGE
; flip page
; have $20/$40 want to map to C054/C055
asl
asl ; $20 -> C=1 $00
asl ; $40 -> C=0 $00
rol
tax
sta PAGE1,X
; A and X are 0/1 here
; if rot_smc not 64 then loop
bit rot_smc+1 ; set V if bit 6 set
bvc main_loop ; 2
; fall through at end and crash
shape_dsr:
.byte $89,$a4,$37,$3f
.byte $9c,$a4,$25,$2d,$06,$00

25
graphics/hgr/xw/xw.shape Normal file
View File

@ -0,0 +1,25 @@
# Number of shapes
1
START
NRT
NRT
NDN
UP
UP
NDN
LT
DN
LT
LT
UP
NLT
NDN
UP
UP
NDN
RT
UP
RT
RT
DN
STOP