ZX Forum #04
19 ноября 1997

world of sound Spectrum - Annex 1, 2: Listings sound effects SUPER SOUND'a, tips assembler.

<b>world of sound Spectrum</b> - Annex 1, 2: Listings sound effects SUPER SOUND'a, tips assembler.
              Appendix 1

  Listings sound effects SUPER SOUNDa


   All the effects are exactly the same form as in SUPER SOUND 
v2.2 and provided comments. Tags starting with "+","*",":" 
characters and "?" are special and celebrate the values ​​of 
variable: 

 + - One-byte change the value
 * - Two-byte variable values
 : - Change the value of the two-byte
 ? - Variable command


   The word following the special character repeats the name of 
the item in the program, is responsible for this setting 
(perhaps in abbreviated form). In the case of variable commands 
in the comments (in brackets) of all possible options. For a 
normal compile special tags must be removed or renamed. 1415.


                      Input Sound

 10 DI; ban interrupt
 20 LD HL, 37000; HL = address of save sound
 30: LENGTH LD DE, 27000; DE = duration of sound
 40 LOOP1 LD B, 8; B = bit counter
 50 LOOP2 SLA (HL); scrolling the values ​​in the

                                      Memory
 60 IN A, (254), enter the value from the port

                                      254
 70 BIT 6, A; check bit recorder
 80 JR Z, + INPUT_SPD; if 0, then go to

                                      NOSIGN
 90 SET 0, (HL); set bit D0 in the memory
100 + INPUT_SPD LD C, 3; C = delay
110 PAUSE DEC C; C = C-1
120 JR NZ, PAUSE; if C <> 0 then loop
130 DJNZ LOOP2; continue the loop

                                      Byte
140 INC HL; HL = HL +1
150 DEC DE; DE = DE-1
160 LD A, D; DE =
170 OR E; 0?
180 JR NZ, LOOP1; if not, then the cycle
190 EI; permission to interrupt
200 RET; Returns


                       Play Sound

 10 CALL 124, located at 124 RET
 20 DEC SP; pick stack pointer
 30 DEC SP; two bytes
 1940 POP HL; removed from the stack address of a string

                                    20
 50 LD DE, 47; DE = number of bytes from the line 20

                                    to buffer
 60 ADD HL, DE; HL = address of buffer
 70: LENGTH LD DE, 27000; DE = duration of sound
 80? REVERSE NOP; reserve REVERSE (ADD HL,

                                    DE)
 90 DI; ban interrupt
100 LD A, (23624); A =
110 RRA; color
120 RRA; bor130 RRA; Duras
140 LOOP3 LD B, 8; B = bit counter
150 LOOP4 AND 239; reset bits D4 register A
160 RLC (HL); scrolling through the data flag

                                    CY
170 JR NC, NOSGN; flag if CY = 0, then go to

                                    NOSGN
180 OR 16; setting bit D4 register A
190 NOSGN OUT (254), A; output to port A 254
200 + PLAY_SPD LD C, 3; C = delay
210 PAUS2 DEC C; C = C-1
220 JR NZ, PAUS2; if C <> 0 then loop
230 DJNZ LOOP4; continue the loop

                                    Byte
240? REVERSE INC HL; HL = HL +1 (DEC HL)
250 LD C, A; preservation A
260 DEC DE; DE = DE-1
270 LD A, D; DE =
280 OR E; 0?
290 LD A, C; A recovery
300 JR NZ, LOOP3; if DE <> 0 then loop
310 EI; permission to interrupt
320 RET; Returns


                       Double Beep

 10 DI; ban interrupt
 20 * FRQ1, FRQ2 LD DE, 13000; E = Frequency 1, D = Frequency 2
 30 + DURATION LD H, 100; H = duration
 40 LD A, (23624); A =
 1950 RRA; color
 1960 RRA; Bor 1970 RRA; Duras
 80 LD C, A; preservation A
 90 EX AF, AF '; shift registers A and F on

                                    Alternative
100 LD A, C; A recovery
110 LD C, E; C = Counter 1
120 LD B, D; B = Counter 2
130 BEEP EX AF, AF '; shift registers A and F (change

                                    votes)
