AY Crudentials: Making all AY registers Visible in Memory

Probably the most technical forum around. It does not have to be coding related, or assembly code only. Just talk about how you can use the AY chip to do cool sounding things :)
Post Reply
User avatar
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK

AY Crudentials: Making all AY registers Visible in Memory

Post by Twilighte »

This follows on from "AY Crudentials: Accessing the AY".

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

Post Reply