ZX Doze #01
27 апреля 1997
  Игры  

Hardware - описание музыкального сопроцессора AY-3-8910/8912.

<b>Hardware</b> - описание музыкального сопроцессора AY-3-8910/8912.
            THE  AY-3-8910/8912 SOUND SYNTHESIZER IC
            ========================================


                            OVERVIEW
                            --------

        The  AY-3-8910/8912  is  a sound generator IC containing
three  tone  generators and a white noise generator. In addition
to its sound producing capabilities, the AY-3-8910 has two 8-bit
I/O ports and the AY-3-8912 has one.


                PINOUTS (FOR THE AY-3-8912 ONLY)
                --------------------------------

                         +----+--+----+
          Channel C out -+  1 |__| 28 +- DAO
                         |            |
                 Test 1 -+            +- DA1
                         |            |
                    +5V -+            +- DA2
                         |            |
          Channel B out -+            +- DAЗ
                         |            |
          Channel A out -+            +- DAЧ
                         |            |
                    GND -+            +- DAS
                         |            |
                   IOA7 -+            +- DAб
                         |            |
                   IOAб -+            +- DA7
                         |            |
                   IOAS -+            +- BC1
                         |            |
                   IOAЧ -+            +- BC2
                         |            |
                   IOAЗ -+            +- BDIR
                         |            |
                   IOA2 -+            +- A8
                         |            |  _____
                   IOA1 -+            +- RESET
                         |            |
                   IOAO -+ 14      15 +- CLK
                         +------------+

        DAO-DA7  are multiplexed data and address lines, as used
in  the  range of GI processors that this IC was originally part
of. The BC1 and BDIR pins are used to control the IC as follows:

Function       BDIR   BC1

Inactive         0     0
Read             0     1
Write            1     0
Latch address    1     1

        In  addition  to  using BC1 and BDIR, A8 should be taken
high  to  enable  the  chip. IOAO-IOA7 are the input/output pins
(the  AY-3-8910  has an additional set marked IOBO-IOB7). The IC
does not contain an internal oscillator - the clock input to the
CLK pin should fall between 1MHz-2MHz, so a typical Z80 system's
clock would need to be divided.


                           REGISTERS
                           ---------

        The  AY-3-8910/8912  contains  16  internal registers as
follows:

REGISTER          FUNCTION                  RANGE

    0       Channel A fine pitch         8-bit (0-255)
    1       Channel A course pitch       4-bit (0-15)
    2       Channel B fine pitch         8-bit (0-255)
    3       Channel B course pitch       4-bit (0-15)
    4       Channel C fine pitch         8-bit (0-255)
    5       Channel C course pitch       4-bit (0-15)
    6       Noise pitch                  5-bit (0-31)
    7       Mixer                        8-bit (see below)
    8       Channel A volume             4-bit (0-15, see below)
    9       Channel B volume             4-bit (0-15, see below)
   10       Channel C volume             4-bit (0-15, see below)
   11       Envelope fine duration       8-bit (0-255)
   12       Envelope course duration     8-bit (0-255)
   13       Envelope shape               4-bit (0-15)
   14       I/O port A                   8-bit (0-255)
   15       I/O port B                   8-bit (0-255)

        Notes:
        - The AY-3-8912 does not contain register 15.
        -  The  volume  registers  (8, 9 and 10) contain a 4-bit
setting  but if bit 5 is set then that channel uses the envelope
defined by register 13 and ignores its volume setting.
        -  The  mixer  (register  7) is made up of the following
bits (low=enabled):

Bit:  7       6       5       4       3       2       1       0
     _       _
     I/O     I/O   Noise   Noise   Noise    Tone    Tone    Tone
      B       A       C       B       A       C       B       A

        The AY-3-8912 ignores bit 7 of this register.


                           ENVELOPES
                           ---------

        The   AY-3-8910/8912   contains   the  following  preset
envelopes  or  waveforms  (set  using control register 13). Note
that these affect volume only and not the pitch:

         0      __________     single decay then off

         4      /|_________     single attack then off

         8      |||||     repeated decay

         9      __________     single decay then off

        10      /////     repeated decay-attack
                  _________
        11      |              single decay then hold

        12      /|/|/|/|/|/     repeated attack
                 __________
        13      /               single attack then hold

        14      //////     repeated attack-decay

        15      /|_________     single attack then off


                          PITCH VALUES
                          ------------

        The course and fine pitch registers for each channel are
used in the following fashion (assuming channel A).
        Registers  0  and 1 operate together to form channel A's
final  pitch.  The  eight  least  significant  bits  are sent to
register  0  and  the  four  most  significant  bits are sent to
register  1.  The output frequency is equal to the IC's incoming
clock  frequency  divided  by 16 and then further divided by the
number  written  to  the course and fine pitch registers, so the
higher  the  number  written  to these, the lower the pitch. For
example,  if a frequency of 1KHz was required and the IC's clock
frequency  was  1MHz,  a  total  division  rate of 1000 would be
needed.  The  sound generator itself divides by 16 so the course
and fine pitch registers must provide a further division by 62.5
(due to the fact that 1000/16 is 62.5). A division rate of 62 or
63  will  be accurate enough, since the registers can only store
whole  numbers. Therefore, 62 or 63 would be written to register
0 and 0 would be written to register 1.
        The  following  frequency table may be useful in musical
