From ef0fbe4048ebd6699e18fdf756033914b00c53ec Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 10 Jan 2023 09:14:36 -0500 Subject: [PATCH] shape_table: trying to find a good 16-byte entry --- graphics/hgr/shape_table/Makefile | 33 +++++++++- graphics/hgr/shape_table/herring16.s | 86 ++++++++++++++++++++++++++ graphics/hgr/shape_table/line16.s | 92 ++++++++++++++++++++++++++++ graphics/hgr/shape_table/line32.s | 2 +- graphics/hgr/shape_table/stripe17.s | 92 ++++++++++++++++++++++++++++ linker_scripts/apple2_e7_zp.inc | 12 ++++ 6 files changed, 315 insertions(+), 2 deletions(-) create mode 100644 graphics/hgr/shape_table/herring16.s create mode 100644 graphics/hgr/shape_table/line16.s create mode 100644 graphics/hgr/shape_table/stripe17.s create mode 100644 linker_scripts/apple2_e7_zp.inc diff --git a/graphics/hgr/shape_table/Makefile b/graphics/hgr/shape_table/Makefile index 1c6664c4..e3a0a539 100644 --- a/graphics/hgr/shape_table/Makefile +++ b/graphics/hgr/shape_table/Makefile @@ -8,7 +8,8 @@ EMPTYDISK = ../../../empty_disk/empty.dsk all: gear.dsk gear.dsk: HELLO APPLE.BAS GEAR.BAS \ - APPLE2 GEAR LINE32 PATTERN PATTERN_LOGO SQUARE_WAVE + APPLE2 GEAR LINE32 PATTERN PATTERN_LOGO SQUARE_WAVE \ + LINE16 HERRING16 STRIPE17 cp $(EMPTYDISK) gear.dsk $(DOS33) -y gear.dsk SAVE A HELLO $(DOS33) -y gear.dsk SAVE A GEAR.BAS @@ -16,6 +17,9 @@ gear.dsk: HELLO APPLE.BAS GEAR.BAS \ $(DOS33) -y gear.dsk BSAVE -a 0x3f5 GEAR $(DOS33) -y gear.dsk BSAVE -a 0xc00 APPLE2 $(DOS33) -y gear.dsk BSAVE -a 0xc00 LINE32 + $(DOS33) -y gear.dsk BSAVE -a 0xe7 LINE16 + $(DOS33) -y gear.dsk BSAVE -a 0xe7 STRIPE17 + $(DOS33) -y gear.dsk BSAVE -a 0xc00 HERRING16 $(DOS33) -y gear.dsk BSAVE -a 0xc00 PATTERN $(DOS33) -y gear.dsk BSAVE -a 0x3f5 PATTERN_LOGO $(DOS33) -y gear.dsk BSAVE -a 0xc00 SQUARE_WAVE @@ -69,6 +73,33 @@ LINE32: line32.o line32.o: line32.s ca65 -o line32.o line32.s -l line32.lst +### + +LINE16: line16.o + ld65 -o LINE16 line16.o -C $(LINKERSCRIPTS)/apple2_e7_zp.inc + +line16.o: line16.s + ca65 -o line16.o line16.s -l line16.lst + +### + +STRIPE17: stripe17.o + ld65 -o STRIPE17 stripe17.o -C $(LINKERSCRIPTS)/apple2_e7_zp.inc + +stripe17.o: stripe17.s + ca65 -o stripe17.o stripe17.s -l stripe17.lst + + +### + +HERRING16: herring16.o + ld65 -o HERRING16 herring16.o -C $(LINKERSCRIPTS)/apple2_c00.inc + +herring16.o: herring16.s + ca65 -o herring16.o herring16.s -l herring16.lst + + + ### PATTERN: pattern.o diff --git a/graphics/hgr/shape_table/herring16.s b/graphics/hgr/shape_table/herring16.s new file mode 100644 index 00000000..b23e89e4 --- /dev/null +++ b/graphics/hgr/shape_table/herring16.s @@ -0,0 +1,86 @@ +; 16B herringbone pattern + +; FIXME: depends on memory init + +; 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_SCALE = $E7 +HGR_SHAPE_TABLE = $E8 +HGR_SHAPE_TABLE2= $E9 +HGR_COLLISIONS = $EA +HGR_ROTATION = $F9 +FRAME = $FC +XPOS = $FD +YPOS = $FF + +; ROM calls +HGR2 = $F3D8 +HGR = $F3E2 +HPOSN = $F411 +XDRAW0 = $F65D +XDRAW1 = $F661 +RESTORE = $FF3F + + +tiny_xdraw: + + jsr HGR2 ; Hi-res, full screen ; 3 + ; Y=0, A=0 after this call + +; lda #10 +; sta HGR_SCALE + + ; A and Y are 0 here. + ; X is left behind by the boot process? + + +; ldy #0 +; ldx #100 +; lda #100 + jsr HPOSN ; set screen position to X= (y,x) Y=(a) + ; saves X,Y,A to zero page + ; after Y= orig X/7 + ; A and X are ?? +tiny_loop: + +; ldx #shape_table ; point to top byte of shape address + + ; ROT in A + + ; this will be 0 2nd time through loop, arbitrary otherwise +; lda #1 ; ROT=1 + jsr XDRAW0 ; XDRAW 1 AT X,Y + ; Both A and X are 0 at exit + ; Z flag set on exit + ; Y varies + + inx ; X=1 + txa ; A=1 + tay ; Y=1 + + bne tiny_loop ; bra + +; be sure this is at address $0101, easy to set address +shape_table: + .byte $04,$00 diff --git a/graphics/hgr/shape_table/line16.s b/graphics/hgr/shape_table/line16.s new file mode 100644 index 00000000..37688f36 --- /dev/null +++ b/graphics/hgr/shape_table/line16.s @@ -0,0 +1,92 @@ +; 16B weird line pattern + +; 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_SCALE = $E7 +HGR_SHAPE_TABLE = $E8 +HGR_SHAPE_TABLE2= $E9 +HGR_COLLISIONS = $EA +HGR_ROTATION = $F9 +FRAME = $FC +XPOS = $FD +YPOS = $FF + +; ROM calls +HGR2 = $F3D8 +HGR = $F3E2 +HPOSN = $F411 +XDRAW0 = $F65D +XDRAW1 = $F661 +RESTORE = $FF3F + + +tiny_xdraw: + + .byte $0A ; scale at $E7 (also harmless asl) + + jsr HGR2 ; Hi-res, full screen ; 3 + ; Y=0, A=0 after this call + +; lda #10 +; sta HGR_SCALE + + ; A and Y are 0 here. + ; X is left behind by the boot process? + + +; ldy #0 +; ldx #100 +; lda #100 +; jsr HPOSN ; set screen position to X= (y,x) Y=(a) + ; saves X,Y,A to zero page + ; after Y= orig X/7 + ; A and X are ?? +tiny_loop: + +; ldx #shape_table ; point to top byte of shape address + + ldy #$e8 + ldx #$0e + + ; ROT in A + + ; this will be 0 2nd time through loop, arbitrary otherwise + lda #1 ; ROT=1 + jsr XDRAW0 ; XDRAW 1 AT X,Y + ; Both A and X are 0 at exit + ; Z flag set on exit + ; Y varies + +; jsr $F666 ; rot in X, a=0 +; inx + +; inx ; X=1 +; txa ; A=1 +; tay ; Y=1 + + beq tiny_loop ; bra + +; be sure this is at address $0101, easy to set address +;shape_table: +; .byte $04,$00 diff --git a/graphics/hgr/shape_table/line32.s b/graphics/hgr/shape_table/line32.s index 38a442bf..7e285a7d 100644 --- a/graphics/hgr/shape_table/line32.s +++ b/graphics/hgr/shape_table/line32.s @@ -1,4 +1,4 @@ -; Tiny Xdraw +; 32B weird line pattern ; zero page locations HGR_SHAPE = $1A diff --git a/graphics/hgr/shape_table/stripe17.s b/graphics/hgr/shape_table/stripe17.s new file mode 100644 index 00000000..0ce486fb --- /dev/null +++ b/graphics/hgr/shape_table/stripe17.s @@ -0,0 +1,92 @@ +; 16B weird line pattern + +; 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_SCALE = $E7 +HGR_SHAPE_TABLE = $E8 +HGR_SHAPE_TABLE2= $E9 +HGR_COLLISIONS = $EA +HGR_ROTATION = $F9 +FRAME = $FC +XPOS = $FD +YPOS = $FF + +; ROM calls +HGR2 = $F3D8 +HGR = $F3E2 +HPOSN = $F411 +XDRAW0 = $F65D +XDRAW1 = $F661 +RESTORE = $FF3F + + +tiny_xdraw: + +; .byte $0A ; scale at $E7 (also harmless asl) + + jsr HGR2 ; Hi-res, full screen ; 3 + ; Y=0, A=0 after this call + +; lda #10 +; sta HGR_SCALE + + ; A and Y are 0 here. + ; X is left behind by the boot process? + + +; ldy #0 +; ldx #100 +; lda #100 + jsr HPOSN ; set screen position to X= (y,x) Y=(a) + ; saves X,Y,A to zero page + ; after Y= orig X/7 + ; A and X are ?? +tiny_loop: + +; ldx #shape_table ; point to top byte of shape address + + ldy #$e8 + ldx #$0e + + ; ROT in A + + ; this will be 0 2nd time through loop, arbitrary otherwise + lda #1 ; ROT=1 + jsr XDRAW0 ; XDRAW 1 AT X,Y + ; Both A and X are 0 at exit + ; Z flag set on exit + ; Y varies + +; jsr $F666 ; rot in X, a=0 +; inx + +; inx ; X=1 +; txa ; A=1 +; tay ; Y=1 + + beq tiny_loop ; bra + +; be sure this is at address $0101, easy to set address +;shape_table: +; .byte $04,$00 diff --git a/linker_scripts/apple2_e7_zp.inc b/linker_scripts/apple2_e7_zp.inc new file mode 100644 index 00000000..a670f054 --- /dev/null +++ b/linker_scripts/apple2_e7_zp.inc @@ -0,0 +1,12 @@ +MEMORY { + ZP: start = $E7, size = $90, type = rw; + RAM: start = $E7, size = $8E00, file = %O; +} + +SEGMENTS { +CODE: load = RAM, type = ro; +#RODATA: load = RAM, type = ro; +#DATA: load = RAM, type = rw; +#BSS: load = RAM, type = bss, define = yes; +ZEROPAGE: load = ZP, type = ro; +}