mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-07 08:30:20 +00:00
hgr: particle
This commit is contained in:
parent
8dfb365ab5
commit
c0ee4c4df2
47
graphics/hgr/particle/Makefile
Normal file
47
graphics/hgr/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_hgr.dsk
|
||||
|
||||
$(DOS33):
|
||||
cd ../../../utils/dos33fs-utils && make
|
||||
|
||||
particle_hgr.dsk: $(DOS33) HELLO PARTICLE_HGR PARTICLE_HGR_BOT
|
||||
cp $(EMPTY_DISK)/empty.dsk particle_hgr.dsk
|
||||
$(DOS33) -y particle_hgr.dsk SAVE A HELLO
|
||||
$(DOS33) -y particle_hgr.dsk BSAVE -a 0xc00 PARTICLE_HGR
|
||||
$(DOS33) -y particle_hgr.dsk BSAVE -a 0x36C PARTICLE_HGR_BOT
|
||||
|
||||
###
|
||||
|
||||
HELLO: hello.bas
|
||||
$(TOKENIZE) < hello.bas > HELLO
|
||||
|
||||
###
|
||||
|
||||
PARTICLE_HGR: particle_hgr.o
|
||||
ld65 -o PARTICLE_HGR particle_hgr.o -C $(LINKERSCRIPTS)/apple2_c00.inc
|
||||
|
||||
particle_hgr.o: particle_hgr.s
|
||||
ca65 -o particle_hgr.o particle_hgr.s -l particle_hgr.lst
|
||||
|
||||
###
|
||||
|
||||
PARTICLE_HGR_BOT: particle_hgr_bot.o
|
||||
ld65 -o PARTICLE_HGR_BOT particle_hgr_bot.o -C $(LINKERSCRIPTS)/apple2_36c.inc
|
||||
|
||||
particle_hgr_bot.o: particle_hgr_bot.s
|
||||
ca65 -o particle_hgr_bot.o particle_hgr_bot.s -l particle_hgr_bot.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO PARTICLE_HGR PARTICLE_HGR_BOT
|
||||
|
2
graphics/hgr/particle/hello.bas
Normal file
2
graphics/hgr/particle/hello.bas
Normal file
|
@ -0,0 +1,2 @@
|
|||
5 HOME
|
||||
10 PRINT CHR$(4);"CATALOG"
|
203
graphics/hgr/particle/particle_hgr.s
Normal file
203
graphics/hgr/particle/particle_hgr.s
Normal file
|
@ -0,0 +1,203 @@
|
|||
; particle effect? -- Apple II Lores
|
||||
|
||||
; by Vince `deater` Weaver
|
||||
|
||||
PARTICLES = 64
|
||||
SCALE = 2
|
||||
|
||||
HGR_BITS = $1C
|
||||
COLOR = $30
|
||||
SEEDLO = $43
|
||||
SEEDHI = $44
|
||||
HGR_COLOR = $E4
|
||||
|
||||
QUOTIENT = $FA
|
||||
DIVISOR = $FB
|
||||
DIVIDEND = $FC
|
||||
XX = $FD
|
||||
YY = $FE
|
||||
FRAME = $FF
|
||||
|
||||
FULLGR = $C052
|
||||
LORES = $C056 ; Enable LORES graphics
|
||||
|
||||
HGR2 = $F3D8
|
||||
HGR = $F3E2
|
||||
HPLOT0 = $F457 ; plot at (Y,X), (A)
|
||||
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:
|
||||
jsr HGR ; clear $2000 for data struct
|
||||
jsr HGR2 ; clear/display HGR2
|
||||
|
||||
; init
|
||||
|
||||
ldx #PARTICLES
|
||||
init_particles_loop:
|
||||
jsr init_particle
|
||||
dex
|
||||
bpl init_particles_loop
|
||||
|
||||
|
||||
|
||||
main_loop:
|
||||
|
||||
lda #100
|
||||
jsr WAIT
|
||||
|
||||
lda #0
|
||||
sta HGR_COLOR
|
||||
|
||||
ldx #PARTICLES
|
||||
clear_loop:
|
||||
|
||||
txa
|
||||
pha
|
||||
tay
|
||||
|
||||
ldx particle_x,Y
|
||||
lda particle_y,Y
|
||||
ldy #0
|
||||
jsr HPLOT0 ; plot at (Y,X), (A)
|
||||
|
||||
pla
|
||||
tax
|
||||
|
||||
dex
|
||||
bpl 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 #191
|
||||
bcc y_good
|
||||
|
||||
redo_particle:
|
||||
jsr init_particle
|
||||
|
||||
y_good:
|
||||
dec particle_life,X
|
||||
beq redo_particle
|
||||
|
||||
lda #$ff
|
||||
sta HGR_COLOR
|
||||
|
||||
; lda particle_life,X
|
||||
; sta HGR_COLOR
|
||||
; sec
|
||||
; sbc #$11
|
||||
; sta particle_life,X
|
||||
; cmp #$ef
|
||||
; beq redo_particle
|
||||
|
||||
txa
|
||||
pha
|
||||
tay
|
||||
|
||||
ldx particle_x,Y
|
||||
lda particle_y,Y
|
||||
ldy #0
|
||||
jsr HPLOT0 ; plot at (Y,X), (A)
|
||||
|
||||
pla
|
||||
tax
|
||||
|
||||
dex
|
||||
bpl draw_particles_loop
|
||||
|
||||
jmp main_loop
|
||||
|
||||
|
||||
|
||||
|
||||
; init particle
|
||||
; particle in X
|
||||
init_particle:
|
||||
|
||||
; source
|
||||
|
||||
lda #128 ; init x
|
||||
sta particle_x,X
|
||||
lda #100 ; init y
|
||||
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
|
||||
ora #$f0
|
||||
sta particle_vy,X
|
||||
|
||||
rts
|
||||
|
||||
|
||||
; -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
|
||||
|
||||
jmp particle
|
180
graphics/hgr/particle/particle_hgr_bot.s
Normal file
180
graphics/hgr/particle/particle_hgr_bot.s
Normal file
|
@ -0,0 +1,180 @@
|
|||
; particle effect? -- Apple II Lores
|
||||
|
||||
; by Vince `deater` Weaver
|
||||
|
||||
|
||||
; 165 byte original
|
||||
; 154 skip init code
|
||||
; 152 avoid saving on stack
|
||||
; 147 inline init particle
|
||||
; 144 bytes, remove wait
|
||||
|
||||
PARTICLES = 64
|
||||
|
||||
HGR_BITS = $1C
|
||||
COLOR = $30
|
||||
SEEDLO = $43
|
||||
SEEDHI = $44
|
||||
HGR_COLOR = $E4
|
||||
|
||||
PARTICLE2 = $FD
|
||||
PARTICLE = $FE
|
||||
FRAME = $FF
|
||||
|
||||
FULLGR = $C052
|
||||
LORES = $C056 ; Enable LORES graphics
|
||||
|
||||
HGR2 = $F3D8
|
||||
HGR = $F3E2
|
||||
HPLOT0 = $F457 ; plot at (Y,X), (A)
|
||||
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:
|
||||
jsr HGR ; clear $2000 for data struct
|
||||
jsr HGR2 ; clear/display HGR2
|
||||
|
||||
; init
|
||||
|
||||
; just let it init to 0, eventually starts
|
||||
|
||||
|
||||
main_loop:
|
||||
|
||||
; lda #100
|
||||
; jsr WAIT
|
||||
|
||||
lda #0 ; already 0 from wait
|
||||
sta HGR_COLOR
|
||||
|
||||
ldx #PARTICLES
|
||||
stx PARTICLE
|
||||
stx PARTICLE2
|
||||
|
||||
clear_loop:
|
||||
|
||||
ldy PARTICLE
|
||||
|
||||
ldx particle_x,Y
|
||||
lda particle_y,Y
|
||||
ldy #0
|
||||
jsr HPLOT0 ; plot at (Y,X), (A)
|
||||
|
||||
dec PARTICLE
|
||||
bpl clear_loop
|
||||
|
||||
|
||||
|
||||
; move particles
|
||||
; draw particles
|
||||
; ldx #PARTICLES
|
||||
draw_particles_loop:
|
||||
|
||||
ldy PARTICLE2
|
||||
tya
|
||||
tax
|
||||
|
||||
; adjust x
|
||||
|
||||
lda particle_x,Y
|
||||
clc
|
||||
adc particle_vx,Y
|
||||
sta particle_x,Y
|
||||
|
||||
; don't look for overflow on X, just wrap
|
||||
|
||||
|
||||
|
||||
; first adjust for gravity
|
||||
inc particle_vy,X
|
||||
|
||||
; adjust y
|
||||
|
||||
lda particle_y,Y
|
||||
clc
|
||||
adc particle_vy,Y
|
||||
sta particle_y,Y
|
||||
cmp #191
|
||||
bcc y_good
|
||||
|
||||
redo_particle:
|
||||
|
||||
; inline
|
||||
|
||||
; init particle
|
||||
; particle in X
|
||||
init_particle:
|
||||
|
||||
; source
|
||||
|
||||
lda #128 ; init x
|
||||
sta particle_x,Y
|
||||
lda #100 ; init y
|
||||
sta particle_y,Y
|
||||
|
||||
; color
|
||||
lda #$f
|
||||
sta particle_life,Y
|
||||
|
||||
; velocities
|
||||
; -8 to 8?
|
||||
|
||||
jsr random
|
||||
cmp #$80
|
||||
ror
|
||||
|
||||
sta particle_vx,Y
|
||||
|
||||
jsr random
|
||||
ora #$f0
|
||||
sta particle_vy,Y
|
||||
|
||||
|
||||
y_good:
|
||||
dec particle_life,X
|
||||
beq redo_particle
|
||||
|
||||
lda #$ff
|
||||
sta HGR_COLOR
|
||||
|
||||
ldx particle_x,Y
|
||||
lda particle_y,Y
|
||||
ldy #0
|
||||
jsr HPLOT0 ; plot at (Y,X), (A)
|
||||
|
||||
dec PARTICLE2
|
||||
bpl draw_particles_loop
|
||||
|
||||
bmi 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
|
||||
|
||||
jmp particle
|
Loading…
Reference in New Issue
Block a user