mod9: update

This commit is contained in:
Vince Weaver 2021-04-12 01:33:27 -04:00
parent b9402c8dbe
commit 6a9edf267b
20 changed files with 505 additions and 27 deletions

View File

@ -15,7 +15,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
FASTAR2.BAS BIN.BAS FALLING.BAS SNOW.BAS XMAS.BAS AN3.BAS PLASMA.BAS \
C64.BAS SIERPINSKI.BAS FAKES.BAS SIER.BAS DROPS.BAS RR.BAS RR_HGR.BAS \
COMBO.BAS WIRES.BAS PATTERN.BAS BALL.BAS LINES.BAS MOD9.BAS \
XOR_ZOOM.BAS
XOR_ZOOM.BAS MOD9_HGR.BAS
# cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk
cp empty.dsk appleiibot.dsk
$(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD
@ -74,7 +74,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
$(DOS33) -y appleiibot.dsk SAVE A LINES.BAS
$(DOS33) -y appleiibot.dsk SAVE A MOD9.BAS
$(DOS33) -y appleiibot.dsk SAVE A XOR_ZOOM.BAS
$(DOS33) -y appleiibot.dsk SAVE A MOD9_HGR.BAS
####
@ -167,6 +167,11 @@ MOD9.BAS: mod9.bas
####
MOD9_HGR.BAS: mod9_hgr.bas
$(TOKENIZE) < mod9_hgr.bas > MOD9_HGR.BAS
####
XOR_ZOOM.BAS: xor_zoom.bas
$(TOKENIZE) < xor_zoom.bas > XOR_ZOOM.BAS

View File

@ -8,8 +8,14 @@
//#define OFFSET 35
#define END_AT_3F5 0
#define BEGIN_AT_3F5 1
int main(int argc, char **argv) {
// int mode=END_AT_3F5;
int mode=BEGIN_AT_3F5;
int i = 0;
int e = 0,filesize;
int val,pv,final;
@ -19,7 +25,6 @@ int main(int argc, char **argv) {
// printf("1REM");
filesize=read(0,in,1024);
do {
third = ((in[i + 2] & 3) << 4) +
@ -107,25 +112,28 @@ int main(int argc, char **argv) {
printf("2CALL768\"%s%s\n",enc2,enc);
#endif
#if 1
// if using & to the end then jumping back
printf("1FORI=0TO%d:POKE%d+I,4*PEEK(%d+I)-"
"192+(PEEK(%d+I/3)-%d)/4^(I-INT(I/3)*3):NEXT\n",
filesize-1,
0x3f5-filesize+3,
2125,2125+filesize,OFFSET2);
printf("2&\"%s%s\n",enc2,enc);
#endif
if (mode==END_AT_3F5) {
fprintf(stderr,"Ending at $3F5\n");
printf("1FORI=0TO%d:POKE%d+I,4*PEEK(%d+I)-"
"192+(PEEK(%d+I/3)-%d)/4^(I-INT(I/3)*3):NEXT\n",
filesize-1,
0x3f5-filesize+3,
2125,2125+filesize,OFFSET2);
printf("2&\"%s%s\n",enc2,enc);
}
#if 0
// if using & to jump to beginning (over-writing text page)
printf("1FORI=0TO%d:POKE%d+I,4*PEEK(%d+I)-"
"192+(PEEK(%d+I/3)-%d)/4^(I-INT(I/3)*3):NEXT\n",
filesize-1,
0x3f5,
2126,2126+filesize,OFFSET2);
printf("2&\"%s%s\n",enc2,enc);
#endif
// if using & to jump to beginning (over-writing text page)
if (mode==BEGIN_AT_3F5) {
fprintf(stderr,"Beginning at $3F5\n");
printf("1FORI=0TO%d:POKE%d+I,4*PEEK(%d+I)-"
"192+(PEEK(%d+I/3)-%d)/4^(I-INT(I/3)*3):NEXT\n",
filesize-1,
0x3f5,
2126,2126+filesize,OFFSET2);
printf("2&\"%s%s\n",enc2,enc);
}
// printf("%s\n",enc);
// printf("2FORI=0TO%d:POKE768+I,4*PEEK(2054+I)-"

View File

@ -0,0 +1,2 @@
1FORI=0TO122:POKE1013+I,4*PEEK(2126+I)-192+(PEEK(2249+I/3)-35)/4^(I-INT(I/3)*3):NEXT
2&"7G1,clNnX0QoP.X/Yo74mP.QiQAiY_(2Yjc2b0l#W0C91.lZTB2UkmQ7:Q08Om8Fm8JkYojdaioYo`Ta^bmYmb1`0Z%Nna2d0Z0NnCl0X.X0QV04bl1jh*jlblH'S0#C''E<;C6$Y#P+L$/%%E$-#SA*3W('00+)#&D+

View File

@ -9,8 +9,10 @@ all: ootw_c16_end.inc
ootw_c16_end.inc: \
blank.lzsa wing_bg.lzsa \
left_unfurl1.lzsa left_unfurl2.lzsa \
right_unfurl1.lzsa right_unfurl2.lzsa \
left_unfurl1.lzsa left_unfurl2.lzsa left_unfurl3.lzsa \
left_unfurl4.lzsa left_unfurl5.lzsa \
right_unfurl1.lzsa right_unfurl2.lzsa right_unfurl3.lzsa \
right_unfurl4.lzsa right_unfurl5.lzsa \
sky_bg.lzsa \
rooftop_bg.lzsa \
rooftop01.lzsa rooftop02.lzsa rooftop03.lzsa rooftop04.lzsa \
@ -59,8 +61,14 @@ ootw_c16_end.inc: \
echo "wing_bg_lzsa: .incbin \"wing_bg.lzsa\"" >> ootw_c16_end.inc
echo "left_unfurl1_lzsa: .incbin \"left_unfurl1.lzsa\"" >> ootw_c16_end.inc
echo "left_unfurl2_lzsa: .incbin \"left_unfurl2.lzsa\"" >> ootw_c16_end.inc
echo "left_unfurl3_lzsa: .incbin \"left_unfurl3.lzsa\"" >> ootw_c16_end.inc
echo "left_unfurl4_lzsa: .incbin \"left_unfurl4.lzsa\"" >> ootw_c16_end.inc
echo "left_unfurl5_lzsa: .incbin \"left_unfurl5.lzsa\"" >> ootw_c16_end.inc
echo "right_unfurl1_lzsa: .incbin \"right_unfurl1.lzsa\"" >> ootw_c16_end.inc
echo "right_unfurl2_lzsa: .incbin \"right_unfurl2.lzsa\"" >> ootw_c16_end.inc
echo "right_unfurl3_lzsa: .incbin \"right_unfurl3.lzsa\"" >> ootw_c16_end.inc
echo "right_unfurl4_lzsa: .incbin \"right_unfurl4.lzsa\"" >> ootw_c16_end.inc
echo "right_unfurl5_lzsa: .incbin \"right_unfurl5.lzsa\"" >> ootw_c16_end.inc
echo "onboard_lzsa: .incbin \"onboard.lzsa\"" >> ootw_c16_end.inc
echo "sky_bg_lzsa: .incbin \"sky_bg.lzsa\"" >> ootw_c16_end.inc
echo "flying01_lzsa: .incbin \"flying01.lzsa\"" >> ootw_c16_end.inc

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 466 B

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -7,15 +7,18 @@ EMPTY_DISK = ../../../empty_disk/empty.dsk
all: triangles.dsk
triangles.dsk: HELLO TINY_TRIANGLES XOR MOD9 MOD9_64 WRITING MOVE_RIGHT
triangles.dsk: HELLO TINY_TRIANGLES XOR MOD9 MOD9_64 WRITING MOVE_RIGHT \
SIER_HGR RAINBOW_SQUARES
cp $(EMPTY_DISK) triangles.dsk
$(DOS33) -y triangles.dsk SAVE A HELLO
$(DOS33) -y triangles.dsk BSAVE -a 0x070 TINY_TRIANGLES
$(DOS33) -y triangles.dsk BSAVE -a 0x300 XOR
$(DOS33) -y triangles.dsk BSAVE -a 0x300 MOD9
$(DOS33) -y triangles.dsk BSAVE -a 0x3F5 MOD9
$(DOS33) -y triangles.dsk BSAVE -a 0x300 MOD9_64
$(DOS33) -y triangles.dsk BSAVE -a 0x300 WRITING
$(DOS33) -y triangles.dsk BSAVE -a 0x300 MOVE_RIGHT
$(DOS33) -y triangles.dsk BSAVE -a 0x300 SIER_HGR
$(DOS33) -y triangles.dsk BSAVE -a 0x300 RAINBOW_SQUARES
###
@ -41,11 +44,29 @@ xor.o: xor.s
###
MOD9: mod9.o
ld65 -o MOD9 mod9.o -C $(LINKER_SCRIPTS)/apple2_300.inc
ld65 -o MOD9 mod9.o -C $(LINKER_SCRIPTS)/apple2_3f5.inc
mod9.o: mod9.s
ca65 -o mod9.o mod9.s -l mod9.lst
###
SIER_HGR: sier_hgr.o
ld65 -o SIER_HGR sier_hgr.o -C $(LINKER_SCRIPTS)/apple2_300.inc
sier_hgr.o: sier_hgr.s
ca65 -o sier_hgr.o sier_hgr.s -l sier_hgr.lst
###
RAINBOW_SQUARES: rainbow_squares.o
ld65 -o RAINBOW_SQUARES rainbow_squares.o -C $(LINKER_SCRIPTS)/apple2_3f5.inc
rainbow_squares.o: rainbow_squares.s
ca65 -o rainbow_squares.o rainbow_squares.s -l rainbow_squares.lst
###
MOD9_64: mod9_64.o
@ -77,4 +98,4 @@ move_right.o: move_right.s
clean:
rm -f *~ *.o *.lst HELLO TINY_TRIANGLES XOR MOD9 MOD9_64 WRITING \
MOVE_RIGHT
MOVE_RIGHT SIER_HGR RAINBOW_SQUARES

View File

@ -174,3 +174,4 @@ m9_loop:
m9_done:
rts

View File

@ -0,0 +1,219 @@
; this was a weird effect that turns out to be because we're linking
; at the wrong address so it's just the effect when
; TL/TH holds the values $A0 $A0
; sierpinski-like demo
; based on the code from Hellmood's Memories demo
; by Vince `deater` Weaver <vince@deater.net>
; the simple sierpinski you more or less just plot
; X AND Y
; Hellmood's you plot something more or less like
; COLOR = ( (Y-(X*T)) & (X+(Y*T) ) & 0xf0
; where T is an incrementing frame value
; to get speed on 6502/Apple II we change the multiplies to
; a series of 16-bit 8.8 fixed point adds
; TODO:
; HPLOT timing
; MOVERIGHT timing
; MOVERIGHT MOVEDOWN timing
; LOOKUP TABLE timing
; zero page
HGR_BITS = $1C
GBASH = $27
MASK = $2E
COLOR = $30
HGR_X = $E0
HGR_Y = $E2
HGR_COLOR = $E4
;XX = $F7
XX_TH = $F8
XX_TL = $F9
;YY = $FA
YY_TH = $FB
YY_TL = $FC
;T_L = $FD
;T_H = $FE
SAVED = $FF
; Soft switches
FULLGR = $C052
PAGE1 = $C054
PAGE2 = $C055
LORES = $C056 ; Enable LORES graphics
; ROM routines
HGR = $F3E2
HGR2 = $F3D8
HPLOT0 = $F457
PLOT1 = $F80E ;; PLOT at (GBASL),Y (need MASK to be $0f or $f0)
GBASCALC= $F847 ;; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear)
SETGR = $FB40
;.zeropage
;.globalzp T_L,T_H
;================================
; Clear screen and setup graphics
;================================
sier:
jsr HGR2 ; set FULLGR, sets A=0
; lda #0 ; start with multiplier 0
; sta T_L
; sta T_H
sier_outer:
ldy #0 ; YY starts at 0
sty YY_TL
sty YY_TH
sier_yloop:
; calc YY_T (8.8 fixed point add)
; save space by skipping clc as it's only a slight variation w/o
; clc
lda YY_TL
adc T_L
sta YY_TL
lda YY_TH
adc T_H
sta YY_TH
; txa ; YY ; plot call needs Y/2
; lsr
; php
; bcc even_mask
; ldy #$f0
; .byte $2C ; bit hack
;even_mask:
; ldy #$0f
; sty MASK
; jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear)
; lda GBASH
;draw_page_smc:
; adc #0
; sta GBASH ; adjust for PAGE1/PAGE2 ($400/$800)
; plp
; jsr $f806 ; trick to calculate MASK by jumping
; into middle of PLOT routine
; reset XX to 0
ldx #0 ; XX
stx XX_TL
stx XX_TH
sier_xloop:
; want (YY-(XX*T)) & (XX+(YY*T)
; SAVED = XX+(Y*T)
; clc
txa ; XX
adc YY_TH
sta SAVED
; calc XX*T
; clc
lda XX_TL
adc T_L
sta XX_TL
lda XX_TH
adc T_H
sta XX_TH
; calc (YY-X_T)
tya ; lda YY
sec
sbc XX_TH
; want (YY-(XX*T)) & (XX+(YY*T)
and SAVED
and #$f0
beq white
black:
lda #00 ; black
.byte $2C ; bit trick
white:
lda #$ff ; green
sta HGR_COLOR
tya ; YY in A
ldy #0
; XX in X
jsr HPLOT0 ; plot at (Y,X), (A)
; at begin, stores A to HGR_Y
; X to HGR_X and Y to HGR_X+1
; destroys X,Y,A
; Y is XX/7
ldy HGR_Y
ldx HGR_X
inx ; XX
cpx #255
bne sier_xloop
iny ; YY
cpy #192
bne sier_yloop
; inc T
; clc
lda T_L
blah_smc:
adc #1
sta T_L
bcc no_carry
inc T_H
no_carry:
; speed up the zoom as it goes
inc blah_smc+1
; x is 48
;flip_pages:
; lda draw_page_smc+1 ; DRAW_PAGE
; beq done_page
; inx
;done_page:
; X=48 ($30) PAGE1=$C054-$30=$C024
; ldy $C024,X ; set display page to PAGE1 or PAGE2
; eor #$4 ; flip draw page between $400/$800
; sta draw_page_smc+1 ; DRAW_PAGE
jmp sier_outer ; what can we branch on?
T_L: .byte $00
T_H: .byte $00

View File

@ -0,0 +1,214 @@
; sierpinski-like demo
; based on the code from Hellmood's Memories demo
; by Vince `deater` Weaver <vince@deater.net>
; the simple sierpinski you more or less just plot
; X AND Y
; Hellmood's you plot something more or less like
; COLOR = ( (Y-(X*T)) & (X+(Y*T) ) & 0xf0
; where T is an incrementing frame value
; to get speed on 6502/Apple II we change the multiplies to
; a series of 16-bit 8.8 fixed point adds
; TODO:
; HPLOT timing
; MOVERIGHT timing
; MOVERIGHT MOVEDOWN timing
; LOOKUP TABLE timing
; zero page
HGR_BITS = $1C
GBASH = $27
MASK = $2E
COLOR = $30
HGR_X = $E0
HGR_Y = $E2
HGR_COLOR = $E4
;XX = $F7
XX_TH = $F8
XX_TL = $F9
;YY = $FA
YY_TH = $FB
YY_TL = $FC
;T_L = $FD
;T_H = $FE
SAVED = $FF
; Soft switches
FULLGR = $C052
PAGE1 = $C054
PAGE2 = $C055
LORES = $C056 ; Enable LORES graphics
; ROM routines
HGR = $F3E2
HGR2 = $F3D8
HPLOT0 = $F457
PLOT1 = $F80E ;; PLOT at (GBASL),Y (need MASK to be $0f or $f0)
GBASCALC= $F847 ;; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear)
SETGR = $FB40
;.zeropage
;.globalzp T_L,T_H
;================================
; Clear screen and setup graphics
;================================
sier:
jsr HGR2 ; set FULLGR, sets A=0
; lda #0 ; start with multiplier 0
; sta T_L
; sta T_H
sier_outer:
ldy #0 ; YY starts at 0
sty YY_TL
sty YY_TH
sier_yloop:
; calc YY_T (8.8 fixed point add)
; save space by skipping clc as it's only a slight variation w/o
; clc
lda YY_TL
adc T_L
sta YY_TL
lda YY_TH
adc T_H
sta YY_TH
; txa ; YY ; plot call needs Y/2
; lsr
; php
; bcc even_mask
; ldy #$f0
; .byte $2C ; bit hack
;even_mask:
; ldy #$0f
; sty MASK
; jsr GBASCALC ; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear)
; lda GBASH
;draw_page_smc:
; adc #0
; sta GBASH ; adjust for PAGE1/PAGE2 ($400/$800)
; plp
; jsr $f806 ; trick to calculate MASK by jumping
; into middle of PLOT routine
; reset XX to 0
ldx #0 ; XX
stx XX_TL
stx XX_TH
sier_xloop:
; want (YY-(XX*T)) & (XX+(YY*T)
; SAVED = XX+(Y*T)
; clc
txa ; XX
adc YY_TH
sta SAVED
; calc XX*T
; clc
lda XX_TL
adc T_L
sta XX_TL
lda XX_TH
adc T_H
sta XX_TH
; calc (YY-X_T)
tya ; lda YY
sec
sbc XX_TH
; want (YY-(XX*T)) & (XX+(YY*T)
and SAVED
and #$f0
beq white
black:
lda #00 ; black
.byte $2C ; bit trick
white:
lda #$ff ; green
sta HGR_COLOR
tya ; YY in A
ldy #0
; XX in X
jsr HPLOT0 ; plot at (Y,X), (A)
; at begin, stores A to HGR_Y
; X to HGR_X and Y to HGR_X+1
; destroys X,Y,A
; Y is XX/7
ldy HGR_Y
ldx HGR_X
inx ; XX
cpx #255
bne sier_xloop
iny ; YY
cpy #192
bne sier_yloop
; inc T
; clc
lda T_L
blah_smc:
adc #1
sta T_L
bcc no_carry
inc T_H
no_carry:
; speed up the zoom as it goes
inc blah_smc+1
; x is 48
;flip_pages:
; lda draw_page_smc+1 ; DRAW_PAGE
; beq done_page
; inx
;done_page:
; X=48 ($30) PAGE1=$C054-$30=$C024
; ldy $C024,X ; set display page to PAGE1 or PAGE2
; eor #$4 ; flip draw page between $400/$800
; sta draw_page_smc+1 ; DRAW_PAGE
jmp sier_outer ; what can we branch on?
T_L: .byte $00
T_H: .byte $00