ThomasHarte wrote:Ugh, I almost can't take the pain of that clearly-by-a-teenager document of mine. I'm going to get the red pen out immediately.
It's been a very valuable reference - I'd love to see it maintained and back on the "live" web.
In the other thread you said:
ThomasHarte wrote:From memory, from writing ElectrEm, a decade and a half ago:
- a hardware quirk causes the 'receive data' (the real one; this isn't a comment about mislabelling) to be triggered if the tape hardware is put into output mode and appropriate data is sent to look like a stop bit. Joe Blade uses that like a programmable interrupt counter — analogous to those other platforms where you can say "give me an interrupt in 32 lines" — in order to trigger its palette change; possibly Northern Star and Southern Belle do too;
I've been wondering about the code necessary to reproduce this quirk, even if it wasn't used by
Joe Blade.
Here's another test program:
Code: Select all
10 FOR I%=0 TO 2 STEP 2
20 P%=&2000
30 [OPT I%
40 SEI
50 LDA #&00 \ clear counter
60 STA &FE06
70 LDA #&B4 \ set tape output mode
80 STA &FE07
90 LDA &FE04 \ clear RXFULL int
100 LDA #&AA
110 STA &FE04 \ transmit a character
120 LDX #&00
130 .LOOP
200 LDA &FE00 \ save the int status
210 STA &2100,X
220 LDY #100 \ delay for 500us
230 .DELAY
240 DEY
250 BNE DELAY
260 INX
270 BNE LOOP
280 CLI
290 RTS
300 ]
310 NEXT
320 CALL &2000
330 FOR I=0 TO 23
340 PRINT I,~I?&2100 AND &70
350 NEXT
This code is putting the ULA in tape-output mode, sending a character, and then sampling the interrupt status flags every 500us.
On my real Electron, I get:
Code: Select all
0 0
1 0
2 0
3 0
4 0
5 10
6 10
7 10
8 10
9 10
10 10
11 10
12 10
13 10
14 10
15 10
16 30
17 30
18 30
19 30
20 30
21 30
22 30
23 30
...
You would expect the point at which the Tx interrupt (bit 5) fires to be about 9 bit times (7.5ms) after the byte is written to &FE04. Each row in the above table is ~500us. So row 16 (8ms) is about right.
What's interesting is the point at which the Rx interrupt (bit 4) fires is somewhat random. More specifically:
- it doesn't seem to depend on the character being sent
- it does seem to depend on the tape input (but not 100% consistently)
- sometimes it never fires (especially when the tape input is disconnected)
- sometimes it fires as soon as row 1 (especially when you touch the tape input)
Based on this experiment it seems:
- the Tx interrupt could be used as a fixed 7.5ms timer (117 lines)
- the Rx interrupt is less use, because it's doesn't seem to depend on the data being sent
Does this match your understanding?
Dave