CoCo 3 GIME Timer Tests

Screen Shot 2021-05-12 at 11.17.36 PM

Recently I was investigating why the Color Computer 3 version of Arkanoid didn’t make any ricochet sounds when the ball bounced off an object in MAME. For an example of the game working properly see this video here: https://youtu.be/1eexgL5b4lo

After talking with the author of the game (Steve Bjork: name drop) he said the sound in question was being played by using the timer interrupt system in the machine. I disassembled the FIRQ handler and quickly found the problem. His playback routine did two things: it wrote a value to the DAC, and determined the proper amount of time to wait before the next DAC update. It did not update the DAC at a constant frequency.

Here is what the ISR did, in the order it did them:

1. Acknowledge the interrupt.
2. Write the new timer delay to the register
3. Enable the interrupt again.
4. Write the value to the DAC.
5. Determine the next timer delay and store it for the next interrupt.

The problem was the first time the ISR was called: It wrote a zero for the amount of delay to the next interrupt, because the delay isn’t properly determined until then end of the ISR. Documentation about the CoCo 3 hardware says this should stop the timer interrupt. And that is what MAME did. But this is not what real hardware does. On real hardware you get an immediate re-aserting of the interrupt when the timer value is set to zero. On the second interrupt the sound system is properly initialized, real timer values were being written, and samples are being sent to the DAC.

In order to find this problem I wrote some test programs. This helped me to fix the above bug, and also discover another bug in MAME. MAME tightly coupled the pulling of the F/IRQ line with setting the F/IRQ flag. On real hardware turning off the interrupt has no effect whether the flags are set.

The archive below is the test code I wrote. Three different routines that set up the timer interrupt. Every time the interrupt is fired the address $400 is incremented.

