Oric Speech Engine

Here you can ask questions or provide insights about how to use efficiently 6502 assembly code on the Oric.
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Oric Speech Engine

Post by Twilighte »

Electronic Speech Systems(ESS) was a company back in the Eighties that produced a number of software speech modules for the Commodore 64.

These were used in classic games such as Impossible Mission, Ghostbusters and Beachhead II amongst many others.
There actually exists a player for these here..

http://www.the-commodore-zone.com/artic ... Page2.html

The interesting thing is that although it was synthesised speech it just acted upon the Commodore 64's SID 4 bit Volume register.

Now as we all know the C64 has a variant of the 6502 as its cpu(6510). Not much difference and certainly a 6502 core.

There also exists SID files for most of the games shown in the link. A SID is a file containing the original code and data for the games music or sound element and a common format header describing its contents.

The one below is for the game Impossible Mission which i have particular interest in.

http://www.lemon64.com/music/download.php?sid=1748

So i took this particular SID, stripped out everything but the actual C64 code and data ( 8K ! ) and disassembled it with the intention of creating a player for the Oric.

For sound output, i disabled all chip channels and set the current AY register to Volume of channel A. This turns the location $030F into a virtual volume register which is perfect for outputting the speech onto.

But i then hit a problem. The Speech code uses two interrupt routines. On the C64 one interrupt (IRQ) is driven from a CIA chip (#1) and the other interrupt (NMI) from the second CIA chip (#2).

Both CIA chips produced regular interrupts, the first (i believe) set to 50Hz VBL and the other set to 10Khz.

The second interrupt routine redirects the NMI routine vector within it in order to perform a progression of operations on the sound. The CIA timer is also stopped and started dynamically within the code. This is difficult to perform on the Oric since the 6522 has no such hardware control over the timers.

My modification has been to use VIA's Timer 1 to replace the main IRQ and VIA's Timer 2 to replace the NMI interrupt then a common service routine to handle both interrupt sources.

Currently i disable or enable the Interrupt source for Timer2 in the IER in place of stopping and starting the CIA timer B but this doesn't seem to work. There seems to be a problem resetting the irq.

The first interrupt (IRQ) appears to dampen (delay) the playing of the sound.

I have uploaded the project which can be dl'd as a zip here..

http://www.defence-force.org/ftp/forum/ ... ode/sp.zip

all_memory.asm is the dump from the utility i used to disassemble the sid to a source file. The ASM format is not dissimilar to the xa format but the dump provided is all 64K !
BuildSpeech.bat is the batch file i use to compile Test1.s with osdk
code_only.asm is the same as all_memory.asm except all (or most) of the data has been stripped out.
test1.s is the Oric conversion which compiles on osdk using the xa 6502 source format. It has many more comments than asm files.

I will delve into the irq and nmi routines shortly.
User avatar
carlsson
Pilot Officer
Posts: 127
Joined: Thu Jan 12, 2006 11:26 pm
Location: Västerås, Sweden

Re: Oric Speech Engine

Post by carlsson »

Twilighte wrote:[..] although it was synthesised speech it just acted upon the Commodore 64's SID 4 bit Volume register
I think they all did. Some may have used frequency modulation or PWM to generate sampled sound at a higher resolution than the volume register can do.
[..] the C64 has a variant of the 6502 as its cpu(6510). Not much difference and certainly a 6502 core.
The 6510 is a 6502 with a 8-bit I/O register added to allow it to bank switch ROMs on top of the 64K RAM actually inside the computer. Nothing more, nothing less as far as I know. No extra adressing modes or instructions except for the undocumented/illegal ones where support may vary depending on CMOS/HMOS/NMOS. The 65C02 however is slightly different.

As a side note, someone recently asked one of the C= engineers if they ever licensed the 6510 to other manufacturers but the answer seems to have been they kept this gem to themselves, forcing Apple, Atari and the others to find their own solutions to host 64K RAM if required.
Anders Carlsson
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Post by Twilighte »

The impact on the 6510 of the extra i/o port was addresses 00 and 01 being for bank switching/data direction register.
Post Reply