mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-09-10 08:54:51 +00:00
more sizecoding
This commit is contained in:
parent
2cc45e4517
commit
9e83c5498f
@ -28,8 +28,11 @@
|
|||||||
; 145 bytes -- leave out carry setting
|
; 145 bytes -- leave out carry setting
|
||||||
; 142 bytes -- reduce to 4 colors (from 8)
|
; 142 bytes -- reduce to 4 colors (from 8)
|
||||||
; 141 bytes -- don't dex at beginning ($FF close enough)
|
; 141 bytes -- don't dex at beginning ($FF close enough)
|
||||||
|
; 138 bytes -- no need for jmp at end (not bot)
|
||||||
|
|
||||||
.include "hardware.inc"
|
|
||||||
|
|
||||||
|
; zero page
|
||||||
|
|
||||||
GBASH = $27
|
GBASH = $27
|
||||||
MASK = $2E
|
MASK = $2E
|
||||||
@ -45,6 +48,18 @@ BUF1H = $FD
|
|||||||
BUF2L = $FE
|
BUF2L = $FE
|
||||||
BUF2H = $FF
|
BUF2H = $FF
|
||||||
|
|
||||||
|
; soft switches
|
||||||
|
FULLGR = $C052
|
||||||
|
LORES = $C056 ; Enable LORES graphics
|
||||||
|
|
||||||
|
|
||||||
|
; ROM routines
|
||||||
|
HGR = $F3E2
|
||||||
|
HGR2 = $F3D8
|
||||||
|
PLOT = $F800 ;; PLOT AT Y,A
|
||||||
|
PLOT1 = $F80E ;; PLOT at (GBASL),Y (need MASK to be $0f or $f0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;================================
|
;================================
|
||||||
; Clear screen and setup graphics
|
; Clear screen and setup graphics
|
||||||
@ -71,7 +86,7 @@ drops_outer:
|
|||||||
|
|
||||||
inc FRAME
|
inc FRAME
|
||||||
lda FRAME
|
lda FRAME
|
||||||
tay ; save frame for later
|
tay ; save frame in Y
|
||||||
|
|
||||||
; alternate $20/$28 in BUF1H/BUF2H
|
; alternate $20/$28 in BUF1H/BUF2H
|
||||||
|
|
||||||
@ -93,7 +108,7 @@ drops_outer:
|
|||||||
|
|
||||||
; fake random number generator by reading ROM
|
; fake random number generator by reading ROM
|
||||||
|
|
||||||
lda $E000,Y
|
lda $E000,Y ; based on FRAME
|
||||||
|
|
||||||
; buffer is 40x48 = roughly 2k?
|
; buffer is 40x48 = roughly 2k?
|
||||||
; so random top bits = 0..7
|
; so random top bits = 0..7
|
||||||
@ -128,17 +143,17 @@ no_drop:
|
|||||||
|
|
||||||
drops_yloop:
|
drops_yloop:
|
||||||
|
|
||||||
txa ; YY
|
|
||||||
tay ; plot YY,YY
|
|
||||||
|
|
||||||
jsr PLOT ; PLOT Y,A, setting up MASK and putting addr in GBASL/H
|
|
||||||
|
|
||||||
|
|
||||||
; reset XX to 39
|
; reset XX to 39
|
||||||
|
|
||||||
lda #39 ; XX
|
lda #39 ; XX
|
||||||
sta XX
|
sta XX
|
||||||
|
|
||||||
|
tay
|
||||||
|
txa ; YY into A
|
||||||
|
|
||||||
|
; plot 39,YY
|
||||||
|
jsr PLOT ; PLOT Y,A, setting up MASK and putting addr in GBASL/H
|
||||||
|
|
||||||
|
|
||||||
;=================================
|
;=================================
|
||||||
; xloop
|
; xloop
|
||||||
@ -206,32 +221,3 @@ colors:
|
|||||||
; 0000 0010 0110 1110 0111 1111 1111 1111
|
; 0000 0010 0110 1110 0111 1111 1111 1111
|
||||||
; 0 1 2 3 4 5 6 7
|
; 0 1 2 3 4 5 6 7
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; for maximum twitter size we enter this program
|
|
||||||
; by using the "&" operator which jumps to $3F5
|
|
||||||
|
|
||||||
; we can't load there though as the code would end up overlapping
|
|
||||||
; $400 which is the graphics area
|
|
||||||
|
|
||||||
; this is at 38A
|
|
||||||
; we want to be at 3F5, so load program at 36B?
|
|
||||||
|
|
||||||
; called by EXECUTE.STATEMENT at $D828
|
|
||||||
; which jumps to CHRGET at $00B1
|
|
||||||
; which does a RTS to $3F4 at end
|
|
||||||
|
|
||||||
; CHRGET sets up state based on the char that follows the &
|
|
||||||
; Z==C==1 is colon
|
|
||||||
; Z==1 is EOL (nul)
|
|
||||||
; C==0 is digit
|
|
||||||
|
|
||||||
; when we call with " following
|
|
||||||
; A=$22 (") X=$FF Y=$5E
|
|
||||||
; N=0 V=0 Z=0 C=1
|
|
||||||
|
|
||||||
jmp drops ; entry point from &
|
|
||||||
; bcs drops
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,10 +7,11 @@ EMPTY_DISK = ../../../empty_disk/empty.dsk
|
|||||||
|
|
||||||
all: sier.dsk
|
all: sier.dsk
|
||||||
|
|
||||||
sier.dsk: HELLO SIER SIER_TINY SIER_64
|
sier.dsk: HELLO SIER SIER_BOT SIER_TINY SIER_64
|
||||||
cp $(EMPTY_DISK) sier.dsk
|
cp $(EMPTY_DISK) sier.dsk
|
||||||
$(DOS33) -y sier.dsk SAVE A HELLO
|
$(DOS33) -y sier.dsk SAVE A HELLO
|
||||||
$(DOS33) -y sier.dsk BSAVE -a 0x36C SIER
|
$(DOS33) -y sier.dsk BSAVE -a 0x60 SIER
|
||||||
|
$(DOS33) -y sier.dsk BSAVE -a 0x36C SIER_BOT
|
||||||
$(DOS33) -y sier.dsk BSAVE -a 0x300 SIER_TINY
|
$(DOS33) -y sier.dsk BSAVE -a 0x300 SIER_TINY
|
||||||
$(DOS33) -y sier.dsk BSAVE -a 0x300 SIER_64
|
$(DOS33) -y sier.dsk BSAVE -a 0x300 SIER_64
|
||||||
|
|
||||||
@ -22,13 +23,22 @@ HELLO: hello.bas
|
|||||||
###
|
###
|
||||||
|
|
||||||
SIER: sier.o
|
SIER: sier.o
|
||||||
ld65 -o SIER sier.o -C ./apple2_36c.inc
|
ld65 -o SIER sier.o -C ./apple2_60_zp.inc
|
||||||
|
|
||||||
sier.o: sier.s
|
sier.o: sier.s
|
||||||
ca65 -o sier.o sier.s -l sier.lst
|
ca65 -o sier.o sier.s -l sier.lst
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
SIER_BOT: sier_bot.o
|
||||||
|
ld65 -o SIER_BOT sier_bot.o -C ./apple2_36c.inc
|
||||||
|
|
||||||
|
sier_bot.o: sier_bot.s
|
||||||
|
ca65 -o sier_bot.o sier_bot.s -l sier_bot.lst
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
SIER_TINY: sier_tiny.o
|
SIER_TINY: sier_tiny.o
|
||||||
ld65 -o SIER_TINY sier_tiny.o -C $(LINKERSCRIPTS)/apple2_300.inc
|
ld65 -o SIER_TINY sier_tiny.o -C $(LINKERSCRIPTS)/apple2_300.inc
|
||||||
|
|
||||||
|
12
graphics/gr/sier/apple2_60_zp.inc
Normal file
12
graphics/gr/sier/apple2_60_zp.inc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
MEMORY {
|
||||||
|
ZP: start = $60, size = $90, type = rw;
|
||||||
|
RAM: start = $60, 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;
|
||||||
|
}
|
@ -1,8 +1,9 @@
|
|||||||
; sierpinski-like demo
|
; sierpinski-like demo
|
||||||
; based on the code from Hellmood's Memories demo
|
; based on the code from Hellmood's Memories demo
|
||||||
|
|
||||||
; 140 bytes -- enough for appleiibot plus {B11} directive
|
; by Vince `deater` Weaver <vince@deater.net>
|
||||||
; to allow for decompression time
|
|
||||||
|
; for Lovebyte 2021
|
||||||
|
|
||||||
; the simple sierpinski you more or less just plot
|
; the simple sierpinski you more or less just plot
|
||||||
; X AND Y
|
; X AND Y
|
||||||
@ -14,37 +15,63 @@
|
|||||||
; to get speed on 6502/Apple II we change the multiplies to
|
; to get speed on 6502/Apple II we change the multiplies to
|
||||||
; a series of 16-bit 8.8 fixed point adds
|
; a series of 16-bit 8.8 fixed point adds
|
||||||
|
|
||||||
.include "hardware.inc"
|
|
||||||
|
; 140 bytes -- bot demo version
|
||||||
|
; 137 bytes -- remvoe & jump
|
||||||
|
; 135 bytes -- init with HGR, which sets A=0
|
||||||
|
; 133 bytes -- remove ldx #0 in paeg flip code
|
||||||
|
; 130 bytes -- load in zero page
|
||||||
|
; 128 bytes -- init T_L, T_H as part of zero page since we live there
|
||||||
|
|
||||||
|
; zero page
|
||||||
|
|
||||||
GBASH = $27
|
GBASH = $27
|
||||||
MASK = $2E
|
MASK = $2E
|
||||||
COLOR = $30
|
COLOR = $30
|
||||||
|
|
||||||
;XX = $F7
|
;XX = $F7
|
||||||
XX_TH = $F8
|
XX_TH = $F8
|
||||||
XX_TL = $F9
|
XX_TL = $F9
|
||||||
;YY = $FA
|
;YY = $FA
|
||||||
YY_TH = $FB
|
YY_TH = $FB
|
||||||
YY_TL = $FC
|
YY_TL = $FC
|
||||||
T_L = $FD
|
;T_L = $FD
|
||||||
T_H = $FE
|
;T_H = $FE
|
||||||
SAVED = $FF
|
SAVED = $FF
|
||||||
|
|
||||||
|
; Soft switches
|
||||||
|
FULLGR = $C052
|
||||||
|
PAGE1 = $C054
|
||||||
|
PAGE2 = $C055
|
||||||
|
LORES = $C056 ; Enable LORES graphics
|
||||||
|
|
||||||
|
; ROM routines
|
||||||
|
HGR = $F3E2
|
||||||
|
HGR2 = $F3D8
|
||||||
|
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
|
; Clear screen and setup graphics
|
||||||
;================================
|
;================================
|
||||||
sier:
|
sier:
|
||||||
|
jsr HGR2 ; set FULLGR, sets A=0
|
||||||
|
; be sure to avoid code at E6 if we do this
|
||||||
|
bit LORES ; drop down to lo-res
|
||||||
|
|
||||||
jsr SETGR ; set lo-res 40x40 mode
|
; lda #0 ; start with multiplier 0
|
||||||
bit FULLGR ; make it 40x48
|
; sta T_L
|
||||||
|
; sta T_H
|
||||||
lda #0 ; start with multiplier 0
|
|
||||||
sta T_L
|
|
||||||
sta T_H
|
|
||||||
|
|
||||||
sier_outer:
|
sier_outer:
|
||||||
|
|
||||||
ldx #0 ; YY starts at 0
|
ldx #0 ; YY starts at 0
|
||||||
|
|
||||||
stx YY_TL
|
stx YY_TL
|
||||||
stx YY_TH
|
stx YY_TH
|
||||||
|
|
||||||
@ -65,7 +92,7 @@ sier_yloop:
|
|||||||
|
|
||||||
bcc even_mask
|
bcc even_mask
|
||||||
ldy #$f0
|
ldy #$f0
|
||||||
.byte $C2 ; bit hack
|
.byte $2C ; bit hack
|
||||||
even_mask:
|
even_mask:
|
||||||
ldy #$0f
|
ldy #$0f
|
||||||
sty MASK
|
sty MASK
|
||||||
@ -152,26 +179,22 @@ blah_smc:
|
|||||||
; speed up the zoom as it goes
|
; speed up the zoom as it goes
|
||||||
inc blah_smc+1
|
inc blah_smc+1
|
||||||
|
|
||||||
flip_pages:
|
|
||||||
ldx #0
|
|
||||||
|
|
||||||
|
; x is 48
|
||||||
|
flip_pages:
|
||||||
lda draw_page_smc+1 ; DRAW_PAGE
|
lda draw_page_smc+1 ; DRAW_PAGE
|
||||||
beq done_page
|
beq done_page
|
||||||
inx
|
inx
|
||||||
done_page:
|
done_page:
|
||||||
ldy PAGE0,X ; set display page to PAGE1 or PAGE2
|
; 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
|
eor #$4 ; flip draw page between $400/$800
|
||||||
sta draw_page_smc+1 ; DRAW_PAGE
|
sta draw_page_smc+1 ; DRAW_PAGE
|
||||||
|
|
||||||
jmp sier_outer ; just slightly too far???
|
|
||||||
|
|
||||||
; for maximum twitter size we enter this program
|
jmp sier_outer ; what can we branch on?
|
||||||
; by using the "&" operator which jumps to $3F5
|
|
||||||
|
|
||||||
; we can't load there though as the code would end up overlapping
|
T_L: .byte $00
|
||||||
; $400 which is the graphics area
|
T_H: .byte $00
|
||||||
|
|
||||||
; this is at 389
|
|
||||||
; we want to be at 3F5, so load program at 36C?
|
|
||||||
jmp sier ; entry point from &
|
|
||||||
|
177
graphics/gr/sier/sier_bot.s
Normal file
177
graphics/gr/sier/sier_bot.s
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
; sierpinski-like demo
|
||||||
|
; based on the code from Hellmood's Memories demo
|
||||||
|
|
||||||
|
; 140 bytes -- enough for appleiibot plus {B11} directive
|
||||||
|
; to allow for decompression time
|
||||||
|
|
||||||
|
; 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
|
||||||
|
|
||||||
|
.include "hardware.inc"
|
||||||
|
|
||||||
|
GBASH = $27
|
||||||
|
MASK = $2E
|
||||||
|
COLOR = $30
|
||||||
|
;XX = $F7
|
||||||
|
XX_TH = $F8
|
||||||
|
XX_TL = $F9
|
||||||
|
;YY = $FA
|
||||||
|
YY_TH = $FB
|
||||||
|
YY_TL = $FC
|
||||||
|
T_L = $FD
|
||||||
|
T_H = $FE
|
||||||
|
SAVED = $FF
|
||||||
|
|
||||||
|
|
||||||
|
;================================
|
||||||
|
; Clear screen and setup graphics
|
||||||
|
;================================
|
||||||
|
sier:
|
||||||
|
|
||||||
|
jsr SETGR ; set lo-res 40x40 mode
|
||||||
|
bit FULLGR ; make it 40x48
|
||||||
|
|
||||||
|
lda #0 ; start with multiplier 0
|
||||||
|
sta T_L
|
||||||
|
sta T_H
|
||||||
|
|
||||||
|
sier_outer:
|
||||||
|
|
||||||
|
ldx #0 ; YY starts at 0
|
||||||
|
stx YY_TL
|
||||||
|
stx 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
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
; reset XX to 0
|
||||||
|
|
||||||
|
ldy #0 ; XX
|
||||||
|
sty XX_TL
|
||||||
|
sty XX_TH
|
||||||
|
|
||||||
|
|
||||||
|
sier_xloop:
|
||||||
|
|
||||||
|
; want (YY-(XX*T)) & (XX+(YY*T)
|
||||||
|
|
||||||
|
|
||||||
|
; SAVED = XX+(Y*T)
|
||||||
|
; clc
|
||||||
|
tya ; 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)
|
||||||
|
txa ; lda YY
|
||||||
|
sec
|
||||||
|
sbc XX_TH
|
||||||
|
|
||||||
|
; want (YY-(XX*T)) & (XX+(YY*T)
|
||||||
|
|
||||||
|
and SAVED
|
||||||
|
|
||||||
|
and #$f0
|
||||||
|
|
||||||
|
beq green
|
||||||
|
black:
|
||||||
|
lda #00 ; black
|
||||||
|
.byte $2C ; bit trick
|
||||||
|
green:
|
||||||
|
lda #$CC ; green
|
||||||
|
sta COLOR
|
||||||
|
|
||||||
|
; XX value already in Y
|
||||||
|
|
||||||
|
jsr PLOT1 ; PLOT AT (GBASL),Y
|
||||||
|
|
||||||
|
iny ; XX
|
||||||
|
cpy #40
|
||||||
|
bne sier_xloop
|
||||||
|
|
||||||
|
inx ; YY
|
||||||
|
cpx #48
|
||||||
|
bne sier_yloop
|
||||||
|
|
||||||
|
; inc T
|
||||||
|
; clc
|
||||||
|
lda T_L
|
||||||
|
blah_smc:
|
||||||
|
adc #1
|
||||||
|
sta T_L
|
||||||
|
lda T_H
|
||||||
|
adc #0
|
||||||
|
sta T_H
|
||||||
|
|
||||||
|
; speed up the zoom as it goes
|
||||||
|
inc blah_smc+1
|
||||||
|
|
||||||
|
flip_pages:
|
||||||
|
ldx #0
|
||||||
|
|
||||||
|
lda draw_page_smc+1 ; DRAW_PAGE
|
||||||
|
beq done_page
|
||||||
|
inx
|
||||||
|
done_page:
|
||||||
|
ldy PAGE0,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 ; just slightly too far???
|
||||||
|
|
||||||
|
; for maximum twitter size we enter this program
|
||||||
|
; by using the "&" operator which jumps to $3F5
|
||||||
|
|
||||||
|
; we can't load there though as the code would end up overlapping
|
||||||
|
; $400 which is the graphics area
|
||||||
|
|
||||||
|
; this is at 389
|
||||||
|
; we want to be at 3F5, so load program at 36C?
|
||||||
|
jmp sier ; entry point from &
|
Loading…
Reference in New Issue
Block a user