Subject: RS232 pin assignment

From: "mizapf" <[email-masked]>
Date: Sat, 25 Jun 2011 11:28:49 -0000

I just checked whether this was the time where all kinds of drugs were popular ... the pin assignment of the TI RS232 is a bad joke, isn't it?

I tried to make sense of the strange assignment, but I can only guess that this was done to simplify cable connections to external devices.

Not only are input pins and output pins swapped in relation to standard RS232 plugs (25 pin), but the naming of the pins is also heavily misleading.

CTS (clear to send) is an input signal which is intended to activate the sender in the UART. On the TI RS232 it is an output signal, and it gets its level from a CRU latch. Note that the TMS9902 actually has a CTS pin, but it's connected to DTR on the connector.

DTR (data terminal ready) is an output signal which should indicate the UARTs readiness to send data. On the TI card it is an input leading to the CTS pin of the UART.

CD (carrier detect) is an input coming from a modem, and it indicates what it says - there is a carrier, data exchange is possible. On our card it is an output. What the ...? 

RTS (request to send) is an output towards the external device, and it should make the external device trigger the CTS line in turn. You guessed ... no, it's not connected. Instead, the RTS signal from the UART is fed into CD. 

The names can only be properly understood as the pins of the opposite side. So it's not only a swapped pin order; the pin names have swapped meanings. Why should anyone do this? 

Michael

---

From: mark wills <[email-masked]>
Date: Sat, 25 Jun 2011 13:17:06 +0100 (BST)

I think the idea was that a pin-to-pin cable could be used. I heard that somewhere. I use Fred's Y-Cable into a null-modem cable into my PC.

Fred has a good wiring diagram here:

http://members.ziggo.nl/fgkaal/Hardware/hw_ti99hdx_ti_rs232.html

(the last link at the bottom of the page).

Mark

>________________________________
>From: mizapf <[email-masked]>
>To: [email-masked]
>Sent: Saturday, 25 June 2011, 12:28
>Subject: [TI994A] RS232 pin assignment
>
>------------------------------------
>
>Yahoo! Groups Links
>
>
>
>
>
>

---

From: mark wills <[email-masked]>
Date: Sat, 25 Jun 2011 13:24:55 +0100 (BST)

Friends

I decided to find out if Classic99 and a real 4A could work with the 
*same physical* files, hosted on a PC and served to the TI using Fred 
Kaal's HDX Server.

The answer is yes. You can develop code on the PC, and when you want to 
test it on the real 4A, there is no need to transfer with a TIFILES 
header and run it through Archiver blah blah blah... Just connect the TI
 to the PC with a serial cable, and type OLD HDX1.<filename>

You can then modify the *same* file *on the TI* if you want, and later re-load it in Classic99 to continue work!

Fantastic.

Here is a video proof-of-concept:

http://www.youtube.com/watch?v=8FJxyp6ORWM

Enjoy. This is a REALLY cool system. Much nicer than a nanoPEB in my 
view, because to transfer all your old 5.25" disk files to the PC with 
HDX you need to do nothing more than copy them using DM2K.

Awesome.

My next task is to resurrect an old laptop that I have in the garage (it
 has a serial port) and install it as a permanent file server. I'll 
probably remove the hard disk completely, as they can't be trusted long 
term. I'll install Windows on a USB key and have it boot from that. I'll
 host all the TI files on an SD card.

With such a setup, one can simply copy all their old floppy disks to the
 PC using subdirectories and not have to rely on 25 year old disk drives
 and disks.

I'll go on the lookout for a really tiny (i.e. miniature) PC, one that I
 can attach to the back of the PEB. It can sit there with no keyboard or
 screen attached and just serve files from solid-state media.

Mark

---

From: "Michael Zapf" <[email-masked]>
Date: Sat, 25 Jun 2011 12:26:46 -0000

Some thoughts later ...

... it *does* make sense if we look at our computer not as the DTE but as the DCE.

That is, if we think of the TI as playing the role of the modem, it makes sense to use the DCD line as an output (towards the *real* computer :-) ) and the DTR as an input. 

