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 / I2HZ-6.AZM / I2HZ-6.ASM
Assembly Source File  |  2000-06-30  |  13KB  |  413 lines

  1.  
  2. ; I2HZ-5.ASM - Heath/Zenith - 100 overlay for IMP - 06/01/87
  3. ;
  4. ;       2661 I/O, built-in baudrate generator at 4.9152 MHz
  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 places adapts the Heath/Zenith "100" series 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,I2HZ-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. ; 02/12/86  Added Function keys for the Z-100 as well as 25th line
  36. ;        (status line) display.  These F-keys execute terminal mode
  37. ;        commands and are separate from the ESC-<number> sequences
  38. ;        already present in IMP.  25th line display is currently set
  39. ;        for a green indication of key assignments.    This is a color
  40. ;        which will illuminate monochrome and and color monitors
  41. ;        alike.  (Uses: F0 thru F6 keys and the Home key.)
  42. ;                        - Hampton Childress
  43. ;
  44. ; 09/07/85  Added 19200 Baud            - Fred Townsend
  45. ; 07/17/85  Written to work with IMP        - Irv Hoff
  46. ;
  47. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  48. ;
  49. ;
  50. YES    EQU    0FFH
  51. NO    EQU    0
  52. ;
  53. ;
  54. ; Values shown are for a 2661B I/O
  55. ;
  56. PORT    EQU    0ECH    ; Your base port (data or status)
  57. MDCTL1    EQU    PORT+1    ; Modem control port
  58. MDDATP    EQU    PORT    ; Modem data port
  59. MDRCV    EQU    02H    ; Modem receive ready
  60. MDSND    EQU    01H    ; Modem send ready bit
  61. MDTXE    EQU    05H    ; Modem send buffer empty, holding buffer empty
  62. ;
  63. ;
  64. ;-----------------------------------------------------------------------
  65. ;
  66. ESC    EQU    '['-40H    ; ^[ = Escape
  67. BELL    EQU    'G'-40H    ; ^G = Bell character
  68. LF    EQU    'J'-40H    ; ^J = Linefeed
  69. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  70. CR    EQU    'M'-40H    ; ^M = Carriage return
  71. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  72. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  73. ;
  74. ;
  75. ;-----------------------------------------------------------------------
  76. ;
  77. ; Change the clock speed if needed, to match your system.  The 2661B
  78. ; normally runs 4.9152 MHz.
  79. ;
  80. ;
  81.      ORG    0100H
  82. ;
  83. ;
  84.      DS    3    ; Skip the data area below
  85. ;
  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
  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    'E'    ; Clear screen character (ESC not needed)    10AH
  98. CLOCK:     DB    49    ; 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    '['-40H    ; ESC = preceeds local control character    114H
  120. EXITCHR: DB    'J'    ; Exit character            (F0)    115H
  121. FILESND: DB    'W'    ; Send file when in terminal mode    (F5)    116H
  122. NOCONCT: DB    'P'    ; Disconnect from phone line        (F6)    117H
  123. LOGCHR:     DB    'S'    ; Send logon                (F1)    118H
  124. LSTCHR:     DB    'T'    ; Toggle printer            (F2)    119H
  125. UNSAVCH: DB    'V'    ; Close input text buffer        (F4)    11AH
  126. SAVECHR: DB    'U'    ; Open input text buffer        (F3)    11BH
  127. CLEARS:     DB    'H'    ; Clears screen, terminal mode        (Home)    11CH
  128. BRKCHR:     DB    'Q'    ; Send a break tone                11DH
  129. NODTR:     DB    NO    ; YES if no DTR and need ATH0 to disconnect    11EH
  130. ;.....
  131. ;
  132. ;
  133. ; Handles in/out ports for data and status
  134. ;
  135. I$MDCTL1: IN    MDCTL1        ;                    11FH
  136.       RET            ; IN modem control port         121H
  137.       DB    0,0,0,0,0,0,0    ; Spares if needed            122H
  138. ;
  139. I$MDTXE:  IN    MDCTL1        ; (Needed for SIO or DART register 1    129H
  140.       RET            ;                    12BH
  141.       DB    0,0,0,0,0,0,0    ;                    12CH
  142. ;
  143. I$MDDATP: IN    MDDATP        ;                    133H
  144.       RET            ;                    135H
  145.       DB    0,0,0,0,0,0,0    ;                    136H
  146. ;
  147. O$MDDATP: OUT    MDDATP        ;                    13DH
  148.       RET            ; OUT modem data port            13FH
  149.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  150. ;.....
  151. ;
  152. ;
  153. A$MDRCV:  ANI    MDRCV        ;                    147H
  154.       RET            ;                    149H
  155. ;
  156. C$MDRCV:  CPI    MDRCV        ;                    14AH
  157.       RET            ;                    14CH
  158. ;
  159. A$MDSND:  ANI    MDSND        ;                    14DH
  160.       RET            ;                    14FH
  161. ;
  162. C$MDSND:  CPI    MDSND        ;                    150H
  163.       RET            ;                    152H
  164. ;
  165. A$MDTXE:  ANI    MDTXE        ;                    153H
  166.       RET            ;                    155H
  167. ;
  168. C$MDTXE:  CPI    MDTXE        ;                    156H
  169.       RET            ;                    158H
  170. ;.....
  171. ;
  172. ;
  173. ; Special exit vector, used by some computers to reset interrupt vectors
  174. ; or in this case, to clear the 25th line and clear the screen.
  175. ;
  176. J$EXITVEC:JMP    EXITRM        ;                    159H
  177. ;.....
  178. ;
  179. ;
  180. ; Jump vectors needed by each overlay
  181. ;
  182. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  183. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  184. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  185. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  186. ;.....
  187. ;
  188. ;
  189. ; "AT" command strings, can be replaced in individual overlay if needed
  190. ;
  191. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  192. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  193. ;
  194. ;
  195. ; Next fourteen lines should not be changed by user overlay as these go
  196. ; to specific locations in the main program, not in the overlay.
  197. ;
  198. ;
  199. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  200. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  201. J$DIAL:      DS    3        ; Start of dialing routine        174H
  202. J$DSCONT: 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: DS    3        ; Inline "compare strings" routine    183H
  207. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  208. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  209. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  210. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  211. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  212. J$BREAK:  JMP    SENDBRK        ; Break routine             195H
  213. J$NEW2:      DB    0,0,0        ; For future needs            198H
  214. ;.....
  215. ;
  216. ;
  217. ; For 2400 bps auto-stepdown units
  218. ;
  219. MANUAL:      DB    0        ; For manual selection flag        19BH
  220. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  221. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  222. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  223. ;.....
  224. ;
  225. ;
  226. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  227. ;
  228. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  229.       DB    'Version for Zenith Z-100 modem port J2' ;        1AAH
  230.       DB    CR,LF,0
  231.       RET
  232. ;.....
  233. ;
  234. ;
  235. ;-----------------------------------------------------------------------
  236. ;
  237. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  238. ;     end of your last routine should terminate by 0400H (601 bytes
  239. ;     available after start of SYSVER).
  240. ;
  241. ;-----------------------------------------------------------------------
  242. ;
  243. ; You can put in a message at this location which can be called up with
  244. ; (special character-L).  You can put in several lines.  End with a 0.
  245. ;
  246. LOGON:    DB    'Hello from a Zenith Z-100 computer',CR,LF,0
  247. ;
  248. ;-----------------------------------------------------------------------
  249. ;
  250. ; This routine sets a 300 ms break tone
  251. ;
  252. SENDBRK:
  253.     MVI    A,1FH        ; DTR normal, send break tone
  254.     JMP    GOODBYE+2    ; Send the break tone
  255. ;.....
  256. ;
  257. ;
  258. ; This routine sets DTR low for 300 ms to disconnect the phone
  259. ;
  260. GOODBYE:
  261.     MVI    A,1DH        ; Set RTS, flags, DTR, break
  262.     OUT    PORT+3        ; Put command register out of mode
  263.     IN    PORT+3        ; Make sure it is now clear
  264.     IN    PORT+3        ; Try once more
  265.     MVI    B,3        ; Turn off DTR for 300 ms
  266.     CALL    J$TIMER
  267.     MVI    A,37H        ; Turn DTR back on
  268.     OUT    PORT+3        ; Send to command register
  269.     IN    PORT+3        ; Clear any incoming characters
  270.     IN    PORT+3        ; Try once more
  271.     XRA    A        ; Clear the 'A' register
  272.     RET
  273. ;.....
  274. ;
  275. ;
  276. ; The following are used in setting up the 2661B I/O port and the 25th
  277. ; (status) line
  278. ;
  279. INITMOD:
  280.     CALL J$ILPRT        ; Set up 25th line on the Z-100 terminal
  281.     DB    ESC,'j'        ; Save cursor position
  282.     DB    ESC,'x1'
  283.     DB    ESC,'Y8 '    ; Go to the 25th line
  284.     DB    ESC,'m04','f0',ESC,'p',' CMD Mode '    ; F0 key
  285.     DB    ESC,'q','f1',ESC,'p',' Logon '        ; F1 key
  286.     DB    ESC,'q','f2',ESC,'p',' Prt '        ; F2 key
  287.     DB    ESC,'q','f3',ESC,'p',' Op Buf '        ; F3 key
  288.     DB    ESC,'q','f4',ESC,'p',' Cl Buf '        ; F4 key
  289.     DB    ESC,'q','f5',ESC,'p',' Send F '        ; F5 key
  290.     DB    ESC,'q','f6',ESC,'p',' DSC  '        ; F6 key
  291.     DB    ESC,'q','Home',ESC,'p',' Clear'        ; F7 key
  292.     DB    ESC,'q',ESC,'m70'            ; Home key
  293.     DB    ESC,'k'        ; Return curson to previous position
  294.     DB    ESC,'E'
  295.     DB    0        ; All done
  296. ;
  297. ;
  298. ; Now set up the modem
  299. ;
  300.     LDA    MSPEED        ; Get the selected value
  301.     CPI    1        ; 300 bps
  302.     JZ    OK300
  303.     CPI    5        ; 1200 bps
  304.     JZ    OK1200
  305.     CPI    6        ; 2400 bps
  306.     JZ    OK2400
  307.     CPI    8        ; 9600 bps
  308.     JZ    OK9600
  309.     CPI    9        ; 19200 bps
  310.     JZ    OK19200
  311.     JMP    STUPR1        ; Else ask what is wanted
  312. ;...
  313. ;
  314. ;
  315. ; The following changes the baud rate with the set command.
  316. ;
  317. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  318.     JNC    STUPR2
  319. ;
  320. STUPR1:    CALL    J$ILPRT
  321.     DB    'Input Baud Rate (300, 1200, 2400, 9600, 19200): ',0
  322.     LXI    D,BAUDBUF    ; Point to new input buffer
  323.     CALL    J$INBUF
  324.     CALL    J$CRLF
  325.     LXI    D,BAUDBUF+2
  326. ;
  327. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  328.     DB    '300',0
  329.     JNC    OK300        ; Go if got match
  330.     CALL    J$INLNCP
  331.     DB    '1200',0
  332.     JNC    OK1200
  333.     CALL    J$INLNCP
  334.     DB    '2400',0
  335.     JNC    OK2400
  336.     CALL    J$INLNCP
  337.     DB    '9600',0
  338.     JNC    OK9600
  339.     CALL    J$INLNCP
  340.     DB    '19200',0
  341.     JNC    OK19200
  342.     CALL    J$ILPRT        ; All matches failed, tell operator
  343.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  344.     JMP    STUPR1        ; Try again
  345. ;
  346. OK300:    MVI    A,1        ; MSPEED 300 baud value
  347.     MVI    B,BD300
  348.     JMP    LOADBD
  349. ;
  350. OK1200:    MVI    A,5
  351.     MVI    B,BD1200
  352.     JMP    LOADBD
  353. ;
  354. OK2400:    XRA    A
  355.     STA    MANUAL        ; Reset for automatic stepdown
  356.     MVI    A,6
  357.     MVI    B,BD2400
  358.     JMP    LOADBD
  359. ;
  360. OK9600:    MVI    A,8
  361.     MVI    B,BD9600
  362.     JMP    LOADBD
  363. ;
  364. OK19200:MVI    A,9
  365.     MVI    B,BD19200
  366. ;
  367. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  368.     MOV    A,B        ; Get baudrate byte
  369.     STA    SETSPD+1    ; Store in INITMOD
  370.     XRA    A        ; Set RTS, flags, DTR, disable R/T
  371.     OUT    PORT+3        ; Put command register out of mode
  372.     IN    PORT+3        ; Make sure it is now clear
  373.     IN    PORT+3        ; Try once more  (CE, 2 stop, 4E 1 stop)
  374.     MVI    A,04EH        ; 1 stop, no parity, 8 bits, 16x asynch
  375.     OUT    PORT+2        ; Send to mode register 1
  376. ;
  377. SETSPD:    MVI    A,BD1200    ; Start with 1200 baud (4.9152 clock)
  378.     OUT    PORT+2        ; Send to mode register 2
  379.     MVI    A,37H        ; Reset RTS, flags, DTR low, enable R/T
  380.     OUT    PORT+3        ; Send to command register
  381.     IN    PORT+3        ; Clear any incoming chars.
  382.     IN    PORT+3        ; Try once more
  383.     XRA    A        ; Clear the 'A' register
  384.     RET
  385. ;.....
  386. ;
  387. ;
  388. EXITRM:    CALL J$ILPRT
  389.     DB    ESC,'x1',ESC    ; Reset the Z-100 to it's pre-IMP state
  390.     DB    'E',ESC,'y1'    ; Clear the CRT
  391.     DB    0        ; Done with J$ILPRT string
  392.     RET
  393. ;.....
  394. ;
  395. ;
  396. ; Table of baudrate parameters for 2661 I/O
  397. ;
  398. BD300    EQU    0F6H
  399. BD1200    EQU    0F8H
  400. BD2400    EQU    0FBH
  401. BD9600    EQU    0FDH
  402. BD19200    EQU    0FEH
  403. ;
  404. BAUDBUF:DB    10,0,0,0,0,0
  405.     DB    0,0,0,0,0,0
  406. ;
  407. ;                   end
  408. ;-----------------------------------------------------------------------
  409. ;
  410. ; Note: Must terminate prior to 0400H
  411. ;
  412.     END
  413.