Both Oric ROM 1.0 and 1.1 versions provide a number of useful Calls that can access the sound chip. They are not particularly fast but may be more convenient in some cases.
|Routine Name||ROM 1.0 Call Address||ROM 1.1 Call Address||Operation|
|Send Register||$F590||Write value held in X to the AY Register specified in the Accumulator|
|Register Dump||$FA86||Update the complete set of AY Registers from the specified 14 byte array starting at the address parsed in X(Low) and Y(High)|
|ZAP||$FAE1||Play the Classic ORIC Zap Sound Effect|
|PING||$FA9F||Play the Classic ORIC Ping Sound Effect|
|EXPLD||$FACB||Play the Classic ORIC Explode Sound Effect|
|SHOOT||$FAB5||Play the Classic ORIC Shoot Sound Effect|
|KBBEEP||$FB14||Play the Classic ORIC Keyboard Click Sound|
|CONTBP||$FB2A||Play the Classic ORIC CTRL Key Click Sound|
Please note that this article is based on accessing the sound chip more directly than the commands provided under ORIC BASIC such as SOUND, MUSIC and PLAY.
Whilst the sound effect commands can simply be issued as ZAP, PING, etc. either from command line or within a BASIC program the first two calls may still be used from BASIC but will require a SEDORIC Command in order to be able to load the parameters in the registers before calling the routine.
We initialise the SEDORIC command like this..
USER 0,DEF #F590 USER 1,DEF #FA86
Then to set the Volume of channel A(Register 8) to maximum(Volume 15) we do this..
You should hear a slight click as the volume is raised or the previous sound will be heard depending on the last sound operation performed.
To demonstrate passing a complete set of 14 registers, the best example is to use a table that exists in the ROM.
This produces the keyclick sound. This is because the address specified points to the ROM table that holds the register set for keyclick.
Remember if using these commands from command prompt, ensure keyclick is disabled so that each effect is heard.
This final example dumps 14 AY Registers from a table set up at $B400 to $B40D.
10 USER 0,DEF #FA86 20 FOR A = #B400 TO #B40D 30 READ B 40 POKE A,B 50 NEXT A 60 USER 0,X#00,Y#B4 100 DATA 233,0 110 DATA 232,0 120 DATA 231,0 130 DATA 0 140 DATA 120 150 DATA 16,16,16 160 DATA 0,100 170 DATA 9
And now an explanation of the code.
Line 10 sets up Sedoric User Call 0 to Send Register Bank routine.
Lines 20 to 50 compile the table at $B400. Note $B400 to $B4FF is unused memory (TEXT mode only).
Line 60 Calls the ROM routine parsing the table address of $B400.
Lines 100 to 170 are the values for all AY registers from 0 to 14.
Line 100 sets the pitch of Channel A to 233
Line 110 sets the pitch of Channel B to 232 (very close to channel A)
Line 120 sets the pitch of Channel C to 231 (very close to other channels)
Line 130 sets the noise shape (Noise is not used)
Line 140 sets all noise off and all tones on
Line 150 sets all volumes to 16 passing volume control to the Envelope Generator
Line 160 sets the Envelope Generator Period to 100*256
Line 170 set the Envelope Generator waveform to a single slope starting at 15 and diminishing to 0.
Refer to wiki Sound for specific information on register contents
Under Machine code the calling of the routines is much easier but does require some knowledge of 6502 assembly.
To set the Volume of channel A(Register 8) to maximum(Volume 15) like in the BASIC example we do this..
LDA #8 LDX #15 JSR $F590
To play the keyclick sound we call the Register Dump routine like this..
LDX #<$FB1C LDY #>$FB1C JSR $FA86
The final example repeats the same BASIC routine to dump a user defined table. However since the table already exists in memory we can just direct it to the FA86 routine.
LDX #<AYRegisterBlock LDY #>AYRegisterBlock JSR $FA86 RTS
AYRegisterBlock .byt 233,0 .byt 232,0 .byt 231,0 .byt 0 .byt 120 .byt 16,16,16 .byt 0,100 .byt 9