Nicron #28
03 апреля 1997

Programming - a simple player tunes with the indicator signal.

<b>Programming</b> - a simple player tunes with the indicator signal.
(C) WLODEK BLACK


      PRIME PLAYER

      MELODIES WITH INDICATOR

        Signal

Programmable sound generator AY-3-8910 (hereafter AY) contains
set of internal registers, whose function I will not
describe here, as on this in instructions to the computer. Any 
player melodies created by the music editors Sound Tracker, Pro 
Tracker, ASC Sound Master etc., refers to each AY 1 / 50 
seconds (interrupt) (This does not apply to "digital" music 
Digital Studio, etc.; there is an entirely different 
principle), setting up a certain way , after which he worked 
until the next re-programming itself, generating an audible 
alert. Programming AY, in particular, sets the signal level in 
each of the channels A, B and C. Registers AY, designed to 
record all kinds of control settings are also available for 
reading. Through this program the user can "see" the current 
sound volume by simply querying registers the volume. It really 
is the easiest way to get information about the level of the 
signal, besides it is not tied to any particular type of music 
player. 

   For the signal correspond to the registers 8.9 and 10 (# A) 
-, respectively, for channels A, B and C. Strictly speaking, 
they are not alone determine the level of sound - can, for 
example, generally prohibit the operation of any channel. 
However, in actual melodies usually involve all three channels. 
Loudness is determined by bits 0,1,2 and 3 registers the 
volume. Bit 4 specifies the modulation of sound management, but 
its value can be ignored. Used in the "demo" level indicators 
are purely artistic sense, and neglect of some parameters AY 
perfectly acceptable - as they say, "only would jump. :-)


   To learn the value of any register AY, we must first
Record number register port 65533 (# FFFD), and then read
from the same port.

   Following is the text-display program with a simple call to 
the player tunes created in the ASC Sound Master. Address 
49,152 expected to compile. 

; Simple player ASM tunes.
START CALL INIT1
; PLLOOP EI
    HALT
PLAY0 CALL 49166, play tunes interrupt
    XOR A; 0 - Channel A
    CALL PLAY
    LD A, 1, 1 - B channel
    CALL PLAY
    LD A, 2, 2 - Channel C
    CALL PLAY
    XOR A
    IN A, (# FE); it's just a poll keypad
    CPL
    AND # 1F
    JR Z, PLLOOP
    CALL 49169; mute AY
    EI
    RET
; PLAY LD E, A; here begins the actual indicator.
    ADD A, 8, 8 to add the channel number for
              register number
    LD BC, 65533
    OUT (C), A; write the register number
    IN A, (C); read register
    AND 15; mask the extra bits
    LD HL, OLDS; check the previous value
    LD D, 0
    ADD HL, DE
    CP (HL)
    JR NC, PLAY1
    LD A, (HL)
    DEC A; gradual decrease in the indicator readings
            with a sharp decrease of the sound level
PLAY1 LD (HL), A
    LD B, A
    INC B

    LD IX, VBASE; procedure for drawing "columns"
L1 LD L, (IX +0)
    INC IX
    LD H, (IX +0)
    INC IX
    ADD HL, DE
    LD (HL), # 7E
    DJNZ L1
L2 LD L, (IX +0)
    INC IX
    LD H, (IX +0)
    INC IX
    LD A, L
    OR H
    RET Z
    ADD HL, DE
    LD (HL), 0
    JR L2
; INIT1 CALL 49163; initialization Player
    LD A, 2
    CALL # 1601
    XOR A
    LD (23659), A
    LD DE, AMPTXT
    LD BC, AMPTXE-AMPTXT
    CALL # 203C; print on screen the field under the "columns"
    LD A, 2
    LD (23659), A
    RET
; VBASE
    DEFW 22496,21984,21472,20960; address memory
    DEFW 22464,21952,21440,20928
    DEFW 22432,21920,21408,20896
    DEFW 22400,21888,21376,20864
    DEFW 0,0
; AMPTXT DEFB 22,20,0,16,4,17,0,32,32,32; "text" field
    DEFB 13,32,32,32; "columns."
    DEFB 13,32,32,32
    DEFB 13,32,32,32
    DEFB 22,0,0
AMPTXE
; OLDS DEFB 0,0,0; variables - previous value of the thunder of 
bone in the channels. ; END


... Of course, this is a matter of taste, but personally I do 
not like, when sharp decrease of the signal level drops sharply 
as the indicator. To increase, as they say, "time reversal" 
indicator, I decided to memorize the previous value of the 
level. If at the next poll registers the volume is found that 
the level was lower by more than one, then the indicator 
"retrace" only unit. Thus, the full time reversal of the 
maximum level of 15 to zero will be 15/50 = 0.3 seconds, which 
is well different visual and non-irritating, like a sharp flick.

Remember how the indicators of the level of recording in the 
recorder: their hands or glowing strips react quickly to 
increase the signal level (integration time), but rolled back 
back much slower (time reversal).


   My indicator you can see in some unpretentious greeting 
demos - at the bottom left jump three columns of green color.


   See how this program is queried AY. And the artistic part of 
the indicator you are able to do as you wish! 







Other articles:

Entry - the contents of rooms.

BBS - list of stations BBS ZXNet.

Programming - a simple player tunes with the indicator signal.

Soft - utility for converting graphic images.

Poems - from the personal library of USC.

Search - search for game programs.

Humor - Dembelskaya rocket ordinary Kochkurkina.

Humor - anecdotes.

Information - an explanation of the status MAGIC SOFT.

Advertising - advertising and announcements.

Feedback - contact the publisher.


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

Similar articles:
lyrics - The article is dedicated to those who know what love is.
From the authors - Presentation of the new modem infotainment newspaper. About NEWSPAPER.

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