To make all AY registers visible in main memory, we can write a simple AY Register Dump Routine.
Note: this routine actually already exists in BASIC 1.1 ROM but does not compensate for special case Register 0D.
The routine uses two tables.
Table_Source contains all 14 virtual registers
Table_Reference is used to optimise the writing of register data by only writing registers that have changed since the last interrupt.
This table is also used to avoid special case register 0D where a write of the same value will reset the Envelope Cycle (See AY Crudentials: The Envelope Generator).
So the actual routine...
Code: Select all
LDX #$0D loop LDA Table_Source,X CMP Table_Reference,X BEQ skip STA Table_Reference,X STX $030F LDY #$FF STY $030C LDY #$DD STY $030C STA $030F LDA #$FD STA $030F STY $030C skip DEX BPL loop RTS