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 / I2CT-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  13KB  |  367 lines

  1. ;***************************************************************************
  2. ;*                                       *
  3. ;*  I2CT-1.ASM - Cromemco TUART overlay for IMP - 12/27/86           *
  4. ;*                                       *
  5. ;*                USES TMS 5501 I/O                   *
  6. ;*                                       *
  7. ;*  You will want to look this file over carefully. There are a number of  *
  8. ;*  options that you can use to configure the program to suit your taste.  *
  9. ;*  This file adapts systems with the Cromemco TUART to IMP.           *
  10. ;*                                       *
  11. ;*  Edit this file for your preferences then follow the "TO USE:" example  *
  12. ;*  shown below.                               *
  13. ;*                                       *
  14. ;*  Many terminals will clear the screen with a CTL-Z.    If yours does, put *
  15. ;*  a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first *
  16. ;*  normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:  *
  17. ;*  (The ESC will automatically be typed with no CTL-character present.)   *
  18. ;*  If you don't know what your terminal uses, put a 0 at CLEAR: and IMP   *
  19. ;*  will scroll up 24 blank lines to clear the CRT for things like MENU,   *
  20. ;*  looking at the function key table, typing CTL-Z in command mode, etc.  *
  21. ;*                                       *
  22. ;*  Use the "SET" command to change the baudrate when desired.    The value  *
  23. ;*  at MSPEED controls the baudrate when the program is first called up.   *
  24. ;*                                       *
  25. ;*    TO USE: First edit this file filling in answers for your own       *
  26. ;*        equipment.  Then assemble with ASM.COM or equivalent       *
  27. ;*        assembler.  Then use MLOAD to merge into the main file:    *
  28. ;*                                       *
  29. ;*        MLOAD IMP.COM=IMP.COM,I2CT-x.HEX               *
  30. ;*                                       *
  31. ;*  =    =   =    =   =    =   =    =   =    =   =    =   =    =   =    =   =    =  *
  32. ;*                                       *
  33. ;*  12/27/87 - Adapted from I2NH-2        - Mark D. Pickerill       *
  34. ;*  10/27/85 - Minor changes            - Irv Hoff           *
  35. ;*  09/03/85 - Written to work with IMP     - Irv Hoff           *
  36. ;*                                       *
  37. ;*  =    =   =    =   =    =   =    =   =    =   =    =   =    =   =    =   =    =  *
  38. ;*                                       *
  39. ;***************************************************************************
  40.                 ;
  41. YES:    EQU    0FFH        ; Value for yes
  42. NO:    EQU    0        ; Value for no
  43.                 ;
  44.                 ; Values shown are for a TMS 5501
  45.                 ;
  46. PORT:    EQU    30H        ; Your base port (data or status)
  47. MDDATP:    EQU    PORT+1        ; Modem data port
  48. BDR:    EQU    PORT        ; Baud rate port
  49. MDCTL1:    EQU    PORT        ; Status port
  50. MSKP:    EQU    PORT+3        ; Interrupt mask port
  51. MDRCV:    EQU    40H        ; Modem receive ready (dav)
  52. MDSND:    EQU    80H        ; Modem send ready bit    (TBE)
  53. MDTXE:    EQU    80H        ; Modem send buffer empty, holding buffer empty
  54. MDRSET:    EQU    09H        ; Resets uart for additional commands
  55. MASK:    EQU    0        ; No interrupts from device
  56.                 ;
  57. ;-----------------------------------------------------------------------
  58.                 ;
  59. ESC:    EQU    '['-40H        ; ^[ = escape
  60. BELL:    EQU    'G'-40H        ; ^g = bell character
  61. LF:    EQU    'J'-40H        ; ^j = linefeed
  62. NEXTRY:    EQU    'K'-40H        ; ^k = try next phone number, abort this try
  63. CR:    EQU    'M'-40H        ; ^m = carriage return
  64. CLEARSC:EQU    'Z'-40H        ; ^z = clears screen, command mode only
  65. EOFCHAR:EQU    'Z'-40H        ; ^z = end of file
  66.                 ;
  67. ;-----------------------------------------------------------------------
  68.                 ;
  69.     ORG    0100H        ; Start of tpa
  70.     DS    3        ; Skip the data area below
  71.                 ;
  72. ;***************************************************************************
  73. ;*                                       *
  74. ;*  These routines and equates are at the beginning of the program so       *
  75. ;*  they can be patched by a monitor or overlay file without re-assembling *
  76. ;*  the program.                               *
  77. ;*                                       *
  78. ;***************************************************************************
  79.                 ;
  80. MSPEED:    DB    5        ; 0=110 1=300 2=450 3=600 4=710 5=1200        103h
  81.                 ; 6=2400 7=4800 8=9600 9=19200 default
  82. HS2400:    DB    NO        ; Yes=2400 bps highest speed            104h
  83. HS1200:    DB    YES        ; Yes=1200 bps highest speed            105h
  84. RACAL:    DB    NO        ; Yes=racal-vadic 1200v or 2400v or 2400pa    106h
  85. PROMODM:DB    NO        ; Yes=prometheus promodem 1200 bps        107h
  86. RESVD1:    DB    NO        ; Reserved for special modems            108h
  87. RESVD2:    DB    NO        ; Reserved for special modems            109h
  88.                 ;
  89. CLEAR:    DB    'E'        ; Clear screen character (esc not needed)    10ah
  90. CLOCK:    DB    20        ; Clock speed in mhz x10, 25.5 mhz max.     10bh
  91.                 ; 20=2 mhh, 37=3.68 mhz, 40=4 mhz, etc.
  92. BYTDLY:    DB    1        ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10ch
  93.                 ; Default time to send character in ter-
  94.                 ; Minal mode file transfer for slow bbs
  95. CRDLY:    DB    1        ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10dh
  96.                 ; Default time for extra wait after crlf
  97.                 ; In terminal mode file transfer
  98. NOFCOL:    DB    5        ; Number of directory columns shown        10eh
  99. TCHPUL:    DB    'T'        ; T=tone, p=pulse (hayes 2400 modems)        10fh
  100.                 ;
  101. ADDLFD:    DB    NO        ; Yes=add lf after cr to send file in terminal    110h
  102.                 ; Mode (normally added by remote echo)
  103. CONVRUB:DB    YES        ; Yes=convert rub to backspace            111h
  104. CRCDFLT:DB    YES        ; Yes=default to crc checking            112h
  105. IGNRCTL:DB    NO        ; Yes=ctl-chars above ^m not displayed        113h
  106.                 ;
  107. EXTCHR:    DB    '['-40H        ; Esc = preceeds local control character    114h
  108. EXITCHR:DB    'E'        ; Exit character                115h
  109. FILESND:DB    'F'        ; Send file when in terminal mode        116h
  110. NOCONCT:DB    'N'        ; Disconnect from phone line            117h
  111. LOGCHR:    DB    'L'        ; Send logon                    118h
  112. LSTCHR:    DB    'P'        ; Toggle printer                119h
  113. UNSAVCH:DB    'R'        ; Close input text buffer            11ah
  114. SAVECHR:DB    'Y'        ; Open input text buffer            11bh
  115. CLEARS:    DB    'Z'        ; Clears screen, terminal mode            11ch
  116. SPARE1:    DB    0        ; For future development            11dh
  117. NODTR:    DB    YES        ; Yes if no dtr and need +++ to disconnect    11eh
  118.                 ;
  119. ;***************************************************************************
  120. ;*                                       *
  121. ;*        Handles in/out ports for data and status           *
  122. ;*                                       *
  123. ;***************************************************************************
  124.                 ;
  125. I$MDCTL1:            ;
  126.     IN    MDCTL1        ; 11fh
  127.     RET            ; In modem control port         121h
  128.     DB    0,0,0,0,0,0,0    ; Spares if needed            122h
  129.                 ;
  130. I$MDTXE:IN    MDCTL1        ; (needed for sio or dart register 1    129h
  131.     RET            ; 12bh
  132.     DB    0,0,0,0,0,0,0    ; 12ch
  133.                 ;
  134. I$MDDATP:            ;
  135.     IN    MDDATP        ; 133h
  136.     RET            ; 135h
  137.     DB    0,0,0,0,0,0,0    ; Spares if needed            136h
  138.                 ;
  139. O$MDDATP:            ;
  140.     OUT    MDDATP        ; 13dh
  141.     RET            ; Out modem data port            13fh
  142.     DB    0,0,0,0,0,0,0    ; Spares if needed            140h
  143.                 ;
  144. A$MDRCV:ANI    MDRCV        ; 147h
  145.     RET            ; 149h
  146.                 ;
  147. C$MDRCV:CPI    MDRCV        ; 14ah
  148.     RET            ; 14ch
  149.                 ;
  150. A$MDSND:ANI    MDSND        ; 14dh
  151.     RET            ; 14fh
  152.                 ;
  153. C$MDSND:CPI    MDSND        ; 150h
  154.     RET            ; 152h
  155.                 ;
  156. A$MDTXE:ANI    MDTXE        ; 153h
  157.     RET            ; 155h
  158.                 ;
  159. C$MDTXE:CPI    MDTXE        ; 156h
  160.     RET            ; 158h
  161.                 ;
  162. ;***************************************************************************
  163. ;*                                       *
  164. ;*  Special exit vector, used by some computers to reset interrupt vectors *
  165. ;*                                       *
  166. ;***************************************************************************
  167.                 ;
  168. J$EXITVEC:            ;
  169.     RET            ; 159h
  170.     DB    0,0        ; 15ah
  171.                 ;
  172.                 ; Jump vectors needed by each overlay
  173.                 ;
  174. J$GOODBYE:            ;
  175.     JMP    GOODBYE        ; Disconnects modem by dropping dtr    15ch
  176. J$INITMOD:            ;
  177.     JMP    INITMOD        ; Initializes modem, autosets baudrate    15fh
  178. J$STUPR:JMP    STUPR        ; Set routine to change baudrate    162h
  179. J$SYSVR:JMP    SYSVR        ; Signon message            165h
  180.                 ;
  181. ;***************************************************************************
  182. ;*                                       *
  183. ;*  "AT" command strings, can be replaced in individual overlay if needed  *
  184. ;*                                       *
  185. ;***************************************************************************
  186.                 ;
  187. J$STRNGA: DS    3        ; 1200 bps "AT" string            168h
  188. J$STRNG1: DS    3        ; 2400 bps "AT" string            16bh
  189.                 ;
  190. ;***************************************************************************
  191. ;*                                       *
  192. ;*  Next fourteen lines should not be changed by user overlay as these go  *
  193. ;*  to specific locations in the main program, not in the overlay.       *
  194. ;*                                       *
  195. ;***************************************************************************
  196.                 ;
  197. J$CMDSPL:            ;
  198.     DS    3        ; Allows entry of baudrate on cmd line    16eh
  199. J$CRLF:    DS    3        ; Turns up one new line on display    171h
  200. J$DIAL:    DS    3        ; Start of dialing routine        174h
  201. J$DSCONT:            ;
  202.     DS    3        ; Terminates modem use            177h
  203. J$GOLST:DS    3        ; Printer routine, needed by apple //e    17ah
  204. J$ILPRT:DS    3        ; Prints an inline string, 0 to end    17dh
  205. J$INBUF:DS    3        ; Stores a keybd string for comparison    180h
  206. J$INLNCP:            ;
  207.     DS    3        ; Inline "compare strings" routine    183h
  208. J$INMDM:DS    3        ; Max .1 sec wait for modem character    186h
  209. J$RCVRSP:            ;
  210.     DS    3        ; For 3801 i/o use (tv-803)        189h
  211. J$SNDCHR:            ;
  212.     DS    3        ; Sends a character to the modem    18ch
  213. J$SNDSTR:            ;
  214.     DS    3        ; Sends a string to the modem, $ to end 18fh
  215. J$TIMER:DS    3        ; 1 second timer (amount in 'b' reg.)    192h
  216. J$NEW1:    DB    0,0,0        ; For future needs            195h
  217. J$NEW2:    DB    0,0,0        ; For future needs            198h
  218.                 ;
  219.                 ; For 2400 bps auto-stepdown units
  220.                 ;
  221. MANUAL:    DB    0        ; For manual selection flag        19bh
  222.                 ;
  223. J$300:    JMP    OK300        ; Sets baudrate to 300 baud        19ch
  224. J$1200:    JMP    OK1200        ; Sets baudrate to 1200 bps        19fh
  225. J$2400:    JMP    OK2400        ; Sets baudrate to 2400 bps        1a2h
  226.                 ;
  227. LOGPTR:    DW    LOGON        ; Pointer to display logon message    1a5h
  228. SYSVR:    CALL    J$ILPRT        ; Display the following line        1a7h
  229.     DB    'Version for Cromemco TUART modem port 30H' ; 1aah
  230.     DB    CR,LF,0        ;
  231.     RET            ; Go home
  232.                 ;
  233. ;***************************************************************************
  234. ;*                                       *
  235. ;*  NOTE:  You can change the SYSVER message to be longer or shorter.       *
  236. ;*  The end of your last routine should terminate by 0400H (601 bytes       *
  237. ;*  available after start of SYSVER).                       *
  238. ;*                                       *
  239. ;*-------------------------------------------------------------------------*
  240. ;*                                       *
  241. ;*  You can put in a message at this location which can be called up with  *
  242. ;*  (special character-L).  You can put in several lines.  End with a 0.   *
  243. ;*                                       *
  244. ;***************************************************************************
  245.                 ;
  246. LOGON:    DB    'S-100 Forever...' ; Logon message
  247.     DB    CR,LF,0        ;
  248.                 ;
  249. ;***************************************************************************
  250. ;*                                       *
  251. ;*    This routine normally sets DTR low for 300 ms to disconnect the    *
  252. ;*    phone.    As the TUART does not support DTR, this routine is deleted *
  253. ;*    from this overlay and NODTR is set true.  If your TUART has been   *
  254. ;*    modified to control DTR (using the spare 1488/1489 sections),       *
  255. ;*    patch the below routine accordingly.                   *
  256. ;*                                       *
  257. ;***************************************************************************
  258.                 ;
  259. GOODBYE:            ;
  260.     MVI    B,'S'-40H    ; X-off to stop host if needed
  261.     CALL    J$SNDCHR    ;
  262.     MVI    B,1        ; Wait a moment to let it react
  263.     CALL    J$TIMER        ;
  264.                 ;
  265.                 ; Command to set dtr low goes here
  266.                 ;
  267.     MVI    B,3        ; Delay 300 ms to hang up phone
  268.     CALL    J$TIMER        ;
  269.                 ;
  270.                 ; Command to set dtr high goes here
  271.                 ;
  272.     RET            ; Go home
  273.                 ;
  274.                 ; Sets tms 5501 to 8 bits, no parity, 1 stop
  275.                 ;
  276. INITMOD:            ;
  277.     LDA    MSPEED        ; Get the selected value
  278.     CPI    1        ; 300 bps
  279.     JZ    OK300        ;
  280.     CPI    5        ; 1200 bps
  281.     JZ    OK1200        ;
  282.     CPI    6        ; 2400 bps
  283.     JZ    OK2400        ;
  284.                 ;
  285.     JMP    STUPR1        ; Else ask what is wanted
  286.                 ;
  287. STUPR:    CALL    J$CMDSPL    ; Gives us cmdbuf+6
  288.     JNC    STUPR2        ;
  289.                 ;
  290. STUPR1:    LDA    HS2400        ; 2400 baud?
  291.     ORA    A        ; Force flags
  292.     JZ    STUPR1A        ; No
  293.     CALL    J$ILPRT        ;
  294.     DB    'Input Baud Rate (300, 1200, 2400): ',0
  295.     JMP    AROUND        ; Around next
  296. STUPR1A:CALL    J$ILPRT        ;
  297.     DB    'Input Baud Rate (300, 1200): ',0
  298. AROUND:    LXI    D,BAUDBUF    ; Point to new input buffer
  299.     CALL    J$INBUF        ;
  300.     CALL    J$CRLF        ;
  301.     LXI    D,BAUDBUF+2    ;
  302.                 ;
  303. STUPR2:    CALL    J$INLNCP    ; Compare baudbuf+2 with chars. below
  304.     DB    '300',0        ; 300 baud
  305.     JNC    OK300        ; Go if got match
  306.     CALL    J$INLNCP    ;
  307.     DB    '1200',0    ; 1200 baud
  308.     JNC    OK1200        ;
  309.     CALL    J$INLNCP    ;
  310.     DB    '2400',0    ; 2400 baud
  311.     JNC    OK2400        ;
  312.     CALL    J$ILPRT        ; All matches failed, tell operator
  313.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0 ; Screwup
  314.     JMP    STUPR1        ; Try again
  315.                 ;
  316. OK300:    MVI    A,1        ; Mspeed 300 baud value
  317.     MVI    B,BD300        ; Get 300 baud parameters in b
  318.     JMP    LOADBD        ; Go load them
  319.                 ;
  320. OK1200:    MVI    A,5        ; Mspeed 1200 baud value
  321.     MVI    B,BD1200    ; Get 1200 baud parms in b
  322.     JMP    LOADBD        ; Go do it
  323.                 ;
  324.                 ;
  325. OK2400:    LDA    HS2400        ; 2400 baud supported?
  326.     ORA    A        ; Force flags
  327.     JZ    OK1200        ; No
  328.     MVI    A,6        ; Mspeed 2400 baud value
  329.     MVI    B,BD2400    ; Get 2400 baud parms in b
  330.     JMP    LOADBD        ; Go do it
  331.                 ;
  332. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  333.                 ;
  334. ;***************************************************************************
  335. ;*                                       *
  336. ;*    INIT:  This routine initializes 1 chanel of the Cromemco TUART.    *
  337. ;*    Accepts: Baud rate in B   Returns: Nothing.  Clobbers: Nothing.    *
  338. ;*    Calls:    Nothing.                           *
  339. ;*                                       *
  340. ;***************************************************************************
  341.                 ;
  342. INIT:    PUSH    PSW        ; Save acc
  343.     MVI    A,MDRSET    ; Get command
  344.     OUT    PORT+2        ; Device reset
  345.                 ;
  346.     MVI    A,MASK        ; Get interrupt mask
  347.     OUT    MSKP        ; Mask set
  348.                 ;
  349.     MOV    A,B        ; Get baud rate
  350.     OUT    BDR        ; Rate set
  351.     POP    PSW        ; Restore acc
  352.     RET            ; Go home
  353.                 ;
  354.                 ; Table of baudrate parameters
  355.                 ;
  356. BD300:    EQU    84H        ; 300 baud
  357. BD1200:    EQU    88H        ; 1200 baud
  358. BD2400:    EQU    90H        ; 2400 baud
  359.                 ;
  360. BAUDBUF:DB    10,0,0,0,0,0    ;
  361.     DB    0,0,0,0,0,0    ;
  362.                 ;
  363.                 ; Note: must terminate by 0400h
  364.                 ;
  365.     END            ; End
  366.  
  367.