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 / I2NH-3.AZM / I2NH-3.ASM
Assembly Source File  |  2000-06-30  |  11KB  |  350 lines

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