Coding
Using Code to help Troubleshoot & Repairing TI FDC
Content provided by Stuart Conner
A common point of failure on the TI Floppy Disk Controller (FDC) card is the 74LS245 chip that buffers data on and off the card. If this chip fails, the console power-up routine cannot read the FDC card Device Service Routine (DSR) header when it scans for hardware devices, and so considers the FDC card to be 'not there'. (The DSR is stored in the EPROMs on the card.)
If you have a Mini Memory cartridge, you can use the Easy Bug feature (option 2 on the startup screen) to easily test that the DSR can be read by writing a '1' to CRU address >1100 then reading out memory locations >4000 onwards (first 2 bytes should be >AA and >02).
If you haven't got a Mini Memory cartridge but do have an Editor/Assembler cartridge, then the following BASIC program will perform the same test and is short enough to easily type in."
10 CALL INIT
20 CALL LOAD(12288,2,12,17,0,29,0,200,32,64,0,48,32,200,32,64,2,48,34,4,91)
30 CALL LOAD(8234,63,48)
40 CALL LOAD(16176,70,68,67,32,32,32,48,0)
50 CALL LINK(“FDC”)
60 CALL PEEK(12320,A,B)
70 PRINT A
80 PRINT B
If the DSR can be read, it should print the values 170 and 2 (>AA, >02 - the first two bytes of the TI FDC DSR).
Breaking down how the program works:
Line 20 pokes into memory the code for the following, starting at address >3000:
LI R12,>1100 'CRU base address for FDC card.
SBO 0 'Switch on card.
MOV @>4000,@>3020 'Copy word from DSR ROM at >4000 and store at >3020
MOV @>4002,@>3022 'Copy word from DSR ROM at >4002 and store at >3022
B *R11 'Return
Line 30 changes the pointer at >202A to >3F30 to add an extra entry to the REF/DEF table. See the bottom half of page 276 of the E/A manual for further details.
Line 40 adds the program name "FDC" and start address >3000 in the new entry in the REF/DEF table. See page 276 of the E/A manual again.
Line 50 calls the code just poked into memory.
Line 60 gets the values copied from the DSR ROM to memory at >3020 and >3021. (I've just relisted that the code above is copying 4 bytes, whereas only meant to copy 2!) Found (on Classic99 at least) that CALL PEEK can't read from the DSR ROM directly as for some reason the routine is first switching the card off, hence the need for the code above to copy the bytes we need to another location, then the CALL PEEK can read them from there.
Using Arrays by Chris Schneider
Have you ever logged into a BBS that you know was running only on floppy drives and wondered how their pre-login message gets displayed so fast?
When I was originally running a BBS back in the 80’s on my TI and of course I was running it on 4 DS/DD floppy drives. I wanted to be able to display the pre-login message to users without having it pause as so many menus did on the BBS’ because of disk access. So I decided to put my pre-login message in memory with an array at the beginning of the BBS starting up.
I have used this little bit of code to do this for many programs that I have written that have menus based on text files. Of course I did not have the unlimited amount of RAM on the TI, so I usually kept what I used for arrays limited.
I would first create a text file in TI-Writer (back then), now I use BA-Writer. The text file was created as follows:
- Line 1 would have the total amount of lines you wanted for your message
- The CR/LF was removed from each line
- Your login message would start on line #2
- Instead of saving the file we need to print the file to the filename on disk
So in my example I have a text file called ‘ARRAYTEST’ as a Display Variable 80 format, as below:
4
This is line 1
This is line 2
This is line 3
This is line 4
The code I then use to put it in an array with Extended Basic is:
100 DIM LG$(4)
110 OPEN #1:"DSK3.ARRAYTEST",INPUT :: LINPUT #1:A$ :: A=VAL(A$)
120 FOR X=1 TO A :: LINPUT #1:LG$(X)
130 NEXT X
140 CLOSE #1
Line 100 declares the array of LG$ to have 4 members. (total # of lines)
Line 110 opens the ARRAYTEST text file for input and then takes the first line, which is the # of lines it needs to read and places that in string value of A$. It then converts the string value to an integer (A).
Line 120 stars a loop from 1 to 4 since A=4 and then pulls each line of the text file into the specified array as defined by X.
Line 130 simple next and sends back to line 120 until loop is complete (4 times).
Line 140 closes the text file.
We can now execute code to display the text from the array values on the screen.
150 FOR Z=1 TO A :: PRINT LG$(Z)
160 NEXT Z