ZX-News #26
03 апреля 1997
  Звук  

General Sound - The process of adaptation of branded toys under General Sound - first results (Xecutor, Target Renegade). Programming Guide, a brief description, specifications, system commands.

<b>General Sound</b> - The process of adaptation of branded toys under General Sound -
 first results (Xecutor, Target Renegade).
Programming Guide, a brief description, specifications, system commands.
              GENERAL SOUND



  Newskah keeps pace with the times and
here's a new topic ...



                           (C), Michael Blum

                               Zx-Masters


          GENER'IZATSIYA PROGRAMS


  Began an active process of adaptation of branded toys under 
GENERAL SOUND (GS). 


  On this weekend there were 2 first -
XECUTOR and TARGET RENEGADE.


  The first impression of them - full of distorted. Instead of 
the usual beeper or AY is a cool 8-bit music, and all this 
background ... jumping piles of monochrome pixels, so even 
Sinclair to do the same. : ( 


  In a word - is something absurd and disparate. But ... After 
five minutes of play, at least in Target Renegade, it is 
difficult to present without the techno music, savory

blows to the face and the perineum, meat
kicks, strokes of hammers, screaming victims and
of falling prostrate bodies.


  So you can imagine all the effects, list them:


  Music - all 4 tunes: one in the menu and
three alternate in five levels.


  Effects - a total of 26 effects.


              Common effects:

1. Flipping a bonus during the passage of each
level.

2. Whoops, inquired about the appearance of another
one life.

3. Sound, characterized by loss of life.

4. Sound that characterizes the passage level.

5. Beep - aware of an expiration time.

6. The sound of falling bodies - is played on a 7-
notes, depending on the level and players.

7. Punch and kick - depending on the
Impact played on different notes.

8. Beat after the jump, and finishing - - / /
8. Kick in the crotch of two types: a blow with his knee and 
roundhouse kicks. 

10. Jump up.

11. Running jump.


  1st Level:

12. Motor bike.
13. Bringing the motorcycle player.
14. Max hammer.


  2nd Level:

15. Shot.
16. Whip kick her aunt.
17. Whip kick a player.
18. Creek aunt during a fall.


  Third level:

19. Max ax.


  Fourth level:

20. A dog bite.
21. Yelp dogs.


  5th level - here are the

                 "Meat" sounds:

22. Beat the forehead.
23. Fruity kick to the liver and in the face.
24. Wag and hit with a stick.
25. Beat the boss forehead with tilting

    victim on the floor down the ridge.
26. If you defeat the boss, you will hear:

    "ALILUYA!".


  Almost all the effects are played with different notes, 
depending on the number of players or enemy. Dispersion of 
music is normally chosen randomly. In short, almost every

effects play 3-7 notes.


  Volume of the music and effects you can adjust the slider in 
the menu. 


  That's all that relates to Target Renegade.
Well Xecutor did not I, so I can not
give such podrbnogo describe the effects
I can only say that they are there 11.


  Following after the Target Renegade will be
ZYNAPS and POWERBOAT, then CHASE H.Q. and
HEADBALL.


  In addition, recent data have begun
FROST BYTE voice and FLYING SHARK.


  All this you can expect in April, and
everything will depend on the sale of such games so compelling
request to all sysop - do not put such
Games at BBS; to distributors - not piracy, and then this thing 
wither away, because Encoders are not going to adapt these 
things games for free.



  And now, let me doozvuchivat ZYNAPS!



                               (C) STINGER


     Programming Guide

              General Sound.


       Version v1.03. Revision 003.

 1. Brief technical characteristics of the GS.

    -------------------------------------
Processor: Z80, 12MHz, without wait cycles
ROM: 32k, 27256
RAM: Static Ram 128k total,

           112k available for modules and

           samples in the base version
INT: 37.5 KHz
Channels: 4 independent 8-bit channels, each with 6-bit volume 
control. 


  2. Brief description of GS, or a lot every Labuda.

     --------------------------------------------

  GS - musical card, designed to play music modules and
individual samples (effects).


  Modules for the GS - it is the standard Amiga
PCshnye and 4-channel MOD files, and samples - as Amiga signed 
sample, and PCshnye unsigned sample. 


  MOD player file in GS is
practically a complete analog ProTracker'a
on the Amiga was created with intensive use of sources 
ProTracker'a. (Sources were from Protracker'a v2.1A by Lars 
"ZAP" Hamre - Amiga Freelancers) 


  MOD Player Pro supports all the teams
