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 / I218-4.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  13KB  |  479 lines

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