STDIO.DOC -- Description of the I/O procedures in STDIO.ASM =========================================================== From `BLUEBOOK of ASSEMBLY ROUTINES for the IBM PC & XT' by Christopher L. Morgan Copyright (C) 1984 by The Waite Group, Inc. Purpose: These routines perform fundamental input/output functions for the keyboard, screen, and communication lines. The standard I/O routines can be redirected. The communications routines alleviate some of the problems encountered in DOS and BIOS serial communications handling. Contains: --------- COM_INCK -- Communications line check COM_INIT -- Initialize communications line COM_OFF -- Communications line off COM_ON -- Communications line on COM_OUT -- Communications line output STD_CRLF -- Standard output with carriage return & linefeed STD_IN -- Standard input with echo STD_INCK -- Standard input check STD_INNE -- Standard input with no echo STD_MSGOUT -- Standard output of a message STD_OUT -- Standard output STD_OUTDR -- Direct standard output STD_SPACE -- Standard output of a space _______________________________________________________________________________ STD_IN -- Standard Input with Echo --------------------------------- Function: This routine accepts input from the standard I/O device. Input: This routine waits for one character code from the std input device. Output: ASCII codes are returned in the AL register. Each character is echoed out the standard output device as it is input through the standard input device. Registers used: AH is modified; AL is used for output. Routines called: DOS call #1 (Keyboard input) is used. _______________________________________________________________________________ STD_INNE -- Standard Input with No Echo -------------------------------------- Function: This routine accepts input from the standard I/O device. No echo is generated. Input: This routine waits for one character code from the std input device. Output: ASCII codes are returned in the AL register. Registers used: AH is modified; AL is used for output Routines called: DOS call #8 (Console output without echo) is used. _______________________________________________________________________________ STD_INCK -- Standard Input Check ------------------------------- Function: This routine checks, but does not wait for input from the standard input device. Input: Input is from the standard I/O device. No check is made for ^-Break. Output: If a character is available, the routine returns with the flag condition NZ and a character in AL. If no character is available, then the routine returns with the flag condition Z, and AL is garbage. No echo is generated for the input characters. Registers used: AH is modified; AL is used for output. Routines called: DOS call #6 (Direct console I/O) is used. _______________________________________________________________________________ STD_OUT -- Standard Output ------------------------- Function: This routine sends individual characters out the std output device. Input: Upon entry, an ASCII code is in AL. Output: A single character is output through the standard output device. Registers used: AH is modified; AL is used for input. Routines called: DOS call #2 (Display output) is used. _______________________________________________________________________________ STD_OUTDR -- Direct Standard Output ---------------------------------- Function: This routine sends individual characters out the standard output device, using direct output. Input: Upon entry, an ASCII code is in AL. Output: A single character is output through the direct standard output call. Registers used: AH is modified; AL is used for input. Routines called: DOS call #6 (Direct console I/O) is used. _______________________________________________________________________________ STD_CRLF -- Standard Output of a Carriage Return/Linefeed Sequence ----------------------------------------------------------------- Function: This routine sends a and then a to the std output device. Input: None Output: ASCII code 13 for and ASCII code 10 for are sent to the standard output device. Registers used: AX is first saved and then restored. Routines called: STD_OUT _______________________________________________________________________________ SDTSPACE -- Standard Output of a Space -------------------------------------- Function: This routine sends a space out through the standard output device. Input: None Output: ASCII code 32 for a space is sent to the standard output device. Registers used: AX is first saved and then restored. Routines called: STD_OUT _______________________________________________________________________________ STD_MESSOUT -- Standard Output of a Message ------------------------------------------ Function: This routine sends a message out through the std output device. Input: Upon input, DS:SI points to the message. The message must terminate with an ASCII code 0. Output: The individual characters of the message are output through the standard output device. Registers used: AX is first saved and then restored; SI is used to point to the input. Segments referenced: The data segment must contain the message. Routines called: STD_OUT _______________________________________________________________________________ COM_INIT -- Initialize Communications Line ----------------------------------------- Function: This routine initializes one of the two communications lines. Input: Upon entry, AL contains the initialization byte as follows: bit ---- 7 6 5 ---------- 4 3 ------------ 2 -------------- 1 0 ---- bit --------- ------ -------- ----------- baud rate parity stop bit word length ========== ========= ======== =========== 000 = 110 00 = none 0 = 1 10 = 7 bits 001 = 150 01 = odd 1 = 2 11 = 8 bits 010 = 300 10 = none 011 = 600 11 = even 100 = 1200 101 = 2400 110 = 4800 111 = 9600 DX contains the unit number (0=COM_1:, 1=COM_2:). Output: Output is sent to the hardware controlling the specified com line. Registers used: None Routines called: BIOS interrupt 14H (RS-232 I/O) is used. _______________________________________________________________________________ COM_INCK -- Communications Line Input Check ------------------------------------------ Function: This routine checks, but does not wait for input from one of the two serial communications lines. Input: Upon entry, DX contains the unit number (0=COM_1:, 1=COM_2:). During the routine, input is from the specified communications line. Output: If a byte is available, the routine returns with the flag condition NZ and the byte in AL. If no byte is available, the routine returns with the flag condition Z, and AL is garbage. Registers used: AH is modified; DX is used for input & AL is used for output. Segments referenced: The system data segment is referenced. _______________________________________________________________________________ COM_OUT -- Communications Line Output ------------------------------------ Function: This routine sends a byte out one of the two communications lines. Input: Upon entry, AL contains the byte to be sent out and DX contains the specified unit number (0=COM_1:, 1=COM_2:). Output: Output is sent to the specified communications line. Registers used: None. Routines called: BIOS interrupt 14H (RS-232 I/O) is used. _______________________________________________________________________________ COM_ON -- Communications Line On ------------------------------- Function: This routine turns on the handshaking signal, DTR(line 20), and RTS (line 4) on the specified communications line Input: Upon entry, DX contains the unit number (0=COM_1:,1=COM_2:). Output: Just to the communications line Registers used: DX is used for input; no registers are modified. Segments referenced: The system data segment is referenced. _______________________________________________________________________________ COM_OFF -- Communications Line Off --------------------------------- Function: This routine turns off the handshaking signal, DTR(line 20), on the specified communications line. RTS(line 4) is kept on as it was. Input: Upon entry, DX contains the unit number (0=COM_1:,1=COM_2:). Output: Just to the communications line Registers used: DX is used for input; no registers are modified. Segments referenced: The system data segment is referenced. _______________________________________________________________________________ >>>>> Physical EOF STDIO.DOC <<<<<