Tracker'a, except for two things:

 E01 Filter On Amiga-specific commands
                 yes, includes a filter high
                 frequencies.

 EFX Invert Loop I have not seen the player,
which would support this team. Perhaps it is supported on some 
older players. 


  GS represents himself, in essence, a complex microprocessor 
with its own CPU, ROM, RAM, and ports, and absolutely no 
depends on the main processor Spectrum, that allows, for 
example, upload your own favorite module, reset the Spectrum, 
download the assembler and create your favorite music. Soft 
inside the GS is fully takes problem playing sound, the 
interpretation of module, etc. Programming GS'a reduces the 
transmission of byte by byte module and / or samples, and then 
you only need give commands like: start the module, set the 
global volume of the playback module, run the sample # 09 in 
Channel # 02, etc. 


  If you intend to load the module
together with the samples, make sure you first need to download 
the module, and then sampled. 


  When you load the module is highly recommended
left free to 2k of memory, ie, load modules with a maximum 
length 110K. This condition is not necessary, but its execution 
is highly desirable for compatibility with future versions. 


  Similarly, highly recommended to leave
80 bytes for each sample, for example,
If you want to download 63-Kbyte
module and 18 samples, we have:


  Total_Sample_Length = 112 * 1024-63 * 1024-2 * 1024-18 * 80 = 
46688 bytes 


  This is the total length of sample, which, when
this state of affairs can be downloaded.


  If, for example, is required to compute
as will fit in memory GS'a 2 KB sample, it is calculated as 
follows: 

 112 * 1024 / (2048 +80) = 53 sample.


  In GS'e have 4 physical channels, which are losing the sound.


  Channels 0 and 1 - left, and 2 and 3 - Right.

 3. Interface with the Spectrum.

    -----------------------

  GS looks at the world with 4 registers:

1. Command register - register of commands available to the 
port of entry at 187. In This register is written to the 
command. 

2. Status register - status register,
readable port at 187.


  Register bits:


   7 - Data bit, flag data

   6 - Undefined

   5 - Undefined

   4 - Undefined

   3 - Undefined

   2 - Undefined

   1 - Undefined

   0 - Command bit, flag teams


  This register allows to define the state of GS, in particular 
whether it is possible to read or write the next byte of data, 
or apply another command, etc.


3. Data register - Register of data available for the port of 
entry at 179. In this Spectrum Registry records data, for 
example, it may be arguments to commands. 

4. Output register - register output port is available for 
reading at 179. From This register reads the Spectrum data

going from the GS.


  Command bit in the status register is set by hardware after 
writing team into the instruction register. Reset to 0 it can 
only GS, which indicates a certain stage of execution. 


  Data bit in the register states can be
set or reset as optional
Spectrum and optional GS: recording
Spectrum in the data register it hardware
set to 1, and after reading GS'om
from this register is reset to 0. When
GS record in the register display it (all the same
Data bit) is set by hardware to 1, and
after reading from this port Spectrum
cleared by hardware to 0.


  Despite the fact that the data register and output register 
are located in space port addresses to the same address

and affect the same bits of data, they are two separate 
registers. Value, once recorded in One of these registers, it 
remains unchanged until a new record. 


  Status bits of data are often undefined, and if the 
specification of commands not the values ​​of this bit on 
opredennyh stages of execution of a command is not valid make 
any assumptions about the value of this bit. 

 4. The command system GS.

    -----------------

  At first, let me digress from the actual system commands. GS, 
as is known, is designed mainly for playing modules and 
samples. In this version (1.03) GS ROM dopukaetsya downloading 
a module and / or up to 32 samples. 


  Each sample loading it into memory
gets a unique identifier
that uniquely identifies the call to
given samples of the teams, which require
number of samples. The first loaded
sample receives a number (handle) = 1, the next - the number 2, 
etc. 


  The same applies to modules and
this one loaded module will
have a handle = 1 after boot.


  A feature of this version is also something that must first 
