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 / I2AD-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  12KB  |  396 lines

  1.  
  2. ; I2SD-2.ASM - Avanced Digital Super Six file for IMP - 06/01/87
  3. ;
  4. ;     Z80 DART and 8116 baudrate generator (5.0688 MHz)
  5. ;
  6. ; This overlay file adapts the Advanced Digital Super Quad and Super Six
  7. ; single board computers to IMP.  Baudrate is read from a parallel port
  8. ; and sent to the baudrate generator from default jumpers.
  9. ;
  10. ; Select serial port for either A or B, whichever you are using.
  11. ;
  12. ; You will want to look this file over carefully. There are a number of
  13. ; options that you can use to configure the program to suit your taste.
  14. ; This file adapts Advanced Digital Super Six computers to IMP.COM.
  15. ;
  16. ; Edit this file for your preferences then follow the "TO USE:" example
  17. ; shown below.
  18. ;
  19. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  20. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  21. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  22. ; (The ESC will automatically be typed with no CTL-character present.)
  23. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  24. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  25. ; looking at the function key table, typing CTL-Z in command mode, etc.
  26. ;
  27. ; Use the "SET" command to change the baudrate when desired.  The value
  28. ; at MSPEED controls the baudrate when the program is first called up.
  29. ;
  30. ;    TO USE: First edit this file filling in answers for your own
  31. ;        equipment.  Then assemble with ASM.COM or equivalent
  32. ;        assembler.  Then use MLOAD to merge into the main file:
  33. ;
  34. ;        MLOAD IMP.COM=IMP.COM,I2KP-x.HEX
  35. ;
  36. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  37. ;
  38. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  39. ;        IMP245 to use it.        - Irv Hoff
  40. ;    
  41. ; 10/27/85 - Written to work with IMP    - Irv Hoff
  42. ;
  43. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  44. ;
  45. ;
  46. YES    EQU    0FFH
  47. NO    EQU    0
  48. ;
  49. ;
  50. ; Serial port A = 00H, Serial port B = 02H (Select correct one)
  51. ;
  52. PORT    EQU    02H    ; Your 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    18H    ; Baud rate generator port
  60. JUMPRS    EQU    15H    ; Baud rate default jumpers
  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    '['-40H    ; ESC = preceeds local control character    114H
  120. EXITCHR: DB    'E'    ; Exit character                115H
  121. FILESND: DB    'F'    ; Send file when in terminal mode        116H
  122. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  123. LOGCHR:     DB    'L'    ; Send logon                    118H
  124. LSTCHR:     DB    'P'    ; Toggle printer                119H
  125. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  126. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  127. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            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: MVI    A,10H        ; Register 0, reset interrupts        11FH
  136.       OUT    MDCTL1        ;                    121H
  137.       IN    MDCTL1        ; Get the status            123H
  138.       RET            ;                    125H
  139.       DB    0,0,0        ; Spares if needed            126H
  140. ;
  141. I$MDTXE:  MVI    A,11H        ; For read register 1            129H
  142.       OUT    MDCTL1        ;                    12BH
  143.       IN    MDCTL1        ; Get status of read register 1     12DH
  144.       RET            ;                    12FH
  145.       DB    0,0,0        ;                    130H
  146. ;
  147. I$MDDATP: IN    MDDATP        ;                    133H
  148.       RET            ;                    135H
  149.       DB    0,0,0,0,0,0,0    ; Spares if needed            136H
  150. ;
  151. O$MDDATP: OUT    MDDATP        ;                    13DH
  152.       RET            ; OUT modem data port            13FH
  153.       DB    0,0,0,0,0,0,0    ; Spares if needed            140H
  154. ;.....
  155. ;
  156. ;
  157. A$MDRCV:  ANI    MDRCV        ;                    147H
  158.       RET            ;                    149H
  159. ;
  160. C$MDRCV:  CPI    MDRCV        ;                    14AH
  161.       RET            ;                    14CH
  162. ;
  163. A$MDSND:  ANI    MDSND        ;                    14DH
  164.       RET            ;                    14FH
  165. ;
  166. C$MDSND:  CPI    MDSND        ;                    150H
  167.       RET            ;                    152H
  168. ;
  169. A$MDTXE:  ANI    MDTXE        ;                    153H
  170.       RET            ;                    155H
  171. ;
  172. C$MDTXE:  CPI    MDTXE        ;                    156H
  173.       RET            ;                    158H
  174. ;.....
  175. ;
  176. ;
  177. ; Special exit vector, used by some computers to reset interrupt vectors
  178. ;
  179. J$EXITVEC:RET            ;                    159H
  180.       DB    0,0        ;                    15AH
  181. ;.....
  182. ;
  183. ;
  184. ; Jump vectors needed by each overlay
  185. ;
  186. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  187. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  188. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  189. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  190. ;.....
  191. ;
  192. ;
  193. ; "AT" command strings, can be replaced in individual overlay if needed
  194. ;
  195. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  196. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  197. ;
  198. ;
  199. ; Next fourteen lines should not be changed by user overlay as these go
  200. ; to specific locations in the main program, not in the overlay.
  201. ;
  202. ;
  203. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  204. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  205. J$DIAL:      DS    3        ; Start of dialing routine        174H
  206. J$DSCONT: DS    3        ; Terminates modem use            177H
  207. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  208. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  209. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  210. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  211. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  212. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  213. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  214. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  215. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  216. J$BREAK:  JMP    SENDBRK        ; Break routine                195H
  217. J$NEW2:      DB    0,0,0        ; For future needs            198H
  218. ;.....
  219. ;
  220. ;
  221. ; For 2400 bps auto-stepdown units
  222. ;
  223. MANUAL:      DB    0        ; For manual selection flag        19BH
  224. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  225. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  226. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  227. ;.....
  228. ;
  229. ;
  230. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  231. ;
  232. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  233.       DB    'Version for Advanced Digital computers' ;        1AAH
  234.       DB    CR,LF,0
  235.       RET
  236. ;.....
  237. ;
  238. ;
  239. ;-----------------------------------------------------------------------
  240. ;
  241. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  242. ;     end of your last routine should terminate by 0400H (601 bytes
  243. ;     available after start of SYSVER).
  244. ;
  245. ;-----------------------------------------------------------------------
  246. ;
  247. ; You can put in a message at this location which can be called up with
  248. ; (special character-L).  You can put in several lines.  End with a 0.
  249. ;
  250. LOGON:    DB    'This is an Advanced Digital computer... ',CR,LF,0
  251. ;
  252. ;-----------------------------------------------------------------------
  253. ;
  254. ; This routine sets a 300 ms break tone
  255. ;
  256. SENDBRK:
  257.     MVI    A,5
  258.     OUT    MDCTL1        ; Send to the status port
  259.     MVI    A,0F8H        ; DTR normal, send break tone
  260.     JMP    GOODBYE1    ; Go send the break tone
  261. ;.....
  262. ;
  263. ;
  264. ; This routine sets DTR low for 300 ms to disconnect the modem.
  265. ;
  266. GOODBYE:
  267.     MVI    A,5
  268.     OUT    MDCTL1        ; Send to the status port
  269.     MVI    A,78H        ; Turn off DTR and send break tone
  270. ;
  271. GOODBYE1:
  272.     OUT    MDCTL1
  273.     MVI    B,3        ; Delay 300 ms
  274.     CALL    J$TIMER
  275.     MVI    A,5
  276.     OUT    MDCTL1
  277.     MVI    A,0E8H        ; Restore normal, 8 bits, DTR on, etc.
  278.     OUT    MDCTL1
  279.     RET
  280. ;.....
  281. ;
  282. ;
  283. ; Initialization -- sets CTC timer 00H for send and receive
  284. ; baudrate.
  285. ;
  286. ;
  287. INITMOD:
  288.     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,44H        ; 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.     JMP    STUPR1        ; Else ask what is wanted
  315. ;.....
  316. ;
  317. ;
  318. ; Sets the modem speed via the SET command.
  319. ;
  320. ;
  321. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  322.     JNC    STUPR2
  323. ;
  324. STUPR1:    CALL    J$ILPRT
  325.     DB    'Input Baud Rate (300, 1200, 2400, 9600): ',0
  326.     LXI    D,BAUDBUF    ; Point to new input buffer
  327.     CALL    J$INBUF
  328.     CALL    J$CRLF
  329.     LXI    D,BAUDBUF+2
  330. ;
  331. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  332.     DB    '300',0
  333.     JNC    OK300        ; Go if got match
  334.     CALL    J$INLNCP
  335.     DB    '1200',0
  336.     JNC    OK1200
  337.     CALL    J$INLNCP
  338.     DB    '2400',0
  339.     JNC    OK2400
  340.     CALL    J$INLNCP
  341.     DB    '9600',0
  342.     JNC    OK9600
  343.     CALL    J$ILPRT        ; All matches failed, tell operator
  344.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  345.     JMP    STUPR1        ; Try again
  346. ;
  347. OK300:    MVI    A,1        ; MSPEED 300 baud value
  348.     MVI    B,BD300
  349.     JMP    LOADBD
  350. ;
  351. OK1200:    MVI    A,5
  352.     MVI    B,BD1200
  353.     JMP    LOADBD
  354. ;
  355. OK2400:    XRA    A
  356.     STA    MANUAL        ; Reset to maximum auto-speed
  357.     MVI    A,6
  358.     MVI    B,BD2400
  359.     JMP    LOADBD
  360. ;
  361. OK9600:    MVI    A,8
  362.     LHLD    BD9600
  363. ;
  364. LOADBD:    STA    MSPEED        ; Store the file transfer speed
  365.     MOV    A,B        ; Get the baudrate
  366.     RLC            ; Move the LSB into upper four bits
  367.     RLC
  368.     RLC
  369.     RLC
  370.     ANI    0F0H        ; Mask off lower four bits, saving MSB
  371.     MOV    B,A        ; Store for now
  372.     IN    JUMPRS        ; Get the jumpers value from port 15H
  373.     ANI    0FH        ; Mask off upper four bits, saving LSB
  374.     ORA    B        ; Combine MSB and LSB bits
  375.     OUT    BRPORT
  376.     RET
  377. ;.....
  378. ;
  379. ;
  380. ; TABLE OF BAUDRATE PARAMETERS
  381. ;
  382. BD300    EQU    5
  383. BD1200    EQU    7
  384. BD2400    EQU    10
  385. BD9600    EQU    14
  386. ;
  387. BAUDBUF:DB    10,0,0,0,0,0
  388.     DB    0,0,0,0,0,0
  389. ;
  390. ;                   end
  391. ;-----------------------------------------------------------------------
  392. ;
  393. ; NOTE: Must terminate prior to 0400H
  394. ;
  395.     END
  396.