Like with the T2C64, the CPLD on the T2A2 maps the C012 registers into the memory area of the used slot, using just 6 addresses starting at 0xc080 + (SLOT# * 0x10). So for e.g. Slot 4 this would be:
- BASE (0xc080 + (4 * 0x10)) = 49344
- Data in: BASE 49344
- Data out: (BASE + 1) 49345
- in-status: (BASE + 2) 49346
- out-status:(BASE + 3) 49347
- reset: (BASE + 8) 49352 (writing)
- analyse: (BASE + 12) 49356
- errorflag: (BASE + 8) 49352 (reading)
With this ‘knowlege’ we can start talking to the Transputer… and to make our first babysteps we’re using BASIC. It’s pretty much the same code as used on the C64 with the exception that there’s no “elegant” timeout handling due to the missing clock in AppleSoft, so you have to wait a bit longer until you get the printout in the end.
For details about what’s going on here, see the C64 page.
10 PRINT "INIT TRANSPUTER"
11 BASE = 49344:IN = BASE:OUT = BASE + 1:IS = BASE + 2
12 OS = BASE + 3:RESET = BASE + 8:ANA = BASE + 12
13 POKE RESET,0: POKE ANA,1: POKE RESET,1
20 REM CLEAR I/O ENABLE
21 POKE IS,0
22 POKE OS,0
30 REM READ STATI
31 PRINT "I STATUS: ";( PEEK (IS) AND 1)
35 PRINT "O STATUS: ";( PEEK (OS) AND 1)
40 PRINT "ERROR: ";( PEEK (RESET) AND 1)
45 PRINT "SENDING POKE COMMAND"
46 POKE OUT,0
50 PRINT "O STATUS: ";( PEEK (OS) AND 1)
58 :
59 PRINT "SENDING DATA TO T."
60 POKE OUT,0: POKE OUT,0: POKE OUT,0: POKE OUT,128
61 POKE OUT,12: POKE OUT,34: POKE OUT,56: POKE OUT,78
70 PRINT "I STATUS: ";( PEEK (IS) AND 1)
79 :
80 PRINT "READING FROM T."
90 POKE OUT,1: REM PEEKING
100 POKE OUT,0: POKE OUT,0: POKE OUT,0: POKE OUT,128
110 PRINT PEEK (IN); PEEK (IN); PEEK (IN); PEEK (IN)
128 DIM R(4)
129 PRINT "SENDING PROGRAM TO TRANSPUTER..."
130 FOR X = 1 TO 24
140 READ T: POKE OUT,T
150 WAIT OS,1
160 NEXT X
170 PRINT : PRINT "READING RESULT:"
175 C = 0: REM RETRIES
180 IF C = 10 GOTO 220
181 FOR X = 0 TO 5000: NEXT X: REM DELAY
189 ER = ER + 1: IF ER = 10 GOTO 220
190 IF ( PEEK (IS) AND 1) = 0 GOTO 181
195 R(C) = PEEK (IN)
200 C = C + 1:ER = 0
210 GOTO 180
211 REM ------------------------
220 IF C = 1 THEN PRINT "C004 FOUND"
230 IF C = 2 THEN PRINT "16 BIT TRANSPUTER FOUND"
240 IF C = 4 THEN PRINT "32 BIT TRANSPUTER FOUND"
250 IF C = 0 OR C > 4 THEN PRINT "COULD NOT IDENTIFY""
1000 DATA 23,177,209,36,242,33,252,36,242,33,248
1001 DATA 240,96,92,42,42,42,74,255,33,47,255,2,0
Ok, if this is running fine, i.e. a Transputer was actually found and your Apple didn’t went up in smoke, we’re set for some serious numbercruncing… and a video! Yay! We love Videos, don’t we?
(I’m skipping the other sample code available on the T2C64 page. It’ll work the same on an Apple, so no need for redundancy)