Changes
PlayCity
,/* Technical description */
[[File:PlayCity.jpg|thumb|320px|]]
==Introduction==
* 6 audio channels sound with programmable frequency (stereo line out and speaker mono mix in).
* 4 counter/timer channels for programmable interrupt (including NMI).
* CRTC hardware CURSOR interrupt support.
* The LIGHT PEN/GUN connector.
==Technical description==
The board main feature is the Zilog Z80 Counter Timer Circuit, the best friend of the Zilog Z80 CPU.
The CTC is linked to the CPU to allow it to manage vectorized interrupt (IM2) and handling triggered events.
Programmers can only get benefit of that to save CPU time and make complex programs more easy to achieve.
I can only invite them to read the Zilog CTC data-sheet for more informations. (it's really easy to use)
Because the CPC expansion port have some interesting signals on it, it had been a shame to not use them.
* CTC channel 0 is a programable audio clock generator. i.e. allow to replay ST or ZX sound on a CPC using AUDIO pin.
* CTC channel 1 is linked to the CURSOR pin and triggered by the NMI pin. Allow accurate hi priority rasters effects.
* CTC channel 2 and 3 are linked together and offers 2x8bit or 1x16bit user purpose timer or counter.
ADDER is the ADDress decodER part of the board. It manage all the ICs.
Because ports are direct access to the hardware, it's really fast.
* CTC channels: #F880, 81, 82, 83
* Audio right: #F884, #F984
* Audio left: #F888, #F988
* Soft reset: #F8FF
At end, the LIGHTPEN pin is rooted to a 4 pins connector for plugging compatible hardware through an adapter.
==Hardware Installation==
* Power OFF your Amstrad / Schneider CPC.
* Attach the PlayCity board to one free MotherX4 slogslot.* Turn ON your computer, and enjoy! (if a grey screen appear, turn off your computer and check the connections)
==Peripheral Soft Reset==
All expansion peripherals should be reset when an output is performed to I/O port '''$F8FF'''.
Used by the standard BIOS functions
'''MC_BOOT_PROGRAM ''' and '''MC_START_PROGRAM ''' (vector BD13h vectors $BD13 and BD16h$BD16), in particular a peripheral that generates interrupts. Also used by [[FutureOS]].
The PlayCity board use this feature to be sure that the CTC and YMZs circuits are properly reseted reset before using them.
== Light Pen/Gun connector ==
For making it easier to adapt Light Pens/Guns from other systems or new ones, we added a 4 pins -pin connector to the board. The connections are labeled in the board as VCC (+5V), TR (Trigger or D7), LS (Light Sensor) and GND. Trigger (TR) = Request via output to port &FBFE. Light Sensor (LS) = CRTC Light Pen input.
Making the system compatible with [[Amstrad_Magnum_Phaser|Amstrad Magnum Phaser]] games, the most accuracy light gun system for CPC.
==Counter/Timer Circuit==
===InformationsInformation===
The Z84C30 has four independently programmable counter/timer channels interfaced directly with the Z80 CPU. You can get full information in the CTC datasheet ([[File:Z80ctc.pdf]]).
Used as a counter, it's synchronized with the CRTC CURSOR signal, generating a smooth high priority rasters interrupt. Used as a
timer (prescaler set to 256), it's its 15.625 kHz signal is scanline-synchronized. That means the time constant is the number of
scanlines to wait before to send an NMI.
====Channel 2/3 ($F882/$F883)====
The channels 2 and 3 are dedicated to general purpose usages. Yes, it's for you! The input for the trigger (TRG2) is the 4 MHz
system clock. The output (ZC/TO0TO2) is linked to the trigger for the channel 3 (TRG3). They can be used as 2x 8-bit or 1x 16-bitcounter/timer. They generate normal interrupts and allow to use using the Z80 vector interrupt (mode 2) too.
===Coding examples===
Each channel is programmed with two bytes; a third is necessary when interrupts are enabled. Once started, the CTC countdown
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.
==Audio Channels==
===Informations===
the frequency by reprograming the CTC Channel 0.
===YMZ294 Registers===
They are exactly the same than the [[PSG]], only remember there is not PSG I/O registers ($0E-$0F90F) in the YMZ.The registers are write only.
===Coding Examples===
====YMZ Initialization====
{| class="wikitable"
|-
|-
| 1 || $$01 || 2,00 || 1,00 || = CPC
|-
| $2 || || 23,67 00 || 1,33 50 ||
|-
| $3 ||$02 || 3,00 33 || 1,50 67 ||
|-
| $4 || || 3,20 50 || 1,60 75 ||= ZX
|-
| $5 || $03 || 3,33 60 || 1,67 80 ||~ MSX
|-
| $6 || || 3,43 67 || 1,71 83 ||
|-
| $7 || $04 || 3,50 71 || 1,75 86 || ZX
|-
| $8 || || 3,56 75 || 1,78 88 || MSX
|-
| $9 || $05 || 3,60 78 || 1,80 89 ||
|-
| 10 || $A || 3,64 80 || 1,82 90 ||
|-
|-
| 12 || $C || 3,69 83 || 1,85 92 ||
|-
|-
| 14 || $E || 3,73 86 || 1,87 93 ||
|-
|-
| 16 || $0 || 3,76 98 || 1,88 99 ||~ ST
|-
|}