Inferno #08
30 ноября 2005

For Coderz - Programming device sound generation Turbo Sound.

<b>For Coderz</b> - Programming device sound generation Turbo Sound.
 Programming Turbo Sound

   This article was published Shiru Otaku
on paper in the journal NedoPC # 3. Here
published at the request of the author and with the consent of 
the Editor NedoPC.



                Chip select


   Both chips are controlled by the same
standard ports (# FFFD - choice Regis
spectrum AY, # BFFD - output value in the register
AY). At one point in time to these ports
connects one of the chips, and all conclusions
AY registers are sent to nego.Pri reset
selected chip number 0. Switching between
chips produced by selecting the Register
AY with the number of which are outside the range of su
isting registers. The choice of register # FF
connects the zero-chip, # FE - first.

   Conditional selection procedure the 0-th chip:

 selChip0:

         LD BC, # FFFD

         LD A, # FF

         OUT (C), A

        RET


   Similarly, the choice is 1 chip:

 selChip1:

         LD BC, # FFFD

         LD A, # FE

         OUT (C), A

        RET


   You can do a simple procedure that is chosen
yuschuyu desired chip on its number of accumulators
Torus (0 ... 1):

 selChip:

         LD BC, # FFFD

        AND 1, to avoid errors

               , With the number in the accumulator,

                ; Not equal to 0 or 1

         XOR B

         OUT (C), A

        RET


   Full compatibility with all previous TS
written on the subject is provided,
that it is not trying to make a choice
non-existent registers AY (for the current
time programs that do not meet this condition
condition, not seen).


             Using TS


   Since the second chip has its own
control ports, provided opportunities
sequence to use any previously written
procedures for sound output without dorabo
current. For example, there are two procedures: the player in
equation describing the music and play audio
effects. On one chip to play
sound effects along with music
have to temporarily disable one or not
how many channels of music, to give the opportunity
sequence play a sound effect. When
the presence of Turbo Sound, you can run music
on a single chip, and the effects on the second, using
Using the same procedure. Need only insert
switching chips between them.

   For example, it was:



         CALL musicPlay

        CALL soundPlay


   Become:



         CALL selChip1

         CALL musicPlay

         CALL selChip0

        CALL soundPlay


   In the absence of a new variant of TS will be
work the same way as the old one.

   At the moment there is no specialist
lysed music players under the TS. But in
test for possible effect such
play, creating two conventional trehkana
lnyh module (each of them shall soda
neigh on three channels of six-channel complex
position) and compile them into different ad
rez. To play it will be enough
do the following:



         CALL selChip1

         CALL player1

         CALL selChip0

        CALL player0


   In this case, each of the players do not need
to know what chip it displays data.

   An important point: after the completion of
with TS need to choose a zero chip. It is also
needs to be done before performing the software
On sbrosa.V otherwise Possible
lems with the operation of the devices connected to
I / O ports AY, as the connector
TS plants only through ports of entry, you
water is zero chip. Sample code is shown
presented above, take into account this requirement.


      Other implementations Turbo Sound


   All the above applies to working with
TS version NedoPC. But there are also two
older version of the scheme Turbo Sound: QUADRA
on Amazing Soft Making and the option of TS
Power of Sound.

   Option QUADRA completely incompatible with
NedoPC TS - it assumes a
own control ports for the second
chip (# EEFD - choice Registry AY, # AFFD -
output value). Support for this option
scheme does not make sense because of its unpopular
STI and the complete absence of the program ensures
baking.

   TS version of the Power of Sound Supported
in a single at the moment Editor
six-channel music, Turbo Sound Editor.
From a programming standpoint, he differs
is just a way of switching chips,
that makes it easy to add support
in written for NedoPC TS software
obespechenii.Dlya is enough Precautions
vit user to select the type of
TS and appropriately modify
procedures to select the chip.

   Switching chips in PoS TS is
through output values ​​0 .. 1 to port
# 1F (selectable number of chip corresponds
The view shown).

   The following is a variant of the universal