load the module, and then sampled. 


  Features command descriptions:


  Teams are described as follows:

 1. Hex command code
 2. Team Name
 3. Actions taken in the performance of the team
 4. Instruction format
 5. Comments to the team


  The command format is described as follows:

 GSCOM EQU 187
 GSDAT EQU 179

SC # NN: Send a command code to the register

             teams


          LD A, # NN

          OUT (GSCOM), A

WC: Waiting for relief Command bit


     WCLP IN A, (GSCOM)

          RRCA

          JR C, WCLP

SD Data: Send data to data register


          LD A, Data

          OUT (GSDAT), A

WD: Waiting for reset Data bit, on

          Indeed, waiting until GS

          will not accept the data sent to him


     WDLP IN A, (GSCOM)

          RLCA

          JR C, WDLP

GD Data: Take the data from the register

            Data


          IN A, (GSDAT)

WN: Waiting for installation Data bit, on

          Indeed, the expectation of regular data

          by GS


     WNLP IN A, (GSCOM)

          RLCA

          JR NC, WNLP



               Command GS:

# 00 Reset flags -

    Resets the flags and Command Data bit

    bit.


    SC # 00

    WC


    (Data bit = 0, Command bit = 0)

# 0E Go in Covox mode

    Goes into Kovoks directly

    copies the data register in the two DACs

    (Right and left) channels.

    To exit this mode - record # 00

    into the instruction register.


    SC # 0E

    WC


    SD \

    SD \

    ... / It's conclusion in DACs

    SD /


    SC # 00

    WC

# F3 Warm restart

    Resets all GS, but misses

    stages of determining the number of pages

    memory and their proveki, which greatly

    accelerates the process of initialization.


    SC # F3

    WC

# F4 Cold restart

    Full restart of GS with all the verification
    kami. In fact, JP # 0000.


    SC # F4

    WC

# 20 Get total RAM

    Get the total available memory

    on the GS. (In the basic version is 112k)


    SC # 20

    WC

    GD RAM.L (youngest part)

    WN

    GD RAM.M (middle part)

    WN

    GD RAM.H (oldest part)

Total RAM = 65536 * RAM.H +256 * RAM.M + RAM.L

# 21 Get free RAM

    Get the total amount of free memory

    on the GS.


    SC # 20

    WC

    GD RAM.L (youngest part)

    WN

    GD RAM.M (middle part)

    WN

    GD RAM.H (oldest part)

 Free_RAM = 65536 * RAM.H +256 * RAM.M + RAM.L

# 23 Get number of RAM Pages

    Get the number of pages on the GS.


    SC # 23

    WC

    GD Number_RAM_Pages


    In the basic version of 3 pages.

