Jump to content

Photo

AUTOBAUD DETECTION FOR 9902


8 replies to this topic

#1 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 854 posts
  • Location:The Great White North

Posted Fri Dec 14, 2018 5:38 PM

I found this code in an old book from TI circa 1981.

 

I thought the gang here might find it interesting.  Apologies.  I have not assembled it and the tabs are all wrong but it's a neat idea.

It appears to work by measuring the time between mark and space in the signal and then looking up the rate interval for that measurement in the table.

Smart people at TI in 1981.

 

Minor edits per Stuart's comments

* autobaud for 9902
* Software Development, Texas Instruments 1981

           LI      R12,BASE
           SBO     31
           LI      R1,6200
           LDCR    R1,8
           SBZ     13
           CLR     R3

* wait for start bit
SBAUD      TB      15
           JEQ     SBAUD

* wait until rin goes back to space condition
SBAUD1     INC     R3
           TB      15
           JNE     SBAUD1

* FIND THE BAUD RATE
           LI      R4,BAUDTB-2
SBAUD2     INCT    R4
           C       R3 *R4+
           JH      SBAUD2

* baud rate found - set recieve and transmit data interval
* read a char and throw it away

           LDCR *R4,12
SBAUD3     TB   21
           JNE SBAUD3
           SBZ 18

BAUDTB     DATA >0007,>001A     * 19200
           DATA >000E,>0034     *  9600
           DATA >001D,>0068     *  4800
           DATA >003B,>00D0     *  2400
           DATA >0075,>01A0     *  1200
           DATA >00EA,>0340     *   600
           DATA >0246,>04D0     *   300
           DATA >7FFF,>0638     *   110

Edited by TheBF, Sat Dec 15, 2018 10:02 AM.


#2 TheBF OFFLINE  

TheBF

    Dragonstomper

  • Topic Starter
  • 854 posts
  • Location:The Great White North

Posted Fri Dec 14, 2018 5:52 PM

I just discovered that you don't have to turn on the RS232 CARD to access the 9902 chips!

 

The CRU address can be set to >1340 and you can read and write the 9902 bits and send and receive data just fine.

 

Does anyone know of a downside if you are not using the DSR code?



#3 InsaneMultitasker OFFLINE  

InsaneMultitasker

    River Patroller

  • 2,318 posts

Posted Fri Dec 14, 2018 7:14 PM

The nanoPEB devices require you to turn on the card, causing incompatibility with any programs that used the "feature" you describe.

 

The creator did not want to fix this difference which, in my opinion, is a mistake and has created a few headaches.

 

No downside so long as you roll your own code.



#4 Stuart OFFLINE  

Stuart

    Dragonstomper

  • 817 posts
  • Location:Southampton, UK

Posted Sat Dec 15, 2018 9:37 AM

 

I found this code in an old book from TI circa 1981.

 

I thought the gang here might find it interesting.  Apologies.  I have not assembled it and the tabs are all wrong but it's a neat idea.

It appears to work by measuring the time between mark and space in the signal and then looking up the rate interval for that measurement in the table.

Smart people at TI in 1981.

 

 

Tiny little typo in the listing:

 

LI R4,BAUDTB=2    should be   LI R4,BAUDTB-2 (minus 2, not equals 2)

 

Note that the values in the Baud rate table are for no-wait state memory. The values in the first column will need recalculating if the code is run from memory with wait states. The Baud rates, from the top to the bottom of the table, are 19200, 9600, 4800, 2400, 1200, 600, 300, 110 Baud.



#5 TheBF OFFLINE  

TheBF

    Dragonstomper

  • Topic Starter
  • 854 posts
  • Location:The Great White North

Posted Sat Dec 15, 2018 10:06 AM

Thanks Stuart,

 

Any thoughts on the multiple that we should use for those times in column 1?

I suppose I could just load the code and hit it with a known BPS rate and look at R3.

 

I need to write this up in RPN assembler and try it.



#6 Stuart OFFLINE  

Stuart

    Dragonstomper

  • 817 posts
  • Location:Southampton, UK

Posted Sat Dec 15, 2018 10:48 AM

Values best established by experimentation I think.  ;-)  Probably best to make sure interrupts are off as well, just in case.



#7 apersson850 OFFLINE  

apersson850

    Dragonstomper

  • 534 posts

Posted Sat Dec 15, 2018 2:41 PM

This was a common feature back then. I remember first learning about it in school, 1982 or something. Not with the same UART, but using a similar principle. It was common to send the character 'A', due to its bit pattern.



#8 Swim OFFLINE  

Swim

    Chopper Commander

  • 152 posts
  • Location:Staten Island

Posted Tue Dec 18, 2018 6:47 AM

I seem to recall baud rate parsing is done in the console ROMs? Parsing wait state and clock speed? Correct? I think user atrax27407, Hummingbird EPROMs, has ROMs with wait state and clock speed options available.



#9 atrax27407 ONLINE  

atrax27407

    Stargunner

  • 1,178 posts

Posted Tue Dec 18, 2018 8:19 AM

Here are the baud rate calculations:

Attached Files

  • Attached File  Scan.pdf   174.65KB   16 downloads





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users