mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-11 05:29:38 +00:00
gr: particle effect
This commit is contained in:
parent
fdeee10096
commit
8dfb365ab5
|
@ -21,7 +21,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
|
||||||
FIREWORKS.BAS THINKING.BAS ARCS.BAS WIRE_HGR.BAS STATIC.BAS \
|
FIREWORKS.BAS THINKING.BAS ARCS.BAS WIRE_HGR.BAS STATIC.BAS \
|
||||||
OVAL.BAS OVAL_HGR.BAS MOVING.BAS THICK_SINE.BAS TURKEY.BAS \
|
OVAL.BAS OVAL_HGR.BAS MOVING.BAS THICK_SINE.BAS TURKEY.BAS \
|
||||||
FLAME_HGR.BAS RECT.BAS SNOWY.BAS EDGAR.BAS OOPS4.BAS OOPS3.BAS \
|
FLAME_HGR.BAS RECT.BAS SNOWY.BAS EDGAR.BAS OOPS4.BAS OOPS3.BAS \
|
||||||
HORROR.BAS DIAMOND.BAS LEMM.BAS OOPS.BAS SPLIT.BAS
|
HORROR.BAS DIAMOND.BAS LEMM.BAS OOPS.BAS SPLIT.BAS PARTICLE.BAS
|
||||||
# cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk
|
# cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk
|
||||||
cp empty.dsk appleiibot.dsk
|
cp empty.dsk appleiibot.dsk
|
||||||
$(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD
|
$(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD
|
||||||
|
@ -116,6 +116,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \
|
||||||
$(DOS33) -y appleiibot.dsk SAVE A LEMM.BAS
|
$(DOS33) -y appleiibot.dsk SAVE A LEMM.BAS
|
||||||
$(DOS33) -y appleiibot.dsk SAVE A OOPS.BAS
|
$(DOS33) -y appleiibot.dsk SAVE A OOPS.BAS
|
||||||
$(DOS33) -y appleiibot.dsk SAVE A SPLIT.BAS
|
$(DOS33) -y appleiibot.dsk SAVE A SPLIT.BAS
|
||||||
|
$(DOS33) -y appleiibot.dsk SAVE A PARTICLE.BAS
|
||||||
|
|
||||||
####
|
####
|
||||||
|
|
||||||
|
@ -660,5 +661,10 @@ SPLIT.BAS: split.bas
|
||||||
|
|
||||||
####
|
####
|
||||||
|
|
||||||
|
PARTICLE.BAS: particle.bas
|
||||||
|
$(TOKENIZE) < particle.bas > PARTICLE.BAS
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *~ *.o *.lst convert_to convert_from convert_qkumba convert_vmw make_boxes convert_back convert_tgreene LOAD *.BAS make_hgr_boxes
|
rm -f *~ *.o *.lst convert_to convert_from convert_qkumba convert_vmw make_boxes convert_back convert_tgreene LOAD *.BAS make_hgr_boxes
|
||||||
|
|
2
basic/appleiibot/particle.bas
Normal file
2
basic/appleiibot/particle.bas
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
1FORI=0TO139:POKE876+I,4*PEEK(2125+I)-204+(PEEK(2265+I/3)-35)/4^(I-INT(I/3)*3):NEXT
|
||||||
|
2&"-ho<Gc<Hc]L;YqZ/3Z.3Z-3Z(2ebnb/:R,:Z3;?7eGU5r/;b.:R/;Z2;?3eKR9]<Z35DZ.:]5Z3/8k2eSLZ3/8k2Z3;b3;;Loj3;?ib3;A\b*9E;3qeg]iV\9C<<U3A_TBDD65m5KFK3[++$337;O73?#)K373''7';7*U*)V*'%+%$5G#%;NC4*@#/
|
47
graphics/gr/particle/Makefile
Normal file
47
graphics/gr/particle/Makefile
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
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
|
||||||
|
EMPTY_DISK = ../../../empty_disk
|
||||||
|
|
||||||
|
all: particle.dsk
|
||||||
|
|
||||||
|
$(DOS33):
|
||||||
|
cd ../../../utils/dos33fs-utils && make
|
||||||
|
|
||||||
|
particle.dsk: $(DOS33) HELLO PARTICLE PARTICLE_BOT
|
||||||
|
cp $(EMPTY_DISK)/empty.dsk particle.dsk
|
||||||
|
$(DOS33) -y particle.dsk SAVE A HELLO
|
||||||
|
$(DOS33) -y particle.dsk BSAVE -a 0xc00 PARTICLE
|
||||||
|
$(DOS33) -y particle.dsk BSAVE -a 0x36C PARTICLE_BOT
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
HELLO: hello.bas
|
||||||
|
$(TOKENIZE) < hello.bas > HELLO
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
PARTICLE: particle.o
|
||||||
|
ld65 -o PARTICLE particle.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||||
|
|
||||||
|
particle.o: particle.s
|
||||||
|
ca65 -o particle.o particle.s -l particle.lst
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
PARTICLE_BOT: particle_bot.o
|
||||||
|
ld65 -o PARTICLE_BOT particle_bot.o -C $(LINKERSCRIPTS)/apple2_36c.inc
|
||||||
|
|
||||||
|
particle_bot.o: particle_bot.s
|
||||||
|
ca65 -o particle_bot.o particle_bot.s -l particle_bot.lst
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *~ *.o *.lst HELLO PARTICLE PARTICLE_BOT
|
||||||
|
|
2
graphics/gr/particle/hello.bas
Normal file
2
graphics/gr/particle/hello.bas
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
5 HOME
|
||||||
|
10 PRINT CHR$(4);"CATALOG"
|
189
graphics/gr/particle/particle.s
Normal file
189
graphics/gr/particle/particle.s
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
; particle effect? -- Apple II Lores
|
||||||
|
|
||||||
|
; by Vince `deater` Weaver
|
||||||
|
|
||||||
|
PARTICLES = 128
|
||||||
|
SCALE = 2
|
||||||
|
|
||||||
|
COLOR = $30
|
||||||
|
|
||||||
|
QUOTIENT = $FA
|
||||||
|
DIVISOR = $FB
|
||||||
|
DIVIDEND = $FC
|
||||||
|
XX = $FD
|
||||||
|
YY = $FE
|
||||||
|
FRAME = $FF
|
||||||
|
|
||||||
|
FULLGR = $C052
|
||||||
|
LORES = $C056 ; Enable LORES graphics
|
||||||
|
|
||||||
|
HGR2 = $F3D8
|
||||||
|
HGR = $F3E2
|
||||||
|
PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved)
|
||||||
|
SETGR = $FB40
|
||||||
|
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
|
||||||
|
|
||||||
|
|
||||||
|
particle_x = $2000
|
||||||
|
particle_y = $2100
|
||||||
|
particle_life = $2200
|
||||||
|
particle_vx = $2300
|
||||||
|
particle_vy = $2400
|
||||||
|
particle_decay = $2600
|
||||||
|
|
||||||
|
particle:
|
||||||
|
|
||||||
|
jsr SETGR
|
||||||
|
bit FULLGR
|
||||||
|
|
||||||
|
; init
|
||||||
|
|
||||||
|
ldx #PARTICLES
|
||||||
|
init_particles_loop:
|
||||||
|
jsr init_particle
|
||||||
|
dex
|
||||||
|
bpl init_particles_loop
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
main_loop:
|
||||||
|
|
||||||
|
lda #200
|
||||||
|
jsr WAIT
|
||||||
|
|
||||||
|
; clear screen
|
||||||
|
ldx #0
|
||||||
|
lda #$8
|
||||||
|
sta clear_loop_smc+2
|
||||||
|
lda #0
|
||||||
|
|
||||||
|
clear_loop:
|
||||||
|
|
||||||
|
clear_loop_smc:
|
||||||
|
sta $400,X
|
||||||
|
dex
|
||||||
|
bne clear_loop
|
||||||
|
dec clear_loop_smc+2
|
||||||
|
ldy clear_loop_smc+2
|
||||||
|
cpy #3
|
||||||
|
bne clear_loop
|
||||||
|
|
||||||
|
; move particles
|
||||||
|
; draw particles
|
||||||
|
ldx #PARTICLES
|
||||||
|
draw_particles_loop:
|
||||||
|
|
||||||
|
; adjust x
|
||||||
|
|
||||||
|
lda particle_x,X
|
||||||
|
clc
|
||||||
|
adc particle_vx,X
|
||||||
|
sta particle_x,X
|
||||||
|
bmi redo_particle
|
||||||
|
cmp #40*SCALE
|
||||||
|
bcs redo_particle
|
||||||
|
|
||||||
|
; adjust y
|
||||||
|
|
||||||
|
; first adjust for gravity
|
||||||
|
inc particle_vy,X
|
||||||
|
; inc particle_vy,X
|
||||||
|
|
||||||
|
lda particle_y,X
|
||||||
|
clc
|
||||||
|
adc particle_vy,X
|
||||||
|
sta particle_y,X
|
||||||
|
bmi redo_particle
|
||||||
|
cmp #48*SCALE
|
||||||
|
bcc y_good
|
||||||
|
|
||||||
|
redo_particle:
|
||||||
|
jsr init_particle
|
||||||
|
|
||||||
|
y_good:
|
||||||
|
|
||||||
|
lda particle_life,X
|
||||||
|
sta COLOR
|
||||||
|
sec
|
||||||
|
sbc #$11
|
||||||
|
sta particle_life,X
|
||||||
|
cmp #$ef
|
||||||
|
beq redo_particle
|
||||||
|
|
||||||
|
lda particle_x,X
|
||||||
|
lsr
|
||||||
|
tay
|
||||||
|
|
||||||
|
lda particle_y,X
|
||||||
|
lsr
|
||||||
|
jsr PLOT ; PLOT AT Y,A
|
||||||
|
|
||||||
|
dex
|
||||||
|
bpl draw_particles_loop
|
||||||
|
|
||||||
|
jmp main_loop
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; init particle
|
||||||
|
; particle in X
|
||||||
|
init_particle:
|
||||||
|
|
||||||
|
; source
|
||||||
|
|
||||||
|
lda #20*SCALE
|
||||||
|
sta particle_x,X
|
||||||
|
lda #10*SCALE
|
||||||
|
sta particle_y,X
|
||||||
|
|
||||||
|
; color
|
||||||
|
lda #$ff
|
||||||
|
sta particle_life,X
|
||||||
|
|
||||||
|
; velocities
|
||||||
|
; -8 to 8?
|
||||||
|
|
||||||
|
jsr random
|
||||||
|
cmp #$80
|
||||||
|
ror
|
||||||
|
|
||||||
|
sta particle_vx,X
|
||||||
|
|
||||||
|
jsr random
|
||||||
|
sta particle_vy,X
|
||||||
|
|
||||||
|
; we don't actually use this?
|
||||||
|
|
||||||
|
; lda #32
|
||||||
|
; sta particle_decay,X
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
; -8 to 8
|
||||||
|
random:
|
||||||
|
|
||||||
|
inc random_smc+1
|
||||||
|
bne noflo
|
||||||
|
inc random_smc+2
|
||||||
|
beq noflo
|
||||||
|
lda #$d0
|
||||||
|
sta random_smc+2
|
||||||
|
|
||||||
|
noflo:
|
||||||
|
|
||||||
|
random_smc:
|
||||||
|
lda $d000
|
||||||
|
|
||||||
|
and #$f
|
||||||
|
sec
|
||||||
|
sbc #$8
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; need this to be at $3F5
|
||||||
|
|
||||||
|
jmp particle
|
176
graphics/gr/particle/particle_bot.s
Normal file
176
graphics/gr/particle/particle_bot.s
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
; particle effect? -- Apple II Lores
|
||||||
|
|
||||||
|
; by Vince `deater` Weaver
|
||||||
|
|
||||||
|
; 175 bytes at start
|
||||||
|
; 169 bytes -- use batari RNG
|
||||||
|
; 163 bytes -- optimize clear screen
|
||||||
|
; 159 bytes -- WAIT leaves A as 0, X is 0 on other loop
|
||||||
|
; 154 bytes -- init with HGR
|
||||||
|
; 150 bytes -- inline particle_init
|
||||||
|
; 145 bytes -- optimize color code
|
||||||
|
|
||||||
|
PARTICLES = 256
|
||||||
|
SCALE = 2
|
||||||
|
|
||||||
|
SEEDHI = $43
|
||||||
|
SEEDLO = $44
|
||||||
|
|
||||||
|
COLOR = $30
|
||||||
|
|
||||||
|
FULLGR = $C052
|
||||||
|
LORES = $C056 ; Enable LORES graphics
|
||||||
|
|
||||||
|
HGR2 = $F3D8
|
||||||
|
HGR = $F3E2
|
||||||
|
PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved)
|
||||||
|
SETCOL = $F864 ; COLOR=A
|
||||||
|
SETGR = $FB40
|
||||||
|
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
|
||||||
|
|
||||||
|
|
||||||
|
particle_x = $2000
|
||||||
|
particle_y = $2100
|
||||||
|
particle_life = $2200
|
||||||
|
particle_vx = $2300
|
||||||
|
particle_vy = $2400
|
||||||
|
particle_decay = $2600
|
||||||
|
|
||||||
|
particle:
|
||||||
|
|
||||||
|
; HGR clears our particle area to 0
|
||||||
|
|
||||||
|
jsr HGR
|
||||||
|
bit FULLGR
|
||||||
|
bit LORES ; lores
|
||||||
|
|
||||||
|
main_loop:
|
||||||
|
|
||||||
|
lda #100
|
||||||
|
jsr WAIT
|
||||||
|
|
||||||
|
; clear screen
|
||||||
|
|
||||||
|
; X is 0 at least on the second time through
|
||||||
|
|
||||||
|
; ldx #0
|
||||||
|
; txa
|
||||||
|
clear_loop:
|
||||||
|
sta $400,X
|
||||||
|
sta $500,X
|
||||||
|
sta $600,X
|
||||||
|
sta $700,X
|
||||||
|
dex
|
||||||
|
bne clear_loop
|
||||||
|
|
||||||
|
; move particles
|
||||||
|
; draw particles
|
||||||
|
|
||||||
|
;ldx #0 ; 256 particles (X should be 0 here)
|
||||||
|
draw_particles_loop:
|
||||||
|
|
||||||
|
; adjust x
|
||||||
|
|
||||||
|
lda particle_x,X
|
||||||
|
; clc
|
||||||
|
adc particle_vx,X
|
||||||
|
sta particle_x,X
|
||||||
|
|
||||||
|
bmi redo_particle ; new particle if off screen
|
||||||
|
cmp #40*SCALE
|
||||||
|
bcs redo_particle
|
||||||
|
|
||||||
|
; adjust y
|
||||||
|
|
||||||
|
; first adjust for gravity
|
||||||
|
inc particle_vy,X
|
||||||
|
|
||||||
|
lda particle_y,X
|
||||||
|
; clc
|
||||||
|
adc particle_vy,X
|
||||||
|
sta particle_y,X
|
||||||
|
|
||||||
|
bmi redo_particle ; new particle if off screen
|
||||||
|
cmp #48*SCALE
|
||||||
|
bcc y_good
|
||||||
|
|
||||||
|
redo_particle:
|
||||||
|
|
||||||
|
; init particle
|
||||||
|
; particle in X
|
||||||
|
init_particle:
|
||||||
|
|
||||||
|
; source
|
||||||
|
|
||||||
|
lda #20*SCALE
|
||||||
|
sta particle_x,X
|
||||||
|
lsr
|
||||||
|
; lda #10*SCALE
|
||||||
|
sta particle_y,X
|
||||||
|
|
||||||
|
; color
|
||||||
|
lda #$f
|
||||||
|
sta particle_life,X
|
||||||
|
|
||||||
|
; velocities
|
||||||
|
; -8 to 8?
|
||||||
|
|
||||||
|
jsr random
|
||||||
|
cmp #$80 ; asr
|
||||||
|
ror
|
||||||
|
|
||||||
|
sta particle_vx,X
|
||||||
|
|
||||||
|
jsr random
|
||||||
|
sta particle_vy,X
|
||||||
|
|
||||||
|
; done inline
|
||||||
|
|
||||||
|
y_good:
|
||||||
|
|
||||||
|
lda particle_life,X ; set color
|
||||||
|
jsr SETCOL
|
||||||
|
|
||||||
|
dec particle_life,X ; decreent color
|
||||||
|
|
||||||
|
bmi redo_particle ; if <0 then new particle
|
||||||
|
|
||||||
|
lda particle_x,X ; we're actually *2
|
||||||
|
lsr
|
||||||
|
tay
|
||||||
|
|
||||||
|
lda particle_y,X
|
||||||
|
lsr
|
||||||
|
jsr PLOT ; PLOT AT Y,A
|
||||||
|
|
||||||
|
dex
|
||||||
|
bne draw_particles_loop
|
||||||
|
|
||||||
|
beq main_loop
|
||||||
|
|
||||||
|
|
||||||
|
; -8 to 8
|
||||||
|
; batari RNG
|
||||||
|
|
||||||
|
random:
|
||||||
|
lda SEEDHI
|
||||||
|
lsr
|
||||||
|
rol SEEDLO
|
||||||
|
bcc noeor
|
||||||
|
eor #$B4
|
||||||
|
noeor:
|
||||||
|
sta SEEDHI
|
||||||
|
eor SEEDLO
|
||||||
|
|
||||||
|
and #$f
|
||||||
|
; sec
|
||||||
|
sbc #$8
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
; need this to be at $3F5
|
||||||
|
|
||||||
|
; 140 so 137, $36C
|
||||||
|
|
||||||
|
jmp particle
|
Loading…
Reference in New Issue
Block a user