dya: almost have playing out of same buffer

need to also update the copy code
This commit is contained in:
Vince Weaver 2018-11-20 12:21:01 -05:00
parent b26ee7c7d4
commit c1ce7d59a8
3 changed files with 126 additions and 17 deletions

View File

@ -380,6 +380,11 @@ done_name_loop:
lda #>UNPACK_BUFFER1
sta INH
lda #<UNPACK_BUFFER2 ; set input pointer
sta INL2
lda #>UNPACK_BUFFER2
sta INH2
; Decompress first chunks
lda #$0

View File

@ -77,26 +77,19 @@ 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
lda #MOCK_AY_INACTIVE ; go inactive ; 2
sta MOCK_6522_ORB1 ; 4
sta MOCK_6522_ORB2 ; 4
; value
lda REGISTER_DUMP,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
sta MOCK_6522_ORB1 ; write on PB1 ; 4
sta MOCK_6522_ORB2 ; write on PB2 ; 4
lda #MOCK_AY_INACTIVE ; go inactive ; 2
sta MOCK_6522_ORB1 ; 4
sta MOCK_6522_ORB2 ; 4
;===========
; 62
mb_no_write:
inx ; point to next register ; 2
cpx #14 ; if 14 we're done ; 2
@ -118,6 +111,75 @@ mb_reg_copy:
;=============
; 171
;======================================
; Write frames to Mockingboard
;======================================
; actually plays frame loaded at end of
; last interrupt, so 20ms behind?
mb_write_frame2:
ldx #0 ; set up reg count ; 2
;============
; 2
mb_write_loop2:
lda REGISTER_DUMP2,X ; load register value ; 4
cmp REGISTER_OLD2,X ; compare with old values ; 4
beq mb_no_write2 ; 3/2nt
;=============
; typ 11
; special case R13. If it is 0xff, then don't update
; otherwise might spuriously reset the envelope settings
cpx #13 ; 2
bne mb_not_132 ; 3/2nt
cmp #$ff ; 2
beq mb_skip_132 ; 3/2nt
;============
; typ 5
mb_not_132:
; address
stx MOCK_6522_ORA2 ; put address on PA2 ; 4
lda #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2
sta MOCK_6522_ORB2 ; latch_address on PB2 ; 4
lda #MOCK_AY_INACTIVE ; go inactive ; 2
sta MOCK_6522_ORB2 ; 4
; value
lda REGISTER_DUMP2,X ; load register value ; 4
sta MOCK_6522_ORA2 ; put value on PA2 ; 4
lda #MOCK_AY_WRITE ; ; 2
sta MOCK_6522_ORB2 ; write on PB2 ; 4
lda #MOCK_AY_INACTIVE ; go inactive ; 2
sta MOCK_6522_ORB2 ; 4
mb_no_write2:
inx ; point to next register ; 2
cpx #14 ; if 14 we're done ; 2
bmi mb_write_loop2 ; otherwise, loop ; 3/2nt
;============
; 7
mb_skip_132:
;=====================================
; Copy registers to old
;=====================================
ldx #13 ; 2
mb_reg_copy2:
lda REGISTER_DUMP2,X ; load register value ; 4
sta REGISTER_OLD2,X ; compare with old values ; 4
dex ; 2
bpl mb_reg_copy2 ; 2nt/3
;=============
; 171
;===================================
; Load all 14 registers in advance
;===================================
@ -134,6 +196,8 @@ mb_load_values:
mb_load_loop:
lda (INL),y ; load register value ; 5
sta REGISTER_DUMP,X ; 4
lda (INL2),y
sta REGISTER_DUMP2,X
;============
; 9
;====================
@ -145,6 +209,11 @@ mb_load_loop:
adc CHUNKSIZE ; 3
sta INH ; 3
clc
lda INH2
adc CHUNKSIZE
sta INH2
inx ; point to next register ; 2
cpx #14 ; if 14 we're done ; 2
bmi mb_load_loop ; otherwise, loop ; 3/2nt
@ -225,15 +294,24 @@ back_to_first_reg_b:
back_to_first_reg_a:
clc ; 2
adc #>UNPACK_BUFFER1 ; in proper chunk 1 or 2 ; 2
adc #>UNPACK_BUFFER1 ; in proper chunk 1 or 2; 2
sta INH ; update r0 pointer ; 3
sec
sbc #>UNPACK_BUFFER1
clc
adc #>UNPACK_BUFFER2
sta INH2
jmp update_r0_pointer ; 3
back_to_first_reg_c:
lda #>(UNPACK_BUFFER1+$2A00) ; in linear C area ; 2
lda #>(UNPACK_BUFFER1+$2A00) ; in linear C area ; 2
sta INH ; update r0 pointer ; 3
lda #>(UNPACK_BUFFER2+$2A00) ; in linear C area ; 2
sta INH2 ; update r0 pointer ; 3
update_r0_pointer:
sta INH ; update r0 pointer ; 3
@ -351,6 +429,8 @@ quiet_exit:
mb_clear_reg:
sta REGISTER_DUMP,X ; clear register value ; 4
sta REGISTER_OLD,X ; clear old values ; 4
sta REGISTER_DUMP2,X ; clear register value ; 4
sta REGISTER_OLD2,X ; clear old values ; 4
dex ; 2
bpl mb_clear_reg ; 2nt/3
@ -374,3 +454,6 @@ exit_interrupt:
REGISTER_OLD:
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0
REGISTER_OLD2:
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0

View File

@ -32,12 +32,29 @@ COLOR EQU $30
; DOS33: Confirmed kills $68
RWTSL EQU $60
RWTSH EQU $61
DOSBUFL EQU $62
DOSBUFH EQU $63
FILEML EQU $64
FILEMH EQU $65
REGISTER_DUMP2 EQU $60
A_FINE_TONE2 EQU $60
A_COARSE_TONE2 EQU $61
B_FINE_TONE2 EQU $62
B_COARSE_TONE2 EQU $63
C_FINE_TONE2 EQU $64
C_COARSE_TONE2 EQU $65
NOISE2 EQU $66
ENABLE2 EQU $67
A_VOLUME2 EQU $68
B_VOLUME2 EQU $69
C_VOLUME2 EQU $6A
ENVELOPE_FINE2 EQU $6B
ENVELOPE_COARSE2 EQU $6C
ENVELOPE_SHAPE2 EQU $6D
;RWTSL EQU $60
;RWTSH EQU $61
;DOSBUFL EQU $62
;DOSBUFH EQU $63
;FILEML EQU $64
;FILEMH EQU $65
;TURNING EQU $60
;SCREEN_X EQU $61 ; not used?
;SCREEN_Y EQU $62
@ -72,6 +89,8 @@ C_VOLUME EQU $7A
ENVELOPE_FINE EQU $7B
ENVELOPE_COARSE EQU $7C
ENVELOPE_SHAPE EQU $7D
COPY_OFFSET EQU $7E
DECODER_STATE EQU $7F
;SPACEY_I EQU $70
@ -158,6 +177,8 @@ LASTKEY EQU $F1
;XPOS EQU $F3
;YPOS EQU $F4
INL2 = $f4
INH2 = $f5
namlo = $f6
namhi = $f7