At those times serial VT100 terminals were quite common, and if you attached a VT100 to the RS232 card, the DTE was the VT100 and not the TI. Maybe the TI engineers had this in mind when designing the TI RS232. 

Michael

---

From: ti99_forever <[email-masked]>
Date: Sat, 25 Jun 2011 07:00:03 -0700 (PDT)

Exactly. You have saved me some typing...
As another group recently commented, the RS232 standard wasn't so "standard"... (comp.sys.apple2, I think)

--- On Sat, 6/25/11, Michael Zapf <[email-masked]> wrote:

> From: Michael Zapf <[email-masked]>
> Subject: [TI994A] Re: RS232 pin assignment
> Date: Saturday, June 25, 2011, 8:26 AM
> Some thoughts later ...
> 
> That is, if we think of the TI as playing the role of the
> modem, it makes sense to use the DCD line as an output
> (towards the *real* computer :-) ) and the DTR as an input.
> 
> 
> At those times serial VT100 terminals were quite common,
> and if you attached a VT100 to the RS232 card, the DTE was
> the VT100 and not the TI. Maybe the TI engineers had this in
> mind when designing the TI RS232. 
> 
> Michael
> 
> 
> 
>     [email-masked]
> 
> 
>

---

From: Jeffrey White <[email-masked]>
Date: Mon, 27 Jun 2011 20:20:31 -0700 (PDT)

From comp.sys.ti,

http://groups.google.com/group/comp.sys.ti/browse_thread/thread/193d862d7523f5e1/63ecd6cfed27c2a?hl=en&q=jeff+white+group:comp.sys.ti+RS232#

Yes, that # is part of the link.

Jeff White

________________________________
From: ti99_forever <[email-masked]>
To: [email-masked]
Sent: Sat, June 25, 2011 10:00:03 AM
Subject: Re: [TI994A] Re: RS232 pin assignment

Exactly. You have saved me some typing...
As another group recently commented, the RS232 standard wasn't so "standard"... 
(comp.sys.apple2, I think)

---

From: "Michael Zapf" <[email-masked]>
Date: Tue, 28 Jun 2011 11:53:31 -0000

Hello Jeff,

many thanks ... this is very helpful!

Obviously, what I discovered last week-end already was a topic of discussion 15 years ago. :-)

The moment when it came to my mind that the RS232 plays the modem role was when I tried to make sense of having an output line "Carrier Detect". 

The discussion cited by you is particular helpful because I have the same problems as mentioned there. I have to figure out how to re-interpret the TI assignment in terms of DTE assignments. In other words: How do I get the RTS back (and the other signals)?

The RXTX Java library (which I use to build the serial bridge) is only intended for DTEs, not DCEs. Thus you cannot do a setDCD or setCTS but only a setRTS or setDTR.

I guess I should really take the time and carefully read that discussion.

Michael

---

From: Insane Multitasker <[email-masked]>
Date: Wed, 29 Jun 2011 00:43:42 -0500

No promises,Michael, but if you are interested I will spend some time hunting down the PORT RS232 source.  It might give you a real-world example to play around with and it would tie in nicely with Jeff's explanations from the past.  
 
There are two hardware handshaking cable configurations selectable within PORT, named after the people who recommended and used them:  Jeff (White) and Mike (Maksimik).  I believe the latter was closer to the "standard" BBS cable config with CTS only modifications, allowing Mike to run both the CTIUG BBS and PORT via the same cable.  IIRC, Jeff's cable was more friendly to other terminal programs and worked with all RS232 models.   Both provided equivalent functionality. 
 
Tim

> From: [email-masked]
> Date: Tue, 28 Jun 2011 11:53:31 +0000

---

From: mark wills <[email-masked]>
Date: Fri, 1 Jul 2011 08:45:37 +0100 (BST)

Does anyone have some TI BASIC or XB code to catalog a disk? I remember years ago a lot of the disks I owned had a little LOAD program that would catalog the disk when you started XB. I'd like to look at the code to see how it's done.

Thanks

Mark

---

