home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols200 / vol273 / i2mm-1.asm < prev    next >
Encoding:
Assembly Source File  |  1994-07-13  |  11.1 KB  |  389 lines

  1.  
  2. ; I2MM-1.ASM - MicroMint SB180 overlay file for IMP - 03/27/86
  3. ;
  4. ;        HD64180 On-chip ASCII Port 0
  5. ;
  6. ; This file adapts the MicroMint SB180 computer to IMP.COM.  This com-
  7. ; puter computer was featured in the September & October 1985 issues of
  8. ; BYTE magazine in Ciarcia's Circuit Cellar.  The SB180 is an extremely
  9. ; compact (4" by 7") single board computer with 2 serial ports, 1 paral-
  10. ; lel printer port, 5"/8" disk controller, and 256K RAM as well as an
  11. ; expansion port for SASI/SCSI controllers, etc.  It utilizes the Hi-
  12. ; tachi HD64180 CMOS CPU, a VLSI chip with memory management, serial,
  13. ; DMA and timer functions on-chip. It's instruction set is upwardly com-
  14. ; compatible with the Z80.
  15. ;
  16. ; Edit this file for your preferences then follow the "TO USE:" example
  17. ; shown below.    Some special HD64180 instructions are used, but any nor-
  18. ; mal 8080 or Z80 assembler may be used.
  19. ;
  20. ; Many terminals will clear the screen with a CTL-Z.  If yours does, put
  21. ; a 1AH at CLEAR: (010AH).  Many terminals use two characters, the first
  22. ; normally an ESC.  For example, ESC *.  In this case put '*' at CLEAR:
  23. ; (The ESC will automatically be typed with no CTL-character present.)
  24. ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
  25. ; will scroll up 24 blank lines to clear the CRT for things like MENU,
  26. ; looking at the function key table, typing CTL-Z in command mode, etc.
  27. ;
  28. ; Use the "SET" command to change the baudrate when desired.  The value
  29. ; at MSPEED controls the baudrate when the program is first called up.
  30. ;
  31. ; TO USE: First edit this file filling in answers for your own
  32. ;        equipment.  Then assemble with ZAS.COM or equivalent
  33. ;        assembler.  Then use MLOAD to merge into the main file:
  34. ;
  35. ;        MLOAD IMP.COM=IMP.COM,I2MM-x.HEX
  36. ;
  37. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  38. ;
  39. ; 03/27/86  Converted for assembly with normal 8080 or Z80 assemblers,
  40. ;        like other IMP overlays.  Renamed to I2MM to avoid conflict
  41. ;        with I2SB for Intertec Super Brain computer.
  42. ;                    - Irv Hoff
  43. ;
  44. ; 08/19/85  First version for the MicroMint SB180.
  45. ;                    - Max Southall
  46. ;
  47. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  48. ;
  49. YES     EQU    0FFH
  50. NO     EQU    0
  51. ;
  52. ;
  53. ; Values shown are for a Z80 SIO
  54. ;
  55. PORT     EQU    00H        ; Your base port (data or status)
  56. MDCTL1     EQU    PORT+4        ; Modem status port
  57. MDDATIN     EQU    PORT+8        ; Modem data in port
  58. MDDATOUT EQU    PORT+6        ; Modem data out port
  59. MDRCV     EQU    80H        ; Modem receive ready
  60. MDSND     EQU    02H        ; Modem send ready bit
  61. MDTXE     EQU    02H        ; Modem send buffer empty, holding buffer empty
  62. ;
  63. BAUDRP     EQU    PORT+2        ; HD64180 Port 0 ^B
  64. ;
  65. IN0     EQU    38EDH        ; Special Hitachi op code pair for 'A' reg.
  66. OUT0     EQU    39EDH        ; Special Hitachi op code pair for 'A' reg.
  67. ;-----------------------------------------------------------------------
  68. ;
  69. ESC     EQU    '['-40H        ; ^[ = Escape
  70. BELL     EQU    'G'-40H        ; ^G = Bell character
  71. LF     EQU    'J'-40H        ; ^J = Linefeed
  72. NEXTRY     EQU    'K'-40H        ; ^K = Try next phone number, abort this try
  73. CR     EQU    'M'-40H        ; ^M = Carriage return
  74. CLEARSC     EQU    'Z'-40H        ; ^Z = Clears screen, command mode only
  75. EOFCHAR     EQU    'Z'-40H        ; ^Z = End of file
  76. ;
  77. ;
  78.      ORG    0100H
  79. ;
  80. ;
  81.      DS    3        ; Skip the data area below
  82. ;
  83. ;
  84. ; These routines and equates are at the beginning of the program so
  85. ; they can be patched by a monitor or overlay file without re-assembling
  86. ; the program.
  87. ;
  88. MSPEED:     DB    5    ; 0=110 1=300 2=450 3=600 4=710 5=1200        103H
  89.             ; 6=2400 7=4800 8=9600 9=19200 default
  90. HS2400:     DB    NO    ; Yes=2400 bps highest speed            104H
  91. HS1200:     DB    YES    ; Yes=1200 bps highest speed            105H
  92. RACAL:     DB    NO    ; Yes=Racal-Vadic 1200V or 2400V or 2400PA    106H
  93. PROMODM: DB    YES    ; Yes=Prometheus ProModem 1200 bps        107H
  94. RESVD1:     DB    NO    ; Reserved for special modems            108H
  95. RESVD2:     DB    NO    ; Reserved for special modems            109H
  96. ;
  97. ;
  98. CLEAR:     DB    1AH    ; Clear screen character (ESC not needed)    10AH
  99. CLOCK:     DB    61    ; Clock speed in MHz x10, 25.5 MHz max.     10BH
  100.             ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  101. BYTDLY:     DB    2    ; 0=0 delay  1=10ms  5=50 ms - 9=90 ms        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=100 ms 5=500 ms - 9=900 ms    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    ; Yes=default to CRC checking            112H
  116. IGNRCTL: DB    YES    ; Yes=CTL-chars above ^M not displayed        113H
  117. ;.....
  118. ;
  119. ;
  120. EXTCHR:     DB    '['-40H    ; ESC = preceeds local control character    114H
  121. EXITCHR: DB    'E'    ; Exit character                115H
  122. FILESND: DB    'F'    ; Send file when 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. SAVECHR: DB    'Y'    ; Open input text buffer            11BH
  128. CLEARS:     DB    'Z'    ; Clears screen, terminal mode            11CH
  129. SPARE1:     DB    0    ; For future development            11DH
  130. NODTR:     DB    NO    ; Yes if need pause +++ ATH0 to disconnect    11EH
  131. ;......
  132. ;
  133. ;
  134. ; Handles in/out ports for data and status
  135. ;
  136. I$MDCTL1: DW    IN0        ;                    11FH
  137.       DB    MDCTL1        ;                    121H
  138.       DW    IN0        ;                    122H
  139.       DB    MDCTL1        ;                    124H
  140.       RET            ;                    125H
  141.       DB    0,0,0        ;                    126H
  142. ;
  143. I$MDTXE:  DW    IN0        ;                    129H
  144.       DB    MDCTL1        ;                    12BH
  145.       DW    IN0        ;                    12CH
  146.       DB    MDCTL1        ;                    12EH
  147.       RET            ;                    13FH
  148.       DB    0,0,0        ;                    130H
  149. ;
  150. I$MDDATP: DW    IN0        ;                    133H
  151.       DB    MDDATIN        ;                    135H
  152.       RET            ;                    136H
  153.       DB    0,0,0,0,0,0    ;                    137H
  154. ;
  155. O$MDDATP: DW    OUT0        ;                    13DH
  156.       DB    MDDATOUT    ;                    13FH
  157.       RET            ; OUT modem data port            140H
  158.       DB    0,0,0,0,0,0    ; Spares if needed            141H
  159. ;.....
  160. ;
  161. ;
  162. A$MDRCV:  ANI    MDRCV        ;                    147H
  163.       RET            ;                    149H
  164. ;
  165. C$MDRCV:  CPI    MDRCV        ;                    14AH
  166.       RET            ;                    14CH
  167. ;
  168. A$MDSND:  ANI    MDSND        ;                    14DH
  169.       RET            ;                    14FH
  170. ;
  171. C$MDSND:  CPI    MDSND        ;                    150H
  172.       RET            ;                    152H
  173. ;
  174. A$MDTXE:  ANI    MDTXE        ;                    153H
  175.       RET            ;                    155H
  176. ;
  177. C$MDTXE:  CPI    MDTXE        ;                    156H
  178.       RET            ;                    158H
  179. ;.....
  180. ;
  181. ;
  182. ; Special exit vector, used by some computers to reset interrupt vectors
  183. ;
  184. J$EXITVEC:RET            ;                    159H
  185.       DB    0,0        ;                    15AH
  186. ;.....
  187. ;
  188. ;
  189. ; Jump vectors needed by each overlay
  190. ;
  191. J$GOODBYE:JMP    GOODBYE        ; Disconnects modem by dropping DTR    15CH
  192. J$INITMOD:JMP    INITMOD        ; Initializes modem, autosets baudrate    15FH
  193. J$STUPR:  JMP    STUPR        ; SET routine to change baudrate    162H
  194. J$SYSVR:  JMP    SYSVR        ; Signon message            165H
  195. ;.....
  196. ;
  197. ;
  198. ; "AT" command strings, can be replaced in individual overlay if needed
  199. ;
  200. J$STRNGA: DS    3        ; 1200 bps "AT" string            168H
  201. J$STRNG1: DS    3        ; 2400 bps "AT" string            16BH
  202. ;
  203. ;
  204. ; Next fourteen lines should not be changed by user overlay as these go
  205. ; to specific locations in the main program, not in the overlay.
  206. ;
  207. ;
  208. J$CMDSPL: DS    3        ; Allows entry of baudrate on CMD line    16EH
  209. J$CRLF:      DS    3        ; Turns up one new line on display    171H
  210. J$DIAL:      DS    3        ; Start of dialing routine        174H
  211. J$DSCONT: DS    3        ; Terminates modem use            177H
  212. J$GOLST:  DS    3        ; Printer routine, needed by Apple //e    17AH
  213. J$ILPRT:  DS    3        ; Prints an inline string, 0 to end    17DH
  214. J$INBUF:  DS    3        ; Stores a keybd string for comparison    180H
  215. J$INLNCP: DS    3        ; Inline "compare strings" routine    183H
  216. J$INMDM:  DS    3        ; Max .1 sec wait for modem character    186H
  217. J$RCVRSP: DS    3        ; For 3801 I/O use (TV-803)        189H
  218. J$SNDCHR: DS    3        ; Sends a character to the modem    18CH
  219. J$SNDSTR: DS    3        ; Sends a string to the modem, $ to end 18FH
  220. J$TIMER:  DS    3        ; .1 second timer (amount in 'B' reg.)    192H
  221. J$NEW1:      DB    0,0,0        ; For future needs            195H
  222. J$NEW2:      DB    0,0,0        ; For future needs            198H
  223. ;.....
  224. ;
  225. ;
  226. ; For 2400 bps auto-stepdown units
  227. ;
  228. MANUAL:      DB    0        ; For manual selection flag        19BH
  229. J$300:      JMP    OK300        ; Sets baudrate to 300 baud        19CH
  230. J$1200:      JMP    OK1200        ; Sets baudrate to 1200 bps        19FH
  231. J$2400:      JMP    OK2400        ; Sets baudrate to 2400 bps        1A2H
  232. ;.....
  233. ;
  234. ;
  235. LOGPTR:      DW    LOGON        ; Pointer to display LOGON message    1A5H
  236. ;
  237. SYSVR:      CALL    J$ILPRT        ; Display the following line        1A7H
  238.       DB    'Version for Systech/MicroMint SB180' ;         1AAH
  239.       DB    CR,LF,0
  240.       RET
  241. ;.....
  242. ;
  243. ;
  244. ;-----------------------------------------------------------------------
  245. ;
  246. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  247. ;     end of your last routine should terminate by 0400H (601 bytes
  248. ;     available after start of SYSVER).
  249. ;
  250. ;-----------------------------------------------------------------------
  251. ;
  252. ; You can put in a message at this location which can be called up with
  253. ; (special character-L).  You can put in several lines.  End with a 0.
  254. ;
  255. LOGON:    DB    'This is a SB180 computer...',CR,LF,0
  256. ;
  257. ;-----------------------------------------------------------------------
  258. ;
  259. ;
  260. ; This routine sets DTR low for 300 ms. to disconnect the phone
  261. ;
  262. GOODBYE:
  263.     MVI    B,'S'-40H    ; X-off to stop host if needed
  264.     CALL    J$SNDCHR
  265.     MVI    B,1        ; Wait a moment to let it react
  266.     CALL    J$TIMER
  267. ;
  268.     DW    IN0
  269.     DB    PORT
  270.     DW    0E7CBH        ; Raise DTR (actually RTS)
  271.     DW    OUT0
  272.     DB    PORT
  273.     MVI    B,3        ; Wait for 300 ms.
  274.     CALL    J$TIMER
  275.     DW    IN0
  276.     DB    PORT
  277.     DW    0A7CBH        ; Reset DTR to normal
  278.     DW    OUT0
  279.     DB    PORT
  280. ;
  281.     RET
  282. ;.....
  283. ;
  284. ;
  285. ; Initialization -- sets baudrate
  286. ;
  287. INITMOD:
  288.     LDA    MSPEED        ; Get the selected value
  289.     CPI    1        ; 300 bps
  290.     JZ    OK300
  291.     CPI    5        ; 1200 bps
  292.     JZ    OK1200
  293.     CPI    6        ; 2400 bps
  294.     JZ    OK2400
  295.     CPI    8        ; 9600 bps
  296.     JZ    OK9600
  297.     CPI    9
  298.     JZ    OK19200
  299.     JMP    STUPR1        ; Else ask what is wanted
  300. ;.....
  301. ;
  302. ;
  303. ; Setup routine to allow changing modem speed with the SET command.
  304. ;
  305. STUPR:    CALL    J$CMDSPL    ; Gives us CMDBUF+6
  306.     JNC    STUPR2
  307. ;
  308. STUPR1:    CALL    J$ILPRT
  309.     DB    'Input BPS (300, 1200, 2400, 9600, 19200): ',0
  310.     LXI    D,BAUDBUF    ; Point to new input buffer
  311.     CALL    J$INBUF
  312.     CALL    J$CRLF
  313.     LXI    D,BAUDBUF+2
  314. ;
  315. STUPR2:    CALL    J$INLNCP    ; Compare BAUDBUF+2 with chars. below
  316.     DB    '300',0
  317.     JNC    OK300        ; Go if got match
  318.     CALL    J$INLNCP
  319.     DB    '1200',0
  320.     JNC    OK1200
  321.     CALL    J$INLNCP
  322.     DB    '2400',0
  323.     JNC    OK2400
  324.     CALL    J$INLNCP
  325.     DB    '9600',0
  326.     JNC    OK9600
  327.     CALL    J$INLNCP
  328.     DB    '19200',0
  329.     JNC    OK19200
  330.     CALL    J$ILPRT        ; All matches failed, tell operator
  331.     DB    '=> Unknown entry',CR,LF,BELL,CR,LF,0
  332.     JMP    STUPR1        ; Try again
  333. ;
  334. OK300:    MVI    A,1        ; MSPEED 300 bps value
  335.     MVI    B,BD300
  336.     JMP    LOADBD
  337. ;
  338. OK1200:    MVI    A,5
  339.     MVI    B,BD1200
  340.     JMP    LOADBD
  341. ;
  342. OK2400:    XRA    A        ; Reset to maximum auto-speed
  343.     STA    MANUAL
  344.     MVI    A,6
  345.     MVI    B,BD2400
  346.     JMP    LOADBD
  347. ;
  348. OK9600:    MVI    A,8
  349.     MVI    B,BD9600
  350.     JMP    LOADBD
  351. ;
  352. OK19200:MVI    A,9
  353.     MVI    B,BD19200
  354.  
  355. LOADBD:    STA    MSPEED        ; Change time-to-send to match baudrate
  356.     MOV    A,B        ; Get baudrate byte
  357.     LHLD    1        ; Get BIOS JMP table start address
  358.     LXI    D,61        ; Offset of IOTABLE from BIOS+3
  359.     DAD    D
  360.     PUSH    H
  361.     DW    0E1DDH        ; (POP IX)
  362.     DW    77DDH        ; Z80 op code
  363.     DB    PORT+2
  364.     DW    OUT0
  365.     DB    BAUDRP
  366. ;
  367.     RET
  368. ;.....
  369. ;
  370. ;
  371. ; Baudrate table
  372. ;
  373. BD300    EQU    13
  374. BD1200    EQU    11
  375. BD2400    EQU    10
  376. BD9600    EQU    8
  377. BD19200    EQU    1
  378. ;
  379. BAUDBUF:
  380.     DB    10,0,0,0,0,0
  381.     DB    0,0,0,0,0,0
  382. ;
  383. ;                   end
  384. ;-----------------------------------------------------------------------
  385. ;
  386. ; NOTE: Must terminate prior to 0400H
  387. ;
  388.     END
  389.