; NUOX-1.INS - NUBYE insert for Osborne Executive One - 04/21/86 ; ; Note: This is an insert, not an overlay ; ; ; ======== ; ; 04/21/86 Modified for NUBYE ; 08/17/85 Updated BYE+ version 6 to be compatible with BYE5. ; - George Peace ; ======== ; ; Define insert configuration parameter(s) ; WINDOW EQU NO ; Yes if windows are to be defined and ; ; used with specially configured BBS pgms ; ; Set base port for SIO & Clock chips ; BASEP EQU 0CH ; Base port for sio BASEC EQU 4 ; Base port for baud rate generator ; ; The following define the port addresses to use. ; DATPORT EQU BASEP ; Data port STPORT EQU BASEP+1 ; Status/control port BPORT EQU BASEC ; Baud rate port ; ;; Second Byte of 8253 Command: ; BDCMD1 EQU 1 ; 300 baud BDCMD2 EQU 0 ; 1200 bps BDCMD3 EQU 0 ; 2400 bps BDCMD4 EQU 0 ; 4800 bps BDCMD5 EQU 0 ; 9600 bps ; ; The following are baud rates for BPORT ; B300 EQU 128 ; 300 baud B1200 EQU 96 ; 1200 bps B2400 EQU 48 ; 2400 bps B4800 EQU 24 ; 4800 bps B9600 EQU 12 ; 9600 bps ; ; Is there a carrier? If not, return with the zero flag set. ; MDCARCK:MVI A,10H ; Reset status OUT STPORT IN STPORT ; Get status ANI 8 ; Check for data carrier RET ; Return ; ; This routine will turn off the serial card and hang up the phone. ; MDINIT: MVI A,18H ; Reset channel OUT STPORT MVI A,4 ; Setup to write register 4 OUT STPORT MVI A,44H ; 16x, 1 stop bit, no parity OUT STPORT MVI A,1 ; Setup to write register 1 OUT STPORT MVI A,0 OUT STPORT MVI A,5 ; Setup to write register 5 OUT STPORT MVI A,0 ; Clear DTR causing hangup OUT STPORT PUSH B ; Save in case it's being used elsewhere MVI B,20 ; 2 second delay ; OFFTI: CALL DELAY ; 0.1 second delay DCR B JNZ OFFTI ; Keep looping until finished POP B ; Restore bc MVI A,3 ; Setup to write register 3 OUT STPORT MVI A,0C1H ; Initialize receive register OUT STPORT MVI A,5 ; Setup to write register 5 OUT STPORT MVI A,0EAH ; Turn on DTR so modem can answer phone OUT STPORT ; IF IMODEM ; If using hayes 300/1200 smartmodem CALL IMINIT ; Go initialize smartmodem now ENDIF ; IMODEM ; RET ; Return ; ; Input a character from the modem port. ; MDINP: IN DATPORT ; Get character RET ; Return ; ; Check the status to see if a character is available. Return with the ; zero flat set, if not. If yes, use 0FFH to clear the flag. ; MDINST: IN STPORT ; Get status ANI 1 ; Got a character? RZ ; Return if none ORI 0FFH ; ..otherwise, set the proper flag RET ; ...and return ; ; Send a character to the modem. ; MDOUTP: OUT DATPORT ; Send it RET ; Return ; ; See if the output is ready for another character. ; MDOUTST:IN STPORT ANI 4 ; Mask it RET ; Return ; ; Reinitialize the modem and hang up the phone by dropping DTR and ; leaving it inactive. ; MDQUIT: IF IMODEM ; If using a smartmodem CALL IMQUIT ; Tell it to shut down ENDIF ; IMODEM ; ; Called by the main program after the caller types BYE. ; MDSTOP: MVI A,5 ; Setup to write register 5 OUT STPORT MVI A,44H ; 16x, 1 stop bit, no parity OUT STPORT RET ; ; If you do not support a partiuclar baud rate, put it here before ; SETINV: ; SETINV: ORI 0FFH ; Make sure zero flag is not set RET ; Return ; SET300: MVI A,BDCMD1 ; Get second byte of command PUSH PSW ; ..store it MVI A,B300 ; Load rate JMP SETBAUD ; SET1200:MVI A,BDCMD2 ; Get second byte of command PUSH PSW ; ..save it MVI A,B1200 ; Load rate JMP SETBAUD ; SET2400:MVI A,BDCMD3 ; Get second byte of command PUSH PSW ; ..store it MVI A,B2400 ; Load rate JMP SETBAUD ; SETBAUD:OUT BPORT ; Send first byte of command POP PSW ; Restore the rate OUT BPORT ; Send second byte of command XRA A ; Say rate is OK RET ; Return ; ; Perform system or hardware dependent PRE-processing. ; ; The following code will be executed by the PATCH subroutine before the ; BIOS jump table is overwritten. This will allow the BIOS intercept ; routines to operate as early as the initial signon message display. ; ; Replace the NEWJTBL BIOS routing table with our own ; MDPREP: LXI H,JTBLNEW ; Get replacement table address LXI D,NEWJTBL ; Get address to overwrite LXI B,JTBLEN ; Get number of bytes to overwrite DB 0EDH,0B0H ; Z80 LDIR instruction ; ; Move the BIOS intercept routines up to common memory ; LXI H,STCOMN ; Start of interface routines LXI D,COMMN ; Address in high (common) memory to load them LXI B,COMLEN ; Length of common code ; LDIR ; Move the code to common memory DB 0EDH,0B0H ; Z80 LDIR instruction ; ; Get the BDOS base page and complete the SXBIOS replacement stack ad- ; dress. We use the BDOS copyright notice as a stack since BDOS is in ; common memory and the copyright notice is 40h+ bytes long - quite ; enough for a stack. ; LDA BDOSBASE ; Pick up BDOS start page STA SXBIOS+1 ; Finish up the replacement stack address ; ; This is for Executives that want to implement a status line ; IF WINDOW MVI C,PRINTF LXI D,SETLIN ; Set window to 23x80 CALL BDOS ENDIF ; WINDOW ; RET ; ; Perform system or hardware dependent POST-processing. The following ; code will be executed by the EXCPM routine before returning control to ; CP/M Plus when the NUBYE program is terminated. ; MDPOSP: IF WINDOW MVI C,PRINTF LXI D,NEWSCRN ; Reset to full screen CALL BDOS ENDIF ; WINDOW ; RET ; ; The following code is required for proper operation of the Executive. ; As the Executive operates in a banked environment, BIOS calls may ori- ; ginate in any bank (currently 0, 1, and 8). It is therefore possible ; that window 1 (where the NUBYE program resides) will not be selected ; at the time a BIOS call is made. As a result, steps must be taken to ; be sure that the BIOS jump table does not direct a BIOS call into bank ; 1 unless that bank is selected. This code is moved up to common memory ; where it will be visible to all banks. For each of the intercepted ; BIOS calls, it will: ; ; - Save the caller's stack pointer ; - Save the caller's bank select mask ; - Switch to bank 1 ; - Execute the NUBYE interface routine, then the original BIOS routine ; as necessary ; - Recover the caller's stack pointer ; - Reset the bank select mask to that of the caller ; - Return control to the caller ; ; Address in common memory to load interface. This may need to be ; changed if the BIOS is significantly changed by OCC or others. ; ; - FABAh is the start of the character device I/O table in 1.0 ; and 1.1 BIOS ; - The Executive has 5 physical devices configured ; - Each physical device entry in the table is 8 bytes ; - 1 byte is allowed as the table terminator so DEVICE.COM will work ; - A 20 byte pad is provided to allow operation with EXCLOCK.COM or ; the DOWD 20mb BIOS. This leaves 3 spare bytes following the ; code in 1.0 and 1.1 BIOS. ; COMMN EQU 0FABAH+(5*8)+1+20 ; BANK1 EQU 1 ; Bank 1 select mask STCOMN EQU $ WBCOMN EQU COMMN+($-STCOMN) ; Warm boot CALL SWIN JMP MBOOT ; CSCOMN EQU COMMN+($-STCOMN) ; Console status CALL SWIN CALL MSTAT JMP SWOUT ; CICOMN EQU COMMN+($-STCOMN) ; Console input CALL SWIN CALL MINPUT JMP SWOUT ; COCOMN EQU COMMN+($-STCOMN) ; Console output CALL SWIN CALL MOUTPUT JMP SWOUT ; SWIN EQU COMMN+($-STCOMN) ; Bank switch in routine ; Destroys register HL, A POP H ; Get return address DB 0EDH,73H DW SXSAVE DB 0EDH,7BH DW SXBIOS IN 0 ; Get current bank pointer PUSH PSW ; Save it for return from BIOS MVI A,BANK1 ; Get bank 1 mask OUT 0 ; Set bank pointer PUSH H ; Put return address on new stack RET ; SWOUT EQU COMMN+($-STCOMN) ; Bank switch out routine ; Destroys register H MOV H,A ; Save A register (for console input call) POP PSW ; Retrieve caller's bank selection mask DB 0EDH,7BH DW SXSAVE OUT 0 ; Set bank selection mask MOV A,H ; Restore A register (for console input call) RET ; SXSAVE EQU COMMN+($-STCOMN) DS 2 ; Save area for caller's stack pointer ; SXBIOS EQU COMMN+($-STCOMN) DW 85H ; End of BDOS copyright notice is at BDOS+85h ; COMLEN EQU $-STCOMN ; Length of common memory interface code ; JTBLNEW:JMP MCBOOT ; Cold boot JMP WBCOMN ; Warm boot JMP CSCOMN ; Modem status test JMP CICOMN ; Modem input routine JMP COCOMN ; Modem output routine ; IF NOT HARDLOG JMP COCOMN ; Modem list device JMP COCOMN ; Modem punch device JMP CICOMN ; Modem reader device ENDIF ; NOT HARDLOG ; JTBLEN EQU $-JTBLNEW ; IF WINDOW SETLIN: DB 1BH,'.','0' ; Turn off cursor DB 1BH,'s','0' ; Set screen to 24x80 DB 1AH ; Clear entire screen DB 1BH,'z','1' ; Set new screen to 23x80 ; Line 1 is now used for your status line. ; (Status is filled in by BBS program.) DB 21H,20H ; Start row + 20H, col + 20H DB 37H,6FH ; End row + 20H, col + 20H DB 1BH,'.','2' ; Turn cursor on (steady blk) DB 0,'$' ; String terminater ; NEWSCRN:DB 1BH,'.','0' DB 1BH,'s','0' DB 1AH DB 1BH,'.','2' DB 0,'$' ENDIF ; WINDOW ; ; end of insert ; -------------