; B3US-2.INS - US Robotics S100 modem insert for BYE3 - 08/01/85 ; ; US Robotics S100 modem Interface routines ; ; Note: This is an insert, not an overlay. ; ; ********************************* ; * * ; * DOES NOT SUPPORT 2400 BPS * ; * * ; ********************************* ; ; ; = = = = = = = = = = = = = = = = = = ; ; Port equates ; DPORT EQU 0C0H ; Modem data port SPORT EQU DPORT+1 ; Status port and control port #1 ; ; Status masks ; DAV EQU 00000010B ; Data available TBMT EQU 00000100B ; Transmit buffer empty DCD EQU 10000000B ; Data carrier detect ; ; Bit functions ; BDIV64 EQU 04FH ; 8 data bits, no parity, 1 stop, div 64 BDIV16 EQU 04EH ; 8 data bits, no parity, 1 stop, div 16 BRESET EQU 040H ; Reset 8251A ; BANHI EQU 035H ; Answer phone, RTS high (300/1200 baud) BANLOW EQU 015H ; Answer phone, RTS low (110/600 baud) DTR EQU 002H ; DTR bit in command word for off-hook ; control ; ;----------------------------------------------------------------------- ; ; See if we still have a carrier - if not, return with the zero flag set ; MDCARCK:IN SPORT ; Read port ANI DCD ; Check DCD for carrier detect STA CARFLG+1 ; Remember it RZ ORI 255 RET ; ; Return previous carrier status ; CARFLG: MVI A,0 ; Immediate value set by MDCARCK ORA A ; Set the flags RET ; ; Disconnect and wait for an incoming call ; MDINIT: CALL MDCARCK ; Do we have a carrier? JZ IMINIT ; No carrier, initialize the modem CALL MDRESET ; Hang up JMP MDINIT ; Try it again ; ;Input a character from the modem port ; MDINP: IN DPORT ; Get character RET ; ; Check the status to see if a character is available. If not, return ; with the zero flag set. If yes, use 0FFH to clear the flag. ; MDINST: IN SPORT ; Read port ANI DAV ; Check receive ready bit RZ ; Return if no character ORI 255 RET ; ; Send a character to the modem ; MDOUTP: OUT DPORT ; Send it RET ; ; See if the output is ready for another character ; MDOUTST:IN SPORT ; Read port ANI TBMT ; Check transmit ready bit RET ; ; Reinitialize the modem and hang up the phone by dropping DTR and ; leaving it inactive. ; MDQUIT: CALL IMQUIT ; Tell modem to shut down MDSTOP: RET ; ; The following routine sets the baudrate. BYE3 asks for the maximum ; speed you have available. ; SET2400:ORI 255 ; Make sure the zero flag isn't set RET ; ; The pairs of XCHG instructions in the following code are to allow ; for the reported slowness of the 8251a command/status port. ; ; Note: Asserting DTR during 8251 initialization will hang up the phone. ; To keep the phone off-hook if carrier is present, DTR is asserted or ; not, depending on the last condition of the carrier detect flag. ; MDRESET:CALL INITUSR ; Initialize the modem and hang up MVI A,BDIV16 ; 1200 bps OUT SPORT XCHG XCHG MVI A,BANHI+DTR ; Put phone on-hook JMP SENBAUD ; SET300: CALL INITUSR ; Initialize Robotics MVI A,BDIV64 ; Set mode and divide by 64 (300 baud) OUT SPORT XCHG XCHG CALL CARFLG ; Data carrier detect MVI A,BANHI ; Set RTS high (300 baud) JNZ ST3 ; If carrier, leave phone off-hook ORI DTR ; Otherwise leave it on-hook ; ST3: JMP SENBAUD ; SET1200:CALL INITUSR ; Initialize Robotics MVI A,BDIV16 ; Set mode and divide by 16 (1200 bps) OUT SPORT XCHG XCHG CALL CARFLG MVI A,BANHI ; Set RTS high (1200 bps) JNZ SENBAUD ORI DTR ; SENBAUD:OUT SPORT ; Send the command byte XCHG XCHG CALL DLP ; Let the modem settle down for 1 second XRA A ; Clear flags to indicate good baud RET ; change ; INITUSR:XRA A OUT SPORT XCHG XCHG OUT SPORT XCHG XCHG OUT SPORT XCHG XCHG MVI A,BRESET ; Send reset code to 8251 OUT SPORT XCHG XCHG XRA A ; Says baudrate change was ok RET ; end ;-----------------------------------------------------------------------