applications:

   Note       Frequency (Hz)         Note         Frequency (Hz)

    A             220                 D#              311.1
    A#            233.3               E               329.63
    B             246.94              F               349.23
 middle C         261.63              F#              370
    C#            277.2               G               392
    D             293.66              G#              415.3


                          APPLICATIONS
                          ------------

        The  AY-3-8910/8912  (and derivatives) has found its way
into  a  variety  of home computers and games consoles including
the following:
        . Sinclair ZX Spectrum 128/+2/+3
        . Amstrad CPC 464/664/6128
        . Mattel Intellivision
        . BBC Micro
        . Atari ST
        . Sega Master System

        There  are  also  a couple of emulators available at the
time of writing:
        . "Z80" - the Spectrum emulator by Gerton Lunter for PCs
          and   compatibles   which  utilises  the  Adlib  sound
          generator   present  on  most  Soundblaster-compatible
          cards. This package fully emulates the Spectrum 48/128
          and is well worth looking at.
        . "DeliAY" - by Patrik Rak for the Commodore Amiga. This
          comes  as an add-on for "DeliTracker" (a music player)
          and  emulates  a Z80 and AY-3-8912 (in a Spectrum-like
          fashion)  giving  very  accurate  results.  A  growing
          number  of  Spectrum tunes are being gathered together
          to run under this player.


                   ZX SPECTRUM 128  SPECIFICS
                   --------------------------

        The  Spectrum's "control" and "data" output ports are as
follows:

        - control = 65533
        - data = 49149

        So, to produce a simple sound from BASIC...

        10 LET ayctrl=65533
        20 LET aydata = 49149
        30 OUT ayctrl,7 : REM select the mixer register
        40 OUT aydata,62 : REM enable channel A only
        50 OUT ayctrl,1 : REM channel A course pitch
        60 OUT aydata,50 : REM set it
        70 OUT ayctrl,8 : REM channel A volume
        80 OUT aydata,15 : REM set it to maximum

        .... or from assembler ...

        ayctrl  EQU     65533
        aydata  EQU     49149

        start   ld      d,7          ; select the mixer register
                ld      e,62         ; enable channel A only
                call    outer        ; send it to PSG
                ld      d,1          ; channel A course pitch
                ld      e,50         ; pitch value
                call    outer        ; send it to PSG
                ld      d,8          ; channel A volume
                ld      e,15         ; maximum
                call    outer        ; send it to PSG
                ret

        outer   ld      bc,ayctrl    ; select control port
                out     (c),d        ; send specified value
                ld      bc,aydata    ; select data port
                out     (c),e        ; send specified value
                ret

        For an easy way to generate the required course and fine
pitch values, try the following program:

        10 INPUT "Note value ",n
        20 INPUT "Octave ",o
        30 LET f=INT(n/2^o)
        40 LET c=INT(f/256)
        50 PRINT "Fine = ";f;"  Course = ";c

        The  pitch  values  required  by  this  program  are  as
follows:

  Note            Value                   Note            Value

  C               3421                    F#              2419
  C#              3228                    G               2283
  D               3047                    G#              2155
  D#              2876                    A               2034
  E               2715                    A#              1920
  F               2562                    B               1892


                           REFERENCES
                           ----------

     Micro Interfacing Circuits - Book 2, by R. A. Penfold,
                       ISBN 0-85934-106-2

       Spectrum 128 manual, (c)1986 Sinclair Research Ltd

          Sinclair User magazine, 1986 (issue unknown)

        This  text  was  entered by Alastair Booker on Чth April
1995.   Please  feel  free  to  contact  me  regarding  anything
contained  in this document. I have produced a generic AY-3-8912
interface  circuit  for  Z80-based  systems  and  will make this
available to anyone who requires it.

               email: booker_a%prodev.dnet@sb.com
                 or   : ali@tanagra.demon.co.uk



Другие статьи номера:

Introduction - приложение к журналу.

Introduction - Ну вот и вышел первый компьютерный журнал в городе Рязани!

Informations - Откровения Хакера из Великобритании.

Informations - Oфициальный словаpь улыбок.

Help for games - почему люди играют?

Help for games - разбор игры "HIJACK" ("ЗАХВАТ ЗАЛОЖНИКОВ").

Help for games - разбор игры COLONY.

Help for games - разбор игры MINDFIGHTER.

Help for games - разбор игры "LORDS OF CHAOS".

Help for games - разбор игры THE BARDS TALE (часть 1).

Help for games - разбор игры THE BARDS TALE (часть 2).

Help for games - разбор игры THE BARDS TALE - руководство для начинающих.

Hardware - хитрости процессора Z80.

Hardware - описание музыкального сопроцессора AY-3-8910/8912.

Novels - новелла по мотивам игpы "LORDS OF CHAOS".

Novels - новелла по мотивам игpы "LORDS OF CHAOS" (продолжение).

Novels - новелла по мотивам игpы "LORDS OF CHAOS" (продолжение).

Novels - Конец великой руссификации.

Humor - Щенок.

Humor - Хакер.

Humor - ЛЕСОРУБ.

Humor - СКАЗКА О ПРОГРАММИСТЕ.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Похожие статьи:
Что-где-почем - pассказываю, что я получил на этот pаз от VEL'а.
Новости - конкурент Enlight'у - Consul party в городе Сочи!
Письмо - Письмо от Postman'a в газету.
Описание - Как пройти игру Last Hero.
Обзо игр - GUMMY, After Burner, MURK 3320, BIGNOSE.

В этот день...   21 ноября