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 / I2EQ-4.AZM / I2EQ-4.ASM
Assembly Source File  |  2000-06-30  |  14KB  |  564 lines

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