140 DEC C; C = C-1
150 JR NZ, CONT; if C <> 0, topereyti to CONT
160 LD C, E; restore counter 1
170 XOR 16; invert the bits D4 to vote

                                    1
180 CONT OUT (254), A; bring A to port 254
190 EX AF, AF '; shift registers A and F (change

                                    votes)
200 DEC B; B = B-1
210 JR NZ, CONT2; if B <> 0 then go to

                                    CONT2
220 LD B, D; restore Counter 2
230 XOR 16; invert the bits D4 to vote

                                    2
240 CONT2 OUT (254), A; bring A to port 254
250 INC L; L = L +1
260 JR NZ, BEEP; if L <> 0 then go to

                                    BEEP
270 DEC H; H = H-1
280 JR NZ, BEEP; if H <> 0 then go to

                                    BEEP
290 EI; permission to interrupt
300 RET; Returns


                       Exploding a

 10: GROUP LD HL, 0; HL = address of ROM
 20 LD A, (23624); A =
 1930 RRA; color
 1940 RRA; Bor 1950 RRA; Duras
 60 LD D, A; D = A
 70 * FRQ, LEN LD BC, 38401; C = frequency, B = length
 80 LOOP1 PUSH BC; preservation BC
 90 + DURATION LD B, 20; B = length
100 LOOP2 LD A, (HL); A = cell contents ROM
110 AND 248; reset bits curb
120 OR D; installing curb bits
130 OUT (254), A; output to port A 254
140 PUSH BC; preservation of BC
150 LD B, C; B = frequency
160 LOOP3 DJNZ LOOP3; delay
170 INC HL; HL = HL +1
180 POP BC; restore BC
190 DJNZ LOOP2; cycle
200 POP BC; restore BC
210? INCREASE INC C; increase in delay (DEC C)
220 DJNZ LOOP1; cycle
230 RET; Returns


                       Exploding 2

 10 LD A, (23624); A =
 1920 RRA; color
 1930 RRA; Bor 1940 RRA; Duras
 50 LD L, A; L = A
 60 * FRQ, LEN LD DE, 12801; E = frequency, D = length
 70 LOOP1 PUSH DE; keep DE
 80 LOOP2 LD B, E; B = E
 90 PAUSE DJNZ PAUSE; delay
100 LD A, (BC); A = cell contents ROM
110 AND 248; reset bits curb
120 OR L; set the color of the curb
130 OUT (254), A; output to port A 254
140 INC C; increase ROM address
150 INC D; D = D +1
160 JR NZ, LOOP2; if D <> 0 then loop
170 POP DE; restore DE
180? INCREASE INC E; increase in delay (DEC E)
190 DEC D; D = D-1
200 JR NZ, LOOP1; if D <> 0 then loop
210 RET; Returns


                       Volume FX

 10 DI; ban interrupt
 20 * FRQ, VOL LD BC, 12900; C = frequency, B = volume
 30 * LEN, DUR LD DE, 25650; E = length, D = duration
 40 LD A, (23624); A =
 1950 RRA; color
 1960 RRA; Bor 1970 RRA; Duras
 80 LOOP1 PUSH DE; conservation DE
 90 LOOP2 PUSH BC; preservation BC
100 XOR 16; inverting bits D4
110 OUT (254), A; output to port A 254
120 LOOP3 DJNZ LOOP3; delay (volume)
130 XOR 16; inverting bits D4
140 OUT (254), A; output to port A 254
150 LD B, C; B = C
160 LOOP4 DJNZ LOOP4; delay (frequency)
170 POP BC; restore BC
180 DEC D; D = D-1
190 JR NZ, LOOP2; if D <> 0 then loop
200 POP DE; restoration DE
210? DR: INC INC D; increase in the duration

                                    (DEC D, NOP)
220? VL: DEC DEC B; decrease volume

                                    (INC B, NOP)
230? FQ: INC INC C; increase in the frequency

                                    (DEC C, NOP)
