From d7ebc52fcdd00b7e54bfc1ed8f8be1fc103208fd Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 18 May 2022 20:30:49 -0400 Subject: [PATCH] graphics: hgr: xw --- graphics/hgr/xw/Makefile | 39 ++++++++++++ graphics/hgr/xw/hello.bas | 2 + graphics/hgr/xw/xw.bas | 9 +++ graphics/hgr/xw/xw.s | 127 ++++++++++++++++++++++++++++++++++++++ graphics/hgr/xw/xw.shape | 25 ++++++++ 5 files changed, 202 insertions(+) create mode 100644 graphics/hgr/xw/Makefile create mode 100644 graphics/hgr/xw/hello.bas create mode 100644 graphics/hgr/xw/xw.bas create mode 100644 graphics/hgr/xw/xw.s create mode 100644 graphics/hgr/xw/xw.shape diff --git a/graphics/hgr/xw/Makefile b/graphics/hgr/xw/Makefile new file mode 100644 index 00000000..2ddfcaed --- /dev/null +++ b/graphics/hgr/xw/Makefile @@ -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 diff --git a/graphics/hgr/xw/hello.bas b/graphics/hgr/xw/hello.bas new file mode 100644 index 00000000..133a44bb --- /dev/null +++ b/graphics/hgr/xw/hello.bas @@ -0,0 +1,2 @@ +5 HOME +10 PRINT CHR$(4);"CATALOG" diff --git a/graphics/hgr/xw/xw.bas b/graphics/hgr/xw/xw.bas new file mode 100644 index 00000000..6751e906 --- /dev/null +++ b/graphics/hgr/xw/xw.bas @@ -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 + diff --git a/graphics/hgr/xw/xw.s b/graphics/hgr/xw/xw.s new file mode 100644 index 00000000..a207bcd4 --- /dev/null +++ b/graphics/hgr/xw/xw.s @@ -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 ; 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 + + + diff --git a/graphics/hgr/xw/xw.shape b/graphics/hgr/xw/xw.shape new file mode 100644 index 00000000..801a72c3 --- /dev/null +++ b/graphics/hgr/xw/xw.shape @@ -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