procedures for selecting a chip on its number in the active
kumulyatore. It is assumed that the type of TS Cox
wounded at chipType +1, zero value
corresponds to the embodiment of TS from NedoPC,
nonzero - variant of the PoS.

 selChip:

        AND 1
 chipType:

        LD B, 0, instead of zero is present

              , The number corresponding to the type
 TS

         DEC B

         JR NC, chipPoS

         LD C, # FD

         XOR B

         OUT (C), A

        RET
 chipPoS:

         OUT (# 1F), A

        RET


    Auto detect the presence and type of TS


   Below is the text of the procedure automatically
kinetic determine the presence and type of TS
(Options NedoPC and PoS), used in
Turbo Sound Editor. It should be noted that in
If you can not read the values ​​of regi
displaying the AY (found in rare cases)
automatic detection will not work
det.Poetomu desirable to include in the
zmozhnost specify the type of TS 'manually'.

; Turbo-Sound checker by Himik's ZxZ / PoS-WT
; 24.05.05 at work;)
 ; Found:

   ; No AY / YM chip on board

   ; Single AY / YM chip on board

   ; Turbo-Sound port by PoS 'Bitwalker

                      ; (Port # 1F for swith)

   ; Turbo-Sound port by NedoPC

             ; (Registers # FE-# FF selection)



        ORG # 61A8
 C_1

         DI

         XOR A

         LD HL, # FE00

         LD DE, # FFBF

         LD BC, # FFFD

         OUT (C), B; SELECT TS AY0 CHRV

         OUT (C), A; SELECT REG 0

         LD B, E

         OUT (C), B; # BF-> REG 0 AY0 CHRV

         INC A

         OUT (# 1F), A; SELECT TS AY1 POS

         OUT (C), C; # FD-> REG 0 AY1 POS

         LD B, D

         OUT (C), H; SELECT TS AY1 CHRV

         OUT (C), L; SELECT REG 0

         LD B, E

         OUT (C), H; # FE-> REG 0 AY1 CHRV

         LD A, L

         OUT (# 1F), A; SELECT TS AY0 POS

         OUT (C), L; # 00 -> REG 0 AY0 POS

         INC A

         OUT (# 1F), A; SELECT TS AY1 POS

         LD B, D

         OUT (C), D; SELECT TS AY0 CHRV

         OUT (C), L; SELECT REG 0

         IN A, (C); READ BYTE FROM REG 0

        CP C
 ; Pass, if found TS by NedoPC

        JR Z, TS_ENABLE_CHRV
 ; Pass, if found TS by PoS

         CP # FE

        JR Z, TS_ENABLE_POS
 ; Proceed if no chip is found

         CP # FF

        JR Z, NO_AY
C_2
; Found in only one chip
 TE_DISABLE

         LD A, 1

         OUT (# FE), A

        RET
 NO_AY

         LD A, 2

         OUT (# FE), A

        RET
 TS_ENABLE_CHRV

         LD A, 4

         OUT (# FE), A

        RET
 TS_ENABLE_POS

         LD A, 6

         OUT (# FE), A

        RET
DISPLAY / A, "Length:", C_2-C_1

Shiru (NedoPC team)



   Ed.: I think at the moment
support option PoS has no
sense - adaptation TS by PoS under standard
NedoPC costs nothing, and even easier
scheme (disappear D3 and D4.1, on 1/D4 feeds
Xia 10/D1, and served on 2/D4 inverted
 Noe this D7).

   In the annex are looking for 6-channel module
X-agon'a, compiled NedoPC TS.
In addition, the archive should be based on 4 tracks
Shiru Otaku (each consisting of two pt3moduley) - This is the 
remix of famous melodies from consoles.





Other articles:

Inferno - The authors of the magazine.

Inferno - Entered from the editor.

Inferno - Errors in the previous numbers.

Inferno - On the shell.

Iron - CD-ROM - a device and Tricks connection.

For Coderz - CD video on the ZX. How to write a video player with CD-ROM.

Softinka - Technical Reference disk system DISCiPLE / + D.

For Coderz - Small programmers' tricks.

Mathematics - The history of the solution of Fermat's theorem.

Gameland - Game Shestnashki.

Softinka - a description and history of the program to work with hard disk HDDoctor v0.9.

Secrets - The X button in different applications: Wolfenstein'2004, IG # 5, ACEdit, DNA OS, Wild Disk Copier.

Softinka - Improved graphics converter Gigascreen.

Sound - tube amplifier. Stereo lampochnik 2x5 Tues of old TVs.

Iron - Overview of cassette players.

Inferno - Letters to the Editor.

Gamedev - The history of the game Pang.

Gamedev - Tips for writing an arcade game.

Advertising - Ads by Roman Chuunin.

Advertising - Ads by Alexei Zhabina.

Advertising - Ads by V. Bogdanovich.

Interview - Interview with Nikolay Rodionov, author of popular books for the ZX Spectrum

For Coderz - The calculation of trigonometric and algebraic functions in a high-level languages.

DIY - scheme of 16-color video mode v1.1 for the Pentagon.

Iron - Description of Products K555TL2.

For Coderz - Programming device sound generation Turbo Sound.

Softinka - 384x304 viewer. program allows you to view color pictures, is larger than the screen.

Softinka - ZX Spectrum emulator for ZX Spectrum.


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

Similar articles:
Attention! - call for help to everyone who reads this.
page Lamer - An explanation of Velesoft'om.
Birthday - congratulations spektrumistov with the birthdays.
Baubles - kids say.
BBS - list of stations BBS ZXNet.

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