From 99e183cc3387a9a0c74e179ce36963372e5e8d27 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 8 Feb 2023 11:09:39 -0500 Subject: [PATCH] tiny_hgr8: didn't think it was possible --- demos/lovebyte2023/tinyhgr_8/Makefile | 45 ++++++++++++ demos/lovebyte2023/tinyhgr_8/apple2_b8.inc | 12 ++++ demos/lovebyte2023/tinyhgr_8/file_id.diz | 11 +++ demos/lovebyte2023/tinyhgr_8/hello.bas | 9 +++ demos/lovebyte2023/tinyhgr_8/monitor.txt | 4 ++ demos/lovebyte2023/tinyhgr_8/tiny_hgr.s | 58 ++++++++++++++++ graphics/hgr/tinyhgr/Makefile | 77 +++++++++++++++++++++ graphics/hgr/tinyhgr/apple2_b8.inc | 12 ++++ graphics/hgr/tinyhgr/apple2_b9.inc | 12 ++++ graphics/hgr/tinyhgr/hello.bas | 9 +++ graphics/hgr/tinyhgr/tiny_blinds.s | 80 ++++++++++++++++++++++ graphics/hgr/tinyhgr/tiny_hgr.s | 70 +++++++++++++++++++ graphics/hgr/tinyhgr/tiny_hgr2.s | 70 +++++++++++++++++++ graphics/hgr/tinyhgr/tiny_hgr3.s | 58 ++++++++++++++++ 14 files changed, 527 insertions(+) create mode 100644 demos/lovebyte2023/tinyhgr_8/Makefile create mode 100644 demos/lovebyte2023/tinyhgr_8/apple2_b8.inc create mode 100644 demos/lovebyte2023/tinyhgr_8/file_id.diz create mode 100644 demos/lovebyte2023/tinyhgr_8/hello.bas create mode 100644 demos/lovebyte2023/tinyhgr_8/monitor.txt create mode 100644 demos/lovebyte2023/tinyhgr_8/tiny_hgr.s create mode 100644 graphics/hgr/tinyhgr/Makefile create mode 100644 graphics/hgr/tinyhgr/apple2_b8.inc create mode 100644 graphics/hgr/tinyhgr/apple2_b9.inc create mode 100644 graphics/hgr/tinyhgr/hello.bas create mode 100644 graphics/hgr/tinyhgr/tiny_blinds.s create mode 100644 graphics/hgr/tinyhgr/tiny_hgr.s create mode 100644 graphics/hgr/tinyhgr/tiny_hgr2.s create mode 100644 graphics/hgr/tinyhgr/tiny_hgr3.s diff --git a/demos/lovebyte2023/tinyhgr_8/Makefile b/demos/lovebyte2023/tinyhgr_8/Makefile new file mode 100644 index 00000000..6c8d355d --- /dev/null +++ b/demos/lovebyte2023/tinyhgr_8/Makefile @@ -0,0 +1,45 @@ +include ../../../Makefile.inc + +DOS33 = ../../../utils/dos33fs-utils/dos33 +TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft +EMPTYDISK = ../../../empty_disk/empty.dsk + +all: tiny_hgr8.dsk + +tiny_hgr8.dsk: HELLO TINY_HGR + cp $(EMPTYDISK) tiny_hgr8.dsk + $(DOS33) -y tiny_hgr8.dsk SAVE A HELLO + $(DOS33) -y tiny_hgr8.dsk BSAVE -a 0xB8 TINY_HGR +### + +submit: tiny_hgr8.zip + +tiny_hgr8.zip: TINY_HGR tiny_hgr.s file_id.diz tiny_hgr8.dsk + mkdir -p lovebyte2023_tiny_hgr8 + cp TINY_HGR ./lovebyte2023_tiny_hgr8 + cp tiny_hgr.s ./lovebyte2023_tiny_hgr8 + cp file_id.diz ./lovebyte2023_tiny_hgr8 + cp tiny_hgr8.dsk ./lovebyte2023_tiny_hgr8 + cp tiny_hgr8_720p.mp4 ./lovebyte2023_tiny_hgr8 + zip -r tiny_hgr8.zip lovebyte2023_tiny_hgr8 + +#### + + +#### + +HELLO: hello.bas + $(TOKENIZE) < hello.bas > HELLO + +### + +TINY_HGR: tiny_hgr.o + ld65 -o TINY_HGR tiny_hgr.o -C ./apple2_b8.inc + +tiny_hgr.o: tiny_hgr.s + ca65 -o tiny_hgr.o tiny_hgr.s -l tiny_hgr.lst + +#### + +clean: + rm -f *~ *.o *.lst HELLO TINY_HGR TINY_HGR2 TINY_HGR3 *.zip diff --git a/demos/lovebyte2023/tinyhgr_8/apple2_b8.inc b/demos/lovebyte2023/tinyhgr_8/apple2_b8.inc new file mode 100644 index 00000000..fc22016b --- /dev/null +++ b/demos/lovebyte2023/tinyhgr_8/apple2_b8.inc @@ -0,0 +1,12 @@ +MEMORY { + ZP: start = $00, size = $1A, type = rw; + RAM: start = $b8, 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 = zp; +} diff --git a/demos/lovebyte2023/tinyhgr_8/file_id.diz b/demos/lovebyte2023/tinyhgr_8/file_id.diz new file mode 100644 index 00000000..e8548f57 --- /dev/null +++ b/demos/lovebyte2023/tinyhgr_8/file_id.diz @@ -0,0 +1,11 @@ +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Tiny HGR 8 +--------------------------------------- +8-byte Hi-res Intro for Apple II +Lovebyte 2023 +by Deater / dSr + +Needs Applesoft in ROM (most Apple IIs + meet this) + +Loads code into middle of CHRGET routine diff --git a/demos/lovebyte2023/tinyhgr_8/hello.bas b/demos/lovebyte2023/tinyhgr_8/hello.bas new file mode 100644 index 00000000..30a27352 --- /dev/null +++ b/demos/lovebyte2023/tinyhgr_8/hello.bas @@ -0,0 +1,9 @@ +5 HOME +10 PRINT " TINY HGR -- AN 8 BYTE APPLE II INTRO" +15 PRINT " BY DEATER / DSR" +20 PRINT CHR$(4)"CATALOG" +25 PRINT:PRINT "PRESS ANY KEY TO 'BRUN TINY_HGR'" +30 GET A$ +35 PRINT +40 PRINT "]BRUN TINY_HGR" +50 PRINT CHR$(4)"BRUN TINY_HGR" diff --git a/demos/lovebyte2023/tinyhgr_8/monitor.txt b/demos/lovebyte2023/tinyhgr_8/monitor.txt new file mode 100644 index 00000000..c4f517d5 --- /dev/null +++ b/demos/lovebyte2023/tinyhgr_8/monitor.txt @@ -0,0 +1,4 @@ +CALL -151 +B8: 2c ea 20 f4 f3 20 d8 f3 +B8G + diff --git a/demos/lovebyte2023/tinyhgr_8/tiny_hgr.s b/demos/lovebyte2023/tinyhgr_8/tiny_hgr.s new file mode 100644 index 00000000..99c9dc72 --- /dev/null +++ b/demos/lovebyte2023/tinyhgr_8/tiny_hgr.s @@ -0,0 +1,58 @@ +; Tiny HGr + +; 8-byte Apple II Hi-res intro + +; by Vince `deater` Weaver, vince@deater.net --- d e s i r e --- + +; drops into the middle of the CHRGET get next token routine +; that the Applesoft interpreter copies to $B1 - $C8 on boot + +; Depends on $F3 being executed as a NOP + +; zero page locations + +; ROM calls +HGR2 = $F3D8 +HPOSN = $F411 +XDRAW0 = $F65D +BKGND0 = $F3F4 ; A is color, after A=$40/$60, Y=0 + ; $E6 needs to be $20/$40 + ; alternately can jump slightly further + ; and have $1B be $20/$40 + +tiny_hgr: + +;chrget B1: E6 B8 inc txtptrl +; B3: D0 02 bne chrgot +; B5: E6 B9 inc txtptrh +;chrgot B7: AD 00 08 lda $800 txtprtrl/txtptrh +; BA: C9 3A cmp #$3A +; BC: B0 0A bcs end +; BE: C9 20 cmp #$20 +; C0: F0 EF beq chrget +; C2: 38 sec +; C3: E9 30 sbc #$30 +; C5: 38 sec +; C6: E9 D0 sbc #$D0 +; C8: 60 rts + + +; we drop this at B8 + + +tiny_loop: +.byte $2c ; BIT ; skips the BKGND0 first time through + ; otherwise it rights garbage all over + ; first 8k of RAM due to HGR_PAGE + ; not being set + + nop ; $EA ; points to ROM $EA2C as base for random colors + + jsr BKGND0 ; clear screen to value in A + ; $20 $F3 $F4, depends on f3/f4 being nops + ; first time through the loop + + jsr HGR2 ; HGR2 -- init full-screen hi-res graphics + ; zero flag set + +; code already in RAM does a BEQ diff --git a/graphics/hgr/tinyhgr/Makefile b/graphics/hgr/tinyhgr/Makefile new file mode 100644 index 00000000..7b183c7b --- /dev/null +++ b/graphics/hgr/tinyhgr/Makefile @@ -0,0 +1,77 @@ +include ../../../Makefile.inc + +DOS33 = ../../../utils/dos33fs-utils/dos33 +TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft +EMPTYDISK = ../../../empty_disk/empty.dsk + +all: tiny_hgr8.dsk + +tiny_hgr8.dsk: HELLO TINY_HGR TINY_HGR2 TINY_HGR3 TINY_BLINDS + cp $(EMPTYDISK) tiny_hgr8.dsk + $(DOS33) -y tiny_hgr8.dsk SAVE A HELLO + $(DOS33) -y tiny_hgr8.dsk BSAVE -a 0xB9 TINY_HGR + $(DOS33) -y tiny_hgr8.dsk BSAVE -a 0xB9 TINY_HGR2 + $(DOS33) -y tiny_hgr8.dsk BSAVE -a 0xB9 TINY_BLINDS + $(DOS33) -y tiny_hgr8.dsk BSAVE -a 0xB8 TINY_HGR3 + +### + +submit: tiny_hgr8.zip + +tiny_hgr8.zip: TINY_HGR tiny_hgr.s file_id.diz tiny_hgr8.dsk + mkdir -p lovebyte2023_tiny_hgr8 + cp TINY_HGR ./lovebyte2023_tiny_hgr8 + cp tiny_hgr.s ./lovebyte2023_tiny_hgr8 + cp file_id.diz ./lovebyte2023_tiny_hgr8 + cp tiny_hgr8.dsk ./lovebyte2023_tiny_hgr8 + cp tiny_hgr8_720p.mp4 ./lovebyte2023_tiny_hgr8 + zip -r tiny_hgr8.zip lovebyte2023_tiny_hgr8 + +#### + + +#### + +HELLO: hello.bas + $(TOKENIZE) < hello.bas > HELLO + +### + +TINY_HGR: tiny_hgr.o + ld65 -o TINY_HGR tiny_hgr.o -C ./apple2_b9.inc + +tiny_hgr.o: tiny_hgr.s + ca65 -o tiny_hgr.o tiny_hgr.s -l tiny_hgr.lst + +### + +TINY_HGR2: tiny_hgr2.o + ld65 -o TINY_HGR2 tiny_hgr2.o -C ./apple2_b9.inc + +tiny_hgr2.o: tiny_hgr2.s + ca65 -o tiny_hgr2.o tiny_hgr2.s -l tiny_hgr2.lst + +### + +TINY_BLINDS: tiny_blinds.o + ld65 -o TINY_BLINDS tiny_blinds.o -C ./apple2_b9.inc + +tiny_blinds.o: tiny_blinds.s + ca65 -o tiny_blinds.o tiny_blinds.s -l tiny_blinds.lst + + + +### + +TINY_HGR3: tiny_hgr3.o + ld65 -o TINY_HGR3 tiny_hgr3.o -C ./apple2_b8.inc + +tiny_hgr3.o: tiny_hgr3.s + ca65 -o tiny_hgr3.o tiny_hgr3.s -l tiny_hgr3.lst + + + +#### + +clean: + rm -f *~ *.o *.lst HELLO TINY_HGR TINY_HGR2 TINY_HGR3 TINY_BLINDS *.zip diff --git a/graphics/hgr/tinyhgr/apple2_b8.inc b/graphics/hgr/tinyhgr/apple2_b8.inc new file mode 100644 index 00000000..fc22016b --- /dev/null +++ b/graphics/hgr/tinyhgr/apple2_b8.inc @@ -0,0 +1,12 @@ +MEMORY { + ZP: start = $00, size = $1A, type = rw; + RAM: start = $b8, 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 = zp; +} diff --git a/graphics/hgr/tinyhgr/apple2_b9.inc b/graphics/hgr/tinyhgr/apple2_b9.inc new file mode 100644 index 00000000..117bc628 --- /dev/null +++ b/graphics/hgr/tinyhgr/apple2_b9.inc @@ -0,0 +1,12 @@ +MEMORY { + ZP: start = $00, size = $1A, type = rw; + RAM: start = $b9, 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 = zp; +} diff --git a/graphics/hgr/tinyhgr/hello.bas b/graphics/hgr/tinyhgr/hello.bas new file mode 100644 index 00000000..051e33d5 --- /dev/null +++ b/graphics/hgr/tinyhgr/hello.bas @@ -0,0 +1,9 @@ +5 HOME +10 PRINT " TINY GR -- AN 8 BYTE APPLE II INTRO" +15 PRINT " BY DEATER / DSR" +20 PRINT CHR$(4)"CATALOG" +25 PRINT:PRINT "PRESS ANY KEY TO 'BRUN TINY_GR'" +30 GET A$ +35 PRINT +40 PRINT "]BRUN TINY_GR" +50 PRINT CHR$(4)"BRUN TINY_GR" diff --git a/graphics/hgr/tinyhgr/tiny_blinds.s b/graphics/hgr/tinyhgr/tiny_blinds.s new file mode 100644 index 00000000..59ec2349 --- /dev/null +++ b/graphics/hgr/tinyhgr/tiny_blinds.s @@ -0,0 +1,80 @@ +; Tiny Gr + +; by Vince `deater` Weaver, vince@deater.net --- d e s i r e --- + +; trying to make small graphics in 8 bytes for Apple II + +; drops into the middle of the CHRGET get next token routine +; that the Applesoft interpreter copies to $B1 - $C8 on boot + +; zero page locations + +; ROM calls +SETGR = $FB40 ; set lo-res graphics code, clear screen +PRHEX = $FDE3 ; print hex digit +COUT = $FDED ; output A to screen +COUT1 = $FDF0 ; output A to screen + +tiny_gr: + +;chrget B1: E6 B8 inc txtptrl +; B3: D0 02 bne chrgot +; B5: E6 B9 inc txtptrh +;chrgot B7: AD 00 08 lda $800 txtprtrl/txtptrh +; BA: C9 3A cmp #$3A +; BC: B0 0A bcs end +; BE: C9 20 cmp #$20 +; C0: F0 EF beq chrget +; C2: 38 sec +; C3: E9 30 sbc #$30 +; C5: 38 sec +; C6: E9 D0 sbc #$D0 +; C8: 60 rts + +; we drop this at B9 + +;chrget B1: E6 B8 inc txtptrl +; B3: D0 02 bne chrgot +; B5: E6 B9 inc txtptrh +;chrgot B7: AD 00 08 lda $800 + + +.if 0 +tiny_loop: +; lda $7800 +.byte $78 ; sei ; B9 + bit $C050 ; BA BB BC set LORES + jsr COUT1 ; BD BE BF output A to stdout, with scroll +.byte $50 ; bvc (bra we hope) ; C0 +; chrget + +.endif + +HGR2 = $F3D8 +HPOSN = $F411 +XDRAW0 = $F65D +BKGND0 = $F3F4 ; A is color, after A=$40/$60, Y=0 + ; $E6 needs to be $20/$40 + ; alternately can jump slightly further + ; and have $1B be $20/$40 +.pc02 + +tiny_loop: +;nop +.byte $2c + + jsr BKGND0 ; 6 + + jsr HGR2 ; HGR2 ; 3 +.byte $F0 ; original + +; jsr HPOSN ; 3 +; plx +; ply + +;tinier_loop: +; jsr XDRAW0 ; 3 +; ply +;.byte $50 +; jmp tiny_loop +; bvc tinier_loop diff --git a/graphics/hgr/tinyhgr/tiny_hgr.s b/graphics/hgr/tinyhgr/tiny_hgr.s new file mode 100644 index 00000000..79419660 --- /dev/null +++ b/graphics/hgr/tinyhgr/tiny_hgr.s @@ -0,0 +1,70 @@ +; Tiny Gr + +; by Vince `deater` Weaver, vince@deater.net --- d e s i r e --- + +; trying to make small graphics in 8 bytes for Apple II + +; drops into the middle of the CHRGET get next token routine +; that the Applesoft interpreter copies to $B1 - $C8 on boot + +; zero page locations + +; ROM calls +SETGR = $FB40 ; set lo-res graphics code, clear screen +PRHEX = $FDE3 ; print hex digit +COUT = $FDED ; output A to screen +COUT1 = $FDF0 ; output A to screen + +tiny_gr: + +;chrget B1: E6 B8 inc txtptrl +; B3: D0 02 bne chrgot +; B5: E6 B9 inc txtptrh +;chrgot B7: AD 00 08 lda $800 txtprtrl/txtptrh +; BA: C9 3A cmp #$3A +; BC: B0 0A bcs end +; BE: C9 20 cmp #$20 +; C0: F0 EF beq chrget +; C2: 38 sec +; C3: E9 30 sbc #$30 +; C5: 38 sec +; C6: E9 D0 sbc #$D0 +; C8: 60 rts + +; we drop this at B9 + +;chrget B1: E6 B8 inc txtptrl +; B3: D0 02 bne chrgot +; B5: E6 B9 inc txtptrh +;chrgot B7: AD 00 08 lda $800 + + +.if 0 +tiny_loop: +; lda $7800 +.byte $78 ; sei ; B9 + bit $C050 ; BA BB BC set LORES + jsr COUT1 ; BD BE BF output A to stdout, with scroll +.byte $50 ; bvc (bra we hope) ; C0 +; chrget + +.endif + +HGR2 = $F3D8 +HPOSN = $F411 +XDRAW0 = $F65D + +.pc02 + +tiny_loop: + jsr HGR2 ; HGR2 ; 3 + +; jsr HPOSN ; 3 +; plx +; ply + + jsr XDRAW0 ; 3 + nop +.byte $50 +; jmp tiny_loop + diff --git a/graphics/hgr/tinyhgr/tiny_hgr2.s b/graphics/hgr/tinyhgr/tiny_hgr2.s new file mode 100644 index 00000000..86bd723e --- /dev/null +++ b/graphics/hgr/tinyhgr/tiny_hgr2.s @@ -0,0 +1,70 @@ +; Tiny Gr + +; by Vince `deater` Weaver, vince@deater.net --- d e s i r e --- + +; trying to make small graphics in 8 bytes for Apple II + +; drops into the middle of the CHRGET get next token routine +; that the Applesoft interpreter copies to $B1 - $C8 on boot + +; zero page locations + +; ROM calls +SETGR = $FB40 ; set lo-res graphics code, clear screen +PRHEX = $FDE3 ; print hex digit +COUT = $FDED ; output A to screen +COUT1 = $FDF0 ; output A to screen + +tiny_gr: + +;chrget B1: E6 B8 inc txtptrl +; B3: D0 02 bne chrgot +; B5: E6 B9 inc txtptrh +;chrgot B7: AD 00 08 lda $800 txtprtrl/txtptrh +; BA: C9 3A cmp #$3A +; BC: B0 0A bcs end +; BE: C9 20 cmp #$20 +; C0: F0 EF beq chrget +; C2: 38 sec +; C3: E9 30 sbc #$30 +; C5: 38 sec +; C6: E9 D0 sbc #$D0 +; C8: 60 rts + +; we drop this at B9 + +;chrget B1: E6 B8 inc txtptrl +; B3: D0 02 bne chrgot +; B5: E6 B9 inc txtptrh +;chrgot B7: AD 00 08 lda $800 + + +.if 0 +tiny_loop: +; lda $7800 +.byte $78 ; sei ; B9 + bit $C050 ; BA BB BC set LORES + jsr COUT1 ; BD BE BF output A to stdout, with scroll +.byte $50 ; bvc (bra we hope) ; C0 +; chrget + +.endif + +HGR2 = $F3D8 +HPOSN = $F411 +XDRAW0 = $F65D + +.pc02 + +tiny_loop: + jsr HGR2 ; HGR2 ; 3 + +; jsr HPOSN ; 3 +; plx +; ply + + jsr XDRAW0 ; 3 + plx +.byte $50 +; jmp tiny_loop + diff --git a/graphics/hgr/tinyhgr/tiny_hgr3.s b/graphics/hgr/tinyhgr/tiny_hgr3.s new file mode 100644 index 00000000..99c9dc72 --- /dev/null +++ b/graphics/hgr/tinyhgr/tiny_hgr3.s @@ -0,0 +1,58 @@ +; Tiny HGr + +; 8-byte Apple II Hi-res intro + +; by Vince `deater` Weaver, vince@deater.net --- d e s i r e --- + +; drops into the middle of the CHRGET get next token routine +; that the Applesoft interpreter copies to $B1 - $C8 on boot + +; Depends on $F3 being executed as a NOP + +; zero page locations + +; ROM calls +HGR2 = $F3D8 +HPOSN = $F411 +XDRAW0 = $F65D +BKGND0 = $F3F4 ; A is color, after A=$40/$60, Y=0 + ; $E6 needs to be $20/$40 + ; alternately can jump slightly further + ; and have $1B be $20/$40 + +tiny_hgr: + +;chrget B1: E6 B8 inc txtptrl +; B3: D0 02 bne chrgot +; B5: E6 B9 inc txtptrh +;chrgot B7: AD 00 08 lda $800 txtprtrl/txtptrh +; BA: C9 3A cmp #$3A +; BC: B0 0A bcs end +; BE: C9 20 cmp #$20 +; C0: F0 EF beq chrget +; C2: 38 sec +; C3: E9 30 sbc #$30 +; C5: 38 sec +; C6: E9 D0 sbc #$D0 +; C8: 60 rts + + +; we drop this at B8 + + +tiny_loop: +.byte $2c ; BIT ; skips the BKGND0 first time through + ; otherwise it rights garbage all over + ; first 8k of RAM due to HGR_PAGE + ; not being set + + nop ; $EA ; points to ROM $EA2C as base for random colors + + jsr BKGND0 ; clear screen to value in A + ; $20 $F3 $F4, depends on f3/f4 being nops + ; first time through the loop + + jsr HGR2 ; HGR2 -- init full-screen hi-res graphics + ; zero flag set + +; code already in RAM does a BEQ