mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-10-05 16:58:37 +00:00
update makefiles
This commit is contained in:
parent
4db7be7d22
commit
2cc45e4517
@ -3,13 +3,15 @@ include ../../../Makefile.inc
|
||||
DOS33 = ../../../utils/dos33fs-utils/dos33
|
||||
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
||||
LINKERSCRIPTS = ../../../linker_scripts
|
||||
EMPTYDISK = ../../../empty_disk/empty.dsk
|
||||
|
||||
all: boxes.dsk make_boxes
|
||||
|
||||
boxes.dsk: HELLO BOXES
|
||||
cp empty.dsk boxes.dsk
|
||||
boxes.dsk: HELLO A2_BOXES BOXES
|
||||
cp $(EMPTYDISK) boxes.dsk
|
||||
$(DOS33) -y boxes.dsk SAVE A HELLO
|
||||
$(DOS33) -y boxes.dsk BSAVE -a 0x300 BOXES
|
||||
$(DOS33) -y boxes.dsk BSAVE -a 0xC00 A2_BOXES
|
||||
|
||||
###
|
||||
|
||||
@ -18,12 +20,21 @@ HELLO: hello.bas
|
||||
|
||||
###
|
||||
|
||||
A2_BOXES: a2_boxes.o
|
||||
ld65 -o A2_BOXES a2_boxes.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||
|
||||
a2_boxes.o: a2_boxes.s
|
||||
ca65 -o a2_boxes.o a2_boxes.s -l a2_boxes.lst
|
||||
|
||||
###
|
||||
|
||||
BOXES: boxes.o
|
||||
ld65 -o BOXES boxes.o -C $(LINKERSCRIPTS)/apple2_300.inc
|
||||
|
||||
boxes.o: boxes.s
|
||||
ca65 -o boxes.o boxes.s -l boxes.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
make_boxes: make_boxes.o
|
||||
@ -35,4 +46,4 @@ make_boxes.o: make_boxes.c
|
||||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO BOXES make_boxes
|
||||
rm -f *~ *.o *.lst HELLO A2_BOXES BOXES make_boxes
|
||||
|
240
graphics/gr/boxes/a2_boxes.s
Normal file
240
graphics/gr/boxes/a2_boxes.s
Normal file
@ -0,0 +1,240 @@
|
||||
; Apple II self portrait using Boxes
|
||||
; running sierpinski inside
|
||||
; I heard you liked demos, so...
|
||||
|
||||
; by Vince `deater` Weaver <vince@deater.net> / dSr
|
||||
|
||||
; For LoveByte 2021
|
||||
|
||||
; 223 -- initial
|
||||
; 220 -- update end
|
||||
; 219 -- store color already multiplied by 17
|
||||
; 215 -- load Y0 directly into X
|
||||
; 211 -- load X1 directly into H2
|
||||
; 208 -- add subroutine to read byte into A, no need to save Y
|
||||
; 205 -- optimize end loop
|
||||
; 197 -- only update color if changed
|
||||
; 194 -- pack color in with the other 4 bytes
|
||||
; 191 -- do more common stuff in load_byte
|
||||
; 189 -- change how end is detected
|
||||
; 260 -- add sierpinski code
|
||||
; 255 -- optimize FRAME count
|
||||
; 248 -- realize PLOT doesn't have to be fast
|
||||
; 251 -- add pause at beginning
|
||||
; would have liked to have more elaborate startup, no room
|
||||
|
||||
; LoveByte Rule is 252 bytes (there's a 4-byte DOS33 header)
|
||||
|
||||
; zero page
|
||||
|
||||
H2 = $2C
|
||||
COLOR = $30
|
||||
X0 = $F0
|
||||
XX = $F1
|
||||
FRAME = $F2
|
||||
Y1 = $F3
|
||||
|
||||
; soft-switches
|
||||
FULLGR = $C052
|
||||
|
||||
; ROM routines
|
||||
|
||||
PLOT = $F800 ;; PLOT AT Y,A
|
||||
PLOT1 = $F80E ;; PLOT at (GBASL),Y (need MASK to be $0f or $f0)
|
||||
HLINE = $F819 ;; HLINE Y,$2C at A
|
||||
SETCOL = $F864 ;; COLOR=A
|
||||
SETGR = $FB40 ;; init lores and clear screen
|
||||
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||
|
||||
|
||||
|
||||
;1DEFFNP(X)=PEEK(2054+I*5+X)-32:
|
||||
;GR:POKE49234,0:
|
||||
;FORI=0TO29:COLOR=FNP(0):FORY=FNP(3)TOFNP(4)
|
||||
;:HLINFNP(1),FNP(2)ATY:NEXTY,I:GETA
|
||||
|
||||
|
||||
;================================
|
||||
; Clear screen and setup graphics
|
||||
;================================
|
||||
boxes:
|
||||
|
||||
jsr SETGR ; set lo-res 40x40 mode
|
||||
bit FULLGR ; make it 40x48
|
||||
|
||||
draw_box_loop:
|
||||
|
||||
; get color/Y0
|
||||
jsr load_byte
|
||||
tax ; Y0 is in X
|
||||
|
||||
tya ; check for end
|
||||
|
||||
bmi end
|
||||
|
||||
|
||||
jsr load_byte ; Y1
|
||||
sta Y1
|
||||
|
||||
jsr load_byte ; X0
|
||||
sta X0
|
||||
|
||||
tya
|
||||
lsr
|
||||
lsr
|
||||
sta COLOR
|
||||
|
||||
|
||||
jsr load_byte ; X1
|
||||
sta H2
|
||||
|
||||
tya
|
||||
and #$C0
|
||||
ora COLOR
|
||||
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
|
||||
jsr SETCOL
|
||||
|
||||
|
||||
inner_loop:
|
||||
|
||||
;; HLINE Y,H2 at A
|
||||
;; X left alone, carry set on exit
|
||||
;; H2 left alone
|
||||
;; Y and A trashed
|
||||
|
||||
ldy X0
|
||||
txa
|
||||
jsr HLINE
|
||||
|
||||
cpx Y1
|
||||
inx
|
||||
bcc inner_loop
|
||||
bcs draw_box_loop
|
||||
|
||||
|
||||
;=========================
|
||||
; draw the demo
|
||||
;=========================
|
||||
; screen is from (11,6) - (20,23)
|
||||
; so size is 9,17?
|
||||
end:
|
||||
|
||||
; A comes in as $FF which is fine
|
||||
; actually frame value doesn't matter at all
|
||||
; lda #0
|
||||
; sta FRAME
|
||||
|
||||
|
||||
; pause a bit at beginning
|
||||
jsr WAIT
|
||||
|
||||
sier_loop:
|
||||
|
||||
lda #100 ; Wait a bit, we're too fast
|
||||
jsr WAIT
|
||||
|
||||
inc FRAME ; increment frame
|
||||
|
||||
ldx #17 ; YY
|
||||
|
||||
sier_yloop:
|
||||
|
||||
lda #9 ; XX
|
||||
sta XX
|
||||
|
||||
sier_xloop:
|
||||
|
||||
txa ; get YY
|
||||
clc
|
||||
adc FRAME ; and add in FRAME
|
||||
|
||||
and XX ; and it with XX
|
||||
|
||||
bne black
|
||||
lda FRAME ; color is based on frame
|
||||
lsr ; only update every 16 lines?
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
bne not_zero ; but no color 0 (would be all black)
|
||||
lda #3 ; how about purple instead
|
||||
|
||||
not_zero:
|
||||
|
||||
.byte $2C ; bit trick
|
||||
black:
|
||||
lda #$00
|
||||
|
||||
jsr SETCOL ; set top/bottom nibble same color
|
||||
|
||||
lda XX ; offset XX to tiny screen
|
||||
clc
|
||||
adc #11
|
||||
tay ; put into Y
|
||||
|
||||
txa ; offset YY to tiny screen
|
||||
clc
|
||||
adc #6 ; put into A
|
||||
|
||||
jsr PLOT ; PLOT AT Y,A
|
||||
|
||||
dec XX
|
||||
bpl sier_xloop
|
||||
|
||||
dex
|
||||
bpl sier_yloop
|
||||
bmi sier_loop
|
||||
|
||||
|
||||
;=========================
|
||||
; load byte routine
|
||||
;=========================
|
||||
|
||||
load_byte:
|
||||
inc load_byte_smc+1 ; assume we are always < 256 bytes
|
||||
; so no need to wrap
|
||||
load_byte_smc:
|
||||
lda box_data-1
|
||||
tay
|
||||
and #$3f
|
||||
rts
|
||||
|
||||
|
||||
; 4 6 6 6 6
|
||||
box_data:
|
||||
.byte $00,$2F,$C0,$E7
|
||||
.byte $01,$2B,$0A,$9B
|
||||
.byte $28,$29,$43,$D4
|
||||
.byte $24,$27,$43,$D6
|
||||
.byte $20,$23,$45,$D7
|
||||
.byte $1C,$1F,$48,$D8
|
||||
.byte $23,$26,$07,$8E
|
||||
.byte $24,$27,$08,$92
|
||||
.byte $1F,$1F,$0D,$92
|
||||
.byte $2A,$2B,$43,$54
|
||||
.byte $2C,$2D,$46,$53
|
||||
.byte $2C,$2D,$14,$97
|
||||
.byte $08,$16,$1C,$9C
|
||||
.byte $02,$1A,$49,$D8
|
||||
.byte $04,$18,$0A,$95
|
||||
.byte $06,$17,$0B,$14
|
||||
.byte $15,$29,$22,$A2
|
||||
.byte $13,$28,$22,$A4
|
||||
.byte $13,$14,$5C,$63
|
||||
.byte $15,$16,$5B,$61
|
||||
.byte $17,$2B,$59,$E1
|
||||
.byte $18,$20,$1A,$20
|
||||
.byte $22,$2A,$1A,$20
|
||||
.byte $1C,$1C,$5B,$60
|
||||
.byte $26,$26,$5B,$60
|
||||
.byte $1F,$20,$DF,$1F
|
||||
.byte $29,$2A,$DF,$1F
|
||||
.byte $19,$1E,$5D,$5E
|
||||
.byte $23,$28,$5D,$5E
|
||||
.byte $02,$03,$17,$D7
|
||||
.byte $FF
|
@ -3,14 +3,16 @@ include ../../../Makefile.inc
|
||||
DOS33 = ../../../utils/dos33fs-utils/dos33
|
||||
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
||||
LINKERSCRIPTS = ../../../linker_scripts
|
||||
EMPTY_DISK = ../../../empty_disk/empty.dsk
|
||||
|
||||
all: drops.dsk
|
||||
|
||||
drops.dsk: HELLO DROPS DROPS_TINY
|
||||
cp empty.dsk drops.dsk
|
||||
drops.dsk: HELLO DROPS DROPS_TINY DROPS_BOT
|
||||
cp $(EMPTY_DISK) drops.dsk
|
||||
$(DOS33) -y drops.dsk SAVE A HELLO
|
||||
$(DOS33) -y drops.dsk BSAVE -a 0x300 DROPS
|
||||
$(DOS33) -y drops.dsk BSAVE -a 0x36B DROPS_TINY
|
||||
$(DOS33) -y drops.dsk BSAVE -a 0x36B DROPS_BOT
|
||||
$(DOS33) -y drops.dsk BSAVE -a 0xC00 DROPS_TINY
|
||||
|
||||
|
||||
###
|
||||
@ -29,13 +31,23 @@ drops.o: drops.s
|
||||
###
|
||||
|
||||
DROPS_TINY: drops_tiny.o
|
||||
ld65 -o DROPS_TINY drops_tiny.o -C ./apple2_36b.inc
|
||||
ld65 -o DROPS_TINY drops_tiny.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||
|
||||
drops_tiny.o: drops_tiny.s
|
||||
ca65 -o drops_tiny.o drops_tiny.s -l drops_tiny.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
DROPS_BOT: drops_bot.o
|
||||
ld65 -o DROPS_BOT drops_bot.o -C ./apple2_36b.inc
|
||||
|
||||
drops_bot.o: drops_bot.s
|
||||
ca65 -o drops_bot.o drops_bot.s -l drops_bot.lst
|
||||
|
||||
|
||||
|
||||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO DROPS DROPS_TINY
|
||||
rm -f *~ *.o *.lst HELLO DROPS DROPS_TINY DROPS_BOT
|
||||
|
237
graphics/gr/drops/drops_bot.s
Normal file
237
graphics/gr/drops/drops_bot.s
Normal file
@ -0,0 +1,237 @@
|
||||
; water drops
|
||||
|
||||
; based roughly on
|
||||
; https://github.com/seban-slt/Atari8BitBot/blob/master/ASM/water/water.m65
|
||||
|
||||
; for each pixel
|
||||
|
||||
; C
|
||||
; A V B
|
||||
; D
|
||||
;
|
||||
; calculate color as NEW_V = (A+B+C+D)/2 - OLD_V
|
||||
; then flip buffers
|
||||
|
||||
|
||||
; 211 bytes -- initial
|
||||
; 208 bytes -- use HGR2 to clear
|
||||
; 204 bytes -- optimize buffer switch
|
||||
; 197 bytes -- inline random8
|
||||
; 169 bytes -- rip out page flipping
|
||||
; 163 bytes -- use EOR for BUFH setting
|
||||
; 159 bytes -- put YY in X
|
||||
; 153 bytes -- fake random by reading ROM
|
||||
; 151 bytes -- no seed at all, use frame
|
||||
; 149 bytes -- FRAME saved in Y
|
||||
; 148 bytes -- beq instead of jmp
|
||||
; 147 bytes -- reuse color in drop
|
||||
; 145 bytes -- leave out carry setting
|
||||
; 142 bytes -- reduce to 4 colors (from 8)
|
||||
; 141 bytes -- don't dex at beginning ($FF close enough)
|
||||
|
||||
.include "hardware.inc"
|
||||
|
||||
GBASH = $27
|
||||
MASK = $2E
|
||||
COLOR = $30
|
||||
SEEDL = $4E
|
||||
|
||||
FRAME = $F8
|
||||
XX = $F9
|
||||
DROPL = $FA
|
||||
DROPH = $FB
|
||||
BUF1L = $FC
|
||||
BUF1H = $FD
|
||||
BUF2L = $FE
|
||||
BUF2H = $FF
|
||||
|
||||
|
||||
;================================
|
||||
; Clear screen and setup graphics
|
||||
;================================
|
||||
drops:
|
||||
jsr HGR ; clear $2000-$4000 to zero
|
||||
; A is $00 after this
|
||||
; Y is $00
|
||||
|
||||
bit FULLGR ; full page
|
||||
bit LORES ; switch to LORES
|
||||
|
||||
drops_outer:
|
||||
|
||||
; in all but first loop X is $FF on arrival
|
||||
|
||||
; inx
|
||||
stx BUF1L
|
||||
stx BUF2L
|
||||
|
||||
;=================================
|
||||
; handle new frame
|
||||
;=================================
|
||||
|
||||
inc FRAME
|
||||
lda FRAME
|
||||
tay ; save frame for later
|
||||
|
||||
; alternate $20/$28 in BUF1H/BUF2H
|
||||
|
||||
and #$1
|
||||
asl
|
||||
asl
|
||||
asl ; A now 0 or 8
|
||||
|
||||
ora #$20
|
||||
sta BUF1H
|
||||
eor #$8
|
||||
sta BUF2H
|
||||
|
||||
; check if we add new raindrop
|
||||
|
||||
tya ; reload FRAME
|
||||
and #$3 ; only drop every 4 frames
|
||||
bne no_drop
|
||||
|
||||
; fake random number generator by reading ROM
|
||||
|
||||
lda $E000,Y
|
||||
|
||||
; buffer is 40x48 = roughly 2k?
|
||||
; so random top bits = 0..7
|
||||
|
||||
sta DROPL
|
||||
and #$7
|
||||
ora #$20
|
||||
sta DROPH
|
||||
|
||||
lda #31 ; $1f value for drop
|
||||
|
||||
tay ; cheat and draw drop at offset 31 to reuse value
|
||||
|
||||
sta (DROPL),Y ; draw at offset 31
|
||||
iny
|
||||
sta (DROPL),Y ; draw at offset 32
|
||||
|
||||
ldy #71
|
||||
sta (DROPL),Y ; draw at offset 71 (y+1)
|
||||
iny
|
||||
sta (DROPL),Y ; draw at offset 72
|
||||
|
||||
no_drop:
|
||||
|
||||
|
||||
ldx #47 ; load 47 into YY
|
||||
|
||||
|
||||
;=================================
|
||||
; 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
|
||||
|
||||
lda #39 ; XX
|
||||
sta XX
|
||||
|
||||
|
||||
;=================================
|
||||
; xloop
|
||||
;=================================
|
||||
|
||||
drops_xloop:
|
||||
|
||||
clc
|
||||
ldy #1
|
||||
lda (BUF1L),Y
|
||||
ldy #81
|
||||
adc (BUF1L),Y
|
||||
ldy #40
|
||||
adc (BUF1L),Y
|
||||
ldy #42
|
||||
adc (BUF1L),Y
|
||||
lsr
|
||||
dey
|
||||
|
||||
; sec
|
||||
sbc (BUF2L),Y
|
||||
bpl done_calc
|
||||
eor #$ff
|
||||
done_calc:
|
||||
sta (BUF2L),Y
|
||||
|
||||
inc BUF1L
|
||||
inc BUF2L
|
||||
bne no_oflo
|
||||
|
||||
inc BUF1H
|
||||
inc BUF2H
|
||||
|
||||
no_oflo:
|
||||
|
||||
; adjust color
|
||||
|
||||
lsr
|
||||
lsr
|
||||
and #$3
|
||||
tay
|
||||
lda colors,Y
|
||||
sta COLOR
|
||||
|
||||
ldy XX
|
||||
jsr PLOT1 ; PLOT AT (GBASL),Y
|
||||
|
||||
dec XX
|
||||
bpl drops_xloop
|
||||
|
||||
dex ; YY
|
||||
bpl drops_yloop
|
||||
|
||||
weird_outer:
|
||||
|
||||
bmi drops_outer ; small enough now!
|
||||
|
||||
colors:
|
||||
.byte $22,$66,$77,$ff
|
||||
|
||||
;colors:
|
||||
;.byte $00,$22,$66,$EE,$77,$ff,$ff,$ff
|
||||
|
||||
; 0 2 6 e 7 f f f
|
||||
; 0000 0010 0110 1110 0111 1111 1111 1111
|
||||
; 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
|
||||
|
||||
|
@ -31,6 +31,9 @@ sier:
|
||||
jsr SETGR ; set lo-res 40x40 mode
|
||||
bit FULLGR ; make it 40x48
|
||||
|
||||
; note we can save 4 bytes if we don't care about what boundary
|
||||
; we start at??
|
||||
|
||||
lda #0
|
||||
sta FRAME
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user