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 / I2WM-3.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  12KB  |  392 lines

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