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

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