home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / IMP / I2TV-5.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  16KB  |  567 lines

  1.  
  2. ; I2TV-5.ASM - TeleVideo TS-802/803/804/TPC-1 overlay for IMP - 06/01/87
  3. ;
  4. ;       TV801 uses the Z80 SIO & CTC timer (3.6884 MHz)
  5. ;       TV802 uses the Z80 SIO & CTC timer (3.6864 MHz)
  6. ;       TV803 uses the Mostek 3801 & CTC timer (3.6864 MHz)
  7. ;       TV804 uses the Z80 SIO & CTC timer (3.9936 MHz)
  8. ;       TPC-1 uses the Mostek 3801 & CTC timer (3.6864 MHz)
  9. ;
  10. ; You will want to look this file over carefully. There are a number of
  11. ; options that you can use to configure the program to suit your taste.
  12. ; This file adapts the modem port on the TeleVideo TV801, TV802, TV803,
  13. ; TV804, and TPC-1 to IMP.COM.
  14. ;
  15. ; Edit this file for your preferences then follow the "TO USE:" example
  16. ; shown below.
  17. ;
  18. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  19. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  20. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  21. ; (The ESC will automatically be typed with no CTL-character present.)
  22. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  23. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  24. ; looking at the function key table, typing CTL-Z in command mode, etc.
  25. ;
  26. ; Use the "SET" command to change the baud rate when desired.  The value
  27. ; at MSPEED controls the baudrate when the program is first called up.
  28. ;
  29. ;    TO USE: First edit this file filling in answers for your own
  30. ;        equipment.  Then assemble with ASM.COM or equivalent
  31. ;        assembler.
  32. ;
  33. ;        A>MLOAD IMP.COM=IMP.COM,I2TV-x.HEX
  34. ;
  35. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  36. ;
  37. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  38. ;        IMP245 to use it.            - Irv Hoff
  39. ; 06/30/86  Added TPC-1 capability, and     - Horace Ory
  40. ;        changed INITMOD for 803/TPC-1.
  41. ; 01/05/86  Added TV804 capabiity        - Irv Hoff
  42. ; 01/02/86  Re-written to work with the TS803    - Tanny O'Haley
  43. ; 10/27/85  Written to work with IMP        - Irv Hoff
  44. ;
  45. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  46. ;
  47. ;
  48. YES    EQU    0FFH
  49. NO    EQU    0
  50. ;
  51. ;
  52. ; Select one of the following four choices for your computer
  53. ;
  54. TV801    EQU    NO
  55. TV802    EQU    YES
  56. TV803    EQU    NO
  57. TV804    EQU    NO
  58. TPC1    EQU    NO
  59. ;
  60. ;
  61.      IF    TV801
  62. PORT    EQU    0CH    ; TS-801 Z80 SIO base port (data or status)
  63.      ENDIF        ; TV801
  64. ;
  65.      IF    TV802
  66. PORT    EQU    20H    ; TS-802 Z80 SIO base port (data or status)
  67.      ENDIF        ; TV802
  68. ;
  69.      IF    TV801 OR TV802
  70. MDCTL1    EQU    PORT+2    ; Modem control port
  71. MDDATP    EQU    PORT    ; Modem data port
  72. MDRCV    EQU    01H    ; Modem receive ready
  73. MDSND    EQU    04H    ; Modem send ready bit
  74. MDTXE    EQU    01H    ; Modem send buffer empty, holding buffer empty
  75. ;
  76. BDPORT    EQU    08H    ; CTC port for baud rate
  77.      ENDIF        ; TV801 OR TV802
  78. ;
  79. ;
  80.      IF    TV803 OR TPC1
  81. PORT    EQU    2FH    ; Mostek 3801 base port (data or status)
  82. MDCTL1    EQU    PORT-1    ; Modem control port for output
  83. MDCTL2    EQU    PORT-2    ; Modem control port for input
  84. MDBCT    EQU    29H    ; Modem baud rate control port
  85. MDCMD    EQU    2CH    ; Modem command port
  86. MDDATP    EQU    PORT    ; Modem data port
  87. MDRCV    EQU    80H    ; Modem receive ready
  88. MDSND    EQU    80H    ; Modem send ready bit
  89. MDTXE    EQU    80H    ; Modem send buffer empty, holding buffer empty
  90. ;
  91. BDPORT    EQU    2BH    ; CTC port for baud rate
  92. INTPRT    EQU    27H    ; Interrupt port
  93.      ENDIF        ; TV803 OR TPC-1
  94. ;
  95.      IF    TV804
  96. PORT    EQU    1EH    ; TS-804 Z80 SIO base port (data or status)
  97. MDCTL1    EQU    PORT+1    ; Modem control port
  98. MDDATP    EQU    PORT    ; Modem data port
  99. MDRCV    EQU    01H    ; Modem receive ready
  100. MDSND    EQU    04H    ; Modem send ready bit
  101. MDTXE    EQU    01H    ; Modem send buffer empty, holding buffer empty
  102. ;
  103. BDPORT    EQU    0EH    ; CTC port for baud rate
  104.      ENDIF        ; TV804
  105. ;
  106. ;-----------------------------------------------------------------------
  107. ;
  108. ESC    EQU    '['-40H    ; ^[ = Escape
  109. BELL    EQU    'G'-40H    ; ^G = Bell character
  110. LF    EQU    'J'-40H    ; ^J = Linefeed
  111. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  112. CR    EQU    'M'-40H    ; ^M = Carriage return
  113. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  114. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  115. ;
  116. ;-----------------------------------------------------------------------
  117. ;
  118. ;
  119.     ORG    0100H
  120. ;
  121. ;
  122.     DS    3    ; Skip the data area below
  123. ;
  124. ;
  125. ; These routines and equates are at the beginning of the program so
  126. ; they can be patched by a monitor or overlay file without re-assembling
  127. ; the program.
  128. ;
  129. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  130.             ; 6=2400 7=4800 8=9600 9=19200 default
  131. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  132. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  133. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  134. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  135. RESVD1:     DB    NO    ; Reserved for special modems            108H
  136. RESVD2:     DB    NO    ; Reserved for special modems            109H
  137. ;
  138. ;
  139. CLEAR:     DB    '*'    ; Clear screen character (ESC not needed)    10AH
  140. CLOCK:     DB    37    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  141.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  142. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  143.             ;   default time to send character in ter-
  144.             ;   minal mode file transfer for slow BBS
  145. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  146.             ;   default time for extra wait after CRLF
  147.             ;   in terminal mode file transfer
  148. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  149. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  150. ;.....
  151. ;
  152. ;
  153. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  154.             ;   mode (normally added by remote echo)
  155. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  156. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  157. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  158. ;.....
  159. ;
  160. ;
  161. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  162. EXITCHR: DB    'E'    ; Exit character                115H
  163. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  164. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  165. LOGCHR:     DB    'L'    ; Send logon                    118H
  166. LSTCHR:     DB    'P'    ; Toggle printer                119H
  167. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  168. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  169. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  170. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  171. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  172. ;.....
  173. ;
  174. ;
  175. ; Handles in/out ports for data and status
  176. ;
  177. I$MDCTL1:  IF    TV801 OR TV802 OR TV804    ; Get output status
  178.       MVI    A,10H        ;                    11FH
  179.       OUT    MDCTL1        ;                    121H
  180.       IN    MDCTL1        ;                    123H
  181.       RET            ;                    125H
  182.       DB    0,0,0        ;                    126H
  183.        ENDIF        ; TV801 OR TV802 OR TV804
  184. ;
  185.        IF    TV803 OR TPC1
  186.       IN    MDCTL1        ;                    11FH
  187.       RET            ;                    121H
  188. ;
  189. I$MDCTL2: IN    MDCTL2        ; Get input status            122H
  190.       RET            ;                    124H
  191.       DB    0,0,0,0        ;                    125H
  192.        ENDIF        ; TV803 OR TPC-1
  193. ;
  194. I$MDTXE:   IF    TV801 OR TV802 OR TV804
  195.       MVI    A,11H        ; Read register 1 for "all sent"    129H
  196.       OUT    MDCTL1        ;                    12BH
  197.       IN    MDCTL1        ;                    12DH
  198.       RET            ;                    12FH
  199.       DB    0,0,0        ;                    130H
  200.        ENDIF        ; TV801 OR TV802 OR TV804
  201. ;
  202.        IF    TV803 OR TPC1
  203.       IN    MDCTL1        ;                    129H
  204.       RET            ;                    12BH
  205.       DB    0,0,0,0,0,0,0    ;                    12CH
  206.        ENDIF        ; TV803 OR TPC-1
  207. ;
  208. I$MDDATP: IN    MDDATP        ;                    133H
  209.       RET            ;                    135H
  210.       DB    0,0,0,0,0,0,0    ;                    136H
  211. ;
  212. O$MDDATP: OUT    MDDATP        ;                    13DH
  213.       RET            ;                    13FH
  214.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  215. ;.....
  216. ;
  217. ;
  218. A$MDRCV:  ANI    MDRCV        ;                    147H
  219.       RET            ;                    149H
  220. ;
  221. C$MDRCV:  CPI    MDRCV        ;                    14AH
  222.       RET            ;                    14CH
  223. ;
  224. A$MDSND:  ANI    MDSND        ;                    14DH
  225.       RET            ;                    14FH
  226. ;
  227. C$MDSND:  CPI    MDSND        ;                    150H
  228.       RET            ;                    152H
  229. ;
  230. A$MDTXE:  ANI    MDTXE        ;                    153H
  231.       RET            ;                    155H
  232. ;
  233. C$MDTXE:  CPI    MDTXE        ;                    156H
  234.       RET            ;                    158H
  235. ;.....
  236. ;
  237. ;
  238. ; Special exit vector, used by some computers to reset interrupt vectors
  239. ;
  240. J$EXITVEC:RET            ;                    159H
  241.       DB    0,0        ;                    15AH
  242. ;.....
  243. ;
  244. ;
  245. ; Jump vectors needed by each overlay
  246. ;
  247. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  248. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  249. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  250. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  251. ;.....
  252. ;
  253. ;
  254. ; "AT" command strings, can be replaced in individual overlay if needed
  255. ;
  256. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  257. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  258. ;
  259. ;
  260. ; Next fourteen lines should not be changed by user overlay as these go
  261. ; to specific locations in the main program, not in the overlay.
  262. ;
  263. ;
  264. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  265. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  266. J$DIAL:      DS    3        ; Start of dialing routine        174H
  267. J$DSCONT: DS    3        ; Terminates modem use            177H
  268. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  269. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  270. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  271. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  272. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  273. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  274. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  275. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  276. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  277. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  278. J$NEW2:      DB    0,0,0        ; For future needs            198H
  279. ;.....
  280. ;
  281. ;
  282. ; For 2400 bps auto-stepdown units
  283. ;
  284. MANUAL:      DB    0        ; For manual selection flag        19BH
  285. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  286. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  287. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  288. ;.....
  289. ;
  290. ;
  291. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  292. ;
  293. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  294.       DB    'Version for TeleVideo ' ;                1AAH
  295. ;
  296.        IF    TV801
  297.       DB    'TS-801, modem port 0CH'
  298.        ENDIF            ; TV801
  299. ;
  300.        IF    TV802
  301.       DB    'TS-802, modem port 20H'
  302.        ENDIF            ; TV802
  303. ;
  304.        IF    TV803
  305.       DB    'TS-803, modem port 2FH'
  306.        ENDIF            ; TV803
  307. ;
  308.        IF    TV804
  309.       DB    'TS-804, modem port 0DH'
  310.        ENDIF            ; TV804
  311. ;
  312. ;
  313.        IF    TPC1
  314.       DB    'TPC-1, modem port 2FH'
  315.        ENDIF            ; TPC-1
  316. ;
  317.       DB    CR,LF,0
  318. ;
  319. ;
  320. ;-----------------------------------------------------------------------
  321. ;
  322. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  323. ;     end of your last routine should terminate by 0400H (601 bytes
  324. ;     available after start of SYSVER).
  325. ;
  326. ;-----------------------------------------------------------------------
  327. ;
  328. ; You can put in a message at this location which can be called up with
  329. ; (special character-L).  You can put in several lines.  End with a 0.
  330. ;
  331. LOGON:    DB    'Greetings from a TeleVideo user',CR,LF,0
  332. ;
  333. ;-----------------------------------------------------------------------
  334. ;
  335. ; This routine sets a 300 ms break tone
  336. ;
  337. SENDBRK:
  338.      IF    TV801 OR TV802 OR TV804
  339.     MVI    A,5
  340.     OUT    MDCTL1        ; Send to the status port
  341.     MVI    A,0F8H        ; DTR normal, send break tone
  342.     JMP    GOODBYE1    ; Go send the break tone
  343.      ENDIF            ; TV801 OR TV802 OR TV804
  344. ;
  345.      IF    TV803 OR TPC1
  346.     MVI    A,09H        ; Set the break, keep xmit enabled
  347.     OUT    MDCTL1        ; Send to the output control port
  348.     MVI    B,3        ; Send for 300 ms
  349.     CALL    J$TIMER
  350.     MVI    A,01H        ; Reset normal with xmit enabled
  351.     OUT    MDCTL1        ; Send to the output control port
  352.     RET
  353.      ENDIF            ; TV803 OR TPC1
  354. ;.....
  355. ;
  356. ;
  357. ; This routine sets DTR low for 300 ms to disconnect the phone
  358. ;
  359.      IF    TV801 OR TV802 OR TV804
  360. GOODBYE:
  361.     MVI    A,5
  362.     OUT    MDCTL1        ; Send to the status port
  363.     MVI    A,068H        ; Turn off DTR, send break
  364. ;
  365. GOODBYE1:
  366.     OUT    MDCTL1
  367.     MVI    B,3        ; Wait 300 ms
  368.     CALL    J$TIMER
  369.     MVI    A,5
  370.     OUT    MDCTL1
  371.     MVI    A,0E8H        ; Restore normal, 8 bits, DTR on, etc.
  372.     OUT    MDCTL1
  373.     RET
  374.      ENDIF            ; TV801 OR TV802 OR TV804
  375. ;
  376.      IF    TV803 OR TPC1
  377. GOODBYE:
  378.     MVI    A,20H        ; Turn off DTR to disconnect
  379.     OUT    21H
  380. ;
  381. GOODBYE1:
  382.     MVI    B,3        ; Wait 300 ms
  383.     CALL    J$TIMER
  384.     XRA    A        ; Reactivate DTR
  385.     OUT    21H        ; Reset modem control port
  386.     OUT    MDCTL1        ; Reset output control port
  387.     RET
  388.      ENDIF            ; TV803 OR TPC-1
  389. ;.....
  390. ;
  391. ;
  392. ; Televideo TS-801, TS-802 or TV804 baud rate change.  Sets CTC timer
  393. ; for baudrate.
  394. ;
  395.      IF    TV801 OR TV802 OR TV804
  396. INITMOD:
  397.     MVI    A,0        ; Select register
  398.     OUT    MDCTL1        ; Send to the status port
  399.     MVI    A,18H        ; Reset the Z80 SIO chip
  400.     OUT    MDCTL1        ; Send to the status port
  401.     MVI    A,4        ; Select register
  402.     OUT    MDCTL1        ; Send to the status port
  403.     MVI    A,44H        ; 16x, 1-stop, no parity (44=1, 4C=2)
  404.     OUT    MDCTL1        ; Send to the status port
  405.     MVI    A,3        ; Select register
  406.     OUT    MDCTL1        ; Send to the status port
  407.     MVI    A,0C1H        ; Enable receive section
  408.     OUT    MDCTL1        ; Send to the status port
  409.     MVI    A,5        ; Select register
  410.     OUT    MDCTL1        ; Send to the status port
  411.     MVI    A,0EAH        ; DTR, RTS, 8-bits, enable send section
  412.     OUT    MDCTL1        ; Send to the status port
  413.      ENDIF            ; TV801 OR TV802 or TV804
  414. ;
  415. ;
  416. ; Televideo TS-803 or TPC-1 baud rate change.  Sets CTC timer for baud-
  417. ; rate.
  418.      IF    TV803 OR TPC1
  419. INITMOD:
  420.     IN    MDBCT        ; Get timer value
  421.     PUSH    PSW        ; Save it
  422.     MVI    A,0FH
  423.     OUT    INTPRT        ; Kill interrupts
  424.     POP    PSW        ; Get timer value
  425.     OUT    MDBCT        ; Restart
  426.     MVI    A,88H        ; No parity, 8-bit word, 1 stop bit, X16
  427.     OUT    MDCMD        ; Set it
  428.     MVI    A,01        ; Enable RX
  429.     OUT    MDCTL2
  430.     MVI    A,05        ; Enable TX
  431.     OUT    MDCTL1
  432.     IN    MDDATP        ; Empty receiver buffer
  433. ;
  434. ;
  435. ; This overwrites the first line of the RCVRDY routine in the body of
  436. ; the main program, in order to check I$MDCTL2 rather than I$MODCLT1.
  437. ;
  438.     CALL    J$RCVRSP    ; Gets RCVRDY address in HL
  439.     LXI    B,I$MDCTL2
  440.     MOV    M,C        ; Store
  441.     INX    H
  442.     MOV    M,B
  443.      ENDIF            ; TV803 OR TPC-1
  444. ;
  445.     LDA    MSPEED        ; Get the selected value
  446.     CPI    1        ; 300 bps
  447.     JZ    OK300
  448.     CPI    5        ; 1200 bps
  449.     JZ    OK1200
  450.     CPI    6        ; 2400 bps
  451.     JZ    OK2400
  452.     CPI    8        ; 9600 bps
  453.     JZ    OK9600
  454. ;
  455.      IF    TV801 OR TV802
  456.     CPI    9        ; 19200
  457.     JZ    OK19200
  458.      ENDIF            ; TV801 OR TV802
  459. ;
  460.     JMP    STUPR1        ; Else ask what is wanted
  461. ;.....
  462. ;
  463. ;
  464. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  465.     JNC    STUPR2
  466. ;
  467. STUPR1:    CALL    J$ILPRT
  468.     DB    'Input Baud Rate (300, 1200, 2400, 9600'
  469. ;
  470.      IF    TV801 OR TV802
  471.     DB    ', 19200'
  472.      ENDIF            ; TV801 OR TV802
  473. ;
  474.     DB    '): ',0
  475.     LXI    D,BAUDBUF    ; Point to new input buffer
  476.     CALL    J$INBUF
  477.     CALL    J$CRLF
  478.     LXI    D,BAUDBUF+2
  479. ;
  480. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  481.     DB    '300',0
  482.     JNC    OK300        ; Go if got match
  483.     CALL    J$INLNCP
  484.     DB    '1200',0
  485.     JNC    OK1200
  486.     CALL    J$INLNCP
  487.     DB    '2400',0
  488.     JNC    OK2400
  489.     CALL    J$INLNCP
  490.     DB    '9600',0
  491.     JNC    OK9600
  492. ;
  493.      IF    TV801 OR TV802
  494.     CALL    J$INLNCP
  495.     DB    '19200',0
  496.     JNC    OK19200
  497.      ENDIF            ; TV801 OR TV802
  498. ;
  499.     CALL    J$ILPRT        ; All matches failed, tell operator
  500.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  501.     JMP    STUPR1        ; Try again
  502. ;
  503. OK300:    MVI    A,1        ; MSPEED 300 baud value
  504.     LXI    H,BD300
  505.     JMP    LOADBD
  506. ;
  507. OK1200:    MVI    A,5
  508.     LXI    H,BD1200
  509.     JMP    LOADBD
  510. ;
  511. OK2400:    XRA    A        ; Reset flag for automatic selection
  512.     STA    MANUAL
  513.     MVI    A,6
  514.     LXI    H,BD2400
  515.     JMP    LOADBD
  516. ;
  517. OK9600:    MVI    A,8
  518.     LXI    H,BD9600
  519.     JMP    LOADBD
  520. ;
  521.      IF    TV801 OR TV802
  522. OK19200:MVI    A,9
  523.     LXI    H,BD19200
  524.      ENDIF            ; TV801 OR TV802
  525. ;
  526. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  527.     MOV    A,H        ; CTC timer control word
  528.     OUT    BDPORT        ; Controls CTC timer/counter
  529.     MOV    A,L        ; Baudrate
  530.     OUT    BDPORT
  531.     RET
  532. ;.....
  533. ;
  534. ;
  535. ; Baudrate table
  536. ;
  537.      IF    TV801 OR TV802
  538. BD300    EQU    4780H        ; 38400/300  converted to hex value
  539. BD1200    EQU    4720H        ; 38400/1200 converted to hex value
  540. BD2400    EQU    4710H        ; 38400/2400 converted to hex value
  541. BD9600    EQU    4704H        ; 38400/9600 converted to hex value
  542. BD19200    EQU    4702H        ; 38400/19200 converted to hex value
  543.      ENDIF            ; TV802
  544. ;
  545.      IF    TV803 OR TPC1
  546. BD300    EQU    4720H        ; 9600/300  converted to hex value
  547. BD1200    EQU    4708H        ; 9600/1200 converted to hex value
  548. BD2400    EQU    4704H        ; 9600/2400 converted to hex value
  549. BD9600    EQU    4701H        ; 9600/9600 converted to hex value
  550.      ENDIF            ; TV803 OR TPC-1
  551. ;
  552.      IF    TV804
  553. BD300    EQU    0734H        ; 7800/300 converted to hex value
  554. BD1200    EQU    4768H        ; 124800/1200 converted to hex value
  555. BD2400    EQU    4734H        ; 124800/2400 converted to hex value
  556. BD9600    EQU    470DH        ; 124800/9600 converted to hex value
  557.      ENDIF            ; TV804
  558. ;
  559. BAUDBUF:DB    10,0,0,0,0,0
  560.     DB    0,0,0,0,0,0
  561. ;.....
  562. ;
  563. ;                   end
  564. ;-----------------------------------------------------------------------
  565. ;
  566. ; Note: Must end by 0400H
  567.