home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / modem / i2mm-5.z80 < prev    next >
Encoding:
Text File  |  1993-06-08  |  14.1 KB  |  520 lines

  1. ; I2MM-4.Z80  -  MicroMint SB180 overlay file for IMP  -  06/01/87
  2. ;
  3. ;          HD64180 On-chip ASCII Port 0
  4. ;
  5. ;     This version handles 6 ZMHz, 9 MHz or 12 MHz clock speed
  6. ;
  7. ; This file adapts the MicroMint SB180 computer to IMP.COM.  This com-
  8. ; puter was featured in the September and October 1985 issues of BYTE
  9. ; magazine in Ciarcia's Circuit Cellar.  The SB180 is an extremely com-
  10. ; pact (4" by 7") single board computer with 2 serial ports, 1 parallel
  11. ; printer port, 5"/8" disk controller, and 256K RAM as well as an expan-
  12. ; ion port for SASI/SCSI controllers, etc.  It utilizes the new Hitachi
  13. ; HD64180 CMOS CPU, a VLSI chip with memory management, serial, DMA and
  14. ; timer functions on-chip. It's instruction set is upwardly compatible
  15. ; with the Z80.
  16. ;
  17. ;
  18. ; Edit this file for your preferences then follow the "TO USE:" example
  19. ; shown below.    Some special HD64180 instructions are used, but any nor-
  20. ; mal 8080 or Z80 assembler may be used.
  21. ;
  22. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  23. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  24. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  25. ; (The ESC will automatically be typed with no CTL-character present.)
  26. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  27. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  28. ; looking at the function key table, typing CTL-Z in command mode, etc.
  29. ;
  30. ; Use the "SET" command to change the baudrate when desired.  The value
  31. ; at MSPEED controls the baudrate when the program is first called up.
  32. ;
  33. ; TO USE: First edit this file filling in answers for your own
  34. ;        equipment.  Then assemble with ZAS.COM or equivalent
  35. ;        assembler.  Then use MLOAD to merge into the main file:
  36. ;
  37. ;        MLOAD IMP.COM=IMP.COM,I2MM-x.HEX
  38. ;
  39. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  40. ;
  41. ; 02/14/89  Added true DTR disconnect routine, replacing RTS routine.
  42. ;    v5                    -Gene Pizzetta
  43. ;
  44. ; 06/01/87  After being advised by Steven Mendelson that 6 MHz, 9MHz and
  45. ;    v4     12 MHz versions are available, I called MicroMint and got
  46. ;        the baud rate data for all those from Ken Davidson.
  47. ;                    - Irv Hoff
  48. ;
  49. ; 06/01/87  Improved the GOODBYE routine, added BREAK routine, needs
  50. ;    v3     IMP245 to use it.
  51. ;
  52. ; 03/27/86  Modest changes to standardize appearance with other similar
  53. ;    v2     overlays, other minor changes.  Renamed to I2MM to avoid
  54. ;        conflict with I2SB for Intertec Super Brain computer.
  55. ;                    - Irv Hoff
  56. ;
  57. ; 08/19/85  First version for the MicroMint SB180.
  58. ;    v1                 - Max Southall
  59. ;
  60. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  61. ;
  62. YES    EQU    0FFH
  63. NO    EQU    0
  64. ;
  65. ;
  66. ; Select one of the following for your computer board
  67. ;
  68. CLK6    EQU    NO        ; Yes if using 6 MHz clock
  69. CLK9    EQU    YES        ; Yes if using 9 MHz clock
  70. CKL12    EQU    NO        ; Yes if using 12 MHz clock
  71. ;
  72. ;
  73. ; Values shown are for a HD64180
  74. ;
  75. PORT    EQU    00H        ; Your base port (data or status)
  76. MDCTL1    EQU    PORT+4        ; Modem status port
  77. MDDATIN EQU    PORT+8        ; Modem data in port
  78. MDDATOUT EQU    PORT+6        ; Modem data out port
  79. MDRCV    EQU    80H        ; Modem receive ready
  80. MDSND    EQU    02H        ; Modem send ready bit
  81. MDTXE    EQU    02H        ; Modem send buffer empty, holding buffer empty
  82. ;
  83. BAUDRP    EQU    PORT+2        ; HD64180 Port 0 ^B
  84. ;
  85. IN0    EQU    38EDH        ; Special Hitachi op code pair for 'A' reg.
  86. OUT0    EQU    39EDH        ; Special Hitachi op code pair for 'A' reg.
  87. ;
  88. ;
  89. ;-----------------------------------------------------------------------
  90. ;
  91. ESC    EQU    '['-40H        ; ^[ = Escape
  92. BELL    EQU    'G'-40H        ; ^G = Bell character
  93. LF    EQU    'J'-40H        ; ^J = Linefeed
  94. NEXTRY    EQU    'K'-40H        ; ^K = Try next phone number, abort this try
  95. CR    EQU    'M'-40H        ; ^M = Carriage return
  96. CLEARSC EQU    'Z'-40H        ; ^Z = Clears screen, command mode only
  97. EOFCHAR EQU    'Z'-40H        ; ^Z = End of file
  98. ;
  99. ;
  100.     ORG    0100H
  101. ;
  102. ;
  103.     DEFS    3        ; Skip the data area below
  104. ;
  105. ;
  106. ; These routines and equates are at the beginning of the program so
  107. ; they can be patched by a monitor or overlay file without re-assembling
  108. ; the program.
  109. ;
  110. MSPEED:    DEFB    6        ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  111.                 ; 6=2400 7=4800 8=9600 9=19200 default
  112. HS2400:    DEFB    YES        ; Yes=2400 bps highest speed            104H
  113. HS1200:    DEFB    NO        ; Yes=1200 bps highest speed            105H
  114. RACAL:    DEFB    NO        ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  115. PROMODM:DEFB    NO        ; Yes=Prometheus ProModem 1200 bps        107H
  116. RESVD1:    DEFB    NO        ; Reserved for special modems            108H
  117. RESVD2:    DEFB    NO        ; Reserved for special modems            109H
  118. ;
  119. ;
  120. CLEAR:    DEFB    1AH        ; Clear screen character (ESC not needed)    10AH
  121. ;
  122.      IF    CLK6
  123. CLOCK:    DEFB    60        ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  124.      ENDIF            ; CLK6
  125.      IF    CLK9
  126. CLOCK:    DEFB    90        ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  127.      ENDIF            ; CLK9
  128.      IF    CLK12
  129. CLOCK:    DEFB    120        ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  130.      ENDIF            ; CLK12
  131.  
  132.                 ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  133. BYTDLY:    DEFB    2        ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        10CH
  134.                 ;   default time to send character in ter-
  135.                 ;   minal mode file transfer for slow BBS
  136. CRDLY:    DEFB    2        ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms    10DH
  137.                 ;   default time for extra wait after CRLF
  138.                 ;   in terminal mode file transfer
  139. NOFCOL:    DEFB    5        ; Number of directory columns shown        10EH
  140. TCHPUL:    DEFB    'T'        ; T=tone, P=Pulse (Hayes 2400 modems)        10FH
  141. ;.....
  142. ;
  143. ;
  144. ADDLFD:    DEFB    NO        ; Yes=add LF after CR to send file in terminal    110H
  145.                 ;   mode (normally added by remote echo)
  146. CONVRUB:DEFB    YES        ; Yes=convert rub to backspace            111H
  147. CRCDFLT:DEFB    YES        ; Yes=default to CRC checking            112H
  148. IGNRCTL:DEFB    YES        ; Yes=CTL-chars above ^M not displayed        113H
  149. ;.....
  150. ;
  151. ;
  152. EXTCHR:    DEFB    '['-40H        ; ESC = preceeds local control character    114H
  153. EXITCHR:DEFB    'E'        ; Exit character                115H
  154. FILESND:DEFB    'F'        ; Send file when in terminal mode        116H
  155. NOCONCT:DEFB    'N'        ; Disconnect from phone line            117H
  156. LOGCHR:    DEFB    'L'        ; Send logon                    118H
  157. LSTCHR:    DEFB    'P'        ; Toggle printer                119H
  158. UNSAVCH:DEFB    'R'        ; Close input text buffer            11AH
  159. SAVECHR:DEFB    'Y'        ; Open input text buffer            11BH
  160. CLEARS:    DEFB    'Z'        ; Clears screen, terminal mode            11CH
  161. BRKCHR:    DEFB    'Q'        ; Send a break tone                11DH
  162. NODTR:    DEFB    NO        ; YES if no DTR and need ATH0 to disconnect    11EH
  163. ;......
  164. ;
  165. ;
  166. ; Handles in/out ports for data and status
  167. ;
  168. I$MDCTL1:
  169.     DEFW    IN0        ;                     11FH
  170.     DEFB    MDCTL1        ;                     121H
  171.     DEFW    IN0        ;                     122H
  172.     DEFB    MDCTL1        ;                     124H
  173.     RET            ;                     125H
  174.     DEFB    0,0,0        ;                     126H
  175. ;
  176. I$MDTXE:DEFW    IN0        ;                     129H
  177.     DEFB    MDCTL1        ;                     12BH
  178.     DEFW    IN0        ;                     12CH
  179.     DEFB    MDCTL1        ;                     12EH
  180.     RET            ;                     13FH
  181.     DEFB    0,0,0        ;                     130H
  182. ;
  183. I$MDDATP:
  184.     DEFW    IN0        ;                     133H
  185.     DEFB    MDDATIN        ;                     135H
  186.     RET            ;                     136H
  187.     DEFB    0,0,0,0,0,0    ;                     137H
  188. ;
  189. O$MDDATP:
  190.     DEFW    OUT0        ;                     13DH
  191.     DEFB    MDDATOUT    ;                     13FH
  192.     RET            ; OUT modem data port            140H
  193.     DEFB    0,0,0,0,0,0    ; Spares if needed            141H
  194. ;.....
  195. ;
  196. ;
  197. A$MDRCV:AND    MDRCV        ;                     147H
  198.     RET            ;                     149H
  199. ;
  200. C$MDRCV:CP    MDRCV        ;                     14AH
  201.     RET            ;                     14CH
  202. ;
  203. A$MDSND:AND    MDSND        ;                     14DH
  204.     RET            ;                     14FH
  205. ;
  206. C$MDSND:CP    MDSND        ;                     150H
  207.     RET            ;                     152H
  208. ;
  209. A$MDTXE:AND    MDTXE        ;                     153H
  210.     RET            ;                     155H
  211. ;
  212. C$MDTXE:CP    MDTXE        ;                     156H
  213.     RET            ;                     158H
  214. ;.....
  215. ;
  216. ;
  217. ; Special exit vector, used by some computers to reset interrupt vectors
  218. ;
  219. J$EXITVEC:
  220.     RET            ;                     159H
  221.     DEFB    0,0        ;                     15AH
  222. ;.....
  223. ;
  224. ;
  225. ; Jump vectors needed by each overlay
  226. ;
  227. J$GOODBYE:
  228.     JP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  229. J$INITMOD:
  230.     JP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  231. J$STUPR:JP    STUPR        ; SET routine to change baudrate    162H
  232. J$SYSVR:JP    SYSVR        ; Signon message            165H
  233. ;.....
  234. ;
  235. ;
  236. ; "AT" command strings, can be replaced in individual overlay if needed
  237. ;
  238. J$STRNGA:
  239.     DEFS    3        ; 1200 bps "AT" string            168H
  240. J$STRNG1:
  241.     jp    SplStr        ; 2400 bps "AT" string            16BH
  242. ;
  243. ;
  244. ; Next fourteen lines should not be changed by user overlay as these go
  245. ; to specific locations in the main program, not in the overlay.
  246. ;
  247. ;
  248. J$CMDSPL:
  249.     DEFS    3        ; Allows entry of baudrate on CMD line    16EH
  250. J$CRLF:    DEFS    3        ; Turns up one new line on display    171H
  251. J$DIAL:    DEFS    3        ; Start of dialing routine        174H
  252. J$DSCONT:
  253.     DEFS    3        ; Terminates modem use            177H
  254. J$GOLST:DEFS    3        ; Printer routine, needed by Apple //e    17AH
  255. J$ILPRT:DEFS    3        ; Prints an inline string, 0 to end    17DH
  256. J$INBUF:DEFS    3        ; Stores a keybd string for comparison    180H
  257. J$INLNCP:
  258.     DEFS    3        ; Inline "compare strings" routine    183H
  259. J$INMDM:DEFS    3        ; Max .1 sec wait for modem character    186H
  260. J$RCVRSP:
  261.     DEFS    3        ; For 3801 I/O use (TV-803)        189H
  262. J$SNDCHR:
  263.     DEFS    3        ; Sends a character to the modem    18CH
  264. J$SNDSTR:
  265.     DEFS    3        ; Sends a string to the modem, $ to end 18FH
  266. J$TIMER:DEFS    3        ; .1 second timer (amount in 'B' reg.)    192H
  267. J$BREAK:JP    SENDBRK        ; Break routine             195H
  268. J$NEW2:    DEFB    0,0,0        ; For future needs            198H
  269. ;.....
  270. ;
  271. ;
  272. ; For 2400 bps auto-stepdown units
  273. ;
  274. MANUAL:    DEFB    0        ; For manual selection flag        19BH
  275. J$300:    JP    OK300        ; Sets baudrate to 300 baud        19CH
  276. J$1200:    JP    OK1200        ; Sets baudrate to 1200 bps        19FH
  277. J$2400:    JP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  278. ;.....
  279. ;
  280. ;
  281. LOGPTR:    DEFW    LOGON        ; Pointer to display LOGON message    1A5H
  282. ;
  283. SYSVR:    CALL    J$ILPRT        ; Display the following line        1A7H
  284.     DEFB    'Version for MicroMint SB180FX' ;             1AAH
  285.     DEFB    CR,LF,0
  286.     RET
  287. ;.....
  288. ;
  289. ;
  290. ;-----------------------------------------------------------------------
  291. ;
  292. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  293. ;     end of your last routine should terminate by 0400H (601 bytes
  294. ;     available after start of SYSVER).
  295. ;
  296. ;-----------------------------------------------------------------------
  297. ;
  298. ; You can put in a message at this location which can be called up with
  299. ; (special character-L).  You can put in several lines.  End with a 0.
  300. ;
  301. LOGON:    DEFB    'This is an SB180FX computer...',CR,LF,0
  302. ;
  303. ;-----------------------------------------------------------------------
  304. ;
  305. ; This routine sets a 300 ms break tone.  It changes the baudrate to
  306. ; 38400 bps then sends enough ASCII null characters to consume 300 ms.
  307. ; (A null character is all spacing except for the stop bit.)  At high
  308. ; speed this effectively gives a steady break tone.  When finished it
  309. ; restores the baudrate to the original speed.
  310. ;
  311. SENDBRK:
  312.      IF    CLK6 OR CLK12
  313.     LD    A,BD38400    ; Select 38,400 bps
  314.      ENDIF            ; CLK6 OR CLK12
  315. ;
  316.      IF    CLK9
  317.     LD    A,BD19200    ; Select 19,200 bps
  318.      ENDIF            ; CLK9
  319. ;
  320.     CALL    LOAD1        ; Set output for this speed
  321. ;
  322.      IF    CLK6 OR CLK12
  323.     LD    DE,1150        ; Will take 300 ms at 38,400 bps
  324.      ENDIF            ; CLK6 OR CLK12
  325. ;
  326.      IF    CLK9
  327.     LD    DE,575        ; Will take 300 ms at 19,200 bps
  328.      ENDIF            ; CLK9
  329. ;
  330. SEND1:    XOR    A        ; ASCII null character
  331.     CALL    J$SNDCHR    ; Sends a character to the modem
  332.     DEC    DE        ; One less to go
  333.     JP    NZ,SEND1    ; If not zero, do another
  334. ;
  335.     JP    INITMOD        ; Reset original speed
  336. ;.....
  337. ;
  338. ;
  339. ; This routine sets DTR low for 300 ms to disconnect the modem.
  340. ;
  341. GOODBYE:
  342. ;    DEFW    IN0
  343. ;    DEFB    PORT
  344. ;    DEFW    0E7CBH        ; Raise DTR (actually RTS)
  345. ;    DEFW    OUT0
  346. ;    DEFB    PORT
  347. ;    LD    B,5        ; Wait for 300 ms
  348. ;    CALL    J$TIMER
  349. ;    DEFW    IN0
  350. ;    DEFB    PORT
  351. ;    DEFW    0A7CBH        ; Reset DTR to normal
  352. ;    DEFW    OUT0
  353. ;    DEFB    PORT
  354. ;    RET
  355. ;
  356. ; Routine above raises and lowers RTS instead of DTR.  New routine
  357. ; below raises and lowers DTR.  (Copied from DTR.Z80 by Rory Kestner.)
  358. ;
  359.     call    set        ; raise DTR
  360.     ld    b,5        ; ..for 5 milliseconds
  361.     call    j$timer
  362.     call    reset        ; then lower it
  363.     ret
  364. ;
  365. set:    call    status
  366.     ld    a,01000000b    ; mask off desired bit
  367.     or    b        ; ..or it
  368.     ld    b,a        ; ..put in A for BIOS
  369.     ld    a,0ffh        ; set up for write
  370.     ld    hl,(1)        ; get BIOS address
  371.     ld    l,3fh        ; offset of latch routine
  372.     jp    (hl)        ; jump to BIOS and return
  373. ;
  374. reset:    call    status
  375.     ld    a,10111111b
  376.     and    b        ; and desired bit
  377.     ld    b,a
  378.     ld    a,0ffh
  379.     ld    hl,(1)
  380.     ld    l,3fh
  381.     jp    (hl)
  382. ;
  383. status:    xor    a        ; set up for read function
  384.     ld    hl,(1)        ; get BIOS address
  385.     ld    l,3fh        ; offset for latch routine
  386.     jp    (hl)
  387. ;.....
  388. ;
  389. ;
  390. ; Initialization -- sets baudrate
  391. ;
  392. INITMOD:
  393.     LD    A,(MSPEED)    ; Get the selected value
  394.     CP    1        ; 300 bps
  395.     JP    Z,OK300
  396.     CP    5        ; 1200 bps
  397.     JP    Z,OK1200
  398.     CP    6        ; 2400 bps
  399.     JP    Z,OK2400
  400.     CP    8        ; 9600 bps
  401.     JP    Z,OK9600
  402.     CP    9
  403.     JP    Z,OK19200
  404.     JP    STUPR1        ; Else ask what is wanted
  405. ;.....
  406. ;
  407. ;
  408. ; Setup routine to allow changing modem speed with the SET command.
  409. ;
  410. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  411.     JP    NC,STUPR2
  412. ;
  413. STUPR1:    CALL    J$ILPRT
  414.     DEFB    'Input BPS (300, 1200, 2400, 9600, 19200): ',0
  415.     LD    DE,BAUDBUF    ; Point to new input buffer
  416.     CALL    J$INBUF
  417.     CALL    J$CRLF
  418.     LD    DE,BAUDBUF+2
  419. ;
  420. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  421.     DEFB    '300',0
  422.     JP    NC,OK300    ; Go if got match
  423.     CALL    J$INLNCP
  424.     DEFB    '1200',0
  425.     JP    NC,OK1200
  426.     CALL    J$INLNCP
  427.     DEFB    '2400',0
  428.     JP    NC,OK2400
  429.     CALL    J$INLNCP
  430.     DEFB    '9600',0
  431.     JP    NC,OK9600
  432.     CALL    J$INLNCP
  433.     DEFB    '19200',0
  434.     JP    NC,OK19200
  435.     CALL    J$ILPRT        ; All matches failed, tell operator
  436.     DEFB    '=> Unknown entry',CR,LF,BELL,CR,LF,0
  437.     JP    STUPR1        ; Try again
  438. ;
  439. OK300:    LD    A,1        ; MSPEED 300 bps value
  440.     LD    B,BD300
  441.     JP    LOADBD
  442. ;
  443. OK1200:    LD    A,5
  444.     LD    B,BD1200
  445.     JP    LOADBD
  446. ;
  447. OK2400:    XOR    A        ; Reset to maximum auto-speed
  448.     LD    (MANUAL),A
  449.     LD    A,6
  450.     LD    B,BD2400
  451.     JP    LOADBD
  452. ;
  453. OK9600:    LD    A,8
  454.     LD    B,BD9600
  455.     JP    LOADBD
  456. ;
  457. OK19200:LD    A,9
  458.     LD    B,BD19200
  459. ;
  460. LOADBD:    LD    (MSPEED),A    ; Change time-to-send to match baudrate
  461.     LD    A,B        ; Get baudrate byte
  462. ;
  463. LOAD1:    LD    HL,(1)        ; Get BIOS JMP table start address
  464.     LD    DE,61        ; Offset of IOTABLE from BIOS+3
  465.     ADD    HL,DE
  466.     PUSH    HL
  467.     DEFW    0E1DDH        ; (POP IX)
  468.     DEFW    77DDH        ; Z80 op code
  469.     DEFB    PORT+2
  470.     DEFW    OUT0
  471.     DEFB    BAUDRP
  472.     RET
  473. ;.....
  474. ;
  475. ;
  476. ; Baudrate table
  477. ;
  478.      IF    CLK6
  479. BD300    EQU    13
  480. BD1200    EQU    5
  481. BD2400    EQU    4
  482. BD9600    EQU    2
  483. BD19200 EQU    1
  484. BD38400 EQU    0
  485.      ENDIF            ; CLK6
  486. ;
  487.      IF    CLK9
  488. BD300    EQU    38
  489. BD1200    EQU    36
  490. BD2400    EQU    35
  491. BD9600    EQU    33
  492. BD19200 EQU    32
  493.      ENDIF            ; CLK9
  494. ;
  495.      IF    CLK12
  496. BD300    EQU    14
  497. BD1200    EQU    6
  498. BD2400    EQU    5
  499. BD9600    EQU    3
  500. BD19200 EQU    2
  501. BD38400 EQU    1
  502.      ENDIF            ; CLK12
  503. ;
  504. BAUDBUF:DEFB    10,0,0,0,0,0
  505.     DEFB    0,0,0,0,0,0
  506. ;.....
  507. ;
  508. ;
  509. ; Initialization string - the '#' character is a 100 ms. delay, at least
  510. ; four should be used after a CR following a command.
  511. ;
  512. SplStr:    db    'ATM3L2&D2',CR,'####','ATE1Q0V0X4H0',CR,'####','$'
  513. ;
  514. ;                   end
  515. ;-----------------------------------------------------------------------
  516. ;
  517. ; NOTE: Must terminate prior to 0400H
  518. ;
  519.     END
  520.