From c9ecfaf997536ae6be9b39fb1a7cda036bd5382c Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 12 Jan 2022 00:05:34 -0500 Subject: [PATCH] stargate: initial checkin --- demos/l/stargate/Makefile | 39 ++++++++++ demos/l/stargate/hello.bas | 2 + demos/l/stargate/stargate.s | 150 ++++++++++++++++++++++++++++++++++++ 3 files changed, 191 insertions(+) create mode 100644 demos/l/stargate/Makefile create mode 100644 demos/l/stargate/hello.bas create mode 100644 demos/l/stargate/stargate.s diff --git a/demos/l/stargate/Makefile b/demos/l/stargate/Makefile new file mode 100644 index 00000000..73c0a2df --- /dev/null +++ b/demos/l/stargate/Makefile @@ -0,0 +1,39 @@ +include ../../../Makefile.inc + +DOS33 = ../../../utils/dos33fs-utils/dos33 +PNG2GR = ../../../utils/gr-utils/png2gr +PNG2RLE = ../../../utils/gr-utils/png2rle +TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft +LINKERSCRIPTS = ../../../linker_scripts +EMPTYDISK = ../../../empty_disk + +all: stargate.dsk + +$(DOS33): + cd ../../utils/dos33fs-utils && make + +stargate.dsk: $(DOS33) HELLO STARGATE + cp $(EMPTYDISK)/empty.dsk stargate.dsk + $(DOS33) -y stargate.dsk SAVE A HELLO + $(DOS33) -y stargate.dsk BSAVE -a 0x37c STARGATE + +### + +HELLO: hello.bas + $(TOKENIZE) < hello.bas > HELLO + +### + +STARGATE: stargate.o + ld65 -o STARGATE stargate.o -C $(LINKERSCRIPTS)/apple2_37c.inc + +stargate.o: stargate.s + ca65 -o stargate.o stargate.s -l stargate.lst + + +### + + +clean: + rm -f *~ *.o HELLO TUNNEL.BAS TUNNEL TUNNEL2 STARGATE T.BAS T *.lst + diff --git a/demos/l/stargate/hello.bas b/demos/l/stargate/hello.bas new file mode 100644 index 00000000..133a44bb --- /dev/null +++ b/demos/l/stargate/hello.bas @@ -0,0 +1,2 @@ +5 HOME +10 PRINT CHR$(4);"CATALOG" diff --git a/demos/l/stargate/stargate.s b/demos/l/stargate/stargate.s new file mode 100644 index 00000000..d957c7e5 --- /dev/null +++ b/demos/l/stargate/stargate.s @@ -0,0 +1,150 @@ +; 5 REM BY @hisham_hm Mar 7 @AppleIIBot + +; buggy version that looks cool + +; took a while, but there are two bugs. COUNT (and thus X) gets the wrong +; value and never resets, mostly due to the jmp at the end going +; to the wrong place. The init of COUNTMAX is wrong too + +H2 = $2C +V2 = $2D +COLOR = $30 +J = $FB +Z = $FC +COUNTMAX = $FD +COUNT = $FE +NEWCOLOR = $FF + +FULLGR = $C052 + + + +HLINE = $F819 ;; HLINE Y,$2C at A +VLINE = $F828 ;; VLINE A,$2D at Y +SETCOL = $F864 ; COLOR=A +SETGR = $FB40 +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us + +tunnel: + ; 10 GR:N=7 + + jsr SETGR + bit FULLGR + + lda #$7 + sta NEWCOLOR + + + ; 20 FOR X=0 TO 4 + + lda #0 + sta COUNT + + clc + adc #16 + sta COUNTMAX +cycle: + + ; 30 FOR I=X TO 15+X STEP 5:COLOR=0 + + ldx COUNT +iloop: + lda #0 + sta COLOR + + ; 40 Z=39-I:J=I+1:W=Z-1 + + txa + eor #$ff + sec + adc #39 + sta Z + sta H2 + sta V2 + dec H2 + dec V2 + + txa + clc + adc #1 + sta J + + ; HLIN J,W AT I ; HLINE Y,$2C at A + + ldy J + txa + jsr HLINE + + ; HLIN J,W AT Z ; HLINE Y,$2C at A + + ldy J + lda Z + jsr HLINE + + ; VLIN J,W AT I ; VLINE A,$2D at Y + ; VLIN J,W AT Z ; VLINE A,$2D at Y + + + ; COLOR=N + lda NEWCOLOR + jsr SETCOL + + ; HLIN J,W AT J ; HLINE Y,$2C at A + + ldy J + lda J + jsr HLINE + + ; HLIN J,W AT W ; HLINE Y,$2C at A + ldy J + lda H2 + jsr HLINE + + ; VLIN J,W AT J ; VLINE A,$2D at Y + ; VLIN J,W AT W ; VLINE A,$2D at Y + + ; N=N+1 + + inc NEWCOLOR + + + lda #75 + jsr WAIT + + ; 50 NEXT:N=N-4 + + txa + clc + adc #5 + tax + + cpx COUNTMAX + bcc iloop + + sec + lda NEWCOLOR + sbc #4 + sta NEWCOLOR + + ; 60 NEXT:N=N-1:IF N=0 THEN N=12 + + inc COUNT + lda COUNT + cmp #4 + bne cycle + + dec NEWCOLOR + bne end + + lda #12 + sta NEWCOLOR + +end: + ; 70 GOTO 20 + + jmp cycle + + ; want to load at $3f5, this originally at 379 + ; so load at $37c + + jmp tunnel