240 DEC E; E = E-1
250 JR NZ, LOOP1; if E <> 0 then loop
260 EI; permission to interrupt
270 RET; Returns


                       Flowing 1

 10 DI; ban interrupt
 20 LD A, (23624); A =
 1930 RRA; color
 1940 RRA; Bor 1950 RRA; Duras
 60 * FRQ, LEN LD BC, 65281; C = frequency, B = length
 70 LOOP1 PUSH BC; preservation BC
 80 + DURATION LD B, 20; B = length
 90 LOOP2 XOR 16; inverting bits D4
100 OUT (254), A; output to port A 254
110 PUSH BC; preservation of BC
120 LD B, C; B = C
130 LOOP3 DJNZ LOOP3; delay
140 POP BC; restore BC
150 DJNZ LOOP2; cycle
160 POP BC; restore BC
170? DECREASE DEC C; reduction in the incidence (INC C)
180 DJNZ LOOP1; cycle
190 EI; permission to interrupt
200 RET; Returns


                       Flowing 2

 10 DI; ban interrupt
 20 * FRQ1, FRQ2 LD DE, 2660; E = Frequency 1, D = Frequency 2
 30 + DURATION LD C, 255; C = duration
 40 LD A, (23624); A =
 1950 RRA; color
 1960 RRA; Bor 1970 RRA; Duras
 80 LOOP1 XOR 16; inverting bits D4
 90 OUT (254), A; output to port A 254
100 LD B, D; B = D
110 LOOP2 DJNZ LOOP2; delay 1
120 XOR 16; inverting bits D4
130 OUT (254), A; output to port A 254
140 LD B, E; B = E
150 LOOP3 DJNZ LOOP3; delay
160? F1: INC INC D; an increase in delay

                                    (DEC D, NOP)
170? F2: DEC DEC E; increase Delay 2

                                    (INC E, NOP)
180 DEC C; C = C-1
190 JR NZ, LOOP1; if C <> 0 then loop
200 EI; permission to interrupt
210 RET; Returns


                       Cycle 1

 10 + QUANTITY LD B, 24; B = number of notes
 20: FREQUENCY LD HL, 200; HL = start frequency
 30: DURATION LD DE, 1; DE = duration
 1940 PUSH HL; conservation HL
 1950 PUSH BC; preservation BC
 60 CALL 949, call ROM routines
 1970 POP BC; restore BC
 1980 POP HL; recovery HL
 90: STEP LD DE, 30; DE = step frequency changes
100? INCREASE ADC HL, DE; increase in HL (SBC HL, DE)
110 DJNZ: DURATION; cycle
120 RET; Returns


                       Cycle 2

 10 * STP, QUANT LD BC, 12870; C = step, B = number of notes
 20: FREQUENCY LD HL, 512; HL = start frequency
 30: DURATION LD DE, 20; DE = duration
 1940 PUSH HL; conservation HL
 1950 PUSH BC; preservation BC
 60 CALL 949, call ROM routines
 1970 POP BC; restore BC
 1980 POP HL; recovery HL
 90 LD A, L; umen100? DECREASE SUB C; ratio (ADD A, C)
110 LD L, A; L
120 DJNZ: DURATION; cycle
130 RET; Returns


                       Noise 1

 10: GROUP LD HL, 0; HL = address of ROM
 20 LD A, (23624); A =
 1930 RRA; color
 1940 RRA; Bor 1950 RRA; Duras
 60 LD D, A; D = A
 70: LENGTH LD BC, 2560; BC = length
 80 BEGIN PUSH BC; preservation BC
 90 LD A, (HL); A = cell contents ROM
100 AND 248; reset bits curb
110 OR D; color setting curb
120 OUT (254), A; output to port A 254
130 + FREQUENCY LD B, 40; B = frequency
140 LOOP DJNZ LOOP; delay
150? BOUNDS INC HL; HL = HL +1 (INC L)
160 POP BC; restore BC
170 DEC BC; BC = BC-1
180 LD A, B; BC =
190 OR C; 0?
200 JR NZ, BEGIN; if not, then the cycle
210 RET; Returns


                       Noise 2

 10: GROUP LD HL, 0; HL = address of ROM
 20 * FRQ1, FRQ2 LD DE, 2660; E = delay 1, D = Delay 2
 30 + DURATION LD C, 255; C = duration
 40 LD A, (23624); A =
 1950 RRA; color
 1960 RRA; Bor 1970 RRA; Duras
 80 BEGIN XOR 16; inverting bits D4
 90 OUT (254), A; output to port A 254
