From b6518e69ab7664395cbec21a6dadafe296df7bce Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 20 Jan 2022 22:48:42 -0500 Subject: [PATCH] tiny_gr: update to be more robust --- demos/l/tinygr_8/Makefile | 8 ++--- .../tinygr_8/{apple2_b8.inc => apple2_b9.inc} | 2 +- demos/l/tinygr_8/file_id.diz | 18 +++++++++-- demos/l/tinygr_8/hello.bas | 7 +++-- demos/l/tinygr_8/tiny_gr.s | 31 +++++++++++++++++-- 5 files changed, 52 insertions(+), 14 deletions(-) rename demos/l/tinygr_8/{apple2_b8.inc => apple2_b9.inc} (82%) diff --git a/demos/l/tinygr_8/Makefile b/demos/l/tinygr_8/Makefile index c5ebab46..6a8399c6 100644 --- a/demos/l/tinygr_8/Makefile +++ b/demos/l/tinygr_8/Makefile @@ -9,13 +9,13 @@ all: tiny_gr8.dsk tiny_gr8.dsk: HELLO TINY_GR cp $(EMPTYDISK) tiny_gr8.dsk $(DOS33) -y tiny_gr8.dsk SAVE A HELLO - $(DOS33) -y tiny_gr8.dsk BSAVE -a 0xB8 TINY_GR + $(DOS33) -y tiny_gr8.dsk BSAVE -a 0xB9 TINY_GR ### -submit: text8.zip +submit: tiny_gr8.zip -text8.zip: TINY_GR tiny_gr.s file_id.diz tiny_gr8.dsk +tiny_gr8.zip: TINY_GR tiny_gr.s file_id.diz tiny_gr8.dsk mkdir -p lovebyte2021_tiny_gr8 cp TINY_GR ./lovebyte2021_tiny_gr8 cp tiny_gr.s ./lovebyte2021_tiny_gr8 @@ -35,7 +35,7 @@ HELLO: hello.bas ### TINY_GR: tiny_gr.o - ld65 -o TINY_GR tiny_gr.o -C ./apple2_b8.inc + ld65 -o TINY_GR tiny_gr.o -C ./apple2_b9.inc tiny_gr.o: tiny_gr.s ca65 -o tiny_gr.o tiny_gr.s -l tiny_gr.lst diff --git a/demos/l/tinygr_8/apple2_b8.inc b/demos/l/tinygr_8/apple2_b9.inc similarity index 82% rename from demos/l/tinygr_8/apple2_b8.inc rename to demos/l/tinygr_8/apple2_b9.inc index fc22016b..117bc628 100644 --- a/demos/l/tinygr_8/apple2_b8.inc +++ b/demos/l/tinygr_8/apple2_b9.inc @@ -1,6 +1,6 @@ MEMORY { ZP: start = $00, size = $1A, type = rw; - RAM: start = $b8, size = $8E00, file = %O; + RAM: start = $b9, size = $8E00, file = %O; } SEGMENTS { diff --git a/demos/l/tinygr_8/file_id.diz b/demos/l/tinygr_8/file_id.diz index f1c9f3f0..7e558488 100644 --- a/demos/l/tinygr_8/file_id.diz +++ b/demos/l/tinygr_8/file_id.diz @@ -1,5 +1,17 @@ -Tiny Text +Tiny GR 8 - -Textmode Hex Scroller -8-byte Intro for Apple II, Lovebyte 2021 +8-byte Intro for Apple II, Lovebyte 2022 by Deater / dSr + +You can't do much 6502 assembly in 8 bytes. +This code takes advantage of the fact that on boot, Applesoft BASIC +puts a short routine CHRGET in RAM at address $B1-$C8 that parses +tokens. We can drop our code in the middle of there and re-use +some of the branching infrastructure. + +What this code does is just read out memory, starting at $7800 and +printing it to the screen, with lo-res mode enabled. This makes +a pattern that depends on the default power up of the DRAM (white and black +bars for many Apple II models). At the end it crashes through DOS3.3 +(the colored pattern) and then into the MMIO (soft-switch) area +which leads to a switch to hi-res, some brief sound, then a crash. diff --git a/demos/l/tinygr_8/hello.bas b/demos/l/tinygr_8/hello.bas index 78952d62..051e33d5 100644 --- a/demos/l/tinygr_8/hello.bas +++ b/demos/l/tinygr_8/hello.bas @@ -1,8 +1,9 @@ 5 HOME -10 PRINT "TINY TEXT -- AN 8 BYTE APPLE II INTRO" +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_TEXT'" +25 PRINT:PRINT "PRESS ANY KEY TO 'BRUN TINY_GR'" 30 GET A$ 35 PRINT -40 PRINT CHR$(4)"BRUN TINY_TEXT" +40 PRINT "]BRUN TINY_GR" +50 PRINT CHR$(4)"BRUN TINY_GR" diff --git a/demos/l/tinygr_8/tiny_gr.s b/demos/l/tinygr_8/tiny_gr.s index 09170919..5b606ca5 100644 --- a/demos/l/tinygr_8/tiny_gr.s +++ b/demos/l/tinygr_8/tiny_gr.s @@ -4,6 +4,8 @@ ; 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 @@ -15,7 +17,30 @@ 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 tiny_loop: - lda #$20 - bit $C050 - jsr COUT +; 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