Oric Speech Engine
Posted: Sun Sep 27, 2009 1:56 pm
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.
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.