mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-27 17:29:49 +00:00
rotozoom: more optimizations from qkumba
This commit is contained in:
parent
dc68aabd8d
commit
908f7f96b8
@ -130,6 +130,9 @@ plot_yloop:
|
||||
plot_mask:
|
||||
sty MASK
|
||||
|
||||
; ugh can't use PLOT trick as it always will draw something
|
||||
; to PAGE1 even if we don't want to
|
||||
|
||||
jsr GBASCALC ; point GBASL/H to address in (A is ycoord/2)
|
||||
; after, A is GBASL, C is clear
|
||||
|
||||
|
@ -6,11 +6,12 @@ LINKERSCRIPTS = ../../../linker_scripts
|
||||
|
||||
all: roto.dsk make_sine_table
|
||||
|
||||
roto.dsk: HELLO ROTO ROTOPLASMA
|
||||
roto.dsk: HELLO ROTO ROTOPLASMA ROTOPLASMA_TINY
|
||||
cp empty.dsk roto.dsk
|
||||
$(DOS33) -y roto.dsk SAVE A HELLO
|
||||
$(DOS33) -y roto.dsk BSAVE -a 0x1000 ROTO
|
||||
$(DOS33) -y roto.dsk BSAVE -a 0x1000 ROTOPLASMA
|
||||
$(DOS33) -y roto.dsk BSAVE -a 0x1000 ROTOPLASMA_TINY
|
||||
|
||||
###
|
||||
|
||||
@ -33,6 +34,15 @@ ROTOPLASMA: rotoplasma.o
|
||||
rotoplasma.o: rotoplasma.s rotozoom_texture.s plasma.s
|
||||
ca65 -o rotoplasma.o rotoplasma.s -l rotoplasma.lst
|
||||
|
||||
###
|
||||
|
||||
ROTOPLASMA_TINY: rotoplasma_tiny.o
|
||||
ld65 -o ROTOPLASMA_TINY rotoplasma_tiny.o -C $(LINKERSCRIPTS)/apple2_1000.inc
|
||||
|
||||
rotoplasma_tiny.o: rotoplasma_tiny.s rotozoom_texture.s plasma.s
|
||||
ca65 -o rotoplasma_tiny.o rotoplasma_tiny.s -l rotoplasma_tiny.lst
|
||||
|
||||
|
||||
|
||||
###
|
||||
|
||||
@ -45,4 +55,4 @@ make_sine_table.o: make_sine_table.c
|
||||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst ROTO ROTOPLASMA make_sine_table
|
||||
rm -f *~ *.o *.lst ROTO ROTOPLASMA ROTOPLASMA_TINY make_sine_table
|
||||
|
170
graphics/gr/rotozoom/rotoplasma_tiny.s
Normal file
170
graphics/gr/rotozoom/rotoplasma_tiny.s
Normal file
@ -0,0 +1,170 @@
|
||||
; rotozoom with cycling plasma texture
|
||||
;
|
||||
|
||||
; TODO:
|
||||
; make angle 64 degrees?
|
||||
; remove scaling step?
|
||||
; cycle between all four color schemes?
|
||||
|
||||
|
||||
|
||||
.include "zp.inc"
|
||||
.include "hardware.inc"
|
||||
|
||||
;================================
|
||||
; Clear screen and setup graphics
|
||||
;================================
|
||||
|
||||
jsr HOME
|
||||
bit PAGE0 ; set page 0
|
||||
bit LORES ; Lo-res graphics
|
||||
bit FULLGR ; mixed gr/text mode
|
||||
bit SET_GR ; set graphics
|
||||
|
||||
lda #0
|
||||
sta DISP_PAGE
|
||||
lda #4
|
||||
sta DRAW_PAGE
|
||||
|
||||
;===================================
|
||||
; Clear top/bottom of page 0 and 1
|
||||
;===================================
|
||||
|
||||
; jsr clear_screens
|
||||
|
||||
;===================================
|
||||
; init the multiply tables
|
||||
;===================================
|
||||
|
||||
jsr init_multiply_tables
|
||||
|
||||
;======================
|
||||
; init plasma texture
|
||||
;======================
|
||||
|
||||
jsr init_plasma_texture
|
||||
|
||||
;=================================
|
||||
; main loop
|
||||
|
||||
lda #0
|
||||
sta ANGLE
|
||||
sta SCALE_F
|
||||
sta FRAMEL
|
||||
|
||||
lda #1
|
||||
sta SCALE_I
|
||||
|
||||
main_loop:
|
||||
jsr update_plasma
|
||||
|
||||
jsr rotozoom
|
||||
|
||||
jsr page_flip
|
||||
|
||||
wait_for_keypress:
|
||||
; lda KEYPRESS
|
||||
; bpl wait_for_keypress
|
||||
; bit KEYRESET
|
||||
|
||||
|
||||
clc
|
||||
lda FRAMEL
|
||||
adc direction
|
||||
sta FRAMEL
|
||||
|
||||
cmp #$f8
|
||||
beq back_at_zero
|
||||
cmp #33
|
||||
; beq at_far_end
|
||||
beq back_at_zero
|
||||
bne done_reverse
|
||||
|
||||
back_at_zero:
|
||||
; change plasma color
|
||||
|
||||
inc which_color
|
||||
lda which_color
|
||||
cmp #4
|
||||
bne refresh_color
|
||||
lda #0
|
||||
sta which_color
|
||||
refresh_color:
|
||||
asl
|
||||
tay
|
||||
|
||||
lda colorlookup,Y
|
||||
sta color_lookup_smc+1
|
||||
; sta colorlookup2_smc+1
|
||||
lda colorlookup+1,Y
|
||||
sta color_lookup_smc+2
|
||||
; sta colorlookup2_smc+2
|
||||
|
||||
at_far_end:
|
||||
|
||||
; change bg color
|
||||
|
||||
; reverse direction
|
||||
lda direction
|
||||
eor #$ff
|
||||
clc
|
||||
adc #1
|
||||
sta direction
|
||||
|
||||
lda scaleaddl
|
||||
eor #$ff
|
||||
clc
|
||||
adc #1
|
||||
sta scaleaddl
|
||||
|
||||
lda scaleaddh
|
||||
eor #$ff
|
||||
adc #0
|
||||
sta scaleaddh
|
||||
|
||||
done_reverse:
|
||||
|
||||
|
||||
clc
|
||||
lda ANGLE
|
||||
adc direction
|
||||
and #$3f
|
||||
sta ANGLE
|
||||
|
||||
; increment zoom
|
||||
|
||||
; clc
|
||||
; lda SCALE_F
|
||||
; adc scaleaddl
|
||||
; sta SCALE_F
|
||||
; lda SCALE_I
|
||||
; adc scaleaddh
|
||||
; sta SCALE_I
|
||||
|
||||
jmp main_loop
|
||||
|
||||
|
||||
direction: .byte $01
|
||||
scaleaddl: .byte $10
|
||||
scaleaddh: .byte $00
|
||||
|
||||
;===============================================
|
||||
; External modules
|
||||
;===============================================
|
||||
|
||||
.include "rotozoom_texture.s"
|
||||
.include "plasma.s"
|
||||
|
||||
.include "gr_pageflip.s"
|
||||
.include "gr_fast_clear.s"
|
||||
.include "gr_copy.s"
|
||||
;.include "decompress_fast_v2.s"
|
||||
|
||||
.include "gr_offsets.s"
|
||||
.include "c00_scrn_offsets.s"
|
||||
|
||||
.include "multiply_fast.s"
|
||||
|
||||
;===============================================
|
||||
; Data
|
||||
;===============================================
|
@ -22,6 +22,7 @@
|
||||
; $39dc9=237,001= change to use common lookup table (outside inner loop)
|
||||
; $3399f=211,359=4.73fps unroll the Y loop by one
|
||||
; $2BA83=178,819=5.59fps optimize unrolled loop
|
||||
; $2B14B=176,459=5.66fps avoid extra jump (qkumba)
|
||||
|
||||
CAL = $B0
|
||||
CAH = $B1
|
||||
@ -265,13 +266,7 @@ roto_color_even_smc:
|
||||
; carry was set a bit before to low bit of YPH
|
||||
; hopefully nothing has cleared it
|
||||
|
||||
bcs rscrn_adjust_odd ; 2nt/3
|
||||
|
||||
rscrn_adjust_even:
|
||||
|
||||
; YP was even so want bottom nibble
|
||||
and #$f ; 2
|
||||
jmp rscrn_done ; 3
|
||||
bcc rscrn_adjust_even ; 2nt/3
|
||||
|
||||
rscrn_adjust_odd:
|
||||
; YP was odd so want top nibble
|
||||
@ -280,6 +275,13 @@ rscrn_adjust_odd:
|
||||
lsr ; 2
|
||||
lsr ; 2
|
||||
|
||||
; fall through
|
||||
|
||||
rscrn_adjust_even:
|
||||
|
||||
; YP was even so want bottom nibble
|
||||
and #$f ; 2
|
||||
|
||||
rscrn_done:
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user