mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-03 18:29:53 +00:00
blue_flame: more optimization
This commit is contained in:
parent
5e823b17d3
commit
3e84b26e7b
@ -48,7 +48,7 @@ blue_flame.o: blue_flame.s \
|
||||
letters.s flame.s sier.s zp.inc \
|
||||
ay3_write_regs.s interrupt_handler.s play_frame.s \
|
||||
SmallLove2.s mockingboard_constants.s mockingboard_init.s \
|
||||
tracker_init.s static_column.s
|
||||
tracker_init.s static_column.s letters_routines.s
|
||||
ca65 -o blue_flame.o blue_flame.s -l blue_flame.lst
|
||||
|
||||
####
|
||||
|
@ -14,6 +14,7 @@
|
||||
; 1040 bytes (+20) -- no need to init FRAME/FRAMEH
|
||||
; 1038 bytes (+18) -- re-arrange sound init so don't have to set Y to 0
|
||||
; 1035 bytes (+15) -- combine memory zeroing functions
|
||||
; 1033 bytes (+13) -- inline letters code
|
||||
|
||||
.include "zp.inc"
|
||||
.include "hardware.inc"
|
||||
@ -98,24 +99,28 @@ div4_loop:
|
||||
|
||||
cli ; enable music
|
||||
|
||||
;=====================================
|
||||
; inline the parallax sierpinski code
|
||||
|
||||
.include "sier.s"
|
||||
|
||||
;====================================
|
||||
; inline the "static column" code
|
||||
|
||||
.include "static_column.s"
|
||||
|
||||
jsr do_letters
|
||||
;====================================
|
||||
; inline the letters code
|
||||
|
||||
.include "letters.s"
|
||||
|
||||
;====================================
|
||||
; fallthrough into flames
|
||||
|
||||
; jsr flames
|
||||
;
|
||||
;end:
|
||||
; jmp end
|
||||
.include "flame.s"
|
||||
|
||||
|
||||
.include "flame.s"
|
||||
|
||||
.include "letters.s"
|
||||
|
||||
.include "letters_routines.s"
|
||||
.include "interrupt_handler.s"
|
||||
.include "mockingboard_constants.s"
|
||||
|
||||
|
@ -52,6 +52,8 @@ do_letters:
|
||||
|
||||
; jsr zoom_in ; just fall through
|
||||
|
||||
; A is $FF here
|
||||
|
||||
;=========================
|
||||
; zoom in
|
||||
;=========================
|
||||
@ -70,11 +72,7 @@ outer_zoom_loop:
|
||||
lda desire_offsets,X ; get offsets in place
|
||||
sta xdraw_offset_smc+1 ; setup xdraw
|
||||
|
||||
bpl not_done2 ; if not end, don't return
|
||||
|
||||
rts
|
||||
|
||||
not_done2:
|
||||
bmi done2 ; if negative, done
|
||||
|
||||
lda #36 ; start big
|
||||
sta HGR_SCALE
|
||||
@ -101,227 +99,9 @@ inner_zoom_loop:
|
||||
|
||||
inc WHICH ; move to next letter
|
||||
|
||||
bpl outer_zoom_loop
|
||||
|
||||
rts
|
||||
|
||||
|
||||
draw_wait_erase:
|
||||
jsr xdraw ; draw
|
||||
|
||||
lda #100 ; wait a bit
|
||||
jsr WAIT
|
||||
|
||||
jmp xdraw ; draw for good
|
||||
|
||||
|
||||
;=========================
|
||||
; slide in
|
||||
;=========================
|
||||
|
||||
slide_in:
|
||||
|
||||
lda #4
|
||||
sta HGR_SCALE
|
||||
|
||||
lda #0
|
||||
sta WHICH
|
||||
|
||||
outer_slide_loop:
|
||||
|
||||
start_smc:
|
||||
lda #252 ; start position
|
||||
sta XPOS ; 252 instead of 279 for size reasons
|
||||
|
||||
lda WHICH
|
||||
tax
|
||||
type_smc:
|
||||
lda desire_ends+1,X
|
||||
sta ends_smc+1
|
||||
|
||||
offsets_smc:
|
||||
lda deater_offsets,X ; point to next
|
||||
sta xdraw_offset_smc+1
|
||||
|
||||
bpl not_done
|
||||
|
||||
rts
|
||||
not_done:
|
||||
|
||||
slide_loop:
|
||||
|
||||
jsr draw_wait_erase
|
||||
|
||||
clc
|
||||
lda XPOS
|
||||
add_smc:
|
||||
adc #$FC
|
||||
sta XPOS
|
||||
|
||||
lsr ; derive rotation from location
|
||||
lsr
|
||||
and #$f
|
||||
tax
|
||||
lda rotate_pattern,X
|
||||
sta ROTATE
|
||||
|
||||
lda XPOS ; see if hit end
|
||||
ends_smc:
|
||||
cmp #65
|
||||
bne slide_loop
|
||||
|
||||
jsr xdraw ; one last draw so remains onscreen
|
||||
|
||||
inc WHICH ; move to next letter
|
||||
|
||||
bpl outer_slide_loop ; bra (WHICH always positive)
|
||||
|
||||
|
||||
|
||||
|
||||
;=======================
|
||||
; xdraw
|
||||
;=======================
|
||||
|
||||
xdraw:
|
||||
ldy #0 ; guess we can't draw far right edge
|
||||
ldx XPOS
|
||||
lda YPOS
|
||||
jsr HPOSN ; X= (y,x) Y=(a)
|
||||
|
||||
clc ; get shape table from offset
|
||||
lda #<shape_table_d
|
||||
xdraw_offset_smc:
|
||||
adc #0
|
||||
tax
|
||||
ldy #>shape_table_d ; assume always in same page
|
||||
|
||||
lda ROTATE
|
||||
|
||||
jmp XDRAW0 ; tail call
|
||||
|
||||
.if 0
|
||||
;=======================
|
||||
; flip page
|
||||
;=======================
|
||||
|
||||
flip_page:
|
||||
lda HGR_PAGE
|
||||
eor #$60
|
||||
sta HGR_PAGE
|
||||
|
||||
clc
|
||||
rol
|
||||
rol
|
||||
tax
|
||||
lda PAGE1,X
|
||||
|
||||
rts
|
||||
.endif
|
||||
|
||||
.if 0
|
||||
|
||||
; border pattern
|
||||
|
||||
lda #4
|
||||
sta HGR_SCALE
|
||||
lda #67
|
||||
sta xdraw_offset_smc+1
|
||||
lda #8
|
||||
sta ROTATE
|
||||
lda #128
|
||||
sta YPOS
|
||||
loop:
|
||||
lda #8
|
||||
sta ROTATE
|
||||
lsr
|
||||
sta XPOS
|
||||
jsr xdraw
|
||||
|
||||
lda #$fc
|
||||
sta ROTATE
|
||||
lda #255
|
||||
sta XPOS
|
||||
jsr xdraw
|
||||
|
||||
dec YPOS
|
||||
dec YPOS
|
||||
dec YPOS
|
||||
dec YPOS
|
||||
|
||||
bne loop
|
||||
|
||||
.endif
|
||||
|
||||
|
||||
; ldy #3 ; 2
|
||||
;init_loop:
|
||||
; tya ; 1
|
||||
; asl
|
||||
; asl
|
||||
; sta rotate_pattern,Y; 3
|
||||
; dey ; 1
|
||||
; bne init_loop ; 2
|
||||
|
||||
.align $100
|
||||
|
||||
rotate_pattern:
|
||||
; offset by 3 to give original effect
|
||||
; .byte 0,3,6
|
||||
.byte 9, 9,6,3,0, 0,$FD,$FA,$F7, $F7,$FA,$FD, 0
|
||||
.byte 0,3,6
|
||||
|
||||
deater_offsets:
|
||||
.byte 0 ; D
|
||||
.byte 8 ; E
|
||||
.byte 15 ; A
|
||||
.byte 23 ; T
|
||||
.byte 8 ; E
|
||||
.byte 30 ; R
|
||||
.byte $FF ; end
|
||||
|
||||
ma2e_offsets:
|
||||
.byte 8 ; E
|
||||
.byte 47 ; 2
|
||||
.byte 15 ; A
|
||||
.byte 39 ; M
|
||||
.byte $FF ; end
|
||||
|
||||
|
||||
desire_offsets:
|
||||
.byte 67 ; -
|
||||
.byte 0 ; D
|
||||
.byte 8 ; E
|
||||
.byte 54 ; S
|
||||
.byte 61 ; I
|
||||
.byte 30 ; R
|
||||
.byte 8 ; E
|
||||
.byte 67 ; -
|
||||
.byte $FF ; end
|
||||
|
||||
desire_ends:
|
||||
; center of screen is 140, offset by 16 each way
|
||||
.byte 28,60,92,124,156,188,220,252
|
||||
|
||||
ma2e_ends:
|
||||
.byte 188,156,124,92
|
||||
|
||||
|
||||
|
||||
shape_table:
|
||||
|
||||
shape_table_d: .byte $23,$2c,$2e,$36, $37,$27,$04,$00 ; 0
|
||||
shape_table_e: .byte $27,$2c,$95,$12, $3f,$24,$00 ; 8
|
||||
shape_table_a: .byte $23,$2c,$35,$96, $24,$3f,$36,$00 ; 15
|
||||
shape_table_t: .byte $12,$24,$e4,$2b, $2d,$05,$00 ; 23
|
||||
shape_table_r: .byte $97,$24,$24,$2d, $36,$37,$35,$06,$00 ; 30
|
||||
shape_table_m: .byte $24,$37,$36,$4e, $24,$24,$07,$00 ; 39
|
||||
shape_table_2: .byte $25,$3c,$97,$39, $36,$2d,$00 ; 47
|
||||
shape_table_s: .byte $27,$2c,$95,$2b, $36,$3f,$00 ; 54
|
||||
shape_table_i: .byte $d2,$ed,$24,$e4, $2d,$00 ; 61
|
||||
shape_table_hline: .byte $2b,$05,$00 ; 67
|
||||
|
||||
;shape_table_vline: .byte $12,$24,$24,$00 ; 67
|
||||
;shape_table_o: .byte $23,$2c,$35,$36, $3e,$27,$04,$00 ;
|
||||
;shape_table_v: .byte $18,$30,$36,$35, $28,$24,$04,$00 ;
|
||||
bpl outer_zoom_loop ; bra
|
||||
|
||||
done2:
|
||||
; rts
|
||||
;
|
||||
;.include "letters_routines.s"
|
||||
|
218
demos/lovebyte2023/1k/letters_routines.s
Normal file
218
demos/lovebyte2023/1k/letters_routines.s
Normal file
@ -0,0 +1,218 @@
|
||||
|
||||
|
||||
draw_wait_erase:
|
||||
jsr xdraw ; draw
|
||||
|
||||
lda #100 ; wait a bit
|
||||
jsr WAIT
|
||||
|
||||
jmp xdraw ; draw for good
|
||||
|
||||
|
||||
;=========================
|
||||
; slide in
|
||||
;=========================
|
||||
|
||||
slide_in:
|
||||
|
||||
lda #4
|
||||
sta HGR_SCALE
|
||||
|
||||
lda #0
|
||||
sta WHICH
|
||||
|
||||
outer_slide_loop:
|
||||
|
||||
start_smc:
|
||||
lda #252 ; start position
|
||||
sta XPOS ; 252 instead of 279 for size reasons
|
||||
|
||||
lda WHICH
|
||||
tax
|
||||
type_smc:
|
||||
lda desire_ends+1,X
|
||||
sta ends_smc+1
|
||||
|
||||
offsets_smc:
|
||||
lda deater_offsets,X ; point to next
|
||||
sta xdraw_offset_smc+1
|
||||
|
||||
bmi done
|
||||
|
||||
slide_loop:
|
||||
|
||||
jsr draw_wait_erase
|
||||
|
||||
clc
|
||||
lda XPOS
|
||||
add_smc:
|
||||
adc #$FC
|
||||
sta XPOS
|
||||
|
||||
lsr ; derive rotation from location
|
||||
lsr
|
||||
and #$f
|
||||
tax
|
||||
lda rotate_pattern,X
|
||||
sta ROTATE
|
||||
|
||||
lda XPOS ; see if hit end
|
||||
ends_smc:
|
||||
cmp #65
|
||||
bne slide_loop
|
||||
|
||||
jsr xdraw ; one last draw so remains onscreen
|
||||
|
||||
inc WHICH ; move to next letter
|
||||
|
||||
bpl outer_slide_loop ; bra (WHICH always positive)
|
||||
done:
|
||||
rts
|
||||
|
||||
|
||||
;=======================
|
||||
; xdraw
|
||||
;=======================
|
||||
|
||||
xdraw:
|
||||
ldy #0 ; guess we can't draw far right edge
|
||||
ldx XPOS
|
||||
lda YPOS
|
||||
jsr HPOSN ; X= (y,x) Y=(a)
|
||||
|
||||
clc ; get shape table from offset
|
||||
lda #<shape_table_d
|
||||
xdraw_offset_smc:
|
||||
adc #0
|
||||
tax
|
||||
ldy #>shape_table_d ; assume always in same page
|
||||
|
||||
lda ROTATE
|
||||
|
||||
jmp XDRAW0 ; tail call
|
||||
|
||||
.if 0
|
||||
;=======================
|
||||
; flip page
|
||||
;=======================
|
||||
|
||||
flip_page:
|
||||
lda HGR_PAGE
|
||||
eor #$60
|
||||
sta HGR_PAGE
|
||||
|
||||
clc
|
||||
rol
|
||||
rol
|
||||
tax
|
||||
lda PAGE1,X
|
||||
|
||||
rts
|
||||
.endif
|
||||
|
||||
.if 0
|
||||
|
||||
; border pattern
|
||||
|
||||
lda #4
|
||||
sta HGR_SCALE
|
||||
lda #67
|
||||
sta xdraw_offset_smc+1
|
||||
lda #8
|
||||
sta ROTATE
|
||||
lda #128
|
||||
sta YPOS
|
||||
loop:
|
||||
lda #8
|
||||
sta ROTATE
|
||||
lsr
|
||||
sta XPOS
|
||||
jsr xdraw
|
||||
|
||||
lda #$fc
|
||||
sta ROTATE
|
||||
lda #255
|
||||
sta XPOS
|
||||
jsr xdraw
|
||||
|
||||
dec YPOS
|
||||
dec YPOS
|
||||
dec YPOS
|
||||
dec YPOS
|
||||
|
||||
bne loop
|
||||
|
||||
.endif
|
||||
|
||||
|
||||
; ldy #3 ; 2
|
||||
;init_loop:
|
||||
; tya ; 1
|
||||
; asl
|
||||
; asl
|
||||
; sta rotate_pattern,Y; 3
|
||||
; dey ; 1
|
||||
; bne init_loop ; 2
|
||||
|
||||
.align $100
|
||||
|
||||
rotate_pattern:
|
||||
; offset by 3 to give original effect
|
||||
; .byte 0,3,6
|
||||
.byte 9, 9,6,3,0, 0,$FD,$FA,$F7, $F7,$FA,$FD, 0
|
||||
.byte 0,3,6
|
||||
|
||||
deater_offsets:
|
||||
.byte 0 ; D
|
||||
.byte 8 ; E
|
||||
.byte 15 ; A
|
||||
.byte 23 ; T
|
||||
.byte 8 ; E
|
||||
.byte 30 ; R
|
||||
.byte $FF ; end
|
||||
|
||||
ma2e_offsets:
|
||||
.byte 8 ; E
|
||||
.byte 47 ; 2
|
||||
.byte 15 ; A
|
||||
.byte 39 ; M
|
||||
.byte $FF ; end
|
||||
|
||||
|
||||
desire_offsets:
|
||||
.byte 67 ; -
|
||||
.byte 0 ; D
|
||||
.byte 8 ; E
|
||||
.byte 54 ; S
|
||||
.byte 61 ; I
|
||||
.byte 30 ; R
|
||||
.byte 8 ; E
|
||||
.byte 67 ; -
|
||||
.byte $FF ; end
|
||||
|
||||
desire_ends:
|
||||
; center of screen is 140, offset by 16 each way
|
||||
.byte 28,60,92,124,156,188,220,252
|
||||
|
||||
ma2e_ends:
|
||||
.byte 188,156,124,92
|
||||
|
||||
|
||||
|
||||
shape_table:
|
||||
|
||||
shape_table_d: .byte $23,$2c,$2e,$36, $37,$27,$04,$00 ; 0
|
||||
shape_table_e: .byte $27,$2c,$95,$12, $3f,$24,$00 ; 8
|
||||
shape_table_a: .byte $23,$2c,$35,$96, $24,$3f,$36,$00 ; 15
|
||||
shape_table_t: .byte $12,$24,$e4,$2b, $2d,$05,$00 ; 23
|
||||
shape_table_r: .byte $97,$24,$24,$2d, $36,$37,$35,$06,$00 ; 30
|
||||
shape_table_m: .byte $24,$37,$36,$4e, $24,$24,$07,$00 ; 39
|
||||
shape_table_2: .byte $25,$3c,$97,$39, $36,$2d,$00 ; 47
|
||||
shape_table_s: .byte $27,$2c,$95,$2b, $36,$3f,$00 ; 54
|
||||
shape_table_i: .byte $d2,$ed,$24,$e4, $2d,$00 ; 61
|
||||
shape_table_hline: .byte $2b,$05,$00 ; 67
|
||||
|
||||
;shape_table_vline: .byte $12,$24,$24,$00 ; 67
|
||||
;shape_table_o: .byte $23,$2c,$35,$36, $3e,$27,$04,$00 ;
|
||||
;shape_table_v: .byte $18,$30,$36,$35, $28,$24,$04,$00 ;
|
||||
|
Loading…
Reference in New Issue
Block a user