Changes

Jump to: navigation, search

PlayCity

1,154 bytes added, 13:56, 9 July 2014
OUT (C),0
</pre>
====Channel 0 example====
<pre>
; Set both YMZ294 clocks to sound like the CPC AY-3-8912
LD BC,$F880
LD HL,$7F01
OUT (C),H ; $7F = Clock generator
OUT (C),L ; $01 = CPC AY
</pre>
====Channel 2 example====
<pre>
; Start CTC channel 2 in timer mode (prescalar 256 and set new time constant)
LD H,%10110111 ; Timer mode and preescalar 256
LD L,1 ; Time constant
LD BC,$F882
OUT (C),H ; Enable Timer
OUT (C),L ; Set new time constant
</pre>
<pre>
; Stop CTC channel 2
LD BC,$F882
LD A,%00000011
OUT (C),A ; Disable Timer 2
</pre>
====Channel 2/3 example====
<pre>
; Start CTC channel 2 and 3 in 16-bit counter mode
LD BC,$F882
LD HL,32768 ; Timer constant
LD A,%11110111 ; Counter mode
OUT (C),A ; Enable Timer 2
OUT (C),L ; Set new time constant (lower byte)
INC BC
OUT (C),A ; Enable Timer 3
OUT (C),H ; Set new time constant (high byte)
</pre>
<pre>
; Stop CTC channel 2 and 3 (16 bit mode)
LD BC,$F882
LD A,%00000011
OUT (C),A ; Disable Timer 2
INC BC
OUT (C),A ; Disable Timer 3
</pre>
Don't forget to use RETN for NMI handlers as well as RETI for normal interrupt handlers. In other case, the Z80 CPU will not
aknowledge the next interrupt properly.
123
edits