mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-10-09 11:54:59 +00:00
Merge pull request #5 from peterferrie/master
cut some bytes and cycles
This commit is contained in:
commit
1348790961
@ -33,17 +33,18 @@ done_fire_line_loop:
|
||||
lda FIRE_FB_L
|
||||
adc #40
|
||||
sta FIRE_FB_L
|
||||
lda FIRE_FB_H
|
||||
adc #0
|
||||
sta FIRE_FB_H
|
||||
bcc skip_inc_hi
|
||||
inc FIRE_FB_H
|
||||
skip_inc_hi:
|
||||
|
||||
dex
|
||||
bne clear_fire_loop
|
||||
|
||||
lda #7
|
||||
jsr fire_setline
|
||||
;fall through
|
||||
;jsr fire_setline
|
||||
|
||||
rts
|
||||
;rts
|
||||
|
||||
|
||||
|
||||
@ -118,7 +119,6 @@ fire_fb_update_loop:
|
||||
; get random number Q 0..3
|
||||
; Q used to see if whether we grab same lower value or if decrement
|
||||
|
||||
lda SEEDL ; 3
|
||||
and #$3 ; 2
|
||||
sta FIRE_Q ; 3
|
||||
|
||||
@ -142,18 +142,18 @@ fire_low:
|
||||
; Q=1 3/4 of time
|
||||
lda FIRE_Q ; 3
|
||||
bne fire_one ; 0-3, is not 0 3/4 of time ; 2/3
|
||||
beq fire_zero ; 3
|
||||
beq fire_set ; 3
|
||||
fire_medium:
|
||||
cmp #$d ; 2
|
||||
lda FIRE_Q ; 3
|
||||
bcs fire_high ; bge ; 2/3
|
||||
|
||||
; Q=1 1/2 of time
|
||||
lda FIRE_Q ; 3
|
||||
and #$1 ; 2
|
||||
jmp fire_set ; 3
|
||||
bcc fire_set ; branch always ; 3
|
||||
fire_high:
|
||||
; Q=1 1/4 of time
|
||||
lda FIRE_Q ; is 0 1/4 of time ; 3
|
||||
;;lda FIRE_Q ; is 0 1/4 of time ; 3
|
||||
bne fire_zero ; 2/3
|
||||
fire_one:
|
||||
lda #1 ; 2
|
||||
@ -174,7 +174,7 @@ fire_set:
|
||||
; bounds check
|
||||
; on edges, don't wrap
|
||||
|
||||
cpy #0 ; 2
|
||||
tya ; 2
|
||||
beq fire_r_same ; 2/3
|
||||
cpy #39 ; 2
|
||||
beq fire_r_same ; 2/3
|
||||
@ -184,15 +184,14 @@ fire_set:
|
||||
; 25% chance comes from right
|
||||
; 25% change comes from left
|
||||
|
||||
lda #$2 ; 2
|
||||
bit SEEDH ; 3
|
||||
bne fire_r_same ; 2/3
|
||||
lda SEEDH ; 3
|
||||
lsr ; 2
|
||||
and #$1 ; 2
|
||||
beq r_up ; 2/3
|
||||
bne fire_r_same ; 2/3
|
||||
bcc r_up ; 2/3
|
||||
r_down:
|
||||
dey ; 2
|
||||
jmp fire_r_same ; 3
|
||||
.byte $a9 ; 2
|
||||
r_up:
|
||||
iny ; 2
|
||||
fire_r_same:
|
||||
@ -232,22 +231,22 @@ done_fire_fb_update_loop:
|
||||
lda fire_smc5_fb+1 ; 4
|
||||
adc #40 ; 2
|
||||
sta fire_smc5_fb+1 ; 4
|
||||
lda fire_smc5_fb+2 ; 4
|
||||
adc #0 ; 2
|
||||
sta fire_smc5_fb+2 ; 4
|
||||
|
||||
bcc skip_fb_inc1 ; 2/3
|
||||
inc fire_smc5_fb+2 ; 4
|
||||
clc ; 2
|
||||
skip_fb_inc1:
|
||||
|
||||
lda fire_smc5_fb2+1 ; 4
|
||||
adc #40 ; 2
|
||||
sta fire_smc5_fb2+1 ; 4
|
||||
lda fire_smc5_fb2+2 ; 4
|
||||
adc #0 ; 2
|
||||
sta fire_smc5_fb2+2 ; 4
|
||||
bcc skip_fb2_inc1 ; 2/3
|
||||
inc fire_smc5_fb2+2 ; 4
|
||||
skip_fb2_inc1:
|
||||
|
||||
inx ; 2
|
||||
cpx #(FIRE_YSIZE-1) ; 2
|
||||
beq fire_update_done ; 2/3
|
||||
jmp fire_fb_update ; 3
|
||||
;beq fire_update_done ; 2/3
|
||||
bne fire_fb_update ; 3
|
||||
|
||||
fire_update_done:
|
||||
|
||||
@ -259,11 +258,12 @@ fire_update_done:
|
||||
|
||||
lda #<fire_framebuffer ; 2
|
||||
sta fire_smc_fb+1 ; 5
|
||||
lda #>fire_framebuffer ; 2
|
||||
sta fire_smc_fb+2 ; 5
|
||||
|
||||
lda #<(fire_framebuffer+40) ; 2
|
||||
sta fire_smc_fb2+1 ; 5
|
||||
|
||||
lda #>fire_framebuffer ; 2
|
||||
sta fire_smc_fb+2 ; 5
|
||||
;this lda could be omitted if values match
|
||||
lda #>(fire_framebuffer+40) ; 2
|
||||
sta fire_smc_fb2+2 ; 5
|
||||
|
||||
@ -323,17 +323,17 @@ done_fire_fb_copy_loop:
|
||||
lda fire_smc_fb+1 ; 4
|
||||
adc #80 ; 2
|
||||
sta fire_smc_fb+1 ; 5
|
||||
lda fire_smc_fb+2 ; 4
|
||||
adc #0 ; 2
|
||||
sta fire_smc_fb+2 ; 5
|
||||
|
||||
bcc skip_fb_inc2 ; 2/3
|
||||
inc fire_smc_fb+2 ; 5
|
||||
clc ; 2
|
||||
skip_fb_inc2:
|
||||
|
||||
lda fire_smc_fb2+1 ; 4
|
||||
adc #80 ; 2
|
||||
sta fire_smc_fb2+1 ; 5
|
||||
lda fire_smc_fb2+2 ; 4
|
||||
adc #0 ; 2
|
||||
sta fire_smc_fb2+2 ; 5
|
||||
bcc skip_fb2_inc2 ; 2/3
|
||||
inc fire_smc_fb2+2 ; 5
|
||||
skip_fb2_inc2:
|
||||
|
||||
dex ; 2
|
||||
bne fire_fb_copy ; 2/3
|
||||
|
@ -4,7 +4,6 @@ clear_screens:
|
||||
;===================================
|
||||
|
||||
lda #$0
|
||||
sta DRAW_PAGE
|
||||
jsr clear_top
|
||||
jsr clear_bottom
|
||||
|
||||
@ -13,30 +12,9 @@ clear_screens:
|
||||
;===================================
|
||||
|
||||
lda #$4
|
||||
sta DRAW_PAGE
|
||||
jsr clear_top
|
||||
jsr clear_bottom
|
||||
jmp clear_bottom
|
||||
|
||||
rts
|
||||
|
||||
clear_bottoms:
|
||||
;===================================
|
||||
; Clear bottom of page 0
|
||||
;===================================
|
||||
|
||||
lda #$0
|
||||
sta DRAW_PAGE
|
||||
jsr clear_bottom
|
||||
|
||||
;===================================
|
||||
; Clear bottom of page 1
|
||||
;===================================
|
||||
|
||||
lda #$4
|
||||
sta DRAW_PAGE
|
||||
jsr clear_bottom
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
@ -49,11 +27,12 @@ clear_bottoms:
|
||||
; (pageX,40rows): 50*120+4+6 = 6010 = 6.0ms 166Hz
|
||||
; 50*120+4+6+37 = 6055 = 6.0ms 166Hz
|
||||
clear_top:
|
||||
lda #0 ; 2
|
||||
clear_top_a:
|
||||
sta COLOR ; 3
|
||||
ldy #0 ; 2
|
||||
|
||||
clear_top_y:
|
||||
sty COLOR ; 3
|
||||
sta DRAW_PAGE ; 3
|
||||
clc ; 2
|
||||
lda DRAW_PAGE ; 3
|
||||
|
||||
adc #4 ; 2
|
||||
sta __ctf+2 ; 3
|
||||
@ -94,6 +73,20 @@ no_draw_bottom:
|
||||
|
||||
|
||||
|
||||
clear_bottoms:
|
||||
;===================================
|
||||
; Clear bottom of page 0
|
||||
;===================================
|
||||
|
||||
lda #$0
|
||||
jsr clear_bottom
|
||||
|
||||
;===================================
|
||||
; Clear bottom of page 1
|
||||
;===================================
|
||||
|
||||
lda #$4
|
||||
; fall through
|
||||
|
||||
;=========================================================
|
||||
; clear_bottom
|
||||
@ -101,8 +94,8 @@ no_draw_bottom:
|
||||
; clear bottom of draw page
|
||||
|
||||
clear_bottom:
|
||||
sta DRAW_PAGE ; 3
|
||||
clc ; 2
|
||||
lda DRAW_PAGE ; 3
|
||||
|
||||
adc #6 ; 2
|
||||
sta __cbf2+2 ; 3
|
||||
@ -134,7 +127,6 @@ clear_screens_notext:
|
||||
;===================================
|
||||
|
||||
lda #$0
|
||||
sta DRAW_PAGE
|
||||
jsr clear_all
|
||||
|
||||
;===================================
|
||||
@ -142,10 +134,7 @@ clear_screens_notext:
|
||||
;===================================
|
||||
|
||||
lda #$4
|
||||
sta DRAW_PAGE
|
||||
jsr clear_all
|
||||
|
||||
rts
|
||||
; fall through
|
||||
|
||||
|
||||
;=========================================================
|
||||
@ -155,8 +144,8 @@ clear_screens_notext:
|
||||
; clear color: clear_all_color+1
|
||||
|
||||
clear_all:
|
||||
sta DRAW_PAGE ; 3
|
||||
clc ; 2
|
||||
lda DRAW_PAGE ; 3
|
||||
|
||||
adc #4 ; 2
|
||||
sta __caf+2 ; 3
|
||||
|
@ -21,27 +21,24 @@ put_sprite:
|
||||
sta CV ; ysize is in CV ; 3
|
||||
iny ; 2
|
||||
|
||||
lda YPOS ; make a copy of ypos ; 3
|
||||
sta TEMPY ; as we modify it ; 3
|
||||
ldx YPOS ; make a copy of ypos ; 3
|
||||
;===========
|
||||
; 28
|
||||
; 25
|
||||
put_sprite_loop:
|
||||
sty TEMP ; save sprite pointer ; 3
|
||||
ldy TEMPY ; 3
|
||||
lda gr_offsets,Y ; lookup low-res memory address ; 4
|
||||
stx TEMPY ; as we modify it ; 3
|
||||
lda gr_offsets,X ; lookup low-res memory address ; 4
|
||||
clc ; 2
|
||||
adc XPOS ; add in xpos ; 3
|
||||
sta OUTL ; store out low byte of addy ; 3
|
||||
lda gr_offsets+1,Y ; look up high byte ; 4
|
||||
lda gr_offsets+1,X ; look up high byte ; 4
|
||||
adc DRAW_PAGE ; ; 3
|
||||
sta OUTH ; and store it out ; 3
|
||||
ldy TEMP ; restore sprite pointer ; 3
|
||||
|
||||
; OUTH:OUTL now points at right place
|
||||
|
||||
ldx CH ; load xsize into x ; 3
|
||||
;===========
|
||||
; 34
|
||||
; 28
|
||||
put_sprite_pixel:
|
||||
lda (INL),Y ; get sprite colors ; 5
|
||||
iny ; increment sprite pointer ; 2
|
||||
@ -88,12 +85,13 @@ put_sprite_done_draw:
|
||||
;==============
|
||||
; 12/13
|
||||
|
||||
inc TEMPY ; each line has two y vars ; 5
|
||||
inc TEMPY ; 5
|
||||
ldx TEMPY ; 3
|
||||
inx ; each line has two y vars ; 2
|
||||
inx ; 2
|
||||
dec CV ; decemenet total y count ; 5
|
||||
bne put_sprite_loop ; loop if not done ; 2nt/3
|
||||
;==============
|
||||
; 17/18
|
||||
; 14/15
|
||||
|
||||
rts ; return ; 6
|
||||
|
||||
|
@ -52,11 +52,11 @@ pt3_play_music:
|
||||
sta current_subframe
|
||||
sta DONE_SONG ; undo the next song
|
||||
|
||||
jmp done_interrupt
|
||||
beq done_interrupt ; branch always
|
||||
|
||||
move_to_next:
|
||||
; same as "press right"
|
||||
lda #$20
|
||||
ldx #$20
|
||||
jmp quiet_exit
|
||||
|
||||
;======================================
|
||||
@ -68,7 +68,7 @@ move_to_next:
|
||||
mb_write_frame:
|
||||
|
||||
|
||||
ldx #0 ; set up reg count ; 2
|
||||
tax ; set up reg count ; 2
|
||||
;============
|
||||
; 2
|
||||
|
||||
@ -138,10 +138,9 @@ update_time:
|
||||
inc frame_count_smc+1 ; 5
|
||||
frame_count_smc:
|
||||
lda #$0 ; 2
|
||||
cmp #50 ; 3
|
||||
eor #50 ; 3
|
||||
bne done_time ; 3/2nt
|
||||
|
||||
lda #$0 ; 2
|
||||
sta frame_count_smc+1 ; 3
|
||||
|
||||
update_second_ones:
|
||||
@ -168,7 +167,7 @@ update_minutes:
|
||||
; we don't handle > 9:59 songs yet
|
||||
done_time:
|
||||
;=============
|
||||
; 89 worst
|
||||
; 87 worst
|
||||
|
||||
|
||||
;=================================
|
||||
@ -184,7 +183,7 @@ check_keyboard:
|
||||
;====================
|
||||
; space pauses
|
||||
|
||||
cmp #(' '+$80)
|
||||
cmp #(' '+$80) ; set carry if true
|
||||
bne key_M
|
||||
key_space:
|
||||
lda #$80
|
||||
@ -195,41 +194,38 @@ key_space:
|
||||
sta DONE_PLAYING
|
||||
beq yes_bar
|
||||
lda #0
|
||||
jmp lowbar
|
||||
beq lowbar ; branch always
|
||||
yes_bar:
|
||||
lda #7
|
||||
lowbar:
|
||||
jsr fire_setline
|
||||
|
||||
lda DONE_PLAYING
|
||||
ldx DONE_PLAYING
|
||||
|
||||
jmp quiet_exit
|
||||
bcs quiet_exit ; branch always
|
||||
|
||||
;===========================
|
||||
; M key switches MHz mode
|
||||
|
||||
key_M:
|
||||
cmp #'M'
|
||||
bne key_L
|
||||
bne key_L ; set carry if true
|
||||
|
||||
ldx #'0'+$80
|
||||
lda convert_177
|
||||
eor #$1
|
||||
sta convert_177
|
||||
beq at_1MHz
|
||||
beq at_MHz
|
||||
|
||||
; update text on screen
|
||||
|
||||
lda #'7'+$80
|
||||
sta $7F4
|
||||
sta $BF4
|
||||
jmp done_key
|
||||
ldx #'7'+$80
|
||||
|
||||
at_1MHz:
|
||||
lda #'0'+$80
|
||||
sta $7F4
|
||||
sta $BF4
|
||||
at_MHz:
|
||||
stx $7F4
|
||||
stx $BF4
|
||||
|
||||
jmp done_key
|
||||
bcs done_key ; branch always
|
||||
|
||||
|
||||
;===========================
|
||||
@ -237,8 +233,9 @@ at_1MHz:
|
||||
|
||||
key_L:
|
||||
cmp #'L'
|
||||
bne key_left
|
||||
bne key_left ; set carry if true
|
||||
|
||||
ldx #'/'+$80
|
||||
lda LOOP
|
||||
eor #$1
|
||||
sta LOOP
|
||||
@ -246,54 +243,44 @@ key_L:
|
||||
|
||||
; update text on screen
|
||||
|
||||
lda #'L'+$80
|
||||
sta $7D0+18
|
||||
sta $BD0+18
|
||||
jmp done_key
|
||||
ldx #'L'+$80
|
||||
|
||||
music_looping:
|
||||
lda #'/'+$80
|
||||
sta $7D0+18
|
||||
sta $BD0+18
|
||||
|
||||
jmp done_key
|
||||
bcs done_key ; branch always
|
||||
|
||||
|
||||
;======================
|
||||
; left key, to prev song
|
||||
|
||||
key_left:
|
||||
ldx #$40
|
||||
cmp #'A'
|
||||
bne key_right
|
||||
|
||||
lda #$40
|
||||
bne quiet_exit
|
||||
beq quiet_exit
|
||||
|
||||
;========================
|
||||
; right key, to next song
|
||||
|
||||
key_right:
|
||||
ldx #$20
|
||||
cmp #'D'
|
||||
bne done_key
|
||||
|
||||
lda #$20
|
||||
bne quiet_exit
|
||||
|
||||
done_key:
|
||||
jmp exit_interrupt
|
||||
|
||||
;========================
|
||||
; stop playing for now
|
||||
; quiet down the Mockingboard
|
||||
; (otherwise will be stuck on last note)
|
||||
|
||||
quiet_exit:
|
||||
sta DONE_PLAYING
|
||||
stx DONE_PLAYING
|
||||
jsr clear_ay_both
|
||||
|
||||
lda #$ff ; also mute the channel
|
||||
sta AY_REGISTERS+7 ; just in case
|
||||
;ldx #$ff ; also mute the channel
|
||||
stx AY_REGISTERS+7 ; just in case
|
||||
|
||||
done_key:
|
||||
exit_interrupt:
|
||||
|
||||
; pla ; restore a ; 4
|
||||
|
@ -7,40 +7,40 @@ get_key:
|
||||
|
||||
lda KEYPRESS ; 3
|
||||
bpl no_key ; 2nt/3
|
||||
bit KEYRESET ; clear the keyboard buffer ; 4
|
||||
|
||||
figure_out_key:
|
||||
cmp #' '+128 ; the mask destroys space ; 2
|
||||
beq save_key ; so handle it specially ; 2nt/3
|
||||
|
||||
and #$5f ; mask, to make upper-case ; 2
|
||||
check_right_arrow:
|
||||
cmp #$15 ; 2
|
||||
cmp #$95 ; 2
|
||||
bne check_left_arrow ; 2nt/3
|
||||
lda #'D' ; 2
|
||||
check_left_arrow:
|
||||
cmp #$08 ; 2
|
||||
cmp #$88 ; 2
|
||||
bne check_up_arrow ; 2nt/3
|
||||
lda #'A' ; 2
|
||||
check_up_arrow:
|
||||
cmp #$0B ; 2
|
||||
cmp #$8B ; 2
|
||||
bne check_down_arrow ; 2nt/3
|
||||
lda #'W' ; 2
|
||||
check_down_arrow:
|
||||
cmp #$0A ; 2
|
||||
cmp #$8A ; 2
|
||||
bne check_escape ; 2nt/3
|
||||
lda #'S' ; 2
|
||||
check_escape:
|
||||
and #$5f ; mask, to make upper-case ; 2
|
||||
cmp #$1B ; 2
|
||||
bne save_key ; 2nt/3
|
||||
lda #'Q' ; 2
|
||||
jmp save_key ; 3
|
||||
bne save_key ; branch always ; 3
|
||||
|
||||
no_key:
|
||||
lda #0 ; no key, so save a zero ; 2
|
||||
|
||||
save_key:
|
||||
sta LASTKEY ; save the key to our buffer ; 2
|
||||
bit KEYRESET ; clear the keyboard buffer ; 4
|
||||
rts ; 6
|
||||
;============
|
||||
|
||||
|
@ -66,6 +66,7 @@ reset_ay_both:
|
||||
; Reset Right AY-3-8910
|
||||
;======================
|
||||
;reset_ay_right:
|
||||
;could be merged with both
|
||||
lda #MOCK_AY_RESET
|
||||
sta MOCK_6522_ORB2
|
||||
lda #MOCK_AY_INACTIVE
|
||||
@ -164,6 +165,41 @@ mb_not_in_this_slot:
|
||||
ldx #00
|
||||
beq done_mb_detect
|
||||
|
||||
;alternative MB detection from Nox Archaist
|
||||
; lda #$04
|
||||
; sta MB_ADDRL
|
||||
; ldx #$c7
|
||||
;
|
||||
;find_mb:
|
||||
; stx MB_ADDRH
|
||||
;
|
||||
; ;detect sound I
|
||||
;
|
||||
; sec
|
||||
; ldy #$00
|
||||
; lda (MB_ADDRL), y
|
||||
; sbc (MB_ADDRL), y
|
||||
; cmp #$05
|
||||
; beq found_mb
|
||||
; dex
|
||||
; cpx #$c0
|
||||
; bne find_mb
|
||||
; ldx #$00 ;no mockingboard found
|
||||
; rts
|
||||
;
|
||||
;found_mb:
|
||||
; ldx #$01 ;mockingboard found
|
||||
; rts
|
||||
;
|
||||
; ;optionally detect sound II
|
||||
;
|
||||
; sec
|
||||
; ldy #$80
|
||||
; lda (MB_ADDRL), y
|
||||
; sbc (MB_ADDRL), y
|
||||
; cmp #$05
|
||||
; beq found_mb
|
||||
|
||||
|
||||
;=======================================
|
||||
; Detect a Mockingboard card in Slot4
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -171,11 +171,11 @@ main_loop:
|
||||
jsr page_flip
|
||||
|
||||
check_done:
|
||||
lda #$ff
|
||||
bit DONE_PLAYING
|
||||
lda DONE_PLAYING
|
||||
asl ; bit 7 to carry, bit 6 to bit 7
|
||||
beq main_loop ; if was all zeros, loop
|
||||
bmi main_loop ; if high bit set, paused
|
||||
bvs minus_song ; if bit 6 set, then left pressed
|
||||
bcs main_loop ; if high bit set, paused
|
||||
bmi minus_song ; if bit 6 set, then left pressed
|
||||
|
||||
; else, either song finished or
|
||||
; right pressed
|
||||
@ -205,7 +205,7 @@ done_play:
|
||||
lda #7
|
||||
jsr fire_setline
|
||||
|
||||
jmp start_interrupts
|
||||
bmi start_interrupts
|
||||
|
||||
|
||||
|
||||
@ -266,8 +266,8 @@ new_song:
|
||||
|
||||
lda #8 ; print filename to screen
|
||||
sta CH
|
||||
lda #21
|
||||
sta CV
|
||||
;lda #21
|
||||
;sta CV
|
||||
|
||||
lda INL
|
||||
sta OUTL
|
||||
@ -331,7 +331,6 @@ upcase_loop:
|
||||
|
||||
cmp #$60
|
||||
bcc not_lowercase ; blt
|
||||
sec
|
||||
sbc #$20
|
||||
sta PT3_LOC,Y
|
||||
not_lowercase:
|
||||
@ -347,7 +346,7 @@ no_uppercase:
|
||||
lda #<(PT3_LOC+$1E)
|
||||
sta OUTL
|
||||
|
||||
lda #20 ; VTAB 20: HTAB from file
|
||||
lda #20 ; VTAB 20: HTAB 4
|
||||
sta CV
|
||||
lda #4
|
||||
sta CH
|
||||
@ -356,15 +355,10 @@ no_uppercase:
|
||||
|
||||
; Print Author
|
||||
|
||||
lda #>(PT3_LOC+$42) ; point to header title
|
||||
sta OUTH
|
||||
lda #<(PT3_LOC+$42)
|
||||
sta OUTL
|
||||
|
||||
lda #21 ; VTAB 21: HTAB from file
|
||||
sta CV
|
||||
lda #4
|
||||
sta CH
|
||||
inc CV ; VTAB 21: HTAB 4
|
||||
jsr print_both_pages ; print, tail call
|
||||
|
||||
; Print clock
|
||||
@ -408,9 +402,7 @@ no_uppercase:
|
||||
lda #<(which_song_string)
|
||||
sta OUTL
|
||||
|
||||
lda #23 ; VTAB 23: HTAB 1
|
||||
sta CV
|
||||
lda #0
|
||||
lda #0 ; HTAB 1
|
||||
sta CH
|
||||
jsr print_both_pages ; print, tail call
|
||||
|
||||
@ -423,25 +415,21 @@ no_uppercase:
|
||||
lda #<(mhz_string)
|
||||
sta OUTL
|
||||
|
||||
lda #23 ; VTAB 23: HTAB 34
|
||||
sta CV
|
||||
lda #34
|
||||
lda #34 ; HTAB 34
|
||||
sta CH
|
||||
jsr print_both_pages ; print, tail call
|
||||
|
||||
; update the MHz indicator with current state
|
||||
|
||||
ldx #'0'+$80
|
||||
lda convert_177
|
||||
beq set_1MHz
|
||||
beq done_MHz
|
||||
|
||||
lda #'7'+$80
|
||||
jmp done_MHz
|
||||
ldx #'7'+$80
|
||||
|
||||
set_1MHz:
|
||||
lda #'0'+$80
|
||||
done_MHz:
|
||||
sta $7F4
|
||||
sta $BF4
|
||||
stx $7F4
|
||||
stx $BF4
|
||||
|
||||
; Print Left Arrow (INVERSE)
|
||||
lda #'<'
|
||||
@ -476,7 +464,6 @@ done_MHz:
|
||||
; Time is just number of frames/50Hz
|
||||
|
||||
|
||||
lda #$0
|
||||
sta current_line
|
||||
sta current_subframe
|
||||
sta current_pattern
|
||||
@ -512,40 +499,36 @@ fc_pattern_good:
|
||||
bne fc_line_good
|
||||
|
||||
inc current_pattern ; increment pattern
|
||||
lda #0
|
||||
sta current_line
|
||||
sta current_subframe
|
||||
jmp frame_count_loop
|
||||
bne frame_count_loop ; branch always
|
||||
|
||||
fc_line_good:
|
||||
inc current_subframe ; 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
|
||||
|
||||
fc_next_line:
|
||||
lda #0 ; reset subframe to 0
|
||||
sta current_subframe
|
||||
sta current_subframe ; reset subframe to 0
|
||||
|
||||
inc current_line ; and increment line
|
||||
lda current_line
|
||||
|
||||
cmp #64 ; always end at 64.
|
||||
eor #64 ; always end at 64.
|
||||
bne fc_do_frame ; is this always needed?
|
||||
|
||||
fc_next_pattern:
|
||||
lda #0 ; reset line to 0
|
||||
sta current_line
|
||||
sta current_line ; reset line to 0
|
||||
|
||||
inc current_pattern ; increment pattern
|
||||
|
||||
fc_do_frame:
|
||||
inc time_frame
|
||||
lda time_frame
|
||||
cmp #50
|
||||
bne fc_bayern
|
||||
eor #50
|
||||
bne frame_count_loop
|
||||
|
||||
lda #0
|
||||
sta time_frame
|
||||
|
||||
; see if overflow low s
|
||||
@ -564,7 +547,7 @@ fc_do_frame:
|
||||
lda #'0'+$80
|
||||
sta $7D0+13+9
|
||||
sta $BD0+13+9
|
||||
jmp clear_low_s
|
||||
bne clear_low_s
|
||||
|
||||
inc_high_s:
|
||||
inc $7D0+13+9
|
||||
@ -575,7 +558,7 @@ clear_low_s:
|
||||
sta $7D0+13+10
|
||||
sta $BD0+13+10
|
||||
|
||||
jmp inc_done
|
||||
bne inc_done
|
||||
|
||||
inc_low_s:
|
||||
inc $7D0+13+10
|
||||
@ -594,9 +577,7 @@ done_counting:
|
||||
sta DONE_PLAYING
|
||||
sta current_pattern
|
||||
|
||||
jsr pt3_init_song
|
||||
|
||||
rts
|
||||
jmp pt3_init_song
|
||||
|
||||
|
||||
|
||||
@ -617,16 +598,15 @@ done_counting:
|
||||
get_filename:
|
||||
|
||||
ldy #0
|
||||
ldx WHICH_FILE
|
||||
|
||||
lda #<song_list ; point to filename
|
||||
sta INL
|
||||
lda #>song_list
|
||||
sta INH
|
||||
ldx WHICH_FILE
|
||||
beq filename_found
|
||||
|
||||
get_filename_loop:
|
||||
cpx #0
|
||||
beq filename_found
|
||||
|
||||
inner_loop:
|
||||
iny
|
||||
@ -636,16 +616,16 @@ inner_loop:
|
||||
iny
|
||||
|
||||
dex
|
||||
jmp get_filename_loop
|
||||
bne get_filename_loop
|
||||
|
||||
filename_found:
|
||||
tya
|
||||
clc
|
||||
adc INL
|
||||
sta INL
|
||||
lda INH
|
||||
adc #0
|
||||
sta INH
|
||||
bcc skip_inh_inc
|
||||
inc INH
|
||||
skip_inh_inc:
|
||||
|
||||
rts
|
||||
|
||||
@ -655,9 +635,8 @@ filename_found:
|
||||
increment_file:
|
||||
inc WHICH_FILE
|
||||
lda WHICH_FILE
|
||||
cmp #NUM_FILES
|
||||
eor #NUM_FILES
|
||||
bne done_increment
|
||||
lda #0
|
||||
sta WHICH_FILE
|
||||
done_increment:
|
||||
rts
|
||||
@ -683,13 +662,11 @@ done_decrement:
|
||||
; trashes X
|
||||
convert_decimal:
|
||||
|
||||
tax
|
||||
ldx #'0'+$80
|
||||
stx which_1s
|
||||
stx which_10s
|
||||
|
||||
lda #'0'+$80
|
||||
sta which_1s
|
||||
sta which_10s
|
||||
|
||||
txa ; special case zero
|
||||
tax ; special case zero
|
||||
beq conv_decimal_done
|
||||
conv_decimal_loop:
|
||||
inc which_1s
|
||||
|
Loading…
Reference in New Issue
Block a user