; B5R3-1.INS - TRS-80 Model III insert for BYE5 - 07/17/85 ; ; TR1602 I/O and BR19411 baudrate generator ; ; Note: This is an insert not an overlay ; ; Some TRS-80 Model III units may differ from the ones that use this ; insert in which case get the one for the Model IV and try that. The ; status on some of the boards such as the Montezuma Micro CP/M 2.2 are ; inverted and you may or may not have that problem. ; ; = = = = = = = = = = = = = = = = = = ; ; 07/17/85 Written to work with BYE5 - Irv Hoff ; ; = = = = = = = = = = = = = = = = = = ; ; ; Modem port equates ; PORT EQU 0EBH ; Modem port MDCTL1 EQU PORT-1 ; Status port MDCTL2 EQU PORT-2 ; Baud rate port MDCTL3 EQU PORT-3 ; Reset port ; MDRCV EQU 80HB ; Data available MDSND EQU 40H ; Xmit buffer empty MDDCD EQU 20H ; Data carrier detect ; ; B300 EQU 55H ; 300 baud B1200 EQU 77H ; 1200 bps B2400 EQU 0AAH ; 2400 bps ; ; ;----------------------------------------------------------------------- ; ; See if we still have a carrier - if not, return with the zero flat set ; MDCARCK:IN MDCTL3 ; Read port ANI MDDCD ; Mask carrier detect RET ;..... ; ; ; Disconnect and wait for an incoming call ; MDINIT: MVI A,01 ; Reset UART, enable modem control OUT MDCTL3 MVI A,68H ; DTR, RTS off to hang up phone OUT MDCTL1 PUSH B MVI B,20 ; 2 seconds to let modem settle down ; MDINIT1:CALL DELAY DCR B JNZ MDINIT1 POP B MVI A,6BH ; Turn DTR back on OUT MDCTL1 ; IF IMODEM CALL IMINIT ENDIF ; IMODEM ; RET ;..... ; ; ; Input a character from the modem port ; MDINP: IN PORT ; 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 MDCTL1 ; Read port ANI MDRCV ; Mask crap RZ ; Nope, nothing there ORI 0FFH ; We got something... RET ;..... ; ; ; Send a character to the modem ; MDOUTP: OUT PORT ; Send it RET ;..... ; ; ; ; See if the output is ready for another character ; MDOUTST:IN MDCTL1 ; Read port ANI MDSND ; Mask crap RET ;..... ; ; ; Reinitialize the modem and hang up the phone by dropping DTR and ; leaving it inactive. ; MDQUIT: IF IMODEM CALL IMQUIT ; Tell smartmodem to shut down ENDIF ; IMODEM ; ; ; Called by main program after caller has typed BYE ; MDSTOP: MVI A,68H ; Turn off DTR so that modem will quit OUT MDCTL1 RET ;..... ; ; ; The following routine sets the baudrate. BYE5 asks for the maximum ; speed you have available. ; SETINV: ORI 0FFH ; Make sure the zero flag is not set RET ;..... ; ; SET300: MVI A,B300 JMP SETBAUD ; SET1200:MVI A,B1200 JMP SETBAUD ; SET2400:MVI A,B2400 ; SETBAUD:OUT MDCTL2 XRA A RET ;..... ; ; end ;-----------------------------------------------------------------------