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 / I2AC-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  12KB  |  412 lines

  1.  
  2. ; I2AC-2.ASM - Actrix computer series overlay for IMP - 06/01/87
  3. ;
  4. ;        DART  at  5.0688 MHz  and  J5 serial port
  5. ;
  6. ; You will want to look this file over carefully. There are a number of
  7. ; options that you can use to configure the program to suit your taste.
  8. ; This file adapts THE J5 serial port on the ACTRIX COMPUTER to IMP.
  9. ;
  10. ; Edit this file for your preferences then follow the "TO USE:" example
  11. ; shown below.
  12. ;
  13. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  14. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  15. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  16. ; (The ESC will automatically be typed with no CTL-character present.)
  17. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  18. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  19. ; looking at the function key table, typing CTL-Z in command mode, etc.
  20. ;
  21. ; Use the "SET" command to change the baudrate when desired.  The value
  22. ; at MSPEED controls the baudrate when the program is first called up.
  23. ;
  24. ;    TO USE: First edit this file filling in answers for your own
  25. ;        equipment.  Then assemble with ASM.COM or equivalent
  26. ;        assembler.  Then use MLOAD to merge the the results
  27. ;        of this program to the original .COM file:
  28. ;
  29. ;        A>MLOAD IMP.COM=IMP.COM,I2AC-x.HEX
  30. ;
  31. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  32. ;
  33. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  34. ;        IMP245 to use it.        - Irv Hoff
  35. ;    
  36. ; 10/27/85  Rewritten for use with IMP    - Irv Hoff
  37. ;
  38. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  39. ;
  40. ;
  41. YES    EQU    0FFH
  42. NO    EQU    0
  43. ;
  44. ;
  45. ; Values shown are for a Z80 DART
  46. ;
  47. PORT    EQU    40H    ; Your base port (data or status)
  48. MDCTL1    EQU    PORT+2    ; Modem control port
  49. MDDATP    EQU    PORT    ; Modem data port
  50. MDRCV    EQU    01H    ; Modem receive ready
  51. MDSND    EQU    04H    ; Modem send ready bit
  52. MDTXE    EQU    01H    ; Modem send buffer empty, holding buffer empty
  53. ;
  54. ;
  55. ;-----------------------------------------------------------------------
  56. ;
  57. BDOS    EQU    05H    ; BDOS jump vector address
  58. DIRCON    EQU    06H    ; Direct console call
  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 = Clear screen, command mode only
  65. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  66. ;
  67. ;
  68. ;-----------------------------------------------------------------------
  69. ;
  70. ;
  71.     ORG    0100H
  72. ;
  73. ;
  74.     DS    3    ; Skip the data area below
  75. ;
  76. ;
  77. ; These routines and equates are at the beginning of the program so
  78. ; they can be patched by a monitor or overlay file without re-assembling
  79. ; the program.
  80. ;
  81. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  82.             ; 6=2400 7=4800 8=9600 9=19200 default
  83. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  84. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  85. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  86. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  87. RESVD1:     DB    NO    ; Reserved for special modems            108H
  88. RESVD2:     DB    NO    ; Reserved for special modems            109H
  89. ;
  90. ;
  91. CLEAR:     DB    '*'    ; Clear screen character (ESC not needed)    10AH
  92. CLOCK:     DB    50    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  93.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  94. BYTDLY:     DB    2    ; 0=0 delay  1=1ms  5=5 ms - 9=9 ms        10CH
  95.             ;   default time to send character in ter-
  96.             ;   minal mode file transfer for slow BBS
  97. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  98.             ;   default time for extra wait after CRLF
  99.             ;   in terminal mode file transfer
  100. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  101. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  102. ;.....
  103. ;
  104. ;
  105. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  106.             ;   mode (normally added by remote echo)
  107. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  108. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  109. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  110. ;.....
  111. ;
  112. ;
  113. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  114. EXITCHR: DB    'E'    ; Exit character                115H
  115. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  116. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  117. LOGCHR:     DB    'L'    ; Send logon                    118H
  118. LSTCHR:     DB    'P'    ; Toggle printer                119H
  119. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  120. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  121. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  122. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  123. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  124. ;.....
  125. ;
  126. ;
  127. ; Handles in/out ports for data and status
  128. ;
  129. I$MDCTL1: MVI    A,10H        ; Register 0, reset interrupts        11FH
  130.       OUT    MDCTL1        ;                    121H
  131.       IN    MDCTL1        ;                    123H
  132.       RET            ; IN modem control port         125H
  133.       DB    0,0,0        ; Spares if needed            126H
  134. ;
  135. I$MDTXE:  MVI    A,11H        ; Read register 1 for "all sent"    129H
  136.       OUT    MDCTL1        ; Select read register 1        12BH
  137.       IN    MDCTL1        ; (Needed for SIO or DART register 1    12DH
  138.       RET            ;                    12FH
  139.       DB    0,0,0        ;                    130H
  140. ;
  141. I$MDDATP: IN    MDDATP        ;                    133H
  142.       RET            ;                    135H
  143.       DB    0,0,0,0,0,0,0    ;                    136H
  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$BREAK:  JMP    SENDBRK        ; Break routine                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    'Version for Actrix computer with ' ;            1AAH
  228.       DB    'modem port J5 (40H)',CR,LF,0
  229.       RET
  230. ;.....
  231. ;
  232. ;
  233. ;-----------------------------------------------------------------------
  234. ;
  235. ; NOTE:  You can change the SYSVR message to be longer or shorter.  The
  236. ;     end of your last routine should terminate by 0400H (601 bytes
  237. ;     available after start of SYSVR).
  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    'Greetings from an Actrix computer user',CR,LF,0
  245. ;
  246. ;-----------------------------------------------------------------------
  247. ;
  248. ;
  249. ; This routine sets a 300 ms break tone
  250. ;
  251. SENDBRK:
  252.     MVI    A,0F8H        ; DTR normal, send break tone
  253.     JMP    GOODBYE1    ; So send the break tone
  254. ;.....
  255. ;
  256. ;
  257. ; This routine sets DTR low for 300 ms to disconnect the modem.
  258. ;
  259. GOODBYE:
  260.     MVI    A,5
  261.     OUT    MDCTL1        ; Send to the status port
  262.     MVI    A,78H        ; Turn off DTR and send break tone
  263. ;
  264. GOODBYE1:
  265.     OUT    MDCTL1
  266.     MVI    B,3        ; Delay 300 ms
  267.     CALL    J$TIMER
  268.     MVI    A,5
  269.     OUT    MDCTL1
  270.     MVI    A,0E8H        ; Restore normal, 8 bits, DTR on, etc.
  271.     OUT    MDCTL1
  272.     RET
  273. ;.....
  274. ;
  275. ;
  276. ; Baud rate change.  Sets counter circuit or CTC for baudrate in/out.
  277. ;
  278. INITMOD:
  279.     LDA    MSPEED        ; Get the selected value
  280.     CPI    1        ; 300 bps
  281.     JZ    OK300
  282.     CPI    5        ; 1200 bps
  283.     JZ    OK1200
  284.     CPI    6        ; 2400 bps
  285.     JZ    OK2400
  286.     CPI    8        ; 9600 bps
  287.     JZ    OK9600
  288.     JMP    STUPR1        ; Else ask what is wanted
  289. ;
  290. ;
  291. ; Baud rate change.  Sets counter circuit or CTC for baudrate in/out.
  292. ;
  293. INITMOD1:
  294.     MVI    A,18H        ; Reset the Z80SIO chip
  295.     OUT    MDCTL1        ; Send to the status port
  296. ;
  297.     MVI    A,04H        ; Select register
  298.     OUT    MDCTL1        ; Send to the status port
  299.     MVI    E,44H        ; Select X16 for all but 300 baud
  300.     LDA    MSPEED
  301. ;
  302.     CPI    1        ; CHECK FOR 300 BAUD
  303.     JNZ    $+5
  304.     MVI    E,0C4H        ; Select X64 just for 300 baud
  305.     MOV    A,E        ; Now have the correct multiplier
  306.     OUT    MDCTL1        ; Send to the status port
  307. ;
  308.     MVI    A,01H        ; Select register
  309.     OUT    MDCTL1        ; Send to the status port
  310.     MVI    A,00H        ; Disable interrupts
  311.     OUT    MDCTL1        ; Send to the status port
  312. ;
  313.     MVI    A,3        ; Select register
  314.     OUT    MDCTL1        ; Send to the status port
  315.     MVI    A,0C1H        ; Enable receive section
  316.     OUT    MDCTL1        ; Send to the status port
  317. ;
  318.     MVI    A,5        ; Select register
  319.     OUT    MDCTL1        ; Send to the status port
  320.     MVI    A,0E8H        ; DTR, RTS, 8-bits, enable send section
  321.     OUT    MDCTL1        ; Send to the status port
  322. ;
  323.     MVI    E,80H        ; Send an attention character to monitor
  324.     MVI    C,DIRCON
  325.     CALL    BDOS
  326. ;
  327.     MVI    E,14H        ; Set baud rate for J5
  328.     MVI    C,DIRCON
  329.     CALL    BDOS
  330. ;
  331.     MVI    E,80H        ; Send an attention character to monitor
  332.     MVI    C,DIRCON
  333.     CALL    BDOS
  334. ;
  335. INITMOD2:
  336.     MVI    A,28H        ; Get the baudrate value
  337.     MOV    E,A        ; Send to the monitor
  338.     MVI    C,DIRCON
  339.     CALL    BDOS
  340.     RET            ; Finished initializing
  341. ;.....
  342. ;
  343. ;
  344. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  345.     JNC    STUPR2
  346. ;
  347. STUPR1:    CALL    J$ILPRT
  348.     DB    'Input Baud Rate (300, 1200, 2400, 9600): ',0
  349.     LXI    D,BAUDBUF    ; Point to new input buffer
  350.     CALL    J$INBUF
  351.     CALL    J$CRLF
  352.     LXI    D,BAUDBUF+2
  353. ;
  354. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  355.     DB    '300',0
  356.     JNC    OK300        ; Go if got match
  357.     CALL    J$INLNCP
  358.     DB    '1200',0
  359.     JNC    OK1200
  360.     CALL    J$INLNCP
  361.     DB    '2400',0
  362.     JNC    OK2400
  363.     CALL    J$INLNCP
  364.     DB    '9600',0
  365.     JNC    OK9600
  366.     CALL    J$ILPRT        ; All matches failed, tell operator
  367.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  368.     JMP    STUPR1        ; Try again
  369. ;
  370. OK300:    MVI    A,1        ; MSPEED 300 baud value
  371.     MVI    B,BD300        ; Go load them
  372.     JMP    LOADBD
  373. ;
  374. OK1200:    MVI    A,5
  375.     MVI    B,BD1200
  376.     JMP    LOADBD
  377. ;
  378. OK2400:    XRA    A        ; Reset the manual baudrate flag
  379.     STA    MANUAL
  380.     MVI    A,6
  381.     MVI    B,BD2400
  382.     JMP    LOADBD
  383. ;
  384. OK9600:    MVI    A,8
  385.     MVI    B,BD9600
  386. ;
  387. LOADBD:    STA    MSPEED        ; Save baud rate
  388.     MOV    A,B
  389.     STA    INITMOD2+1    ; Save accompanying transfer speed
  390.     JMP    INITMOD1    ; Reinitialize to new baudrate, done
  391. ;.....
  392. ;
  393. ;
  394. ; Table of baudrate parameters
  395. ;
  396. BD300    EQU    40        ; 40 X64
  397. BD1200    EQU    40        ; 40 X16
  398. BD2400    EQU    20        ; 20 X16
  399. BD9600    EQU    5        ; 5 X16
  400. ;
  401. BAUDBUF:DB    10,0,0,0,0,0
  402.     DB    0,0,0,0,0,0
  403. ;
  404. ;                   end
  405. ;-----------------------------------------------------------------------
  406. ;
  407. ; NOTE:  Must terminate prior to 0400H
  408. ;
  409. ;
  410.     END
  411.  
  412.