TEST1 sets up the slow timer with a value of $FFF. TEST2 sets up the fast timer with a value of $FFF. TEST3 sets up the slow timer with a value of $0. All three programs use polling to check if the timers fired (bug #2). TEST3 is the program that test a timer value of zero (bug #1).

Included are video files from my Color Computer 3 with an ’86 GIME. They show what the program display as they are running.

CoCo 3 Interrupts Tests.zip

Color Computer 3 Text Mode Study

I decided to run thru the complete 40 column text mode options on a CoCo 3. Documented with pictures.
Here is the program I used to create the display:

10 CLS
20 FOR X = 0 TO 30
30 PRINT
40 PRINT X;
50 FOR Z = 65 TO 75
60 PRINT CHR$(X+Z);
70 NEXT Z
80 NEXT X
90 FOR X + 0 TO 7
100 LOCATE 0,0:PRINT X
110 POKE &HFF98,X
120 A$=INKEY$:IF A$="" THEN 120
130 NEXT X
140 GOTO 90

Text Rows: 24 (VRES0: 0, VRES1: 0).
Vertical Size: 1 scan line (LPR2: 0, LPR1: 0, LPR0: 0).
Description: Uses the first row of every text cell for 192 rows.
IMG_0946_r
Text Rows: 24 (VRES0: 0, VRES1: 0).
Vertical Size: 1 scan line (LPR2: 0, LPR1: 0, LPR0: 1).
Description: Uses the first row of every text cell for 192 rows.
IMG_0947_r
Text Rows: 24 (VRES0: 0, VRES1: 0).
Vertical Size: 2 scan lines (LPR2: 0, LPR1: 1, LPR0: 0).
Description: Uses the first two rows of every text cell for 96 rows.
IMG_0948_r
Text Rows: 24 (VRES0: 0, VRES1: 0).
Vertical Size: 8 scan lines per text cell (LPR2: 0, LPR1: 1, LPR0: 1).
Description: 24 rows of text.
IMG_0949_r
Text Rows: 24 (VRES0: 0, VRES1: 0).
Vertical Size: 9 scan lines per text cel (LPR2: 1, LPR1: 0, LPR0: 0).
Description: 21.3 rows of text
IMG_0950_r
Text Rows: 24 (VRES0: 0, VRES1: 0).
Vertical Size: 10 scan lines per text cell (LPR2: 1, LPR1: 0, LPR0: 1).
Description: 19.3 rows of text
IMG_0951_r
Text Rows: 24 (VRES0: 0, VRES1: 0).
Vertical Size: 11 scan lines per text cell (LPR2: 1, LPR1: 1, LPR0: 0).
Description: 17.5 rows of text
IMG_0952_r
Text Rows: 24 (VRES0: 0, VRES1: 0).
Vertical Size: 16 scan lines per text cell (LPR2: 1, LPR1: 1, LPR0: 1).
Description: 12 rows of text. First row repeated.
IMG_0953_r

Text Rows: 25 (VRES0: 0, VRES1: 1).
Vertical Size: 1 scan line (LPR2: 0, LPR1: 0, LPR0: 0).
Description: Uses the first row of every text cell for 200 rows.
IMG_0902_r
Text Rows: 25 (VRES0: 0, VRES1: 1).
Vertical Size: 1 scan line (LPR2: 0, LPR1: 0, LPR0: 1).
Description: Uses the first row of every text cell for 200 rows.
IMG_0903_r
Text Rows: 25 (VRES0: 0, VRES1: 1).
Vertical Size: 2 scan lines (LPR2: 0, LPR1: 1, LPR0: 0).
Description: Uses the first two rows of every text cell for 100 rows.
IMG_0904_r
Text Rows: 25 (VRES0: 0, VRES1: 1).
Vertical Size: 8 scan lines per text cell (LPR2: 0, LPR1: 1, LPR0: 1).
Description: 25 rows of text.
IMG_0914_r
Text Rows: 25 (VRES0: 0, VRES1: 1).
Vertical Size: 9 scan lines per text cel (LPR2: 1, LPR1: 0, LPR0: 0).
Description: 21.3 rows of text
IMG_0915_r
Text Rows: 25 (VRES0: 0, VRES1: 1).
Vertical Size: 10 scan lines per text cell (LPR2: 1, LPR1: 0, LPR0: 1).
Description: 20 rows of text
IMG_0916_r
Text Rows: 25 (VRES0: 0, VRES1: 1).
Vertical Size: 11 scan lines per text cell (LPR2: 1, LPR1: 1, LPR0: 0).
Description: 18 (and one scan line) rows of text
IMG_0917_r
Text Rows: 25 (VRES0: 0, VRES1: 1).
Vertical Size: 16 scan lines per text cell (LPR2: 1, LPR1: 1, LPR0: 1).
Description: 13 rows of text
IMG_0918_r

Text Rows: 28 (VRES0: 1, VRES1: 1).
Vertical Size: 1 scan line (LPR2: 0, LPR1: 0, LPR0: 0).
Description: Uses the first row of every text cell for 224 rows.
IMG_0919_r
Text Rows: 28 (VRES0: 1, VRES1: 1).
Vertical Size: 1 scan line (LPR2: 0, LPR1: 0, LPR0: 1).
Description: Uses the first row of every text cell for 224 rows.
IMG_0920_r
Text Rows: 28 (VRES0: 1, VRES1: 1).
Vertical Size: 2 scan lines (LPR2: 0, LPR1: 1, LPR0: 0).
Description: Uses the first two rows of every text cell for 112 rows.
IMG_0921_r
Text Rows: 28 (VRES0: 1, VRES1: 1).
Vertical Size: 8 scan lines per text cell (LPR2: 0, LPR1: 1, LPR0: 1).
Description: 28 rows of text.
IMG_0922_r
Text Rows: 28 (VRES0: 1, VRES1: 1).
Vertical Size: 9 scan lines per text cel (LPR2: 1, LPR1: 0, LPR0: 0).
Description: 25 rows of text
IMG_0923_r
Text Rows: 28 (VRES0: 1, VRES1: 1).
Vertical Size: 10 scan lines per text cell (LPR2: 1, LPR1: 0, LPR0: 1).
Description: 22.5 rows of text
IMG_0924_r
Text Rows: 28 (VRES0: 1, VRES1: 1).
Vertical Size: 11 scan lines per text cell (LPR2: 1, LPR1: 1, LPR0: 0).
Description: 21.5 (and one scan line) rows of text
IMG_0925_r
Text Rows: 28 (VRES0: 1, VRES1: 1).
Vertical Size: 16 scan lines per text cell (LPR2: 1, LPR1: 1, LPR0: 1).
Description: 14 (plus one scan line) rows of text
IMG_0926_r