optimize player

This commit is contained in:
Peter Ferrie 2019-06-01 01:54:28 -04:00 committed by Vince Weaver
parent 01f3e24e82
commit a24bf74d23

View File

@ -205,7 +205,7 @@ done_play:
lda #7 lda #7
jsr fire_setline jsr fire_setline
jmp start_interrupts bmi start_interrupts
@ -326,12 +326,13 @@ upcase:
beq no_uppercase beq no_uppercase
ldy #$1e ldy #$1e
;;lda #>(PT3_LOC+$1E) ; point to header title
sta OUTH
upcase_loop: upcase_loop:
lda PT3_LOC,Y lda PT3_LOC,Y
cmp #$60 cmp #$60
bcc not_lowercase ; blt bcc not_lowercase ; blt
sec
sbc #$20 sbc #$20
sta PT3_LOC,Y sta PT3_LOC,Y
not_lowercase: not_lowercase:
@ -342,12 +343,10 @@ not_lowercase:
no_uppercase: no_uppercase:
; print title ; print title
lda #>(PT3_LOC+$1E) ; point to header title
sta OUTH
lda #<(PT3_LOC+$1E) lda #<(PT3_LOC+$1E)
sta OUTL sta OUTL
lda #20 ; VTAB 20: HTAB from file lda #20 ; VTAB 20: HTAB 4
sta CV sta CV
lda #4 lda #4
sta CH sta CH
@ -356,15 +355,10 @@ no_uppercase:
; Print Author ; Print Author
lda #>(PT3_LOC+$42) ; point to header title
sta OUTH
lda #<(PT3_LOC+$42) lda #<(PT3_LOC+$42)
sta OUTL sta OUTL
lda #21 ; VTAB 21: HTAB from file inc CV ; VTAB 21: HTAB 4
sta CV
lda #4
sta CH
jsr print_both_pages ; print, tail call jsr print_both_pages ; print, tail call
; Print clock ; Print clock
@ -408,9 +402,7 @@ no_uppercase:
lda #<(which_song_string) lda #<(which_song_string)
sta OUTL sta OUTL
lda #23 ; VTAB 23: HTAB 1 lda #0 ; HTAB 1
sta CV
lda #0
sta CH sta CH
jsr print_both_pages ; print, tail call jsr print_both_pages ; print, tail call
@ -423,9 +415,7 @@ no_uppercase:
lda #<(mhz_string) lda #<(mhz_string)
sta OUTL sta OUTL
lda #23 ; VTAB 23: HTAB 34 lda #34 ; HTAB 34
sta CV
lda #34
sta CH sta CH
jsr print_both_pages ; print, tail call jsr print_both_pages ; print, tail call
@ -435,7 +425,7 @@ no_uppercase:
beq set_1MHz beq set_1MHz
lda #'7'+$80 lda #'7'+$80
jmp done_MHz bne done_MHz ; branch always
set_1MHz: set_1MHz:
lda #'0'+$80 lda #'0'+$80
@ -476,7 +466,6 @@ done_MHz:
; Time is just number of frames/50Hz ; Time is just number of frames/50Hz
lda #$0
sta current_line sta current_line
sta current_subframe sta current_subframe
sta current_pattern sta current_pattern
@ -515,37 +504,34 @@ fc_pattern_good:
lda #0 lda #0
sta current_line sta current_line
sta current_subframe sta current_subframe
jmp frame_count_loop beq frame_count_loop ; branch always
fc_line_good: fc_line_good:
inc current_subframe ; subframe++ inc current_subframe ; subframe++
lda current_subframe lda current_subframe
cmp pt3_speed ; if we hit pt3_speed, move to next eor pt3_speed ; if we hit pt3_speed, move to next
bne fc_do_frame bne fc_do_frame
fc_next_line: fc_next_line:
lda #0 ; reset subframe to 0 sta current_subframe ; reset subframe to 0
sta current_subframe
inc current_line ; and increment line inc current_line ; and increment line
lda current_line lda current_line
cmp #64 ; always end at 64. eor #64 ; always end at 64.
bne fc_do_frame ; is this always needed? bne fc_do_frame ; is this always needed?
fc_next_pattern: fc_next_pattern:
lda #0 ; reset line to 0 sta current_line ; reset line to 0
sta current_line
inc current_pattern ; increment pattern inc current_pattern ; increment pattern
fc_do_frame: fc_do_frame:
inc time_frame inc time_frame
lda time_frame lda time_frame
cmp #50 eor #50
bne fc_bayern bne frame_count_loop
lda #0
sta time_frame sta time_frame
; see if overflow low s ; see if overflow low s
@ -564,7 +550,7 @@ fc_do_frame:
lda #'0'+$80 lda #'0'+$80
sta $7D0+13+9 sta $7D0+13+9
sta $BD0+13+9 sta $BD0+13+9
jmp clear_low_s bne clear_low_s
inc_high_s: inc_high_s:
inc $7D0+13+9 inc $7D0+13+9
@ -575,7 +561,7 @@ clear_low_s:
sta $7D0+13+10 sta $7D0+13+10
sta $BD0+13+10 sta $BD0+13+10
jmp inc_done bne inc_done
inc_low_s: inc_low_s:
inc $7D0+13+10 inc $7D0+13+10
@ -594,9 +580,7 @@ done_counting:
sta DONE_PLAYING sta DONE_PLAYING
sta current_pattern sta current_pattern
jsr pt3_init_song jmp pt3_init_song
rts
@ -617,16 +601,15 @@ done_counting:
get_filename: get_filename:
ldy #0 ldy #0
ldx WHICH_FILE
lda #<song_list ; point to filename lda #<song_list ; point to filename
sta INL sta INL
lda #>song_list lda #>song_list
sta INH sta INH
ldx WHICH_FILE
beq filename_found
get_filename_loop: get_filename_loop:
cpx #0
beq filename_found
inner_loop: inner_loop:
iny iny
@ -636,16 +619,16 @@ inner_loop:
iny iny
dex dex
jmp get_filename_loop bne get_filename_loop
filename_found: filename_found:
tya tya
clc clc
adc INL adc INL
sta INL sta INL
lda INH bcc skip_inh_inc
adc #0 inc INH
sta INH skip_inh_inc:
rts rts
@ -656,8 +639,7 @@ increment_file:
inc WHICH_FILE inc WHICH_FILE
lda WHICH_FILE lda WHICH_FILE
cmp #NUM_FILES cmp #NUM_FILES
bne done_increment eor done_increment
lda #0
sta WHICH_FILE sta WHICH_FILE
done_increment: done_increment:
rts rts
@ -683,13 +665,11 @@ done_decrement:
; trashes X ; trashes X
convert_decimal: convert_decimal:
tax ldx #'0'+$80
stx which_1s
stx which_10s
lda #'0'+$80 tax ; special case zero
sta which_1s
sta which_10s
txa ; special case zero
beq conv_decimal_done beq conv_decimal_done
conv_decimal_loop: conv_decimal_loop:
inc which_1s inc which_1s