Changes

Jump to: navigation, search

How to access the PSG via PPI

39 bytes added, 10:22, 13 June 2008
{|{{Prettytable|width: 700px; font-size: 2em;}}
|''PPI Port C Bit''||||''PSG Function''
|-
|7||6
Note:
The "inactive" mode must be used between function changes.  If it is not used then there will be problems with the program on the CPC+. See the document about CPC+ extra information for a description of this.  
The "inactive" mode can be used to prevent register corruption between changing modes.
== Programming the PSG== 
The PSG has 16 internal registers and these control the operation. Before a register can be read from/written to it must be selected.
=== Register selection=== 
To write data to the PSG, PPI Port A must be operating as output. (See the document on the 8255 to see how to do this)
The register will remain selected until another is chosen.
=== Writing to the selected PSG register=== 
To write data to the PSG, PPI Port A must be operating as output. (See the document on the 8255 to see how to do this)
write data to PPI Port A,
 
set bit 7 to "1" and bit 6 to "0" of PPI Port C
The data will then be written into the register.
Reading from the selected PSG register
 
To read data from the PSG, PPI Port A must be operating as input. (See the document on the 8255 to see how to do this)
Notes
 
If the tone period is in the range 0-4 I can not hear any tone output.
Programming Examples
ret
=== Writing to a PSG register. ===
This routine can be used to write to registers on the PSG. C contains the index of the PSG register to write. A contains the data to write to the PSG register.
12,273
edits