pt3_player: optimize mockingboard writes

This commit is contained in:
Peter Ferrie 2019-06-07 23:23:29 -04:00 committed by Vince Weaver
parent fda47eda81
commit 26e7d2f990
2 changed files with 14 additions and 17 deletions

View File

@ -105,15 +105,14 @@ mb_not_13:
; address
stx MOCK_6522_ORA1 ; put address on PA1 ; 4
stx MOCK_6522_ORA2 ; put address on PA2 ; 4
lda #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2
sta MOCK_6522_ORB1 ; latch_address on PB1 ; 4
sta MOCK_6522_ORB2 ; latch_address on PB2 ; 4
ldy #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2
sty MOCK_6522_ORB1 ; latch_address on PB1 ; 4
sty MOCK_6522_ORB2 ; latch_address on PB2 ; 4
ldy #MOCK_AY_INACTIVE ; go inactive ; 2
sty MOCK_6522_ORB1 ; 4
sty MOCK_6522_ORB2 ; 4
; value
lda AY_REGISTERS,X ; load register value ; 4
sta MOCK_6522_ORA1 ; put value on PA1 ; 4
sta MOCK_6522_ORA2 ; put value on PA2 ; 4
lda #MOCK_AY_WRITE ; ; 2
@ -122,7 +121,7 @@ mb_not_13:
sty MOCK_6522_ORB1 ; 4
sty MOCK_6522_ORB2 ; 4
;===========
; 60
; 56
mb_no_write:
inx ; point to next register ; 2
cpx #14 ; if 14 we're done ; 2

View File

@ -74,6 +74,15 @@ reset_ay_both:
rts
;=======================================
; clear ay -- clear all 14 AY registers
; should silence the card
;=======================================
clear_ay_both:
ldx #14
lda #0
sta MB_VALUE
clear_ay_left_loop:
; Write sequence
; Inactive -> Latch Address -> Inactive -> Write Data -> Inactive
@ -104,19 +113,8 @@ write_ay_both:
sty MOCK_6522_ORB1 ; 3
sty MOCK_6522_ORB2 ; 3
rts ; 6
;===========
; 51
;=======================================
; clear ay -- clear all 14 AY registers
; should silence the card
;=======================================
clear_ay_both:
ldx #14
lda #0
sta MB_VALUE
clear_ay_left_loop:
jsr write_ay_both
; 45
dex
bpl clear_ay_left_loop
rts