# 2A Set Module Master Volume

    Set the play volume

    modules.


    SD Module_Master_Volume [# 00 .. # 40]

    SC # 2A

    WC

   [GD Old_Master_Volume] - Old loudly.


    A small example of using this

    Team:


    (This assumes that the module is played)


           LD B, # 40


     LOOP: LD A, B

           OUT (GSDAT), A

           LD A, # 2A

           OUT (GSCOM), A

           EI

           HALT

           DJNZ LOOP


           LD A, # 32

           OUT (GSCOM), A


  Described above gradually lowers the volume
playing module, and then stops
him.

# 2B Set FX Master Volume

    Set the play volume

    effects.


    SD FX_Master_Volume [# 00 .. # 40]

    SC # 2B

    WC

   [GD Old_FX_Volume] - Old Volume


  Similarly to the previous command, but operates on the 
samples. 


  With these two commands, you can adjust the volume balance of 
the module and samples, etc.


# 2E Set Current FX

    Set the current effect. Just

    assigns this value CURFX
    inclusion. If any team requires
    em sample number (sample handle), then

    you can instead give her room

    # 00 and Larry substitute

    this zero value of the variable CURFX.

    (See team # 38, # 39, # 40 - # 4F for

    understanding of the above.)


    SD Cur_FX

    SC # 2E

    WC

# 30 Load Module

    Module loading into memory.


    SC # 30

    WC

   [GD Module_Handle]-module number

   (Command bit = 0, Data bit = 0)

    SC # D1 (Open Stream-open stream)

    WC


    SD \

    WD \

    ... Bytes module

    SD /

    WD /


    SC # D2 (Close Stream-close stream)

    WC


    Example:

             LD HL, Mod_adress

             LD DE ,0-Mod_length

             LD C, GSCOM


             LD A, # 30

             CALL SENDCOM

             LD A, # D1

             CALL SENDCOM


             LD A, (HL)

     LOOP: IN B, (C)

             JP P, READY

             IN B, (C)

             JP M, LOOP

     READY: OUT (GSDAT), A

             INC HL

             LD A, (HL)

             INC E

             JP NZ, LOOP

             INC D

             JP NZ, LOOP

     WAIT: IN B, (C); wait prinatiya

             JP M, WAIT; last byte

             LD A, # D2

             CALL SENDCOM

             IN A, (GSDAT); Module Number

             OUT (GSDAT), A

             LD A, # 31


    SENDCOM: OUT (GSCOM), A

    WAITCOM: IN A, (GSCOM)

             RRCA

             JR C, WAITCOM

             RET

# 31 Play module

    Playback module.


    SD Module_Handle - module number

    SC # 31

    WC

# 32 Stop module

    Stop playback module.


    SC # 32

    WC

# 33 Continue module

    Continue playing the module after

    stop.


    SC # 33

    WC

# 38 Load FX

    Download sample effect in memory.

    Loads unsigned samples

    (PC type)


    SC # 38

    WC

   [GD FX_Handle]-number sample

   (Command bit = 0, Data bit = 0)

    SC # D1 (Open Stream-open stream)

    WC


    SD \

    WD \

    ... Bytes sample

    SD /

    WD /


    SC # D2 (Close Stream-close stream)

    WC


  When loading each sample, in memory of GS
created for this sample the title,
which describes the various options
sample. After downloading these parameters are set to certain 
values, as then:



  Note = 1960, Volume = # 40, FineTune = 0, SeekFirst = # 0F, 
SeekLast = # 0F, Priority = # 80, No Loop and the internal 
variable is set to CurFX FX_Handle. 


  Then the teams # 40, # 41, # 42, # 45, # 46
and # 47 may be, these default values ​​to change on their own. 
This is required because the team # 39 to initiate playback of 
the sample using the parameters from the header of the sample. 


  In its natural form samples are usually
poorly packaged compressors, but the compressibility is usually 
possible to pick up, if we translate sample in the Delta-form, 
ie, storing absolute values ​​sample, and the relative offset 
from the previous byte. Around here and so can be translated 
sample in Delta-form:



            LD HL, Start_of_sample

            LD DE ,0-Length_of_sample

            LD C, # 2000


      LOOP: LD A, (HL)

            SUB C

            LD C, (HL)

            LD (HL), A

            INC E

            JP NZ, LOOP

            INC D

            JP NZ, LOOP


    And here's how you upload a sample:


             LD IX, Parameters
             LD HL, Sample_adress

             LD DE ,0-Sample_length

             LD C, GSCOM


             LD A, # 38

             CALL SENDCOM

             LD A, # D1

             CALL SENDCOM


             LD A, (HL)

     LOOP: IN B, (C)

             JP P, READY

             IN B, (C)

             JP M, LOOP

     READY: OUT (GSDAT), A

             INC HL

             ADD A, (HL)

             INC E

             JP NZ, LOOP

             INC D

             JP NZ, LOOP

     WAIT: IN B, (C); wait prinatiya

             JP M, WAIT; last byte

             LD A, # D2

             CALL SENDCOM


      ; Now overrides

      ; Sample by default your

      ; Values


             LD A, (IX + # 00)

             OUT (GSDAT), A; Nota

             LD A, # 40

             CALL SENDCOM

             LD A, (IX + # 01)

             OUT (GSDAT), A; Volume

             LD A, # 41


    SENDCOM: OUT (GSCOM), A

    WAITCOM: IN A, (GSCOM)

             RRCA

             JR C, WAITCOM

             RET

# 39 Play FX

    Playing effect.


    SD FX_Handle - number of samples

    SC # 39

    WC


  In performing this command
the following: see the channels listed in
SeekFirst parameters of our sample, and if
though, would be one of them is free, and it played a sample, 
otherwise look the channels listed in SeekLast and if One of 
them is free, and it is played sample, if not free, then looked 
through all the channels listed SeekLast, from They choose the 
channel with the lowest priority and is compared to the 
priority of our sample (ie the sample that we

want to lose), if this sample will be a higher priority than 
the sample already playing in the channel, then playing in the 
channel sample will be stopped, and our sample will be

run in this channel instead of the old sample. Here are a 
priority scheme here ... 


  When the sample is run in a channel, it
note, volume, etc parameters recorded in the data channel from 
the header sample.



  In general, something to play with the sample
required parameters, you can set
these parameters after loading the sample and safely use the 
command # 39. If the parameters have changed, it is possible to 
do as follows: Team # 2E do

current required sample, the teams # 4x change its parameters, 
and then run it with # 39. 


  An alternative method of triggering samples
provide the team # 80 .. # 9F, the performance of these teams 
you directly in the instruction code indicates in which channel 
you want to run the sample, and besides, you can also point to 
a note and / or volume you want to run the sample. 

# 3A Stop FX in channels

    Stop playing effects

    preset channels, which are specified

    in the mask channel (Channel Mask).

    In her unit in the n-dimensional bit

    indicates that the effect of n-dimensional

    channel you want to stop


    SD Channel_Mask

    SC # 3A

    WC


  Described above is ideal
the work of this team, but unfortunately not
so simple in this world, and this team
act wrong, namely: a unit in the bit
7 stops to sample the zero channel, and
etc. In future versions this will be fixed, but for now I 
recommend stopping in general, all samples mask # FF. 

# 3E Load FX (Extended version)

    Download sample effect in memory.

    Allows you to load samples with a sign.

    (Amiga type)


    SD # 01 (Signed sample)

    SC # 3E

    WC

   [GD FX_Handle]-number sample

   (Command bit = 0, Data bit = 0)

    SC # D1 (Open Stream-open stream)

    WC


    SD \

    WD \

    ... Bytes sample

    SD /

    WD /


    SC # D2 (Close Stream-close stream)

    WC

# 40 Set FX Sample Playing Note

    Installation notes default

    current effect.


    SD Note [0 .. 95]

    SC # 40

    WC

Note =
 0 C-0
 1 C # 0
12 C-1
24 C-2
36 C-3 (C-1 in the Amiga)
48 C-4 (C-2 in the Amiga)
60 C-5 (C-3 in the Amiga)
72 C-6
84 C-7


  In this version of the Sound Generators Wave 2,
3 may play an octave 3, 4 and 5, so the valid values ​​Note
is the range of 36 to 71.

# 41 Set FX Sample Volume

    Setting the default volume for

    current effect.


    SD FX_Volume [# 00 .. # 40]

    SC # 41

    WC

# 45 Set FX Sample Priority

    Set a priority for

    current effect.

    (See the command # 39)


    SD FX_Priority [# 01 .. # fe]

    SC # 45

    WC

# 46 Set FX Sample Seek First parameter

    Setting Seek First to

    current effect.

    (See the command # 39)


    SD FX_SeekFirst

    SC # 46

    WC

# 47 Set FX Sample Seek Last parameter

    Setting Seek Last for

    current effect.

    (See the command # 39)


    SD FX_SeekLast

    SC # 47

    WC

# 60 Get Song Position

    Getting the value of the variable

    Song_Position in the current module.


    SC # 60

    WC

    GD Song_Position [# 00 .. # FF]


  Can be interpreted as the number of
lost pattern module. After starting
module takes the value 0 and incremented after playing a 
regular pattern. This variable can be used for synchronizing 
processes in Spectrum with the playback module. You can, for 
example, at the beginning of procedures for handling interrupts 
to SC # 60, then perform procedures of the various operations

screen skrullinga lines, etc. (Ie
that was sufficient to execute the command delay), and then 
read port 179 (GD Song_Position), and compare it with the 
required, and in case of a tie, go to the next part of demos, 
that is, 


  if (Song_Position == My_Position) then goto Next_Part_Of_Demo

# 61 Get Pattern Position

    Getting the value of the variable

    Pattern_Position in the current module.


    SC # 61

    WC

    GD Pattern_Position [# 00 .. # 3F]


  Get the value of the bias in the pattern
(No ROW), use - similar to
previous command, but you want to see that this value varies 
quite quickly, and therefore


 if (Pattern_Position> = My_Position) then goto 
Next_Part_Of_Demo 

# 62 Get Mixed Position

    Get the value Pattern_Position,

    slightly mixed with Song_Position.


    SC # 62

    WC

    GD Mixed_Position



    Mixed_Position: (in bits)


    7-Song_Position.1

    6-Song_Position.0

    5-Pattern_Position.5

    4-Pattern_Position.4

    3-Pattern_Position.3

    2-Pattern_Position.2

    1-Pattern_Position.1

    0-Pattern_Position.0


  Ie if you get Mixed_Position and be done with it AND # 3F, 
then we obtain the spitting image Pattern_Position, and if 
after receiving its a bit RLCA, RLCA, AND # 02 - it

will be lower two bits Song_Position. See
Note to teams # 60 and # 61.

# 63 Get Channel Notes

    Get the notes of all the channels of the module.


    SC # 63

    WC

    GD Note_of_channel_0

    WN

    GD Note_of_channel_1

    WN

    GD Note_of_channel_2

    WN

    GD Note_of_channel_3


  If in any channel value of the notes
changed from the last command executed
# 63, then bit 7 is obtained zanacheniya


            Note_of_channel_N

will be zero, if the value is the same
thing as it was before, then this bit will be in the unit. 
Younger seven bits and is proper note from 0 to 95, if the 
value is 127, it means that no samples in the channel does not 
play. This command is mainly intended to build on its basis the 
various analyzers. 

# 64 Get Channel Volumes

    Get the volume of all channels

    module.


    SC # 64

    WC

    GD Volume_of_channel_0

    WN

    GD Volume_of_channel_1

    WN

    GD Volume_of_channel_2

    WN

    GD Volume_of_channel_3


    See the description of the command # 63

# 80 Direct Play FX Sample (# 80 .. # 83)

    Playing the sample in a given channel
    le.


    SD Sample_Number

    SC # 80 .. # 83 (Junior bits determine

                 directly Room

                 channel, which requires

                 is to play a sample)

    WC

# 88 Direct Play FX Sample (# 88 .. # 8B)

    Playing the sample in a given channel
    le with a given note.


    SD Sample_Number

    SC # 88 .. # 8B (lower bits define

                 directly Room

                 channel, which requires

                 is to play a sample)

    WC

    SD Note [0 .. 95]

    WD

# 90 Direct Play FX Sample (# 90 .. # 93)

    Playing the sample in a given channel
    le with a given volume.


    SD Sample_Number

    SC # 90 .. # 93 (Junior bits determine

                 directly Room

                 channel, which requires

                 is to play a sample)

    WC

    SD Volume [# 00 .. # 40]

    WD

# 98 Direct Play FX Sample (# 98 .. # 9B)

    Playing the sample in a given channel
    le with a given note and volume.


    SD Sample_Number

    SC # 88 .. # 8B (lower bits define

                 directly Room

                 channel, which requires

                 is to play a sample)

    WC

    SD Note [0 .. 95]

    WD

    SD Volume [# 00 .. # 40]

    WD

        __________________________







Other articles:

General Sound - The process of adaptation of branded toys under General Sound - first results (Xecutor, Target Renegade). Programming Guide, a brief description, specifications, system commands.

Bugs - STS 5.1 new glitches.

Iron - Description of the XTR-modem.

Lit.stranichka - From "the vast universe."

News - XTR-modem new development of X-Trade.

Exchange of experience - IBM-PC Keyboard on the ZX Spectrum ...

From the Editor - In the spring came to Peter.

Advertising - Advertisements and announcements ...


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

Similar articles:
CODING - Lessons from the encoder: Generilka balls.
Entry - Guide to the shell of the magazine.
Advertising - Ads are published free of charge (at least until slyuchae).
Warez - Gaming and system innovations: Imperia 2000, the 8 th Division, The Last Courier, Burial GFX Editor, Perspective Comander.
Iron - Programming Guide itself cool sound card - DMA USC.

В этот день...   21 November