User Tools

Site Tools


oric:hardware:simple_access

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 NameROM 1.0 Call AddressROM 1.1 Call AddressOperation
Send Register $F590Write value held in X to the AY Register specified in the Accumulator
Register Dump $FA86Update the complete set of AY Registers from the specified 14 byte array starting at the address parsed in X(Low) and Y(High)
ZAP $FAE1Play the Classic ORIC Zap Sound Effect
PING $FA9FPlay the Classic ORIC Ping Sound Effect
EXPLD $FACBPlay the Classic ORIC Explode Sound Effect
SHOOT $FAB5Play the Classic ORIC Shoot Sound Effect
KBBEEP $FB14Play the Classic ORIC Keyboard Click Sound
CONTBP $FB2APlay the Classic ORIC CTRL Key Click Sound

Examples under BASIC

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..

     USER 0,A8,X15

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.

     USER 1,X#1C,Y#FB

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

Examples under 6502 ASM(XA)

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
oric/hardware/simple_access.txt · Last modified: 2008/03/25 19:01 by twilighte