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 / BEEHIVE / COMMS / IMP-OV5B.LBR / I2EX-2.AZM / I2EX-2.ASM
Assembly Source File  |  2000-06-30  |  12KB  |  451 lines

  1. ; I2EX-2.ASM - Excalibur 64 overlay for IMP - 03/01/88
  2. ;
  3. ;       USES 8251 I/O and 8253 baudrate generator
  4. ;
  5. ; You will want to look this file over carefully. There are a number of
  6. ; options that you can use to configure the program to suit your taste.
  7. ; This file adapts the Excalibur to the IMP modem program.
  8. ;
  9. ; Edit this file for your preferences then follow the "TO USE:" example
  10. ; shown below.
  11. ;
  12. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  13. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  14. ; normally an ESC.  For example, ESC Z.  In this case put 'Z' at CLEAR:
  15. ; (The ESC will automatically be typed with no CTL-character present.)
  16. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  17. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  18. ; looking at the function key table, typing CTL-Z in command mode, etc.
  19. ;
  20. ; Use the "SET" command to change the baudrate when desired.  The value
  21. ; at MSPEED controls the baudrate when the program is first called up.
  22. ;
  23. ;    TO USE: First edit this file filling in answers for your own
  24. ;        equipment.  Then assemble with ASM.COM or equivalent
  25. ;        assembler.  Then use MLOAD to merge into the main file:
  26. ;
  27. ;        MLOAD IMP.COM=IMP.COM,I2MD-x.HEX
  28. ;
  29. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  30. ;
  31. ; 19/01/87 - Written to work with Excalibur 64 by Maurice Copeland
  32. ;
  33. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  34. ;
  35. ;
  36. YES    EQU    0FFH
  37. NO    EQU    0
  38. ;
  39. ;
  40. ; Values shown are for a 8251
  41. ;
  42. PORT    EQU    10H    ; Your base port (data or status)
  43. MDCTL1    EQU    11H    ; Modem control port
  44. MDDATP    EQU    10H    ; Modem data port
  45. MDRCV    EQU    02H    ; Modem receive ready
  46. MDSND    EQU    01H    ; Modem send ready bit
  47. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  48. ;
  49. C8253:    EQU    23H    ; Baudrate command port for control/status
  50. BAUD1:    EQU    21H    ; Baudrate select port no.1
  51. BAUD2:    EQU    22H    ; Baudrate select port no.2
  52. ;
  53. MDMODE    EQU    37H    ; Insures 8251 is out of mode with DTR high
  54. MDRSET    EQU    42H    ; Resets USART for additional commands
  55. MDSET1    EQU    4EH    ; 1 stop bit, no parity, 8 bits, x16
  56. MDSET2    EQU    4DH    ; 1 stop bit, no parity, 8 bits, x1
  57. MDCOM    EQU    15H    ; Reset RTS, error flags, RCV, DTR, TX ready
  58. RTSOFF    EQU    0    ; Compare for 75/1200 baud
  59. ;
  60. ;
  61. ;-----------------------------------------------------------------------
  62. ;
  63. ESC    EQU    '['-40H    ; ^[ = Escape
  64. BELL    EQU    'G'-40H    ; ^G = Bell character
  65. LF    EQU    'J'-40H    ; ^J = Linefeed
  66. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  67. CR    EQU    'M'-40H    ; ^M = Carriage return
  68. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  69. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  70. ;
  71. ;
  72. ;-----------------------------------------------------------------------
  73. ;
  74. ;
  75.     ORG    0100H
  76. ;
  77. ;
  78.     DS    3        ; Skip the data area below
  79. ;
  80. ;
  81. ; These routines and equates are at the beginning of the program so
  82. ; they can be patched by a monitor or overlay file without re-assembling
  83. ; the program.
  84. ;
  85. MSPEED:     DB    5    ; 0=75 1=300 2=450 3=600 4=710 5=1200        103H
  86.             ; 6=2400 7=4800 8=9600
  87. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  88. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  89. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  90. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  91. RESVD1:     DB    NO    ; Reserved for special modems            108H
  92. RESVD2:     DB    NO    ; Reserved for special modems            109H
  93. ;
  94. ;
  95. CLEAR:     DB    'Z'    ; Clear screen character (ESC not needed)    10AH
  96. CLOCK:     DB    40    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  97.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  98. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  99.             ;   default time to send character in ter-
  100.             ;   minal mode file transfer for slow BBS
  101. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  102.             ;   default time for extra wait after CRLF
  103.             ;   in terminal mode file transfer
  104. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  105. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  106. ;.....
  107. ;
  108. ;
  109. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  110.             ;   mode (normally added by remote echo)
  111. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  112. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  113. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  114. ;.....
  115. ;
  116. ;
  117. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  118. EXITCHR: DB    'E'    ; Exit character                115H
  119. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  120. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  121. LOGCHR:     DB    'L'    ; Send logon                    118H
  122. LSTCHR:     DB    'P'    ; Toggle printer                119H
  123. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  124. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  125. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  126. SPARE1:     DB    0    ; For future development            11DH
  127. NODTR:     DB    NO    ; Yes if no DTR and need +++ to disconnect    11EH
  128. ;.....
  129. ;
  130. ;
  131. ; Handles in/out ports for data and status
  132. ;
  133. I$MDCTL1: IN    MDCTL1        ;                    11FH
  134.       RET            ; IN modem control port         121H
  135.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  136. ;
  137. I$MDTXE:  IN    MDCTL1        ; (Needed for SIO or DART register 1    129H
  138.       RET            ;                    12BH
  139.       DB    0,0,0,0,0,0,0    ;                    12CH
  140. ;
  141. I$MDDATP: IN    MDDATP        ;                    133H
  142.       RET              ;                    135H
  143.       DB    0,0,0,0,0,0,0    ; Spares if needed            13AH
  144. ;
  145. O$MDDATP: OUT    MDDATP        ;                    13DH
  146.       RET            ; OUT modem data port            13FH
  147.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  148. ;.....
  149. ;
  150. ;
  151. A$MDRCV:  ANI    MDRCV        ;                    147H
  152.       RET            ;                    149H
  153. ;
  154. C$MDRCV:  CPI    MDRCV        ;                    14AH
  155.       RET            ;                    14CH
  156. ;
  157. A$MDSND:  ANI    MDSND        ;                    14DH
  158.       RET            ;                    14FH
  159. ;
  160. C$MDSND:  CPI    MDSND        ;                    150H
  161.       RET            ;                    152H
  162. ;
  163. A$MDTXE:  ANI    MDTXE        ;                    153H
  164.       RET            ;                    155H
  165. ;
  166. C$MDTXE:  CPI    MDTXE        ;                    156H
  167.       RET            ;                    158H
  168. ;.....
  169. ;
  170. ;
  171. ; Special exit vector, used by some computers to reset interrupt vectors
  172. ;
  173. J$EXITVEC:RET            ;                    159H
  174.       DB    0,0        ;                    15AH
  175. ;.....
  176. ;
  177. ;
  178. ; Jump vectors needed by each overlay
  179. ;
  180. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  181. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  182. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  183. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  184. ;.....
  185. ;
  186. ;
  187. ; "AT" command strings, can be replaced in individual overlay if needed
  188. ;
  189. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  190. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  191. ;
  192. ;
  193. ; Next fourteen lines should not be changed by user overlay as these go
  194. ; to specific locations in the main program, not in the overlay.
  195. ;
  196. ;
  197. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  198. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  199. J$DIAL:      DS    3        ; Start of dialing routine        174H
  200. J$DSCONT: DS    3        ; Terminates modem use            177H
  201. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  202. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  203. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  204. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  205. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  206. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  207. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  208. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  209. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  210. J$NEW1:      DB    0,0,0        ; For future needs            195H
  211. J$NEW2:      DB    0,0,0        ; For future needs            198H
  212. ;.....
  213. ;
  214. ;
  215. ; For 2400 bps auto-stepdown units
  216. ;
  217. MANUAL:      DB    0        ; For manual selection flag        19BH
  218. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  219. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  220. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  221. ;.....
  222. ;
  223. ;
  224. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  225. ;
  226. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  227.       DB    'EXCALIBUR-64 version v2.0 by Maurice Copeland'     ;    1AAH
  228.       DB    CR,LF,0
  229.       RET
  230. ;.....
  231. ;
  232. ;
  233. ;-----------------------------------------------------------------------
  234. ;
  235. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  236. ;     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. LOGON:    DB    'Hello from a happy Excalibur owner...',CR,LF,0
  245. ;
  246. ;-----------------------------------------------------------------------
  247. ;
  248. BD1:    DB    52
  249. BD1A:    DB    0
  250. BD2:    DB    52
  251. BD2A:    DB    0
  252. ;
  253. ; This routine sets DTR low for 300 ms to disonnect the phone
  254. ;
  255. GOODBYE:
  256.     MVI    B,'S'-40H    ; X-off to stop host if needed
  257.     CALL    J$SNDCHR
  258.     MVI    B,1        ; Wait a moment to let it react
  259.     CALL    J$TIMER
  260.     MVI    A,0AH        ; Send break, turn off DTR
  261.     OUT    MDCTL1        ; Send to status port
  262.     MVI    B,3        ; Delay 300 ms to hang up phone
  263.     CALL    J$TIMER
  264.     MVI    A,15H        ; Normal send/receive with DTR
  265.     OUT    MDCTL1        ; Send to status port
  266.     RET
  267. ;
  268. DLY300:    MVI    B,3
  269.     CALL    J$TIMER
  270.     RET
  271. ;
  272. ; Sets 8253/8251 to default value of 1200 baud
  273. ;
  274. INITMOD:MVI    A,5
  275.     CPI    RTSOFF        ;IS IT 0 FOR 75/1200
  276.     JNZ    INSPD1        ;NO. BYPASS ALL THIS
  277.     MVI    A,35H        ;YES. MAKE RTS LOW
  278.     STA    INITMOD1+1    ;AND STORE IT
  279.     MVI    A,5
  280.     STA    MSPEED
  281.     XRA    A
  282.     JP    INSPD2
  283. ;
  284. INSPD1:    STA    MSPEED
  285.     MVI    A,15H
  286.     STA    INITMOD1+1
  287.     XRA    A
  288. ;
  289. INSPD2:    OUT    MDCTL1
  290.     IN    MDCTL1
  291.     IN    MDCTL1
  292.     MVI    A,76H
  293.     OUT    C8253
  294.     LDA    BD1
  295.     OUT    BAUD1
  296.     LDA    BD1A
  297.     OUT    BAUD1
  298.     MVI    A,0B6H
  299.     OUT    C8253
  300.     LDA    BD2
  301.     OUT    BAUD2
  302.     LDA    BD2A
  303.     OUT    BAUD2
  304.     MVI    A,40H
  305.     OUT    MDCTL1
  306.     CALL    DLY300
  307. PARAM:    MVI    A,78
  308.     OUT    MDCTL1
  309. ;
  310. INITMOD1:
  311.     MVI    A,15H
  312.     OUT    MDCTL1
  313.     IN    MDCTL1
  314.     IN    MDCTL1
  315.     XRA    A
  316.     RET
  317. ;
  318.     LDA    MSPEED        ; Get the selected value
  319.     CPI    0        ; 75/1200
  320.     JZ    OK7512
  321.     CPI    1        ; 300 bps
  322.     JZ    OK300
  323.     CPI    5        ; 1200 bps
  324.     JZ    OK1200
  325.     CPI    6        ; 2400 bps
  326.     JZ    OK2400
  327.     CPI    7        ; 4800 bps
  328.     JZ    OK4800
  329.     CPI    8        ; 9600 bps
  330.     JZ    OK9600
  331.     JMP    STUPR1        ; Else ask what is wanted
  332. ;.....
  333. ;
  334. ;
  335. ;
  336. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  337.     JNC    STUPR2
  338. ;
  339. STUPR1:    CALL    J$ILPRT
  340.     DB    'Input Baud Rate'
  341.     DB    ' (300, [7512, 1275], 1200, 2400, 4800, 9600): ',0
  342.     LXI    D,BAUDBUF    ; Point to new input buffer
  343.     CALL    J$INBUF
  344.     CALL    J$CRLF
  345.     LXI    D,BAUDBUF+2
  346. ;
  347. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  348.     DB    '300',0
  349.     JNC    OK300        ; Go if got match
  350.     CALL    J$INLNCP
  351.     DB    '7512',0
  352.     JNC    OK7512
  353.     CALL    J$INLNCP
  354.     DB    '1275',0
  355.     JNC    OK1275
  356.     CALL    J$INLNCP
  357.     DB    '1200',0
  358.     JNC    OK1200
  359.     CALL    J$INLNCP
  360.     DB    '2400',0
  361.     JNC    OK2400
  362.     CALL    J$INLNCP
  363.     DB    '4800',0
  364.     JNC    OK4800
  365.     CALL    j$INLNCP
  366.     DB    '9600',0
  367.     JNC    OK9600
  368.     CALL    J$ILPRT        ; All matches failed, tell operator
  369.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  370.     JMP    STUPR1        ; Try again
  371. ;
  372. OK300:    MVI    A,1        ; MSPEED 300 baud value
  373.     STA    INITMOD+1
  374.     CALL    PARAM1
  375.     MVI    A,208
  376.     JMP    PARAM2
  377. ;
  378. OK7512:    MVI    A,0
  379.     STA    INITMOD+1
  380.     STA    BD2A
  381.     MVI    A,65
  382.     STA    BD1
  383.     MVI    A,52
  384.     STA    BD2
  385.     MVI    A,3
  386.     STA    BD1A
  387.     CALL    PARAM1
  388.     JMP    INITMOD
  389. ;
  390. OK1275:    MVI    A,5
  391.     STA    INITMOD+1
  392.     MVI    A,52
  393.     STA    BD1
  394.     MVI    A,0
  395.     STA    BD1A
  396.     MVI    A,65
  397.     STA    BD2
  398.     MVI    A,3
  399.     STA    BD2A
  400.     CALL    PARAM1
  401.     JMP    INITMOD
  402. ;
  403. OK1200:    MVI    A,5
  404.     STA    INITMOD+1
  405.     CALL    PARAM1
  406.     MVI    A,52
  407.     JMP    PARAM2
  408. ;
  409. OK2400:    MVI    A,6
  410.     STA    INITMOD+1
  411.     CALL    PARAM1
  412.     MVI    A,26
  413.     JMP    PARAM2
  414. ;
  415. OK4800:    MVI    A,7
  416.     STA    INITMOD+1
  417.     CALL    PARAM1
  418.     MVI    A,13
  419.     JMP    PARAM2
  420. ;
  421. OK9600:    MVI    A,8
  422.     STA    INITMOD+1
  423.     MVI    A,77
  424.     STA    PARAM+1
  425.     MVI    A,107
  426.     STA    BD1
  427.     MVI    A,104
  428.     STA    BD2
  429.     JMP    PARAM3
  430. ;
  431. PARAM1:    MVI    A,78
  432.     STA    PARAM+1
  433.     RET
  434. ;
  435. PARAM2:    STA    BD1
  436.     STA    BD2
  437. PARAM3:    MVI    A,0
  438.     STA    BD1A
  439.     STA    BD2A
  440.     JMP    INITMOD
  441. ;
  442. BAUDBUF:DB    10,0,0,0,0,0
  443.     DB    0,0,0,0,0,0
  444. ;
  445. ;                   end
  446. ;-----------------------------------------------------------------------
  447. ;
  448. ; NOTE: Must terminate by 0400H
  449. ;
  450.     END
  451.