Home

8` ! 80 I eNln".` e!8!A e!8!A

image

Contents

1. Envelope Envelope Coarse Tune Fine Tune Register Rit Register R12 er es es Jefes e eo 27 es Jes e es ee Te ee ees ema emaeea em emo evs ers ev Jers ers ers ees ero ers evo 16 bit Envelope Period EP to Envelope Generator ENVELOPE SHAPE CYCLE CONTROL Register R12 The Envelope Generator further counts down the envelope fre quency by 16 producing a 16 state per cycle envelope pattern as defined by its 4 bit counter output E3 E2 E1 EO The particular shape and cycle pattern of any desired envelope is accomplished by controlling the count pattern count up count down of the 4 bit counter and by defining a single cycle or repeat cycle pattern This envelope shape cycle control is contained in the lower 4 bits B3 BO of register RIZ Each of these 4 bits controls a function in the envelope generator as illustrated in the following Envelope Shape Cycle Control Register R12 ez ss es e es ee e eo 4 NOT Ls Hold USED Alternate To Envelope Attack Generator Continue Page amp AX BITS 53 82 81 BO GRAPHIC REPRESENTATION Of ENVELOPE GENERATOR OUTPUT E3 2 E Eo mcx Azoo oror See Fig 4 for detail EP IS THE ENVELOPE PERIOD DURATION OF ONE CYCLE Fig 3 ENVELOPE SHAPE CYCLE OPERATION GRAPHIC REPRESENTATION OF THE DECIMAL VALUES OF THE ENVELOPE GENERATOR OUTPUT EJ E2 ES 0 Fig 4 DETAIL OF TWO CYCLES OF Fig 3 ref waveform 1010 in F
2. following BASIC statement OUT 159 7 Once the register is prepared a value sent to port i71 will over write the current contents of the register with new data e g OUT 191 55 The whole operation may be contained in one line of BASIC e g 10 OUT 159 0 OUT 191 50 OUT 191 100 will set up register O put the value 350 in register O and then replace it with the value i100 To write a value to a different register it is necessary to send the register number to 159 again Here is an example of the programming of the sound chip REGISTER VALUE BASIC LINE REMARES Binary Dec 7 00110111 53 GUT 159 7 0UT 191 55 Sets channel A to noise 8 90019000 16 OUT 157 39 OUT 191 16 Puts channel under envelope control 12 O0100000 32 OUT 159 12 0UT 191 32 Sets envelope time period 13 o0000000 a GUT 159 13 0UT 191 0 Set envelope shape OQ and triggers the sound effect The sample cassette enclosed with the ADD ON contains 3 programs Copyright Micro Power 1993 Page A Spectrum ADD ON user manual No 1 SOUND EDIT allows changes to register values to be made easily using on screen editing Try running the program and entering the tollowing values into the registers Gun shot Register 7 7 Register 8 16 Register 12 20 Register 13 0 Every time you enter O onto register i3 you will hear a further gun shot The program is entirely in BASIC and you may find it instructive to examine the routines No 2 JSTICK DEM sample game sho
3. ADD ON into the MIC socket at the rear of the Spectrum Adjust the sound level using the volume control Any BEEPs or sound produced by the Spectrum will now be amplified N B when using in this mode ensure the tape recorder lead does not come inte contact with the ADD ON 2 To amplify the output of the sound generator plug the cord into the earphone socket on the ADD ON Adjust sound level as in 1 It is possible to take the ADD ON sound o p from the socket on board to an external amplifier and speaker this should only be attempted if you are confident of your skills and knowledge in electronics Direct connection of the ADD ON to a HiFi system is not recommended Connecting potentiometer igy sticks to the ADD ON board Provision is made for the connection of two independent joy sticks to the board If you only have one stick connect it to port 1 the right hand connector looking at the component side of the board If you accidentally connect the socket to the plug the wrong way round no damage will be caused but of course the joystick will not work see notes with the joy stick kits Connecting a switch type joystick Simply plug the lead from the joystick into the 9 way socket at the top left hand corner of the ADD ON board Copyright Micro Power 1983 Page amp Diagram showing connections te Spectrum ADD ON VOLUME EAR PHONE DVT UT NTRO SOCKET sound cue ieee Soren CE EN TEES C
4. DIM c5 5000 GUT 157 7 0U0T 191 255 OUT 159 15 0UT 191 255 LET a IN 22 5003 LET p 32 5010 FOR t 5 TO 1 STEP 1 LET c t atp 5020 IF a p THEN LET a a p 5030 LET p p 2 S040 NEXT t RETURN You may of course use line numbers and variable names to suit your own program On return from the routine the array c will contain the state of all five switches c 1 Down c 2 Up c 3 Right c 4 Left and c 5 Fire e g If c i 1 then the joystick is thrown down If c 2 1 and c 3 1 then the stick is thrown to the top left Page 16
5. e os e e 60 Function input Enable VO Port owe T e T M e T5 le Amplitude Control Registers R amp R 9 R12 The amplitudes of the signals generated by each of the three D A Converters one each for Channels A B and C is determined by the contents of the lower 5 bits B4 B0 of registers R8 R9 and R1Qas illustrated in the following Amplitude Control Register Channel R A R9 B RIP C e7 ee es e es ne e eo INA E amplitude 4 bit fixed Mode amplitude Level Envelope Generator Control Registers R14 R12 R13 To accomplish the generation of fairly complex envelope patterns two independent methods of control are provided in the PSG first it is possible to vary the frequency of the envelope using registers R1 and R1 and second the relative shape and cycle pattern of the envelope can be varied using register R1 The following paragraphs explain the details of the envelope control functions describing first the envelope period control and then the envelope shape cycle control ENVELOPE PERIOD CONTROL Registers R1t R12 The frequency of the envelope is obtained in the PSG by first counting down the input clock by 256 then by further counting down the result by the programmed 16 bit Envelope Period value This 16 bit value is obtained in the PSG by combining the contents of the Envelope Coarse and Fine Tune registers as illustrated in the following
6. the three channels A value between and 15 decimal will give volumes of between off and maximum A value of 16 or any other with bit four set to one will enable envelope control of the respective register see register 13 Register 13 4 bits used This register is used to select an envelope shape see fig 3 Appendix A If the amplitude register of a channel is set to a value of 16 then the amplitude of that channel will follow the envelope shape selected i e if register 13 contains a value of O then the sound produced will rise sharply and die away gradually The time period over which the envelope operates is controlled by the values in registers 11 amp 12 If the envelope selected is a nan repeating shape then re inputting the same value will re trigger the sound Copyright Micro Power 1983 Page 2 Spectrum ADD ON user manual Register 11 amp 12 Registers 11 12 are used together to make a single 16 bit value which the chip uses to time the envelope period A large value produces a long envelope a small vaiue produces a short envelope Register 11 may be regarded as fine tuning and register 12 as coarse Erogramming the chi The registers on the sound chip may be accessed in BASIC using IN and OUT key words Use of the sound chip from BASIC is simple Before sending a value to a particular register the number of the register must be set up by sending it ta port 159 e g to prepare register 7 for data use the
7. FROM MICRO FPOWER The Micro Power ADD ON Board gives Spectrum users the following advantages i 3 Channnel sound effects ii Amplification of both standard sound and ADD ON sound iii Allows a connection of one or two potentiometer joy sticks iv Allows connection of one switch type joystick If you are anxious to sample the facilities of the ADD ON turn to the back page Introduction to the sound generator chip The I C used on the board for sound generation is the popular AY 3 8910 chip by General Instruments This chip is capable of producing sound and or noise from 3 independent channels The user has full control of pitch amplitude and envelope shape There are also two 8 bit Input Output ports in this implementation they are used to control the joysticks Sound chip registers The sound gererator chip ematains 14 registers for the production of programmed sound There follows a brief description of the usage of the registers for more detail see Appendix A Register 7 8 bits used Register 7 controls the mixing of tone and noise on the three independent sound channels To understand how this register works it is necessary to appreciate that the registers are binary and in register 7 six of the eight bits are used to control the mixing Setting a bit to zero enables tone or noise on the appropriate channel Mixer Control L O Enable Register R7 oncion srt vore T A Fact owe TE o KARREN Setting r
8. XT os LINK SWiTCH TYPE AT UNDER JOYSTEK CoWNECTOR JACK PLUG af INPUT To AR L ec pow cie v3 FHL Om goig d Messa g Bee 4 Tunic T GL sis CMT pg VALS27 E Qe L LINK 25 wAy conn f KEY EDGE CONNECTOR Disconnect power te Spectrum before attaching Or rzmoving the ADD ON board Page ERATION Since ali functions of the PSG are controlled by the host processor via a series of register loads a detailed description of the PSG operation can besi be accomplished by relating each PSG function to the control of its corresponding register The function of creating or programming a specific sound or sound effect logically follows the control sequence listed Operation Registers Function Tone Generator Control RO R5 Program tone periods Noise Generator Control R6 Program noise period Mixer Control R7 Enable tone and or noise on selected channels Select fixed or envelope variable amplitudes Envelope Generator R1i R13 Program envelope period Control and select envelope pattern Amplitude Control R Rt Tone Generator Control Registers RO R1 R2 R3 R4 R5 The frequency of each square wave generated by the three Tone Generators one each for Channels A B and C is obtained in the PSG by first counting down the input clock by 16 then by further counting down the result by the programmed 12 bit Tone Period value Each 12 bit value is obtained in the PSG by combin
9. egister 7 as in the diagram will enable tone on channel A and noise on channel B To set that value from BASIC send a decimal value equivalent to 11101110 i e 238 to register 7 If you don t understand how these figures are arrived at then it might be a good idea if you read up on decimal to binary conversion Spectrum ADD ON user manual Registers 0 5 This group of registers are used in pairs to control the frequency of the three tone generators Register 0 amp 1 for channel A 2 amp 3 for channel B and 4 amp 5 for channel C The even number register is used for fine tuning of the frequency and the odd register for coarse tuning The sound generator chip uses each pair of registers to forma 12 bit number thus Coarse Tune Fine Tune Register Channel Register R1 A RO R3 8 R2 R5 c R4 NOT USED rev rev vo vea ver ve ves rea vea rea vev veo 12 bit Tone Period TP to Tone Generator It can be seen from the diagram that the top four bits of the odd registers are not used and so those registers will only use values between O and 15 decimal The 12 bit number is then used by the chip to divide down the master frequency and so lower numbers produce higher notes Register 6 5 bits used Register six takes a value between O and 31 decimal and is used to change the pitch of the noise generator Registers 8 9 amp 10 5 bits used These three registers are used to control the amplitude volume of
10. ig 3 VO Port Data Store Registers R14 R15 Registers R14 and R15 function as intermediate data storage regis ters between the PSG CPU data bus DAQ DA7 and the two I O ports IOA7 IOA0 and IOB7 IOBO Both ports are available in the AY 3 8910 only I O Port A is available in the AY 3 8912 Using registers R14 and R15 for the transfer of I O data has no effect at all on sound generation D A Converter Operation Since the primary use of the PSG is to produce sound for the highly imperfect amplitude detection mechanism of the human ear the D A Conversion is performed in logarithmic steps with a normalized voltage range of from 0 to 1 Volt The specific amplitude control of each of the three D A Converters is accomplished by the three sets of 4 bit outputs of the Amplitude Control block while the Mixer outputs provide the base signal frequency Noise and or Tone NORMALIZED VOLTAGE NOTE THIS IS THE ENVELOPE ONLY NOISE AND TONES ARE DISABLED DECIMAL VALUE OF E3E2E EO EP ENVELOPE PERIOD Fig 5 D A CONVERTER OUTPUT Fig 7 MIXTURE OF THREE TONES WITH FIXED AMPLITUDES Fage 9 Spectrum ADD ON user manual Appendix B Reading the switch type joystick The switch type joystick is connected to 5 bits of the second I 0 port on the sound chip and is mapped thus b7 be bb bh b3 bZ bl b Where F fire R right L left U up and D down The following BASIC subroutine may be used to read the joystick 10
11. ing the contents of the relative Coarse and Fine Tuneregisters as illustrated in the following Coarse Tune Fine Tune Register Channel Register R1 A RO R3 B R2 R5 C R4 87 es es s es ez e eo ez ee ss Je ea ez e eo NOT USED rev ree ree res er res nes tes ven ree e 9 12 bit Tone Period TP to Tone Generator Noise Generator Control Register R6 The frequency of the noise source is obtained in the PSG by first counting down the input clock by 16 then by further counting down the result by the programmed 5 bit Noise Period value This 5 bit value consists of the lower 5 bits B4 BO of register R6 as illustrated in the following Noise Period Register R6 er ee ss e es o2 ei eo NOT 5 bit Noise Period NP USED to Noise Generator Mixer Control I O Enable Register R7 Register 7 is a multi function Enable register which controls the three Noise Tone Mixers and the two general purpose I O Ports The Mixers as previously described combine the noise and tone frequencies for each of the three channels The determination of combining neither either both noise and tone frequencies on each channel is made by the state of bits B5 BO of R7 The direction input or output of the two general purpose I O Ports IOA and IOB is determined by the state of bits B7 and B6 of R7 These functions are illustrated in the following Mixer Control I O Enable Register R7 e e es
12. wer 1983 Page 4 Spectrum ADD GN user manual To load JOYCODE alone type LOAD DLODE and start the tape If you need the routine at an alternative address type LOAD CODE followed by the address in decimal at which you need the routine To save the routine from its normal address type SAVE JOYCODE CODE 23300 100 Resetting the sound generator The reset pin on the AY 5 89iG has been wired to the least significant bit of I O port B and so is capable of resetting itself BUT 159 15 0UT 191 0 0UT 159 7 0UT 191 255 The sound registers will be set to O and the 1 0 ports set to input Please bear this feature in mind when programming sounds inadvertantly resetting the chip may be a difficult bug to track down Copyright Micro Power 1983 Page S Spectrum ADD ON user manual Connecting the board to your Spectrum ENSURE THAT THE POWER IS REMOVED BEFORE CONNECTING OR DISCONNECT ING Holding the Spectrum keyboard in one hand and the ADD ON board in the the cther offer up the edge connector oan the board to the Spectrum expansion socket to be found at the rear right of the case Take extra care to ensure that the key in the edge connector mates correctly with the keyway oan the Spectrum The board contains a 2w amplifier and loud speaker which may be used to amplify either the output from AY 5 8910 or the standard BEEP built into the Spectrum and is connected in one of two modes 1 To use the amplifier on BEEP plug the cord from
13. wing use of joystick and sounds Joystick No 1 controls the position of your sights on the screen a single dot whilst objects appear at random Position your sights and use the fire button to shoot the objects Once again the program is written in BASIC No 3 JOYCODE machine code program for reading the joy sticks and buttons This block of machine code consists of two small machine code programs the first at 23300 is used to read the joy sticks To read a joy stick from BASIC use the following BASIC line PAUSE 1 POKE 23301 2 LET a USH 23300 On return from the routine a value in the range 90 255 will be placed in the variable a The number 2 in FORE 23301 2 telis the routine which joy stick to read Use a value Gf i to read stick 1 horizontal use 2 to read stick 1 vertical 3 to read stick 2 horizontal and 4 to read stick 2 vertical Any other value may give very strange results The other routine starting at 23353 is calied to read the fire buttons on both joy sticks it doesn t matter if you haven t got both fitted Use the following BASIC LET a USR 23353 LET a PEEK 23296 The variable a will then contain a value of either O or i1 If the value is OG the button on stick one was held down at the time the routine was called PFEEKing 23297 would give similar results for the button on stick two JSTICK DEM loads and uses JOYCODE Programs 1 and 2 contain instructions for use simply load as normal Copyright Micro Fo

Download Pdf Manuals

image

Related Search

Related Contents

MODE D`EMPLOI  Ada in Action  WEINKÜHLER  Scalable Execution of LIGO Astrophysics Application in a Cloud  EtherPeek v5.0 and EtherPeek NX v2.0 Windows user manual    Bedienungsanleitung  DAP-2660 - D-Link  In der Bedienungsanleitung unter Punkt „9 Wartung/Plege“  Plinius Audio P10 User's Manual  

Copyright © All rights reserved.
Failed to retrieve file