From: "Stuart" <[email-masked]>
Date: Fri, 01 Jul 2011 08:19:12 -0000

There's a TI BASIC program in the Disk Controller manual which will be on WHT somnewhere.

Stuart.

---

From: "Tursi" <[email-masked]>
Date: Fri, 1 Jul 2011 01:22:04 -0700

>Does anyone have some TI BASIC or XB code to catalog a disk? I remember 
>years ago a lot of the disks I owned had a little LOAD program that would 
> >catalog the disk when you started XB. I'd like to look at the code to see 
>how it's done.

Yep, there's a simple one in the disk controller manual. here's mine. I 
added comments to explain it, since I worked it out one day for test 
purposes.

100 CALL CLEAR
110 DIM TYPE$(5)
120 TYPE$(1)="DIS/FIX"
130 TYPE$(2)="DIS/VAR"
140 TYPE$(3)="INT/FIX"
150 TYPE$(4)="INT/VAR"
160 TYPE$(5)="PROGRAM"
165 REM  THIS OPENS AS IF/0 - WHICH BECOMES IF/38
170 OPEN #1:"DSK1.",INPUT ,RELATIVE,INTERNAL
175 REM  'ZERO' IS ALWAYS 0
180 INPUT #1:DISKNAME$,ZERO,DISKSECTORS,FREESECTORS
190 DISPLAY "DSK1 -  DISKNAME= ";DISKNAME$:"AVAILABLE= ";FREESECTORS;" USED= 
";DISKSECTORS-FREESECTORS
200 DISPLAY :"FILENAME   SIZE    TYPE    P":"---------- ---- ---------- -";
205 REM  A FILETYPE OF 0 ALSO MEANS END OF DIRECTORY
207 REM  FILETYPE IS NEGATIVE FOR A PROTECTED FILE
210 INPUT #1:FILENAME$,FILETYPE,FILESECTORS,RECORDLENGTH
220 IF LEN(FILENAME$)=0 THEN 300
230 DISPLAY :FILENAME$;TAB(12);FILESECTORS;TAB(17);TYPE$(ABS(FILETYPE));
235 REM  PROGRAM FILES DON'T HAVE A RECORD LENGTH
240 IF ABS(FILETYPE)=5 THEN 270
250 B$=" "&STR$(RECORDLENGTH)
260 DISPLAY SEG$(B$,LEN(B$)-2,3);
270 IF FILETYPE>0 THEN 210
280 DISPLAY TAB(28);"Y";
290 GOTO 210
300 CLOSE #1

---

From: "Michael Zapf" <[email-masked]>
Date: Fri, 01 Jul 2011 08:25:17 -0000

Hi Mark,

see http://www.ninerpedia.org/index.php/Disk_directory_reader_in_BASIC

(just added :-) ) 

Michael

---

From: mark wills <[email-masked]>
Date: Fri, 1 Jul 2011 09:45:27 +0100 (BST)

Wow! Thanks everyone! Now *thats* a response!

Mark

>Sent: Friday, 1 July 2011, 9:25
>Subject: [TI994A] Re: Catalog a disk in BASIC
>
>Hi Mark,
>

---

From: mark wills <[email-masked]>
Date: Fri, 1 Jul 2011 10:09:28 +0100 (BST)

Okay, just doing some hacking here to see whats going on under the covers...

10 OPEN #1:"DSK1.",INPUT ,FIXED 38,RELATIVE,INTERNAL
20 INPUT #1:DN$,ZERO,DISKSECTORS$,FREESECTORS$
30 FOR I=1 TO LEN(DS$)
40 PRINT ASC(SEG$(DS$,I,1))
50 NEXT I

[ Note: I am deliberately pulling back disk-sectors and free-sectors as STRINGS in the above code ]

Yields the output:
 65
 14
 40
  0
  0
  0
  0
  0

Is this a radix 100 number? (The value of DISKSECTORS (as an integer) was 1440). Am I looking at the Radix 100 version of 1440?

I think it is... It is interesting to note the 2nd and 3rd values: 14 and 40... Hmmm... Put them together and you get 1440 ;-)

