home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol273 / i2eq-3.aqm / I2EQ-3.ASM
Encoding:
Assembly Source File  |  1986-06-11  |  13.5 KB  |  555 lines

  1.  
  2. ; I2EQ+1.ASM - INSIGHT EQ-4 overlay file for IMP - 10/27/85
  3. ;
  4. ;        Zilog DART and 8116 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 overlay adapts the Insight Enterprises EQ-4 computer, using the
  9. ; Z80 DART and SMC 8116 baud rate generator to IMP.COM.
  10. ;
  11. ; Edit this file for your preferences then follow the "TO USE:" example
  12. ; shown below.
  13. ;
  14. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  15. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  16. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  17. ; (The ESC will automatically be typed with no CTL-character present.)
  18. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  19. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  20. ; looking at the function key table, typing CTL-Z in command mode, etc.
  21. ;
  22. ; Use the "SET" command to change the baudrate when desired.  The value
  23. ; at MSPEED controls the baudrate when the program is first called up.
  24. ;
  25. ;    TO USE: First edit this file filling in answers for your own
  26. ;        equipment.  Then assemble with ASM.COM or equivalent
  27. ;        assembler.  Then use MLOAD to merge into the main file:
  28. ;
  29. ;        MLOAD IMP.COM=IMP.COM,I2DP-x.HEX
  30. ;
  31. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  32. ;
  33. ; 03/15/86  Converted to 8080 mnemonics, can now be use any normal 8080
  34. ;        normal assembler.  Standardized routines to be compatible
  35. ;        with other IMP overlays.    - Irv Hoff
  36. ;
  37. ; 02/09/86  Correction to 2400 baud select entry
  38. ;                    - Chris Taylor
  39. ;
  40. ; 10/27/84  First version of this file, from I2KP-1.ASM
  41. ;                    - Chris Taylor
  42. ;
  43. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  44. ;
  45. ;
  46. YES    EQU    0FFH
  47. NO    EQU    0
  48. ;
  49. ;
  50. ; Change the following information to match your equipment
  51. ;
  52. PORT    EQU    38H        ; Port modem is on
  53. DART    EQU    'A'        ; Modem is on DART pair "A"
  54. BRPORT    EQU    37H        ; Baud rate generator port
  55. MDCTL1    EQU    PORT+1        ; Modem control port
  56. MDDATP    EQU    PORT        ; Modem data in port
  57. MDRCV    EQU    1        ; Bit to test for receive
  58. MDSND    EQU    4        ; Bit to test for send
  59. MDTXE    EQU    1        ; Value when ready
  60. ;
  61. ;
  62. ;-----------------------------------------------------------------------
  63. ;
  64. ESC    EQU    '['-40H    ; ^[ = Escape
  65. BELL    EQU    'G'-40H    ; ^G = Bell character
  66. LF    EQU    'J'-40H    ; ^J = Linefeed
  67. NEXTRY    EQU    'K'-40H    ; ^K = Try next phone number, abort this try
  68. CR    EQU    'M'-40H    ; ^M = Carriage return
  69. CLEARSC    EQU    'Z'-40H    ; ^Z = Clears screen, command mode only
  70. EOFCHAR    EQU    'Z'-40H    ; ^Z = End of file
  71. ;
  72. ;
  73. ;-----------------------------------------------------------------------
  74. ;
  75. ;
  76.         ORG    100H
  77. ;
  78. ;
  79. ; Change the clock speed if needed, to match your system
  80. ;
  81.      DS    3    ; (for    "JMP   START" instruction)
  82. ;
  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 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 char (ESC not needed)        10AH
  95. CLOCK:     DB    40    ; Clock speed in mhz x10 25.5 MHz max        10BH
  96. ;
  97.  
  98. BYTDLY:     DB    2    ; 0=0 delay 1=10ms 5=50ms 9=90ms        10CH
  99.             ; Default time to send character in ter-
  100.             ;   minal mode file transfer for slow BBS
  101. CRDLY:     DB    2    ; 0=0 delay 1=100ms 5=500ms 9=900ms        10DH
  102.             ; Default time for extra wait after CRLF
  103.             ;   in terminal mode file transfer
  104. NOFCOL:     DB    5    ; Number of directory columns shown        10EH
  105. TCHPUL:     DB    'T'    ; T=tone, p=pulse (Hayes 2400 modems        10FH
  106. ;......
  107. ;
  108. ;
  109. ADDLFD:     DB    NO    ; Yes=add LF after CR to send file in terminal    110H
  110.             ;   mode (normally added by remote echo)
  111. CONVRUB: DB    YES    ; Yes=convert rub to backspace            111H
  112. CRCDFLT: DB    YES    ; Default to CRC checking            112H
  113. IGNRCTL: DB    NO    ; Yes=control chars above ^M not shown        113H
  114. ;.....
  115. ;
  116. ;
  117. EXTCHR:     DB    '['-40H    ; Esc =  preceeds local CTL chars        114H
  118. EXITCHR: DB    'E'    ; Exit character
  119. FILESND: DB    'F'    ; Send file in terminal mode            116H
  120. NOCONCT: DB    'N'    ; Disconnect from phone line            117H
  121. LOGCHR:     DB    'L'    ; Send logon                    118H
  122. LSTCHR:     DB    'P'    ; Toggle printer                119H
  123. UNSAVCH: DB    'R'    ; Close input text buffer            11AH
  124. SAVECH:     DB    'Y'    ; Open input text buffer            11BH
  125. CLEARS:     DB    'Z'    ; Clear screen in terminal mode         11CH
  126. SPARE1:     DB    0    ; Future development                11DH
  127. NODTR:     DB    NO    ; Yes if no DTR and need +++ to disconnect    11EH
  128. ;.....
  129. ;
  130. ;
  131. I$MDCTL1:    IN    MDCTL1        ; In modem control port     11FH
  132.         RET
  133.         DB    0,0,0,0,0,0,0
  134. ;
  135. I$MDTXE:    IN    MDCTL1        ; In modem data port        129H
  136.         RET
  137.         DB    0,0,0,0,0,0,0
  138. ;
  139. IN$MDDATP:    IN    MDDATP        ; In modem data port        133H
  140.         RET
  141.         DB    0,0,0,0,0,0,0
  142. ;
  143. O$MDDATP:    OUT    MDDATP        ; Out modem data port        13DH
  144.         RET
  145.         DB    0,0,0,0,0,0,0
  146. ;.....
  147. ;
  148. ;
  149. A$MDRCV:    ANI    MDRCV        ; Bit to test for receive ready 147H
  150.         RET
  151. ;
  152. C$MDRCV:    CPI    MDRCV        ; Value of rcv. bit when ready    14AH
  153.         RET
  154. ;
  155. A$MDSND:    ANI    MDSND        ; Bit to test for send ready    14DH
  156.         RET
  157. ;
  158. C$MDSND:    CPI    MDSND        ; Value of send bit when ready    150H
  159.         RET
  160. ;
  161. A$MDTXE:    ANI    MDTXE        ;                153H
  162.         RET
  163. ;
  164. C$MDTXE:    CPI    MDTXE        ;                156H
  165.         RET
  166. ;.....
  167. ;
  168. ;
  169. ; Special exit vector to reset interrupt vectors
  170. ;
  171. J$EXITVEC:    RET            ;                159H
  172.         DS    2
  173. ;
  174. ;
  175. J$GOODBYE:    JMP    GOODBYE        ;                15CH
  176. J$INITMOD:    JMP    INITMOD        ; Go to user written routine    15FH
  177. J$STUPR:    JMP    STUPR        ;                162H
  178. J$SYSVER:    JMP    SYSVER        ;                165H
  179. ;.....
  180. ;
  181. ;
  182. ; "AT" command strings, can be replaced by indificual overlay
  183. ;
  184. J$STRNGA:    DS    3        ; 1200 bps "AT" string        168H
  185. J$STRNG1:    DS    3        ; 2400 bps "AT" string        16BH
  186. ;
  187. ;
  188. ; Do not change the following FOURTEEN lines.  They are to specific lo-
  189. ; cations in the main program, not the overlay
  190. ;
  191. J$CMDSPL:    DS    3        ; Allows entry of baudrate    16EH
  192. J$CRLF:        DS    3        ;                171H
  193. J$DIAL:        DS    3        ;                174H
  194. J$DSCONT:    DS    3        ;                177H
  195. J$GOLST:    DS    3        ; Apple //e printer routine    17AH
  196. ;
  197. J$ILPRT:    DS    3        ;                17DH
  198. J$INBUF:    DS    3        ;                180H
  199. J$INLNCP:    DS    3        ;                183H
  200. J$INMDM:    DS    3        ;                186H
  201. ;
  202. J$RCVRSP:    DS    3        ;                189H
  203. J$SNDCHR:    DS    3        ; Send character to modem    18CH
  204. J$SNDSTR:    DS    3        ; Send string ($ at end) to mdm 18FH
  205. ;
  206. J$TIMER:    DS    3        ;                192H
  207. ;
  208. J$NEW1:        DB    0,0,0        ; Future needs            195H
  209. J$NEW2:        DB    0,0,0        ; Future needs            198H
  210. ;.......
  211. ;
  212. ;
  213. ; For 2400 bps auto-stepdown modems
  214. ;
  215. MANUAL:        DB    0        ; Manual selection flag     19BH
  216. J$300:        JMP    OK300        ; Set 300 baud            19CH
  217. J$1200:        JMP    OK1200        ; Set 1200 baud         19FH
  218. J$2400:        JMP    OK2400        ; Set 2400 baud         1A2H
  219. ;.....
  220. ;
  221. ;
  222. LOGPTR:        DW    LOGON        ; Pointer to display logon msg    1A5H
  223. ;
  224. SYSVER:    CALL    J$ILPRT            ;                1A7H
  225.     DB    'Insight Enterprises EQ-4',CR,LF,0 ;            1AAH
  226.     DB    RET
  227. ;.....
  228. ;
  229. ;
  230. ;-----------------------------------------------------------------------
  231. ;
  232. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  233. ;     end of your last routine should terminate by 0400H (601 bytes
  234. ;     available after start of SYSVER) if using the Hayes Smartmodem
  235. ;     or by address 0C00H (2659 bytes) otherwise.
  236. ;
  237. ;-----------------------------------------------------------------------
  238. ;
  239. ; You can put in a message at this location which can be called up with
  240. ; CTL-O if TRANLOGON has been set TRUE.  You can use several lines if
  241. ; desired.  End with a 0.
  242. ;
  243. LOGON:    DB    CR,LF,'Insight Enterprises EQ-4', CR,LF,0
  244. ;
  245. ;-----------------------------------------------------------------------
  246. ;
  247. ;
  248. ; This routine sets DTR low for 300 ms to disconnect the phone
  249. ;
  250. GOODBYE:MVI    B,'S'-40H    ; X-off to stop host if needed
  251.     CALL    J$SNDCHR
  252.     MVI    B,1        ; Wait a moment to let it react
  253.     CALL    J$TIMER
  254.     MVI    A,5
  255.     OUT    MDCTL1        ; Send to the status port
  256.     MVI    A,068H        ; Turn off dtr, send break
  257.     OUT    MDCTL1
  258.     MVI    B,3        ; Wait 300 ms
  259.     CALL    J$TIMER
  260.     MVI    A,5
  261.     OUT    MDCTL1
  262.     MVI    A,0E8H        ; Restore normal, 8 bits, dtr on, etc.
  263.     OUT    MDCTL1
  264.     RET
  265. ;.....
  266. ;
  267. ;
  268. ; The following is used to initialize the EQ-4 Z80 DART-2 port.  Baud
  269. ; rate is initially set to 'SPEED'.
  270. ;
  271. INITMOD:MVI    A,DART
  272.     CPI    'A'        ; If DART pair "A" selected
  273.     MVI    A,MASK$A
  274.     JZ    DO$A
  275.     MVI    A,MASK$B    ; Else, do "B" dart pair
  276. ;
  277. DO$A:    STA    PORT$MASK    ; Set port mask for future baud changes
  278.     MVI    A,00H        ; Select register
  279.     OUT    MDCTL1
  280.     MVI    A,18H        ; Throw out of mode
  281.     OUT    MDCTL1
  282.     MVI    A,04H        ; Select register
  283.     OUT    MDCTL1
  284.     MVI    A,44H        ; Set ASCII parameters (44=1, 4C=2)
  285.     OUT    MDCTL1
  286.     MVI    A,03H        ; Select register
  287.     OUT    MDCTL1
  288.     MVI    A,0C1H        ; Enable receive
  289.     OUT    MDCTL1
  290.     MVI    A,05H        ; Select register
  291.     OUT    MDCTL1
  292.     MVI    A,0EAH        ; Enable send, DTR, RTS
  293.     OUT    MDCTL1
  294. ;
  295.     LDA    MSPEED        ; Get the selected value
  296.     CPI    1        ; 300 bps
  297.     JZ    OK300
  298.     CPI    5        ; 1200 bps
  299.     JZ    OK1200
  300.     CPI    6        ; 2400 bps
  301.     JZ    OK2400
  302.     CPI    8        ; 9600 bps
  303.     JZ    OK9600
  304.     JMP    STUPR1        ; Else ask what is wanted
  305. ;.....
  306. ;
  307. ;
  308. ; Sets the modem speed via the SET command.
  309. ;
  310. ;
  311. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  312.     JNC    STUPR2
  313. ;
  314. STUPR1:    CALL    J$ILPRT
  315.     DB    'Input Baud Rate (300, 1200, 2400, 9600): ',0
  316.     LXI    D,BAUDBUF    ; Point to new input buffer
  317.     CALL    J$INBUF
  318.     CALL    J$CRLF
  319.     LXI    D,BAUDBUF+2
  320. ;
  321. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  322.     DB    '300',0
  323.     JNC    OK300        ; Go if got match
  324.     CALL    J$INLNCP
  325.     DB    '1200',0
  326.     JNC    OK1200
  327.     CALL    J$INLNCP
  328.     DB    '2400',0
  329.     JNC    OK2400
  330.     CALL    J$INLNCP
  331.     DB    '9600',0
  332.     JNC    OK9600
  333.     CALL    J$ILPRT        ; All matches failed, tell operator
  334.     DB    '++ Incorrect entry ++',CR,LF,BELL,CR,LF,0
  335.     JMP    STUPR1        ; Try again
  336. ;
  337. OK300:    MVI    A,1        ; MSPEED 300 baud value
  338.     MVI    B,BD300
  339.     JMP    LOADBD
  340. ;
  341. OK1200:    MVI    A,5
  342.     MVI    B,BD1200
  343.     JMP    LOADBD
  344. ;
  345. OK2400:    XRA    A
  346.     STA    MANUAL        ; Reset to maximum auto-speed
  347.     MVI    A,6
  348.     MVI    B,BD2400
  349.     JMP    LOADBD
  350. ;
  351. OK9600:    MVI    A,8
  352.     MVI    B,BD9600
  353. ;
  354. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  355.     MOV    A,B        ; Get baudrate byte
  356.     CALL    DO$CHANGE
  357.     RET
  358. ;.....
  359. ;
  360. ;
  361. ; TABLE OF BAUDRATE PARAMETERS
  362. ;
  363. BD300    EQU    5
  364. BD1200    EQU    7
  365. BD2400    EQU    10
  366. BD9600    EQU    14
  367. ;
  368. BAUDBUF:DB    10,0,0,0,0,0
  369.     DB    0,0,0,0,0,0
  370. ;.....
  371. ;
  372. ;
  373. ; HL points to block to output
  374. ; DB data,data,data,data....
  375. ;
  376. BLOCK$OUTPUT:
  377.     MVI    B,6        ; Get count
  378.  
  379. BLOCK1:    OUT    MDCTL1
  380.     INX    H
  381.     DCR    B
  382.     JNZ    BLOCK1
  383.     RET            ; Return
  384. ;.....
  385. ;
  386. ;
  387. DBC    EQU    50        ; Direct BIOS call
  388. MASK$A    EQU    0F0H        ; Baud rate mask for port A
  389. MASK$B    EQU    00FH        ; Baud rate mask for port B
  390. BDOS    EQU    0005H        ; BDOS entry
  391. ;
  392. ;
  393. ;-----------------------------------------------------------------------
  394. ;
  395. ; Locate the character I/O table then search for the DART ports.  When
  396. ; correct DART found, change the speed to the new value.  This allows
  397. ; 'device' command to report the actual speed.
  398. ;
  399. ;-----------------------------------------------------------------------
  400. ;
  401. DO$CHANGE:
  402.     CPI    10
  403.     JNC    STO$SPD
  404.     DCR    A
  405. ;
  406. STO$SPD:MOV    L,A        ; Convert speed to a pointer
  407.     MVI    H,0
  408.     DAD    H        ; *2 for table entry size
  409.     LXI    D,SPEED$T    ; Base of table
  410.     DAD    D
  411.     SHLD    TABLE$IDX    ; Save true pointer
  412.     MOV    A,M
  413.     STA    BAUD
  414.     LXI    D,DBCT        ; Point to BIOS call table
  415.     MVI    C,DBC        ; Direct BIOS call
  416.     CALL    BDOS
  417. ;
  418. ;
  419. ; Begin search for DARTS
  420. ;
  421.     LXI    B,8        ; Size of character I/O table entry
  422. ;
  423. LOOP:    MOV    A,M        ; Get link indicator
  424.     ANA    A
  425.     JZ    SET$BAUD$RATE    ; End of link if null
  426.     PUSH    H
  427.     INX    H
  428.     INX    H
  429.     INX    H
  430.     INX    H
  431.     INX    H
  432.     MOV    A,M        ; Get which port
  433.     MOV    D,A        ; Save for later
  434.     INX    H
  435.     INX    H
  436.     MOV    E,M        ; Remember old rate
  437.     CPI    'A'
  438.     JNZ    STO$B
  439.     MOV    A,E        ; Save old rate for later
  440.     STA    A$SPD
  441.     JMP    NEXT
  442. ;
  443. STO$B:    CPI    'B'        ; Is it 'B' port
  444.     JNZ    NEXT        ; No, don't update
  445.     MOV    A,E
  446.     STA    B$SPD
  447. ;
  448. NEXT:    DCX    H
  449.     MVI    A,DART        ; Get selectd port
  450.     CMP    D        ; Is this a match?
  451.     JNZ    BUMP
  452.     DB    0CBH,4EH    ; Z80 code
  453.     JZ    BUMP
  454.     INX    H
  455.     LDA    BAUD        ; Get true baud rate
  456.     CPI    10        ; Check if adjustment needed
  457.     JNC    STO$RT
  458.     INR    A        ; Yes, so correct for display
  459. ;
  460. STO$RT:    MOV    M,A        ; And put into table entry
  461. ;
  462. BUMP:    POP    H        ; Recover HL
  463.     DAD    B        ; Bump pointer
  464.     JMP    LOOP        ; Go do another
  465. ;.....
  466. ;
  467. ;
  468. ; End of chain found, set new baud rate
  469. ;
  470. SET$BAUD$RATE:
  471.     LDA    B$SPD        ; Get the old speeds
  472.     CPI    10
  473.     JNC    SKIP1        ; Adjust rate value
  474.     DCR    A
  475. ;
  476. SKIP1:    RLC
  477.     RLC
  478.     RLC
  479.     RLC
  480.     MOV    B,A
  481.     LDA    A$SPD
  482.     CPI    10
  483.     JNC    SKIP2        ; Adjust rate value
  484.     DCR    A
  485. ;
  486. SKIP2:    ORA    B
  487.     LXI    H,PORT$MASK    ; Get correct mask
  488.     ANA    M        ; Erase for new value
  489.     MOV    B,A        ; Save value for later
  490.     LHLD    TABLE$IDX    ; Get table entry pointer
  491.     LDA    PORT$MASK
  492.     CPI    MASK$A
  493.     JZ    GET$RATE    ; If B port then point to B port speed
  494.     INX    H
  495. ;
  496. GET$RATE:
  497.     MOV    C,M        ; Get new value
  498.     MOV    A,B        ; Get old value
  499.     ORA    C        ; Form new value
  500.     OUT    BRPORT        ; Change the speed
  501.     RET
  502. ;.....
  503. ;
  504. ;
  505. ;****************************************
  506. ;                    *
  507. ;    STORAGE             *
  508. ;                    *
  509. ;****************************************
  510. ;
  511. ;
  512. TABLE$IDX:
  513.     DW    SPEED$T        ; Pointer to table entry
  514. ;
  515. ;
  516. ; Port speed A/B
  517. ;
  518. SPEED$T:DB    0,0*16        ; 50 baud
  519.     DB    1,1*16        ; 75 baud
  520.     DB    2,2*16        ; 110 baud
  521.     DB    3,3*16        ; 134 baud
  522.     DB    4,4*16        ; 150 baud
  523.     DB    5,5*16        ; 300 baud
  524.     DB    6,6*16        ; 600 baud
  525.     DB    7,7*16        ; 1200 bps
  526.     DB    8,8*16        ; 1800 bps
  527.     DB    9,9*16        ; 2000 bps ( not supported )
  528.     DB    10,10*16    ; 2400 bps
  529.     DB    11,11*16    ; 3600 bps
  530.     DB    12,12*16    ; 4800 bps
  531.     DB    13,13*16    ; 7200 bps
  532.     DB    14,14*16    ; 9600 bps
  533.     DB    15,15*16    ; 19200 bps
  534. ;
  535. BAUD:    DB    0        ; Selected baud rate value
  536. A$SPD:    DB    0        ; Old baud rate
  537. B$SPD:    DB    0        ; Old baud rate
  538. ;
  539. PORT$MASK:
  540.     DB    0,0        ; Port mask
  541. ;
  542. DBCT:    DB    20        ; BIOS call 20 - character I/O tables
  543.     DB    0        ; A reg
  544.     DW    0        ; BC regs
  545.     DW    0        ; DE regs
  546.     DW    0        ; HL regs
  547. ;.....
  548. ;
  549. ;                   end
  550. ;-----------------------------------------------------------------------
  551. ;
  552. ; NOTE:  Must terminate prior to 0400H
  553. ;
  554.     END
  555.