User`s guide
Envelope Control (bit 4): 1 = Use Env; 0 = Use Level value
09 B Level (0-3) and
Envelope Control (bit 4): 1 = Use Env; 0 = Use Level value
0A C Level (0-3) and
Envelope Control (bit 4): 1 = Use Env; 0 = Use Level value
0B Envelope Period Fine (bits 0-7)
0C Envelope Period Coarse (bits 0-7)
0D Envelope Shape (four bits):
Continue (bit 3) 0= do 1 cycle and set Level to zero
Attack (bit 2) 1= count up 0= count down
Alternate (bit 1) 1= reverse count direction each cycle
Hold (bit 0) 1= do 1 cycle and hold count
To program the MB you write to the board's 6522 I/O chip(s). All address
references here are for a MB Sound II (2 Audio Outputs) in Slot 4.
$C400 ORB1 function to perform, Output 1
$C480 ORB2 function to perform, Output 2
$C401 ORA1 data, Output 1
$C481 ORA2 data, Output 2
$C402 DDRB1 data direction, Output 1
$C482 DDRB2 data direction, Output 2
$C403 DDRA1 data direction, Output 1
$C483 DDRA2 data direction, Output 2
Before sending music, etc. data to the MB you must Initialize the board's I/O.
To Initialize the 6522's: Store $FF at $C402 and the other three DDRxx
addresses. This needs to be done by your program just once.
Your program gets access to a PSG via the 6522 by using a few basic Function
codes which set the PSG's I/O control lines:
Set Inactive = $04
Set PSG Reg# = $07
Write Data = $06
Reset = $00
To Write to a PSG register: Tell the PSG which Register you wish to access (i.e.
Set the "current register" #) and Write the data. This is easiest to do with
subroutines to handle the basic Functions.
Example Subroutines (for Output Channel 1):
Set Reg # 1000: A9 07 8D 00 C4 A9 04 8D 00 C4 60
Write Data 100B: A9 06 8D 00 C4 A9 04 8D 00 C4 60
Notice that each Function sub ends by setting the PSG control lines to Inactive.