100 LD B, (HL); B = cell contents ROM
110 LOOP1 DJNZ LOOP1; delay 1
120 LD B, D; B = D
130 LOOP2 DJNZ LOOP2; Delay 2
140 XOR 16; inverting bits D4
150 OUT (254), A; output to port A 254
160 LD B, (HL); B = cell contents ROM
170 LOOP3 DJNZ LOOP3; delay 3
180 LD B, E; B = E
190 LOOP4 DJNZ LOOP4; delay 4
200 INC HL; HL = HL +1
210? F1: INC INC D; increase in D (DEC D, NOP)
220? F2: DEC DEC E; decrease in E (INC E, NOP)
230 DEC C; C = C-1
240 JR NZ, BEGIN; if C <> 0 then loop
250 RET; Returns
2


               Appendix 2

    Tips for using assembler


   To test the effects of native, presented in this book, you 
must use a special program - assembler. Currently, there are

many different assemblers, but in Russia the most popular and 
widespread GENS4. It is an integral part of the package DEVPAC4

Company Hisoft. The second part of this package
(Monitor - debugger MONS4) we currently do not
interested.

   I will not describe in detail GENS4, it
well done in [1], but some key points I will explain.

   There are several different versions
this program (including disk), so nothing concrete advise on 
how to download can not except that for safety you can skip the 
BASIC loader, and shipped directly part of the code. For 
download it from the tape, enter the following Team:



      CLEAR 24999: LOAD "" CODE 25000

and on the disc - are:


      CLEAR 24999: RANDOMIZE USR 15619:

      REM: LOAD "GENS4D" CODE 25000

To run the downloaded thus
GENS4 type


      RANDOMIZE USR 25000.


   Almost all the effects listed in
this book, you can enter and assemble
unchanged. The exception is listings Effects SUPER SOUNDa in 
which should be replaced with special tags

more acceptable (they must start with
Latin letter, to be somewhat shorter and
does not contain spaces).

   Before any effect you want to insert assembler directives 
ORG, specifies which address to place the translated code. In 
this case, the address should not be less than 37,000. For 
example: 

 10 ORG 40000
 ... ...


   If you want to call directly from the effect created by the 
assembler, it is necessary insert the directive ENT:


 20 ENT $
 ... ...


   Now a little about the commands line editor GENS4 (a 
complete list of them you can found in [1]):


   I [N] [, M] - Automatic numbering
rows starting at row N, and increments M.
Cancel - Key Edit (CS / 1). Default
N and M equal to 10.

   L [N] [, M] - Displays listings
program with a line N to line M inclusive. By default, the 
output listing the entire program.


    DN, M - Delete rows from N to M
inclusive.

    G [,, S] - Download from the magnetic media program called 
S. 

    P [N] [, M] [, S] - Save on Magnetic
support the program with a line N by line M
inclusive, under the name S. Default
using the parameters set by the previous command G or P.

    O [,, S] - Save on magnetic media program compiled under 
the name S. 

    R - Run the compiled program. Return to GENS4 carried out by
team RET.

    B - Go to BASIC. Restart
GENS4 in our case, we can command RANDOMIZE USR 25000.

    Z - Remove the text of the program.

    H - Display the list of editor commands.

    A - assemble the program. Format
This command is quite complex. Detail he
described in [1]. Here you enough
Just enter the letter A without parameters.


           References

1. Larchenko AA, Rodionov, NJ ZX-Spec
   trum and TR-DOS users and prog
   rammistov - 3rd ed. SPb.: Peter, 1994.
2. Dialects of BASIC for the ZX-Spectrum. Under

   edited Larchenko AA, Rodionova NJ

   SPb.: Peter, 1992.
3. USSR Academy of Sciences, Institute of Informatics Problems. 
Lu    schihina IJ and others Organization of the digital


   music interface MIDI. Moscow:

   Preprint, 1988.
4. MIDI Musical Instrument Digital Inter
   face Specification 1.0 North Hollywood:

   International MIDI Association (IMA),

   1983.