The 65 is the sign, yes? Hmmm... Far's me mini-mem manual?

Assumptions:
* I can ignore the first byte (the sign) 'cos all values should be positive.
* I only need the next two bytes, I can ignore the rest, since those two bytes can represent up to 9999

Agree?

Mark

---

From: "Tursi" <[email-masked]>
Date: Fri, 1 Jul 2011 02:34:12 -0700

>Is this a radix 100 number? (The value of DISKSECTORS (as an integer) was 
>1440). Am I looking at the Radix 100 version of 1440?
>I think it is... It is interesting to note the 2nd and 3rd values: 14 and 
>40... Hmmm... Put them together and you get 1440 ;-)

I assume that your code should say DISKSECTORS$, not DS$, in the loop? 
Otherwise I don't see where DS$ is coming from.

You're kind of gaming the system here, but after a quick look, I can see 
that it should work. The actual raw data is a three followed by three 
(8-byte) numbers, yes, RADIX-100.

Record 0 is the Diskname in the string field, a zero in the first numeric 
position, the number of sectors on the disk in the second, and the number of 
free sectors in the third.

For all other records, the string field is the filename, the first number is 
the type, the second is the file size in sectors (including the FDR, so an 
empty file is 1), and the last is the record length (0 for programs).

A string is stored as a length byte, followed by that many bytes of data. So 
"HELLO" is stored as >05,'H','E','L','L','O'
The radix 100 numbers are stored as a length byte (always 8), followed by 8 
bytes of RADIX 100 data. The TI Disk controller cheats a little, and its 
routine can only handle numbers from -9999 to 9999 - only the first three 
bytes will ever be filled in, the rest are zero. (Since they both have a 
similar format, I guess that's why your trick works!)

Negative numbers actually affect the first TWO bytes, but you can't ignore 
the first byte anyway, since it contains the exponent. My translation of the 
TI disk controller code says it will always be either >41 (65) if the number 
is greater than or equal to 100, or >40 (64) if less.

In this limited implementation, if the number is 100 or larger, then the 
second byte is the number of hundreds (from 1 - 99), and the third byte is 
the number of units (0-99). Otherwise, the second byte is the number of 
units (0-99), and the third byte is zero.

Bytes 4-8 are always zero from the TI disk controller.

The way a negative value works, though I don't think you'll see one, is that 
the first two bytes are inverted. In this limited case, that means you'd see 
 >BE or >BF instead of >41 or >40 in the first byte, and would have to 
bitwise invert the second byte to get the correct value. The rest of the 
number is unaffected.

---

From: mark wills <[email-masked]>
Date: Fri, 1 Jul 2011 12:04:03 +0100 (BST)

Thanks mate!

It's not really gaming the system - I'm just trying to see how the directory data is *really* represented, as read from disk. TI BASIC actually makes it look simpler than it is!

You have probably guessed: I'm looking at how to read a directory from TurboForth. TF does record level IO, so I guess I just read 38 byte records and look inside them to get the data out. 

As an aside: It looks like it is not necessary to open the file for relative access. It can be opened for sequential access, since the record number is never actually set in the TI BASIC code. I'll give that a try.

Mark

>From: Tursi <[email-masked]>
>Sent: Friday, 1 July 2011, 10:34
>Subject: Re: [TI994A] Re: Catalog a disk in BASIC
>

---

From: mark wills <[email-masked]>
Date: Fri, 1 Jul 2011 12:33:09 +0100 (BST)

Ok, to answer my own question: The access type *must* be relative otherwise it crashes. Strange, since the record number is not set, and the records are accessed sequentially.

I was under the impression that a FIXED type file could either be opened for relative *or* sequential access.

Mark

>From: mark wills <[email-masked]>
>To: "[email-masked]" <[email-masked]>
>Sent: Friday, 1 July 2011, 12:04
>>empty file is
 1), and the last is the record length (0 for programs).
>>second byte is
 the number of hundreds (from 1 - 99), and the third byte is 
>>    (Yahoo! ID required)

---

