Changes

How to access the PSG via PPI

39 bytes removed, 10:34, 13 June 2008
/* Notes */
If the tone period is in the range 0-4 I can not hear any tone output.
 == Programming Examples== === Reading a value from a PSG register. === 
This routine can be used to read data from a PSG register.
.read_from_psg
ld b,&f4 ;} Setup register index on PPI port Aout (c),c ;}
ld bc,&f6c0 ;} Tell PSG to select register using data on PPI port Aout (c),c ;}
ld bc,&f600 ;} Put PSG into inactive stateout (c),c ;
;** Set PPI port A to input mode. **
ld b,&f7 ; 8255 PPI Control
ld c,%10010010 ; mode and port configurationout (c),c ; Port A input, Port B input, Port C output ; All operating in mode 0. (see Programming ; 8255 PPI)
ld bc,&f640 ;} Tell PSG to put the data of the selected register to PPI port A toout (c),c ;}
ld b,&f4 ;} Read data from PPI port Ain a,(c) ;}
;** Set PPI port A to output mode. *ld b,&f7 ;8255 PPI control
ld c,%10000010
out (c),c ;Port A output, Port B input, Port C output
ld bc,&f600 ;} Return PSG to inactive mode.out (c),c ;}
ret
</pre>
12,273
edits