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 / I2ME-3.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  11KB  |  398 lines

  1.  
  2. ; I2ME-3.ASM - MORROW MD5/11 overlay file for IMP - 06/01/87
  3. ;
  4. ;                 Z80 SIO
  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 MD5/11 computer to IMP.COM.
  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 into the main file:
  27. ;
  28. ;        MLOAD IMP.COM=IMP.COM,I2MD-x.HEX
  29. ;
  30. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  31. ;
  32. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  33. ;        IMP245 to use it.            - Irv Hoff
  34. ;
  35. ; 01/27/87  Added 19200 bps selection and choice of printer or aux-
  36. ;        iliary ports            - Irv Hoff
  37. ;
  38. ; 10/27/85  Revised Irv Hoff's Epson overlay to work with MD5/11
  39. ;                        - Phil Tobias
  40. ;
  41. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  42. ;
  43. ;
  44. YES    EQU    0FFH
  45. NO    EQU    0
  46. ;
  47. ;
  48. ; Values shown are for a Z80 SIO
  49. ;
  50. ; Printer port     = 62h for data and 51h for baudrate generator
  51. ; Auxiliary port = 70h for data and 50h for baudrate generator
  52. ;
  53. PORT    EQU    62H    ; Your base port (data or status)
  54. MDCTL1    EQU    PORT+1    ; Modem control port
  55. MDDATP    EQU    PORT    ; Modem data port
  56. MDRCV    EQU    01H    ; Modem receive ready
  57. MDSND    EQU    04H    ; Modem send ready bit
  58. MDTXE    EQU    01H    ; Modem send buffer empty, holding buffer empty
  59. ;
  60. BRPORT    EQU    51H    ; Timer port for baudrate generator
  61. ;
  62. ;
  63. ;-----------------------------------------------------------------------
  64. ;
  65. ESC    EQU    '['-40H    ; ^[ = Escape
  66. BELL    EQU    'G'-40H    ; ^G = Bell character
  67. LF    EQU    'J'-40H    ; ^J = Linefeed
  68. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  69. CR    EQU    'M'-40H    ; ^M = Carriage return
  70. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  71. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  72. ;
  73. ;
  74. ;-----------------------------------------------------------------------
  75. ;
  76. ;
  77.     ORG    0100H
  78. ;
  79. ;
  80.     DS    3    ; Skip the data area below
  81. ;
  82. ;
  83. ; These routines and equates are at the beginning of the program so
  84. ; they can be patched by a monitor or overlay file without re-assembling
  85. ; the program.
  86. ;
  87. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  88.             ; 6=2400 7=4800 8=9600 9=19200 default
  89. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  90. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  91. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  92. PROMODM: DB    NO    ; Yes=Prometheus ProModem 1200 bps        107H
  93. RESVD1:     DB    NO    ; Reserved for special modems            108H
  94. RESVD2:     DB    NO    ; Reserved for special modems            109H
  95. ;
  96. ;
  97. CLEAR:     DB    1AH    ; Clear screen character (ESC not needed)    10AH
  98. CLOCK:     DB    40    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  99.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  100. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  101.             ;   default time to send character in ter-
  102.             ;   minal mode file transfer for slow BBS
  103. CRDLY:     DB    2    ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  104.             ;   default time for extra wait after CRLF
  105.             ;   in terminal mode file transfer
  106. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  107. TCHPUL:     DB    'T'    ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  108. ;.....
  109. ;
  110. ;
  111. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  112.             ;   mode (normally added by remote echo)
  113. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  114. CRCDFLT: DB    YES    ; Yes=default to CRC checking            112H
  115. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  116. ;.....
  117. ;
  118. ;
  119. EXTCHR:     DB    ESC    ; Precedes local control character
  120.             ;
  121. EXITCHR: DB    'E'    ; Exit        character                115H
  122. FILESND: DB    'F'    ; Send file  when  in  terminal  mode        116H
  123. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  124. LOGCHR:     DB    'L'    ; Send logon                    118H
  125. LSTCHR:     DB    'P'    ; Toggle printer                119H
  126. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  127. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  128. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  129. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  130. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  131. ;.....
  132. ;
  133. ;
  134. ; Handles in/out ports for data and status
  135. ;
  136. I$MDCTL1: MVI    A,10H        ; Register 0, reset interrupts        11FH
  137.       OUT    MDCTL1        ;                    121H
  138.       IN    MDCTL1        ;                    123H
  139.       RET            ;                    125H
  140.       DB    0,0,0        ; Spares if needed            126H
  141. ;
  142. I$MDTXE:  MVI    A,11H        ; Read register 1 for "all sent"    129H
  143.       OUT    MDCTL1        ;                    12BH
  144.       IN    MDCTL1        ;                    12DH
  145.       RET            ;                    12FH
  146.       DB    0,0,0        ;                    130H
  147. ;
  148. I$MDDATP: IN    MDDATP        ;                    133H
  149.       RET            ;                    135H
  150.       DB    0,0,0,0,0,0,0    ;                    136H
  151. ;
  152. O$MDDATP: OUT    MDDATP        ;                    13DH
  153.       RET            ; OUT modem data port            13FH
  154.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  155. ;.....
  156. ;
  157. ;
  158. A$MDRCV:  ANI    MDRCV        ;                    147H
  159.       RET            ;                    149H
  160. ;
  161. C$MDRCV:  CPI    MDRCV        ;                    14AH
  162.       RET            ;                    14CH
  163. ;
  164. A$MDSND:  ANI    MDSND        ;                    14DH
  165.       RET            ;                    14FH
  166. ;
  167. C$MDSND:  CPI    MDSND        ;                    150H
  168.       RET            ;                    152H
  169. ;
  170. A$MDTXE:  ANI    MDTXE        ;                    153H
  171.       RET            ;                    155H
  172. ;
  173. C$MDTXE:  CPI    MDTXE        ;                    156H
  174.       RET            ;                    158H
  175. ;.....
  176. ;
  177. ;
  178. ; Special exit vector, used by some computers to reset interrupt vectors
  179. ;
  180. J$EXITVEC:RET            ;                    159H
  181.       DB    0,0        ;                    15AH
  182. ;.....
  183. ;
  184. ;
  185. ; Jump vectors needed by each overlay
  186. ;
  187. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  188. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  189. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  190. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  191. ;.....
  192. ;
  193. ;
  194. ; "AT" command strings, can be replaced in individual overlay if needed
  195. ;
  196. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  197. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  198. ;
  199. ;
  200. ; Next fourteen lines should not be changed by user overlay as these go
  201. ; to specific locations in the main program, not in the overlay.
  202. ;
  203. ;
  204. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  205. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  206. J$DIAL:      DS    3        ; Start of dialing routine        174H
  207. J$DSCONT: DS    3        ; Terminates modem use            177H
  208. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  209. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  210. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  211. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  212. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  213. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  214. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  215. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  216. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  217. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  218. J$NEW2:      DB    0,0,0        ; For future needs            198H
  219. ;.....
  220. ;
  221. ;
  222. ; For 2400 bps auto-stepdown units
  223. ;
  224. MANUAL:      DB    0        ; For manual selection flag        19BH
  225. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  226. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  227. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  228. ;.....
  229. ;
  230. ;
  231. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  232. ;
  233. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  234.       DB    '  For MORROW MD5/11 AUX modem port' ;            1AAH
  235.       DB    CR,LF,0
  236.       RET
  237. ;.....
  238. ;
  239. ;
  240. ;-----------------------------------------------------------------------
  241. ;
  242. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  243. ;     end of your last routine should terminate by 0400H (601 bytes
  244. ;     available after start of SYSVER).
  245. ;
  246. ;-----------------------------------------------------------------------
  247. ;
  248. ; You can put in a message at this location which can be called up with
  249. ; (special character-L).  You can put in several lines.  End with a 0.
  250. ;
  251. LOGON:      DB    'Hello from a Morrow computer user',CR,LF,0
  252. ;
  253. ;-----------------------------------------------------------------------
  254. ;
  255. ;
  256. ; This routine sets a 300 ms break tone
  257. ;
  258. SENDBRK:
  259.     MVI    A,5
  260.     OUT    MDCTL1        ; Send to the status port
  261.     MVI    A,0F8H        ; DTR normal, send break tone
  262.     JMP    GOODBYE1    ; Go send the break tone
  263. ;.....
  264. ;
  265. ;
  266. ; This routine sets DTR low for 300 ms to disconnect the modem.
  267. ;
  268. GOODBYE:
  269.     MVI    A,5
  270.     OUT    MDCTL1        ; Send to the status port
  271.     MVI    A,78H        ; Turn off DTR and send break tone
  272. ;
  273. GOODBYE1:
  274.     OUT    MDCTL1
  275.     MVI    B,3        ; Delay 300 ms
  276.     CALL    J$TIMER
  277.     MVI    A,5
  278.     OUT    MDCTL1
  279.     MVI    A,0E8H        ; Restore normal, 8 bits, DTR on, etc.
  280.     OUT    MDCTL1
  281.     RET
  282. ;.....
  283. ;
  284. ;
  285. ; Morrow MD5/11 initialization -- sets Z80 SIO for send and receive
  286. ; baudrate.
  287. ;
  288. INITMOD:MVI    A,00H        ; Select register
  289.     OUT    MDCTL1
  290.     MVI    A,18H        ; Throw out of mode
  291.     OUT    MDCTL1
  292.     MVI    A,04H        ; Select register
  293.     OUT    MDCTL1
  294.     MVI    A,044H        ; Set ASCII parameters (44=1, 4C=2)
  295.     OUT    MDCTL1
  296.     MVI    A,03H        ; Select register
  297.     OUT    MDCTL1
  298.     MVI    A,0C1H        ; Enable receive
  299.     OUT    MDCTL1
  300.     MVI    A,05H        ; Select register
  301.     OUT    MDCTL1
  302.     MVI    A,0EAH        ; Enable send, DTR, RTS
  303.     OUT    MDCTL1
  304. ;
  305.     LDA    MSPEED        ; Get the selected value
  306.     CPI    1        ; 300 bps
  307.     JZ    OK300
  308.     CPI    5        ; 1200 bps
  309.     JZ    OK1200
  310.     CPI    6        ; 2400 bps
  311.     JZ    OK2400
  312.     CPI    8        ; 9600 bps
  313.     JZ    OK9600
  314.     CPI    9        ; 9600 bps
  315.     JZ    OK19200
  316.     JMP    STUPR1        ; Else ask what is wanted
  317. ;.....
  318. ;
  319. ;
  320. ; Sets the modem speed via the SET command.
  321. ;
  322. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  323.     JNC    STUPR2
  324. ;
  325. STUPR1:    CALL    J$ILPRT
  326.     DB    'Input Baud Rate (300, 1200, 2400, 9600, 19200): ',0
  327.     LXI    D,BAUDBUF    ; Point to new input buffer
  328.     CALL    J$INBUF
  329.     CALL    J$CRLF
  330.     LXI    D,BAUDBUF+2
  331. ;
  332. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  333.     DB    '300',0
  334.     JNC    OK300        ; Go if got match
  335.     CALL    J$INLNCP
  336.     DB    '1200',0
  337.     JNC    OK1200
  338.     CALL    J$INLNCP
  339.     DB    '2400',0
  340.     JNC    OK2400
  341.     CALL    J$INLNCP
  342.     DB    '9600',0
  343.     JNC    OK9600
  344.     CALL    J$INLNCP
  345.     DB    '19200',0
  346.     JNC    OK19200
  347.     CALL    J$ILPRT        ; All matches failed, tell operator
  348.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  349.     JMP    STUPR1        ; Try again
  350. ;
  351. OK300:    MVI    A,1        ; MSPEED 300 baud value
  352.     LXI    H,BD300
  353.     JMP    LOADBD
  354. ;
  355. OK1200:    MVI    A,5
  356.     LXI    H,BD1200
  357.     JMP    LOADBD
  358. ;
  359. OK2400:    XRA    A
  360.     STA    MANUAL
  361.     MVI    A,6
  362.     LXI    H,BD2400
  363.     JMP    LOADBD
  364. ;
  365. OK9600:    MVI    A,8
  366.     LXI    H,BD9600
  367.     JMP    LOADBD
  368. ;
  369. OK19200:MVI    A,9
  370.     LXI    H,BD19200
  371. ;
  372. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  373.     MOV    A,L        ; LSP of baudrate
  374.     OUT    BRPORT
  375.     MOV    A,H        ; MSP of baudrate
  376.     OUT    BRPORT
  377.     RET
  378. ;.....
  379. ;
  380. ;
  381. ; Table of baudrate parameters
  382. ;
  383. BD300    EQU    832        ; 300 baud
  384. BD1200    EQU    208        ; 1200 bps
  385. BD2400    EQU    104        ; 2400 bps
  386. BD9600    EQU    26        ; 9600 bps
  387. BD19200    EQU    13        ; 19200 bps
  388. ;
  389. BAUDBUF:DB    10,0,0,0,0,0
  390.     DB    0,0,0,0,0,0
  391. ;
  392. ;                   end
  393. ;-----------------------------------------------------------------------
  394. ;
  395. ; NOTE: Must terminate prior to 0400H
  396. ;
  397.     END
  398.