[Coco] more 1 bit madness

Steve 6809er at srbsoftware.com
Sun Jan 19 18:41:07 EST 2014


On 1/18/2014 10:32 AM, Allen Huffman wrote:
> On Jan 18, 2014, at 12:25 PM, Simon Jonassen <simon at roust-it.dk> wrote:
>
>> well now todays 8 bit experiment on th 0.89Mhz coco II has cooked a 1 bit 1
>> channel player that is almost certainly capable of running the note player
>> in 1..2 Hsync periods..... the sequencer runs off of VSYNC (actually only
>> every 5th frame) so it's a 1/10th second....
> Do you think there would be enough CPU time left to do a game that has music on a CoCo 1?
> -
>
Al,

I took look at the code that Simon just posted today and it could never 
be used while a game is running.  The CPU overhead is just too much.

In his current version, the code spends all it's time doing two things...

1) It's looking and counting for the 5th 60 Hz pulse and using that for 
the note timing.  While this is just test code, it could redesigned to 
just use IRQ 60 Hz vector to run this bit of code and let this part run 
in the background without slowing down the game performance.

2) The remainder of the code is what creates the sound by spending all 
the CPU time flipping the sound bit at the right time.  This is where 
the problem comes in for his technique working in a video game.

The first problem is the amount of CPU time an Interrupt happening 
15,734 time a second.  When I used this Interrupt for video timing in a 
CoCo 1, it took as much as 50% of the CPU time.  That's a hard pill to 
get down when every CPU cycle is need to make a game play at its best.

In Simon's post, he hopes to use H-sync to trigger is code to trigger is 
bit flipping code to create the sound at the right frequency.  A good 
goal.  But an interrupt hitting the code only at 15,734 times a second 
is not fine enough resolution to create notes that are in tune above 400 Hz.

If he was writing this for the CoCo 3, he could use the programmable 
timer to trigger the code at the right time to flip the bit.  This would 
let the code run in the background and only use about 25% to 50% of the 
CPU time depending on the frequency of the note.

It should be noted that the programmable timer was added to the CoCo 3 
so both the playing music / sound FX and high speed Serial I/O could run 
in the background.  (Using a little CPU overhead to emulate these two 
hardware items.)

Getting back to CPU overhead while creating sound.  In my CoCo 3 games, 
I used a 8,000 Hz Interrupt to play my music and sound FX using 6-bit 
data.  At this rate, it took about 25% of the CPU cycles to play the 
stuff.  Games like Super Pitfall, you have an option turn off the music 
and will speed up the game a little.

Steve




More information about the Coco mailing list