From: ti99_forever <[email-masked]>
Date: Fri, 1 Jul 2011 08:14:17 -0700 (PDT)

A protected file will contain a negative number...

---

From: "Tursi" <[email-masked]>
Date: Fri, 1 Jul 2011 11:20:07 -0700

>for relative *or* sequential access.

It's entirely up to the DSR what you're allowed to do. It's perfectly legal 
for a DSR to only work on Tuesdays if it has a way to determine that. ;) Not 
very intuitive though!

How does it crash? Thierry's disassembly is here: 
http://nouspikel.group.shef.ac.uk//ti99/dc6.txt

Starting at address 58B4, the comments suggest that the relative/sequential 
bit is ignored (though the comment also says output mode). But it seems like 
that should indeed work?

---

From: mark wills <[email-masked]>
Date: Fri, 1 Jul 2011 20:40:29 +0100 (BST)

>How does it crash?

You get:

* I/O ERROR #02 IN 170

:-(

>Sent: Friday, 1 July 2011, 19:20

---

From: mark wills <[email-masked]>
Date: Fri, 1 Jul 2011 20:42:49 +0100 (BST)

<stupid question>
If the exponent is >42 is that 10-thousandsths? (could happen with hard disks)

>40 = units
>41 = 100's
>42 = 10000's (100*100=10000)?

</stupid question>

---

From: [email-masked]
Date: Fri, 1 Jul 2011 21:52:41 +0000 (UTC)

If you are looking for info on the DSR and Cataloging then check out Smart Programmer SP840.pdf as it also has a reference to Jim Vincent on Forth conversion for Corcomp and the articles he wrote on doing this from CorComp. 
SP840 also has screens on DSR peeker so you can get direct access to the DSR Assembly routines to speed up access. 
This is similar to what I did with RXB for SCSI, WSD or RAMdisks and Disk cards. It even works for Phoney disk drives if you use a GPLDSRLINK. 

This was the only way I could figure out to access any device and make them all the same with different devices. 
Way to much code was required for every other type of access.

---

From: tursi <[email-masked]>
Date: Fri, 1 Jul 2011 22:00:13 -0700 (PDT)

> >42 = 10000's (100*100=10000)?

I believe that's correct, but I can't check anything myself, I'm on the 
road. :)

---

From: mark wills <[email-masked]>
Date: Sat, 2 Jul 2011 07:58:50 +0100 (BST)

What are you doing on the road? Get on the side-walk for God's sake man!

Tsk... I dunno... You Americans ;-)

>From: tursi <[email-masked]>
>Sent: Saturday, 2 July 2011, 6:00

---

From: "[email-masked]" <[email-masked]>
Date: Sun, 25 Sep 2011 19:58:59 -0000

Does anyone have the Eagle PCB layout files for the RS232 add-on card?  The link on Fred's site appears to no longer work.

-ck

---

From: "fredkaal" <[email-masked]>
Date: Mon, 26 Sep 2011 17:42:07 -0000

Sorry ... Suppose I forgot to put it in the download section. Unfortunetly I can't access my webpages at the moment for some reason.

Fred 

--- In [email-masked], "coryklatt@..." <cory.klatt@...> wrote:
> --- In [email-masked], mark wills <markrobertwills@> wrote:
> >
> > Friends
> >

---

From: "fredkaal" <[email-masked]>
Date: Tue, 27 Sep 2011 17:07:17 -0000

The ZIP file is available!

For some reason I can't make an FTP connection anymore with my webside with Total Commander. Have to use some firefox plugin now to open an explorer window.

Fred ;-)

--- In [email-masked], "fredkaal" <fgkaal@...> wrote:
> --- In [email-masked], "coryklatt@" <cory.klatt@> wrote:
> >

---

From: "Cory Klatt" <[email-masked]>
Date: Mon, 03 Oct 2011 05:34:43 -0000

Thank you Fred!

I've built the board and the cable and am excited to get this up and running.  

~ck

--- In [email-masked], "fredkaal" <fgkaal@...> wrote:
> --- In [email-masked], "fredkaal" <fgkaal@> wrote:
> >