home *** CD-ROM | disk | FTP | other *** search
- ; I2MM-4.Z80 - MicroMint SB180 overlay file for IMP - 06/01/87
- ;
- ; HD64180 On-chip ASCII Port 0
- ;
- ; This version handles 6 ZMHz, 9 MHz or 12 MHz clock speed
- ;
- ; This file adapts the MicroMint SB180 computer to IMP.COM. This com-
- ; puter was featured in the September and October 1985 issues of BYTE
- ; magazine in Ciarcia's Circuit Cellar. The SB180 is an extremely com-
- ; pact (4" by 7") single board computer with 2 serial ports, 1 parallel
- ; printer port, 5"/8" disk controller, and 256K RAM as well as an expan-
- ; ion port for SASI/SCSI controllers, etc. It utilizes the new Hitachi
- ; HD64180 CMOS CPU, a VLSI chip with memory management, serial, DMA and
- ; timer functions on-chip. It's instruction set is upwardly compatible
- ; with the Z80.
- ;
- ;
- ; Edit this file for your preferences then follow the "TO USE:" example
- ; shown below. Some special HD64180 instructions are used, but any nor-
- ; mal 8080 or Z80 assembler may be used.
- ;
- ; Many terminals will clear the screen with a CTL-Z. If yours does, put
- ; a 1AH at CLEAR: (010AH). Many terminals use two characters, the first
- ; normally an ESC. For example, ESC *. In this case put '*' at CLEAR:
- ; (The ESC will automatically be typed with no CTL-character present.)
- ; If you don't know what your terminal uses, put a 0 at CLEAR: and IMP
- ; will scroll up 24 blank lines to clear the CRT for things like MENU,
- ; looking at the function key table, typing CTL-Z in command mode, etc.
- ;
- ; Use the "SET" command to change the baudrate when desired. The value
- ; at MSPEED controls the baudrate when the program is first called up.
- ;
- ; TO USE: First edit this file filling in answers for your own
- ; equipment. Then assemble with ZAS.COM or equivalent
- ; assembler. Then use MLOAD to merge into the main file:
- ;
- ; MLOAD IMP.COM=IMP.COM,I2MM-x.HEX
- ;
- ; = = = = = = = = = = = = = = = = = =
- ;
- ; 02/14/89 Added true DTR disconnect routine, replacing RTS routine.
- ; v5 -Gene Pizzetta
- ;
- ; 06/01/87 After being advised by Steven Mendelson that 6 MHz, 9MHz and
- ; v4 12 MHz versions are available, I called MicroMint and got
- ; the baud rate data for all those from Ken Davidson.
- ; - Irv Hoff
- ;
- ; 06/01/87 Improved the GOODBYE routine, added BREAK routine, needs
- ; v3 IMP245 to use it.
- ;
- ; 03/27/86 Modest changes to standardize appearance with other similar
- ; v2 overlays, other minor changes. Renamed to I2MM to avoid
- ; conflict with I2SB for Intertec Super Brain computer.
- ; - Irv Hoff
- ;
- ; 08/19/85 First version for the MicroMint SB180.
- ; v1 - Max Southall
- ;
- ; = = = = = = = = = = = = = = = = =
- ;
- YES EQU 0FFH
- NO EQU 0
- ;
- ;
- ; Select one of the following for your computer board
- ;
- CLK6 EQU NO ; Yes if using 6 MHz clock
- CLK9 EQU YES ; Yes if using 9 MHz clock
- CKL12 EQU NO ; Yes if using 12 MHz clock
- ;
- ;
- ; Values shown are for a HD64180
- ;
- PORT EQU 00H ; Your base port (data or status)
- MDCTL1 EQU PORT+4 ; Modem status port
- MDDATIN EQU PORT+8 ; Modem data in port
- MDDATOUT EQU PORT+6 ; Modem data out port
- MDRCV EQU 80H ; Modem receive ready
- MDSND EQU 02H ; Modem send ready bit
- MDTXE EQU 02H ; Modem send buffer empty, holding buffer empty
- ;
- BAUDRP EQU PORT+2 ; HD64180 Port 0 ^B
- ;
- IN0 EQU 38EDH ; Special Hitachi op code pair for 'A' reg.
- OUT0 EQU 39EDH ; Special Hitachi op code pair for 'A' reg.
- ;
- ;
- ;-----------------------------------------------------------------------
- ;
- ESC EQU '['-40H ; ^[ = Escape
- BELL EQU 'G'-40H ; ^G = Bell character
- LF EQU 'J'-40H ; ^J = Linefeed
- NEXTRY EQU 'K'-40H ; ^K = Try next phone number, abort this try
- CR EQU 'M'-40H ; ^M = Carriage return
- CLEARSC EQU 'Z'-40H ; ^Z = Clears screen, command mode only
- EOFCHAR EQU 'Z'-40H ; ^Z = End of file
- ;
- ;
- ORG 0100H
- ;
- ;
- DEFS 3 ; Skip the data area below
- ;
- ;
- ; These routines and equates are at the beginning of the program so
- ; they can be patched by a monitor or overlay file without re-assembling
- ; the program.
- ;
- MSPEED: DEFB 6 ; 0=110 1=300 2=450 3=600 4=710 5=1200 103H
- ; 6=2400 7=4800 8=9600 9=19200 default
- HS2400: DEFB YES ; Yes=2400 bps highest speed 104H
- HS1200: DEFB NO ; Yes=1200 bps highest speed 105H
- RACAL: DEFB NO ; Yes=Racal-Vadic 1200V or 2400V or 2400PA 106H
- PROMODM:DEFB NO ; Yes=Prometheus ProModem 1200 bps 107H
- RESVD1: DEFB NO ; Reserved for special modems 108H
- RESVD2: DEFB NO ; Reserved for special modems 109H
- ;
- ;
- CLEAR: DEFB 1AH ; Clear screen character (ESC not needed) 10AH
- ;
- IF CLK6
- CLOCK: DEFB 60 ; Clock speed in MHz x10, 25.5 MHz max. 10BH
- ENDIF ; CLK6
- IF CLK9
- CLOCK: DEFB 90 ; Clock speed in MHz x10, 25.5 MHz max. 10BH
- ENDIF ; CLK9
- IF CLK12
- CLOCK: DEFB 120 ; Clock speed in MHz x10, 25.5 MHz max. 10BH
- ENDIF ; CLK12
-
- ; 20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
- BYTDLY: DEFB 2 ; 0=0 delay 1=10ms 5=50 ms - 9=90 ms 10CH
- ; default time to send character in ter-
- ; minal mode file transfer for slow BBS
- CRDLY: DEFB 2 ; 0=0 delay 1=100 ms 5=500 ms - 9=900 ms 10DH
- ; default time for extra wait after CRLF
- ; in terminal mode file transfer
- NOFCOL: DEFB 5 ; Number of directory columns shown 10EH
- TCHPUL: DEFB 'T' ; T=tone, P=Pulse (Hayes 2400 modems) 10FH
- ;.....
- ;
- ;
- ADDLFD: DEFB NO ; Yes=add LF after CR to send file in terminal 110H
- ; mode (normally added by remote echo)
- CONVRUB:DEFB YES ; Yes=convert rub to backspace 111H
- CRCDFLT:DEFB YES ; Yes=default to CRC checking 112H
- IGNRCTL:DEFB YES ; Yes=CTL-chars above ^M not displayed 113H
- ;.....
- ;
- ;
- EXTCHR: DEFB '['-40H ; ESC = preceeds local control character 114H
- EXITCHR:DEFB 'E' ; Exit character 115H
- FILESND:DEFB 'F' ; Send file when in terminal mode 116H
- NOCONCT:DEFB 'N' ; Disconnect from phone line 117H
- LOGCHR: DEFB 'L' ; Send logon 118H
- LSTCHR: DEFB 'P' ; Toggle printer 119H
- UNSAVCH:DEFB 'R' ; Close input text buffer 11AH
- SAVECHR:DEFB 'Y' ; Open input text buffer 11BH
- CLEARS: DEFB 'Z' ; Clears screen, terminal mode 11CH
- BRKCHR: DEFB 'Q' ; Send a break tone 11DH
- NODTR: DEFB NO ; YES if no DTR and need ATH0 to disconnect 11EH
- ;......
- ;
- ;
- ; Handles in/out ports for data and status
- ;
- I$MDCTL1:
- DEFW IN0 ; 11FH
- DEFB MDCTL1 ; 121H
- DEFW IN0 ; 122H
- DEFB MDCTL1 ; 124H
- RET ; 125H
- DEFB 0,0,0 ; 126H
- ;
- I$MDTXE:DEFW IN0 ; 129H
- DEFB MDCTL1 ; 12BH
- DEFW IN0 ; 12CH
- DEFB MDCTL1 ; 12EH
- RET ; 13FH
- DEFB 0,0,0 ; 130H
- ;
- I$MDDATP:
- DEFW IN0 ; 133H
- DEFB MDDATIN ; 135H
- RET ; 136H
- DEFB 0,0,0,0,0,0 ; 137H
- ;
- O$MDDATP:
- DEFW OUT0 ; 13DH
- DEFB MDDATOUT ; 13FH
- RET ; OUT modem data port 140H
- DEFB 0,0,0,0,0,0 ; Spares if needed 141H
- ;.....
- ;
- ;
- A$MDRCV:AND MDRCV ; 147H
- RET ; 149H
- ;
- C$MDRCV:CP MDRCV ; 14AH
- RET ; 14CH
- ;
- A$MDSND:AND MDSND ; 14DH
- RET ; 14FH
- ;
- C$MDSND:CP MDSND ; 150H
- RET ; 152H
- ;
- A$MDTXE:AND MDTXE ; 153H
- RET ; 155H
- ;
- C$MDTXE:CP MDTXE ; 156H
- RET ; 158H
- ;.....
- ;
- ;
- ; Special exit vector, used by some computers to reset interrupt vectors
- ;
- J$EXITVEC:
- RET ; 159H
- DEFB 0,0 ; 15AH
- ;.....
- ;
- ;
- ; Jump vectors needed by each overlay
- ;
- J$GOODBYE:
- JP GOODBYE ; Disconnects modem by dropping DTR 15CH
- J$INITMOD:
- JP INITMOD ; Initializes modem, autosets baudrate 15FH
- J$STUPR:JP STUPR ; SET routine to change baudrate 162H
- J$SYSVR:JP SYSVR ; Signon message 165H
- ;.....
- ;
- ;
- ; "AT" command strings, can be replaced in individual overlay if needed
- ;
- J$STRNGA:
- DEFS 3 ; 1200 bps "AT" string 168H
- J$STRNG1:
- jp SplStr ; 2400 bps "AT" string 16BH
- ;
- ;
- ; Next fourteen lines should not be changed by user overlay as these go
- ; to specific locations in the main program, not in the overlay.
- ;
- ;
- J$CMDSPL:
- DEFS 3 ; Allows entry of baudrate on CMD line 16EH
- J$CRLF: DEFS 3 ; Turns up one new line on display 171H
- J$DIAL: DEFS 3 ; Start of dialing routine 174H
- J$DSCONT:
- DEFS 3 ; Terminates modem use 177H
- J$GOLST:DEFS 3 ; Printer routine, needed by Apple //e 17AH
- J$ILPRT:DEFS 3 ; Prints an inline string, 0 to end 17DH
- J$INBUF:DEFS 3 ; Stores a keybd string for comparison 180H
- J$INLNCP:
- DEFS 3 ; Inline "compare strings" routine 183H
- J$INMDM:DEFS 3 ; Max .1 sec wait for modem character 186H
- J$RCVRSP:
- DEFS 3 ; For 3801 I/O use (TV-803) 189H
- J$SNDCHR:
- DEFS 3 ; Sends a character to the modem 18CH
- J$SNDSTR:
- DEFS 3 ; Sends a string to the modem, $ to end 18FH
- J$TIMER:DEFS 3 ; .1 second timer (amount in 'B' reg.) 192H
- J$BREAK:JP SENDBRK ; Break routine 195H
- J$NEW2: DEFB 0,0,0 ; For future needs 198H
- ;.....
- ;
- ;
- ; For 2400 bps auto-stepdown units
- ;
- MANUAL: DEFB 0 ; For manual selection flag 19BH
- J$300: JP OK300 ; Sets baudrate to 300 baud 19CH
- J$1200: JP OK1200 ; Sets baudrate to 1200 bps 19FH
- J$2400: JP OK2400 ; Sets baudrate to 2400 bps 1A2H
- ;.....
- ;
- ;
- LOGPTR: DEFW LOGON ; Pointer to display LOGON message 1A5H
- ;
- SYSVR: CALL J$ILPRT ; Display the following line 1A7H
- DEFB 'Version for MicroMint SB180FX' ; 1AAH
- DEFB CR,LF,0
- RET
- ;.....
- ;
- ;
- ;-----------------------------------------------------------------------
- ;
- ; NOTE: You can change the SYSVER message to be longer or shorter. The
- ; end of your last routine should terminate by 0400H (601 bytes
- ; available after start of SYSVER).
- ;
- ;-----------------------------------------------------------------------
- ;
- ; You can put in a message at this location which can be called up with
- ; (special character-L). You can put in several lines. End with a 0.
- ;
- LOGON: DEFB 'This is an SB180FX computer...',CR,LF,0
- ;
- ;-----------------------------------------------------------------------
- ;
- ; This routine sets a 300 ms break tone. It changes the baudrate to
- ; 38400 bps then sends enough ASCII null characters to consume 300 ms.
- ; (A null character is all spacing except for the stop bit.) At high
- ; speed this effectively gives a steady break tone. When finished it
- ; restores the baudrate to the original speed.
- ;
- SENDBRK:
- IF CLK6 OR CLK12
- LD A,BD38400 ; Select 38,400 bps
- ENDIF ; CLK6 OR CLK12
- ;
- IF CLK9
- LD A,BD19200 ; Select 19,200 bps
- ENDIF ; CLK9
- ;
- CALL LOAD1 ; Set output for this speed
- ;
- IF CLK6 OR CLK12
- LD DE,1150 ; Will take 300 ms at 38,400 bps
- ENDIF ; CLK6 OR CLK12
- ;
- IF CLK9
- LD DE,575 ; Will take 300 ms at 19,200 bps
- ENDIF ; CLK9
- ;
- SEND1: XOR A ; ASCII null character
- CALL J$SNDCHR ; Sends a character to the modem
- DEC DE ; One less to go
- JP NZ,SEND1 ; If not zero, do another
- ;
- JP INITMOD ; Reset original speed
- ;.....
- ;
- ;
- ; This routine sets DTR low for 300 ms to disconnect the modem.
- ;
- GOODBYE:
- ; DEFW IN0
- ; DEFB PORT
- ; DEFW 0E7CBH ; Raise DTR (actually RTS)
- ; DEFW OUT0
- ; DEFB PORT
- ; LD B,5 ; Wait for 300 ms
- ; CALL J$TIMER
- ; DEFW IN0
- ; DEFB PORT
- ; DEFW 0A7CBH ; Reset DTR to normal
- ; DEFW OUT0
- ; DEFB PORT
- ; RET
- ;
- ; Routine above raises and lowers RTS instead of DTR. New routine
- ; below raises and lowers DTR. (Copied from DTR.Z80 by Rory Kestner.)
- ;
- call set ; raise DTR
- ld b,5 ; ..for 5 milliseconds
- call j$timer
- call reset ; then lower it
- ret
- ;
- set: call status
- ld a,01000000b ; mask off desired bit
- or b ; ..or it
- ld b,a ; ..put in A for BIOS
- ld a,0ffh ; set up for write
- ld hl,(1) ; get BIOS address
- ld l,3fh ; offset of latch routine
- jp (hl) ; jump to BIOS and return
- ;
- reset: call status
- ld a,10111111b
- and b ; and desired bit
- ld b,a
- ld a,0ffh
- ld hl,(1)
- ld l,3fh
- jp (hl)
- ;
- status: xor a ; set up for read function
- ld hl,(1) ; get BIOS address
- ld l,3fh ; offset for latch routine
- jp (hl)
- ;.....
- ;
- ;
- ; Initialization -- sets baudrate
- ;
- INITMOD:
- LD A,(MSPEED) ; Get the selected value
- CP 1 ; 300 bps
- JP Z,OK300
- CP 5 ; 1200 bps
- JP Z,OK1200
- CP 6 ; 2400 bps
- JP Z,OK2400
- CP 8 ; 9600 bps
- JP Z,OK9600
- CP 9
- JP Z,OK19200
- JP STUPR1 ; Else ask what is wanted
- ;.....
- ;
- ;
- ; Setup routine to allow changing modem speed with the SET command.
- ;
- STUPR: CALL J$CMDSPL ; Gives us CMDBUF+6
- JP NC,STUPR2
- ;
- STUPR1: CALL J$ILPRT
- DEFB 'Input BPS (300, 1200, 2400, 9600, 19200): ',0
- LD DE,BAUDBUF ; Point to new input buffer
- CALL J$INBUF
- CALL J$CRLF
- LD DE,BAUDBUF+2
- ;
- STUPR2: CALL J$INLNCP ; Compare BAUDBUF+2 with chars. below
- DEFB '300',0
- JP NC,OK300 ; Go if got match
- CALL J$INLNCP
- DEFB '1200',0
- JP NC,OK1200
- CALL J$INLNCP
- DEFB '2400',0
- JP NC,OK2400
- CALL J$INLNCP
- DEFB '9600',0
- JP NC,OK9600
- CALL J$INLNCP
- DEFB '19200',0
- JP NC,OK19200
- CALL J$ILPRT ; All matches failed, tell operator
- DEFB '=> Unknown entry',CR,LF,BELL,CR,LF,0
- JP STUPR1 ; Try again
- ;
- OK300: LD A,1 ; MSPEED 300 bps value
- LD B,BD300
- JP LOADBD
- ;
- OK1200: LD A,5
- LD B,BD1200
- JP LOADBD
- ;
- OK2400: XOR A ; Reset to maximum auto-speed
- LD (MANUAL),A
- LD A,6
- LD B,BD2400
- JP LOADBD
- ;
- OK9600: LD A,8
- LD B,BD9600
- JP LOADBD
- ;
- OK19200:LD A,9
- LD B,BD19200
- ;
- LOADBD: LD (MSPEED),A ; Change time-to-send to match baudrate
- LD A,B ; Get baudrate byte
- ;
- LOAD1: LD HL,(1) ; Get BIOS JMP table start address
- LD DE,61 ; Offset of IOTABLE from BIOS+3
- ADD HL,DE
- PUSH HL
- DEFW 0E1DDH ; (POP IX)
- DEFW 77DDH ; Z80 op code
- DEFB PORT+2
- DEFW OUT0
- DEFB BAUDRP
- RET
- ;.....
- ;
- ;
- ; Baudrate table
- ;
- IF CLK6
- BD300 EQU 13
- BD1200 EQU 5
- BD2400 EQU 4
- BD9600 EQU 2
- BD19200 EQU 1
- BD38400 EQU 0
- ENDIF ; CLK6
- ;
- IF CLK9
- BD300 EQU 38
- BD1200 EQU 36
- BD2400 EQU 35
- BD9600 EQU 33
- BD19200 EQU 32
- ENDIF ; CLK9
- ;
- IF CLK12
- BD300 EQU 14
- BD1200 EQU 6
- BD2400 EQU 5
- BD9600 EQU 3
- BD19200 EQU 2
- BD38400 EQU 1
- ENDIF ; CLK12
- ;
- BAUDBUF:DEFB 10,0,0,0,0,0
- DEFB 0,0,0,0,0,0
- ;.....
- ;
- ;
- ; Initialization string - the '#' character is a 100 ms. delay, at least
- ; four should be used after a CR following a command.
- ;
- SplStr: db 'ATM3L2&D2',CR,'####','ATE1Q0V0X4H0',CR,'####','$'
- ;
- ; end
- ;-----------------------------------------------------------------------
- ;
- ; NOTE: Must terminate prior to 0400H
- ;
- END