Entries programmer - the musical programming of the processor AY-8912/10.

Spectrum Progress #02
  (C) Dennis Parinov, 1997.



  Music processor includes 16 registers. 14 were used to 
generate sound. 


  In order to put in the register of musical coprocessor are 
any data, you must: 

1) Select a register to record data


   LD BC, # FFFD

   LD A, the register number 0 - 13

   OUT (C), A

2) write data


   LD BC, # BFFD

   LD A, kakoe any number 0 - 255

   OUT (C), A


  To read the data from the register must:

1) Select a register to record data


   LD BC, # FFFD

   LD A, the register number 0 - 13

   OUT (C), A
2) read data

   IN A, (C)


  The first six registers are used to
set the pitch of each channel of
range 0 - 4095.

  Registers R0, R1 - frequency sound channel A.

  Registers R2, R3 - frequency sound channel B.

  Registers R4, R5 - frequency sound channel C.


  Register R6 - determines the frequency output

  noise for the three channels from a range of 0 - 31.


  Register R7 - controls audio channels

  d7d6d5d4d3d2d1d0

   xx prohibits the sounding channel A.

                   prohibits the sounding of the channel B.

                   prohibits the sounding of the channel C.

                   prohibits noise channel A.

                   prohibits noise channel B.

                   prohibits noise channel C.


  The following three registers are used to
set the volume in the range 0 - 15.
4-th bit indicates that the volume will be
changing the way specified in R13 and with
speed indications in R11/R12.


  Register R8 - determines the volume of channel A.

  Register R9 - determines the volume of channel B.

  Register R10 - determines the volume of the channel C.


  Registers R11, R12 - determine the rate of
change the volume from 0 to 65535. (On
Practice change reg. R11 malooschutimo,
so it suffices to specify only reg. R12)


  Register R13 - uprovlyaet formation
envelope of output signal:

 # 0, # 1, # 2, # 3, # 9 - fading, then quietly;
 # 4, # 5, # 6, # 7, # F - growth, then quietly;
 # B - decay, then loudly;
 # D - the increase, then zromko;
 # 8 - recurring decay;
 # C - repeated growth;
 # E - repeated growth and

      damping;
 # A - recurring decay and

      growth;


  And now a few examples demonstrating the legend.


  Before applying to the program in the register A
need to record the effect of number from 1 to 4.

, BT: A - number of effect from 1 - 4.

AY_EFF LD HL, EFFECT1; Calculate

        LD BC, # 000E; starting address
NEFF ADD HL, BC; effect next

        DEC A; for selected.

        JP NZ, NEFF;

        DEC HL; HL at the end of the chosen
                           ; Nnogo effect.

        LD A, # 0D; Start with reg-ra R13

        LD C, # FD;
NREG LD B, # FF; Select Registry AY

        OUT (C), A; for recording data.

        LD B, # BF; entry in the register AY

        OUTD; bytes of (HL) and

                           , A reduction in HL 1.

        DEC A; Reduced rates

                           ; Register AY, if

        JP P, NREG; he Є 0, continue.

        RET; Otherwise exit.

; Effect is used in various boot'ah at
; Startup programs.

EFFECT1 DEFW # 0080, # 0001, # 0000; tone frequency

   ; For channels A, B, C

        DEFB # 00; frequency noise

        DEFB # 38; 00111000 Off. noise.

        DEFB # 10, # 10, # 10; loudly. channel. A, B, C

        DEFW # 1500; volume change

        DEFB # 01; damping

, The effect of the program Honey Commander.

EFFECT2 DEFW # 203C, # 2064, # 208C

        DEFB # 00

        DEFB # 38

        DEFB # 10, # 10, # 10

        DEFW # 0810

        DEFB # 01

; Effect 2 of Honey Commander.

EFFECT3 DEFW # 2050, # 2060, # 2070

        DEFB # 01

        DEFB # 00

        DEFB # 10, # 10, # 10

        DEFW # 0400

        DEFB # 01

; Effect reminiscent of rotation of the blades
; Helicopter.

EFFECT4 DEFW # 0000, # 0000, # 0000

        DEFB # 00

        DEFB # 07

        DEFB # 10, # 10, # 10

        DEFW # 0100

        DEFB # 0E


  In conclusion, about one bad moment.
Sometimes when reading from the disk from the speakers is heard
buzz - this is due to the fact that the programmer does not 
choke muz.protsessor. Usually, do this again to initialize the 
player tunes. 

  In any case, we present a program stifles muz.protsessor.

RES_AY LD HL, # 0D00

        LD DE, # FFBF

        LD C, # FD
RES_AY1 LD B, D

        OUT (C), H

        LD B, E

        OUT (C), L

        DEC H

        JP P, RES_AY1

        RET


                       *