5. Schulze, Hans-Jochen/Engel, Georg. Mo
   derne Musikelektronik, Praxisorientiere

   Elektroakustik und Gerate zur elektro
   nischen Klangerzeugung. Berlin: Mili
   tarverlag der DDR (VEB), 1989.


                *







Other articles:

Help - Description of the shell of an electronic book "ZX-FORUM 4.

Secrets of Successful Design - Head for the book "Design your Programs

screen effects - Running a string of R-Type.

screen effects - clearing the screen of Zynaps.

screen effects - "minimize" the screen from Comando Tracer.

screen effects - smooth "decay" of the screen Sommando Tracer.

screen effects - changed the character set for the original stylized font from the game Rockstar.

screen effects - "running out the string" out of the game Rockstar.

screen effects - "pouring" the screen of the game Rockstar.

screen effects - a complex multi-effects from the game Bubbler.

New top 40 procedures - scrolling display, a fusion of two images, inverting screen, rotate characters, replacement of attributes, fill a closed loop, the calculation of addresses in the screen, copy of the screen, etc.

Technology sprites - Part 1: Introduction.

Technology sprites - Part 2: The hunt for sprites (search and pulling).

Technology sprites - Part 3: Format of sprites.

Technology sprites - Part 4: Format of sprites with a mask.

Technology sprites - Part 5: Structure sprite blocks (both co-exist in memory sprite and mask, what data to help us quickly find the address of the sprite in memory, and much more.)

Technology sprites - Part 6: preparation of data for publication.

Technology sprites - Part 8: Printing sprites (coordinates are given in familiarity).

Technology sprites - Part 9: Printing sprites (coordinates given in pixels).

Technology sprites - Part 10: a review of programs to work with sprites and graphics.

world of sound Spectrum - Chapter 1: The Physics of Sound.

world of sound Spectrum - Chapter 2: Operator BEEP, Creating effects on BEEPe, Making Music on BEEPe.

world of sound Spectrum - Chapter 3: How is the sound device (BEEP'ra and methods of sound production).

world of sound Spectrum - Chapter 4: Programming sound in assembler.

world of sound Spectrum - Chapter 4.1: Programming sound effects - Tone, Noise, Complexes effects.

world of sound Spectrum - Chapter 4.2: Programming Sound Effects - Volume Control.

world of sound Spectrum - chapter 4.3: Sound Effects - Management timbre.

world of sound Spectrum - Chapter 4.4: Programming sound effects - music programming.

world of sound Spectrum - Chapter 4.5: Programming sound effects - Polyphonic ringtones (polyphonic).

world of sound Spectrum - chapter 4.6: Treatment of external signals - digitization.

world of sound Spectrum - Chapter 4.7: Handling of external signals - Reverberation.

world of sound Spectrum - chapter 4.8: Synthesis of speech.

world of sound Spectrum - Chapter 4.9: audio playback interrupt.

world of sound Spectrum - Chapter 5: The operator PLAY for music coprocessor AY- 3-8910 (AY-3-8912).

world of sound Spectrum - Chapter 5.1: Creating effects operator PLAY.

world of sound Spectrum - Chapter 5.2: Making Music on PLAYe.

world of sound Spectrum - Chapter 6.1: Description of the coprocessor registers of the musical AY- 3-8910 (AY-3-8912).

world of sound Spectrum - Chapter 6.2: Programming effects and music under the musical coprocessor AY- 3-8910 (AY-3-8912).

world of sound Spectrum - Chapter 7: Software Review ZX-Spectrum to create sounds and music.

world of sound Spectrum - chapter 7.1: Editor, Sound Effects SUPER SOUND.

world of sound Spectrum - Chapter 7.2: Music Editor Wham the Music Box.

world of sound Spectrum - Annex 1, 2: Listings sound effects SUPER SOUND'a, tips assembler.


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

Similar articles:
News - News of the software market.
News - News from the Yaroslavl spektrmistov: Marchy, Kav Software, Nicolas Viper, Dr Shura, Harkonnen, MacKeymn, DJ Reason.
UFO - UFO: Questions and Answers (Part 3).

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