Ρουτίνες Λειτουργίας (DOS function calls)

Similar documents
Summer 2003 Lecture 26 07/24/03

DOS INT 21h - DOS Function Codes

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

Microprocessors (A) DOS Services

Lecture 13: I/O I/O. Interrupts. How?

Interrupt Services. Which Way is Best? Characteristics. Direct in, out. BIOS Average Average DOS Most Least

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 13: 16-Bit MS-DOS Programming

Experiment 3 3 Basic Input Output

Time Left. sec(s) Quiz Start Time: 12:13 AM. Question # 5 of 10 ( Start time: 12:18:29 AM ) Total Marks: 1

Intel 8086 MICROPROCESSOR ARCHITECTURE

Microcomputer Architecture..Second Year (Sem.2).Lecture(2) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات

EXPERIMENT TWELVE: USING DISK FILES

Code segment Stack segment

Assembly Language for Intel-Based Computers, 4 th Edition

Intel 8086 MICROPROCESSOR. By Y V S Murthy

Interrupts. Chapter 20 S. Dandamudi. Outline. Exceptions

9/25/ Software & Hardware Architecture

CP/M-86 Compatibility Guide For CP/M-80 Users

Hardware and Software Architecture. Chapter 2

CS609 Final Term Solved MCQs with References Without Repetitions 14/02/2013

IA32 Intel 32-bit Architecture

EEM336 Microprocessors I. Data Movement Instructions

x86 Assembly Tutorial COS 318: Fall 2017

Chapter 2 COMPUTER SYSTEM HARDWARE

Come and join us at WebLyceum

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...

Programming in Module. Near Call

Transfer of Control. Lecture 10 JMP. JMP Formats. Jump Loop Homework 3 Outputting prompts Reading single characters

8086 Interrupts and Interrupt Responses:

Programming in Assembler. Laboratory manual. Exercise 3

BIOS Enhanced Disk Drive Specification. June 24, 1999

Experiment #5. Using BIOS Services and DOS functions Part 1: Text-based Graphics

RAID Option ROM. Product Implementation Guide. Version 1.8 Date: 08/19/2009. Copyright 2009, Promise Technology, Inc. All Rights Reserved

The x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language

EC-333 Microprocessor and Interfacing Techniques

CC411: Introduction To Microprocessors

Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit

icroprocessor istory of Microprocessor ntel 8086:

EC-333 Microprocessor and Interfacing Techniques

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

Proposed Common Configuration Method

DVD :50 PM Page 1 BIOS

16-bit MS-DOS and BIOS Programming

The next page shows the questions asked in revision 0 of this proposal and the answers supplied by the May SCSI Working Group meeting.

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013)

16.317: Microprocessor Systems Design I Fall 2013

Northern India Engineering College, Delhi (GGSIP University) PAPER I

if 2 16bit operands multiplied the result will be

db "Please enter up to 256 characters (press Enter Key to finish): ",0dh,0ah,'$'

Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions.

Segmentation with Paging. Review. Segmentation with Page (MULTICS) Segmentation with Page (MULTICS) Segmentation with Page (MULTICS)

MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN

Lecture 9. INC and DEC. INC/DEC Examples ADD. Arithmetic Operations Overflow Multiply and Divide

CS609 - Final Term Papers Fall 2012

Block Data is the data transferred to or from the device using SCT Command Transport feature set capabilities.

Project 1: Bootloader. COS 318 Fall 2015

CS401 Assembly Language Solved MCQS From Midterm Papers

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

Tutorial Letter 103/3/2012 Computer Organization COS2621 Semesters 1 & 2

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal)

Chapter 2: The Microprocessor and its Architecture

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

8086 INTERNAL ARCHITECTURE

CPMPPG1.WS4 (= "CP/M-86 Plus Programmers's Guide", section 1) CP/M-86 Plus -- Programmer's Guide

The registers(di,si) are automatically incremented or decremented depending on the value of the direction flag:

Operating Systems. Project #2: System Calls

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming)

The Purpose of Interrupt

Table 1 - GET CONFIGURATION Command Descriptor Block

Assembly Language Each statement in an assembly language program consists of four parts or fields.

Processes, Coroutines, and Concurrency Chapter 19

Error num: 1 Meaning: Not owner Error num: 2 Meaning: No such file or directory Error num: 3 Meaning: No such process Error num: 4 Meaning:

Assembly Language for Intel-Based Computers, 4 th Edition

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

Experiment N o 8. String Handling Instructions

Computer Systems. Assembly Language for x86 Processors 6th Edition, Kip Irvine

1. Introduction to Assembly Language

COS 318: Operating Systems. Overview. Prof. Margaret Martonosi Computer Science Department Princeton University

MODE (mod) FIELD CODES. mod MEMORY MODE: 8-BIT DISPLACEMENT MEMORY MODE: 16- OR 32- BIT DISPLACEMENT REGISTER MODE

UNIT 2 PROCESSORS ORGANIZATION CONT.

Lecture 5: Computer Organization Instruction Execution. Computer Organization Block Diagram. Components. General Purpose Registers.

Hong Kong Polytechnic University Department of Electronic and Information Engineering. Experiment On DOS File system

Philadelphia University Student Name: Student Number:

EC 333 Microprocessor and Interfacing Techniques (3+1)

Virus.Dos.Honey.666 Report

Certified Ethical Hacker. Module 25 Writing Virus Codes

INT 21H and INT 10H Programming and Macros

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee

INT 13 command: SCSI Pass Through Proposal

Chapter 3: Addressing Modes

EXPERIMENT NINE DEVELOPING MACRO SEQUENCES

Q1: Multiple choice / 20 Q2: Memory addressing / 40 Q3: Assembly language / 40 TOTAL SCORE / 100

Week /8086 Microprocessor Programming II

Addressing Modes on the x86

Computer Processors. Part 2. Components of a Processor. Execution Unit The ALU. Execution Unit. The Brains of the Box. Processors. Execution Unit (EU)

Week /8086 Microprocessor Programming I

EC 333 Microprocessor and Interfacing Techniques (3+1)

Contents. Error Message Descriptions... 7

Question: How to generate.com file? Answer: For BorlandC 3.1: 1- copy myfile.c into BIN folder of BORLANDC. 2- From command prompt goto BIN

Transcription:

Ρουτίνες Λειτουργίας (DOS function calls) Παρακάτω ακολουθεί µία λίστα αυτών των AH κωδικών µε τα ονόµατα της ρουτίνας λειτουργίας (DOS function calls). 00H 01H 02H 03H 04H 05H 06H 07H 08H 09H TERMINATE A PROGRAM AH = 00H CS = program segment prefix address DOS is entered READ THE KEYBOARD AH = 01H AL = ASCII character If AL = 00H the function call must be invoked again to read an extended ASCII character. Refer to Chapter 9, Table 9 1, for a listing of the extended ASCII keyboard codes. This function call automatically echoes whatever is typed to the video screen. WRITE TO STANDARD OUTPUT DEVICE AH = 02H DL = ASCII character to be displayed This function call normally displays data on the video display. READ CHARACTER FROM COM1 AH = 03H AL = ASCII character read from the communications port This function call reads data from the serial communications port. WRITE TO COM1 AH = 04H DL = character to be sent out of COM1 This function transmits data through the serial communications port. The COM port assignment can be changed to use other COM ports with functions 03H and 04H by using the DOS MODE command to reassign COM1 to another COM port. WRITE TO LPT1 AH = 05H DL = ASCII character to be printed Prints DL on the line printer attached to LPT1. Note that the line printer port can be changed with the DOS MODE command. DIRECT CONSOLE READ/WRITE AH = 06H DL = 0FFH or DL = ASCII character AL = ASCII character If DL = 0FFH on entry, then this function reads the console. If DL = ASCII character, then this function displays the ASCII character on the console (CON) video screen. If a character is read from the console keyboard, the zero flag (ZF) indicates whether a character was typed. A zero condition indicates no key was typed, and a not-zero condition indicates that AL contains the ASCII code of the key or a 00H. If AL = 00H, the function must again be invoked to read an extended ASCII character from the keyboard. Note that the key does not echo to the video screen. DIRECT CONSOLE INPUT WITHOUT ECHO AH = 07H AL = ASCII character This functions exactly as function number 06H with DL = 0FFH, but it will not return from the function until the key is typed. READ STANDARD INPUT WITHOUT ECHO AH = 08H AL = ASCII character Performs as function 07H, except that it reads the standard input device. The standard input device can be assigned as either the keyboard or the COM port. This function also responds to a control-break, where function 06H and 07H do not. A control-break causes INT 23H to execute. By default, this functions as does function 07H. DISPLAY A CHARACTER STRING AH = 09H DS:DX = address of the character string The character string must end with an ASCII $ (24H). The character string can be of any

0AH 0BH length and may contains control characters such as carriage return (0DH) and line feed (0AH). BUFFERED KEYBOARD INPUT AH = 0AH DS:DX = address of keyboard input buffer The first byte of the buffer contains the size of the buffer (up to 255). The second byte is filled with the number of characters typed upon return. The third byte through the end of the buffer contains the character string typed followed by a carriage return (0DH). This function continues to read the keyboard (displaying data as typed) until either the specified number of characters are typed or until the enter key is typed. TEST STATUS OF THE STANDARD INPUT DEVICE AH = 0BH AL = status of the input device This function tests the standard input device to determine if data are available. If AL = 00, no data are available. If AL = 0FFH, then data are available that must be input using function number 08H. 0CH 0DH 0EH 0FH 10H 11H 12H 13H CLEAR KEYBOARD BUFFER AND INVOKE KEYBOARD FUNCTION AH = 0CH AL = 01H, 06H, 07H, or 0AH See exit for functions 01H, 06H, 07H, or 0AH The keyboard buffer holds keystrokes while programs execute other tasks. This function empties or clears the buffer and then invokes the keyboard function located in register AL. FLUSH DISK BUFFERS AH = 0DH Erases all file names stored in disk buffers. This function does not close the files specified by the disk buffers, so care must be exercised in its usage. SELECT DEFAULT DISK DRIVE AH = 0EH DL = desired default disk drive number AL = the total number of drives present in the system Drive A = 00H, drive B = 01H, drive C = 02H, and so forth. @OPEN FILE WITH FCB AH = 0FH DS:DX = address of the unopened file control block (FCB) AL = 00H if file found AL = 0FFH if file not found The file control block (FCB) is only used with early DOS software and should never be used with new programs. File control blocks do not allow path names as do the newer file access function codes presented later. Figure A 2 (p. 738) illustrates the structure of the FCB. To open a file, the file must either be present on the disk or be created with function call 16H. @CLOSE FILE WITH FCB AH = 10H DS:DX = address of the opened file control block (FCB) AL = 00H if file closed AL = 0FFH if error found Errors that occurs usually indicate either that the disk is full or the media is bad. @SEARCH FOR FIRST MATCH (FCB) AH = 11H DS:DX = address of the file control block to be searched AL = 00H if file found AL = 0FFH if file not found Wild card characters (? or *) may be used to search for a file name. The? wild card character matches any character and the * matches any name or extension. @SEARCH FOR NEXT MATCH (FCB) AH = 12H DS:DX = address of the file control block to be searched AL = 00H if file found AL = 0FFH if file not found This function is used after function 11H finds the first matching file name. @DELETE FILE USING FCB AH = 13H DS:DX = address of the file control block to be deleted

14H 15H 16H 17H 19H 1AH 1BH 1CH 21H 22H 23H AL = 00H if file deleted AL = 0FFH if error occurred Errors that most often occur are defective media errors. @SEQUENTIAL READ (FCB) AH = 14H DS:DX = address of the file control block to be read AL = 00H if read successful AL = 01H if end of file reached AL = 02H if DTA had a segment wrap AL = 03H if less than 128 bytes were read @SEQUENTIAL WRITE (FCB) AH = 15H DS:DX = address of the file control block to be written AL = 00H if write successful AL = 01H if disk is full AL = 02H if DTA had a segment wrap @CREATE A FILE (FCB) AH = 16H DS:DX = address of an unopened file control block AL = 00H if file created AL = 01H if disk is full @RENAME A FILE (FCB) AH = 17H DS:DX = address of a modified file control block AL = 00H if file renamed AL = 01H if error occurred Refer to Figure A 3 (p. 738) for the modified FCB used to rename a file. RETURN CURRENT DRIVE AH = 19H AL = current drive AL = 00H for drive A, 01H for drive B, and so forth. SET DISK TRANSFER AREA AH = 1AH DS:DX = address of new DTA The disk transfer area is normally located within the program segment prefix at offset address 80H. The DTA is used by DOS for all disk data transfers using file control blocks. GET DEFAULT DRIVE FILE ALLOCATION TABLE (FAT) AH = 1BH AL = number of sectors per cluster DS:BX = address of the media descriptor CX = size of a sector in bytes DX = number of clusters on drive Refer to Figure A 4 (p. 739) for the format of the media descriptor byte. The DS register is changed by this function, so make sure to save it before using this function. GET ANY DRIVE FILE ALLOCATION TABLE (FAT) AH = 1CH DL = disk drive number AL = number of sectors per cluster DS:BX = address of the media descriptor CX = size of a sector in bytes DX = number of clusters on drive @RANDOM READ USING FCB AH = 21H DS:DX = address of opened FCB AL = 00H if read successful AL = 01H if end of file reached AL = 02H if the segment wrapped AL = 03H if less than 128 bytes read @RANDOM WRITE USING FCB AH = 22H DS:DX = address of opened FCB AL = 00H if write successful AL = 01H if disk full AL = 02H if the segment wrapped @RETURN NUMBER OF RECORDS (FCB)

24H 25H 26H 27H 28H 29H 2AH 2BH 2CH AH = 23H DS:DX = address of FCB AL = 00H number of records AL = 0FFH if file not found @SET RELATIVE RECORD SIZE (FCB) AH = 24H DS:DX = address of FCB Sets the record field to the value contained in the FCB. SET INTERRUPT VECTOR AH = 25H AL = interrupt vector number DS:DX = address of new interrupt procedure Before changing the interrupt vector, it is suggested that the current interrupt vector first be saved using DOS function 35H. This allows a back-link so the original vector can later be restored. CREATE NEW PROGRAM SEGMENT PREFIX AH = 26H DX = segment address of new PSP Figure A 5 (p. 739) illustrates the structure of the program segment prefix. @RANDOM FILE BLOCK READ (FCB) AH = 27H CX = the number of records DS:DX = address of opened FCB AL = 00H if read successful AL = 01H if end of file reached AL = 02H if the segment wrapped AL = 03H if less than 128 bytes read CX = the number of records read @RANDOM FILE BLOCK WRITE (FCB) AH = 28H CX = the number of records DS:DX = address of opened FCB AL = 00H if write successful AL = 01H if disk full AL = 02H if the segment wrapped CX = the number of records written @PARSE COMMAND LINE (FCB) AH = 29H AL = parse mask DS:SI = address of FCB DS:DI = address of command line AL = 00H if no file name characters found AL = 01H if file name characters found AL = 0FFH if drive specifier incorrect DS:SI = address of character after name DS:DI = address first byte of FCB READ SYSTEM DATE AH = 2AH AL = day of the week CX = the year (1980 2099) DH = the month DL = day of the month The day of the week is encoded as Sunday = 00H through Saturday = 06H. The year is a binary number equal to 1980 through 2099. SET SYSTEM DATE AH = 2BH CX = the year (1980 2099) DH = the month DL = day of the month READ SYSTEM TIME AH = 2CH CH = hours (0 23) CL = minutes DH = seconds DL = hundredths of seconds All times are returned in binary form, and hundredths of seconds may not be available.

2DH 2EH 2FH 30H 31H 33H 34H 35H 36H 38H 39H SET SYSTEM TIME AH = 2DH CH = hours CL = minutes DH = seconds DL = hundredths of seconds DISK VERIFY WRITE AH = 2EH AL = 00H to disable verify on write AL = 01H to enable verify on write By default, disk verify is disabled. READ DISK TRANSFER AREA ADDRESS AH = 2FH ES:BX = contains DTA address READ DOS VERSION NUMBER AH = 30H AH = fractional version number AL = whole number version number For example, DOS version number 3.2 is returned as a 3 in AL and a 14H in AH. TERMINATE AND STAY RESIDENT (TSR) AH = 31H AL = the DOS return code DX = number of paragraphs to reserve for program A paragraph is 16 bytes and the DOS return code is read at the batch file level with ERRORCODE. TEST CONTROL-BREAK AH = 33H AL = 00H to request current control-break AL = 01H to change control-break DL = 00H to disable control-break DL = 01H to enable control-break DL = current control-break state GET ADDRESS OF InDOS FLAG AH = 34H ES:BX = address of InDOS flag The InDOS flag is available in DOS versions 3.2 or newer and indicates DOS activity. If InDOS = 00H, DOS is inactive or 0FFH if DOS is active and pursuing another operation. READ INTERRUPT VECTOR AH = 35H AL = interrupt vector number ES:BX = address stored at vector This DOS function is used with function 25H to install/remove interrupt handlers. DETERMINE FREE DISK SPACE AH = 36H DL = drive number AX = FFFFH if drive invalid AX = number of sectors per cluster BX = number of free clusters CX = bytes per sector DX = number of clusters on drive The default disk drive is DL = 00H, drive A = 01H, drive B = 02H, and so forth. RETURN COUNTRY CODE AH = 38H AL = 00H for current country code BX = 16-bit country code DS:DX = data buffer address BX = counter code DS:DX = data buffer address CREATE SUB-DIRECTORY AH = 39H DS:DX = address of ASCII-Z string subdirectory name The ASCII-Z string is the name of the subdirectory in ASCII code ended with a 00H instead of a carriage return/line feed.

3AH 3BH 3CH 3DH 3EH 3FH 40H 41H 42H ERASE SUB-DIRECTORY AH = 3AH DS:DX = address of ASCII-Z string subdirectory name CHANGE SUB-DIRECTORY AH = 3BH DS:DX = address of new ASCII-Z string subdirectory name CREATE A NEW FILE AH = 3CH CX = attribute word DS:DX = address of ASCII-Z string file name AX = file handle if carry cleared The attribute word can contain any of the following (added together): 01H read-only access, 02H = hidden file or directory, 04H = system file, 08H = volume label, 10H = subdirectory, and 20H = archive bit. In most cases, a file is created with 0000H. OPEN A FILE AH = 3DH AL = access code DS:DX = address of ASCII-Z string file name AX = file handle if carry cleared The access code in AL = 00H for a read-only access, AL = 01H for a write-only access, and AL = 02H for a read/write access. For shared files in a network environment, bit 4 of AL = 1 will deny read/write access, bit 5 of AL = 1 will deny a write access, bits 4 and 5 of AL = 1 will deny read access, bit 6 of AL = 1 denies none, bit 7 of AL = 0 causes the file to be inherited by child; if bit 7 of AL = 1, file is restricted to current process. CLOSE A FILE AH = 3EH BX = file handle READ A FILE AH = 3FH BX = file handle CX = number of bytes to be read DS:DX = address of file buffer to hold data read AX = number of bytes read if carry cleared WRITE A FILE AH = 40H BX = file handle CX = number of bytes to write DS:DX = address of file buffer that holds write data AX = number of bytes written if carry cleared DELETE A FILE AH = 41H DS:DX = address of ASCII-Z string file name MOVE FILE POINTER AH = 42H AL = move technique BX = file handle CX:DX = number of bytes pointer moved AX:DX = bytes pointer moved The move technique causes the pointer to move from the start of the file if AL = 00H, from the current location if AL = 01H, and from the end of the file if AL = 02H. The count is stored so DX contains the least-significant 16-bits and either CX or AX contains the most-significant 16-bits. 43H READ/WRITE FILE ATTRIBUTES

44H AH = 43H AL = 00H to read attributes AL = 01H to write attributes CX = attribute word (see function 3CH) DS:DX = address of ASCII-Z string file name CX = attribute word of carry cleared I/O DEVICE CONTROL (IOTCL) AH = 44H AL = sub function code (see notes) AX = error code (see function 59H) if carry set The sub function codes found in AL are as follows: 00H = read device status : BX = file handle : DX = status 01H = write device status : BX = file handle, DH = 0, DL = device information : 02H = read control data from character device : BX = file handle, CX = number of bytes, DS:DX = I/O buffer address : AX = number of bytes read 03H = write control data to character device : BX = file handle, CX = number of bytes, DS:DX = I/O buffer address : AX = number of bytes written 04H = read control data from block device : BL = drive number (0 = default, 1 = A, 2 = B, etc), CX = number of bytes, DS:DX = I/O buffer address : AX = number of bytes read 05H = write control data to block device : BL = drive number, CX = number of bytes, DS:DX = I/O buffer address : AX = number of bytes written 06H = check input status : BX = file handle : AL = 00H ready or FFH not ready 07H = check output status : BX = file handle : AL = 00H ready or FFH not ready 08H = removable media? : BL = drive number : AL = 00H removable, 01H fixed 09H = network block device? : BL = drive number : bit 12 of DX set for network block device 0AH = local or network character device? : BX = file handle : bit 15 of DX set for network character device 0BH = change entry count (must have SHARE.EXE loaded) : CX = delay loop count, DX = retry count : 0CH = generic I/O control for character devices : BX = file handle, CH = category, CL = function Categories: 00H = unknown, 01H = COM port, 02H = CON, 05H = LPT ports Function: CL = 45H; set iteration count CL = 4AH; select code page CL = 4CH; start code page preparation CL = 4DH; end code page preparation CL = 5FH; set display information CL = 65H; get iteration count CL = 6AH; query selected code page CL = 6BH; query preparation list CL = 7FH; get display information 0DH = generic I/O control for block devices

45H 46H 47H 48H 49H 4AH 4BH 4CH : BL = drive number, CH = category, CL = function, DS:DX = address of parameter block Category: 08H = disk drive Function: CL = 40H; set device parameters CL = 41H; write track CL = 42H; format and verify track CL = 46H, set media ID code CL = 47H; set access flag CL = 60H; get device parameters CL = 61H; read track CL = 62H; verify track CL = 66H; get media ID code CL = 67H; get access code 0EH = return logical device map : BL = drive number : AL = number of last device 0FH = change logical device map : BL = drive number : AL = number of last device DUPLICATE FILE HANDLE AH = 45H BX = current file handle AX = duplicate file handle FORCE DUPLICATE FILE HANDLE AH = 46H BX = current file handle CX = new file handle This function works like function 45H except that function 45H allows DOS to select the new handle, while this function allows the user to select the new handle. READ CURRENT DIRECTORY AH = 47H DL = drive number DS:SI = address of a 64 byte buffer for directory name DS:SI addresses current directory name if carry cleared Drive A = 00, drive B = 01, and so forth ALLOCATE MEMORY BLOCK AH = 48H BX = number of paragraphs to allocate CX = new file handle BX = largest block available if carry cleared RELEASE ALLOCATED MEMORY BLOCK AH = 49H ES = segment address of block to be released CX = new file handle Carry indicates an error if set MODIFY ALLOCATED MEMORY BLOCK AH = 4AH BX = new block size in paragraphs ES = segment address of block to be modified BX = largest block available if carry cleared LOAD OR EXECUTE A PROGRAM AH = 4BH AL = function code ES:BX = address of parameter block DS:DX = address ASCII-Z string command Carry indicates an error if set The function codes are AL = 00H to load and execute a program, AL = 01H to load a program but not execute it, AL = 03H to load a program overlay, and AL = 05H to enter the EXEC state. Figure A 6 (p. 740) shows the parameter block used with this function. TERMINATE A PROCESS AH = 4CH AL = error code Returns control to DOS

4DH 4EH 4FH 50H 51H 54H 56H 57H 59H This function returns control to DOS with the error code saved so it can be obtained using DOS ERROR LEVEL batch processing system. We normally use this function with an error code of 00H to return to DOS. READ RETURN CODE AH = 4DH AX = return error code This function is used to obtain the return status code created by executing a program with DOS function 4BH. The return codes are AX = 0000H for a normal-no errortermination, AX = 0001H for a control-break termination, AX = 0002H for a critical device error, and AX = 0003H for a termination by an INT 31H. FIND FIRST MATCHING FILE AH = 4EH CX = file attributes DS:DX = address ASCII-Z string file name Carry is set for file not found This function searches the current or named directory for the first matching file. Upon exit, the DTA contains the file information. See Figure A 7 (p. 740) for the disk transfer area (DTA). FIND NEXT MATCHING FILE AH = 4FH Carry is set for file not found This function is used after the first file is found with function 4EH. SET PROGRAM SEGMENT PREFIX (PSP) ADDRESS AH = 50H BX = offset address of the new PSP Extreme care must be used with this function because no error recovery is possible. GET PSP ADDRESS AH = 51H BX = current PSP segment address READ DISK VERIFY STATUS AH = 54H AL = 00H if verify off AL = 01H if verify on RENAME FILE AH = 56H ES:DI = address of ASCII-Z string containing new file name DS:DX = address of ASCII-Z string containing file to be renamed READ FILE S DATE AND TIME STAMP AH = 57H AL = function code BX = file handle CX = new time DX = new date CX = time if carry cleared DX = date if carry cleared AL = 00H to read date and time or 01H to write date and time. GET EXTENDED ERROR INFORMATION AH = 59H BX = 0000H for DOS version 3.X AX = extended error code BH = error class BL = recommended action CH = locus Following are the extended error codes found in AX: 0001H = invalid function number 0002H = file not found 0003H = path not found 0004H = no file handles available 0005H = access denied 0006H = file handle invalid 0007H = memory control block failure 0008H = insufficient memory 0009H = memory block address invalid

000AH = environment failure 000BH = format invalid 000CH = access code invalid 000DH = data invalid 000EH = unknown unit 000FH = disk drive invalid 0010H = attempted to remove current directory 0011H = not same device 0012H = no more files 0013H = disk write-protected 0014H = unknown unit 0015H = drive not ready 0016H = unknown command 0017H = data error (CRC check error) 0018H = bad request structure length 0019H = seek error 001AH = unknown media type 001BH = sector not found 001CH = printer out of paper 001DH = write fault 001EH = read fault 001FH = general failure 0020H = sharing violation 0021H = lock violation 0022H = disk change invalid 0023H = FCB unavailable 0024H = sharing buffer exceeded 0025H = code page mismatch 0026H = handle end of file operation not completed 0027H = disk full 0028H 0031H reserved 0032H = unsupported network request 0033H = remote machine not listed 0034H = duplicate name on network 0035H = network name not found 0036H = network busy 0037H = device no longer exists on network 0038H = netbios command limit exceeded 0039H = error in network adapter hardware 003AH = incorrect response from network 003BH = unexpected network error 003CH = remote adapter is incompatible 003DH = print queue is full 003EH = not enough room for print file 003FH = print file was deleted 0040H = network name deleted 0041H = network access denied 0042H = incorrect network device type 0043H = network name not found 0044H = network name exceeded limit 0045H = netbios session limit exceeded 0046H = temporary pause 0047H = network request not accepted 0048H = print or disk redirection pause 0049H 004FH reserved 0050H = file already exists 0051H = duplicate FCB 0052H = cannot make directory 0053H = failure in INT 24H (critical error) 0054H = too many re-directions 0055H = duplicate redirection 0056H = invalid password 0057H = invalid parameter 0058H = network write failure 0059H = function not supported by network 005AH = required system component not installed 0065H = device not selected

Following are the error class codes as found in BH: 01H = no resources available 02H = temporary error 03H = authorization error 04H = internal software error 05H = hardware error 06H = system failure 07H = application software error 08H = item not found 09H = invalid format 0AH = item blocked 0BH = media error 0CH = item already exists 0DH = unknown error Following is the recommended action as found in BL: 01H = retry operation 02H = delay and retry operation 03H = user retry 04H = abort processing 05H = immediate exit 06H = ignore error 07H = retry with user intervention Following is a list of locus in CH: 5AH 5BH 5CH 5DH 5EH 01H = unknown source 02H = block device error 03H = network area 04H = serial device error 05H = memory error CREATE UNIQUE FILE NAME AH = 5AH CX = attribute code DS:DX = address of the ASCII-Z string directory path AX = file handle if carry cleared DS:DX = address of the appended directory name The ASCII-Z file directory path must end with a backslash (\). On exit, the directory name is appended with a unique file name. CREATE A DOS FILE AH = 5BH CX = attribute code DS:DX = address of the ASCII-Z string contain the file name AX = file handle if carry cleared The function only works in DOS version 3.X or higher. It is almost identical to function 3CH, except that function 3CH erases the file, if it already exists, while function 5BH reports that the file exists without erasing it. LOCK/UNLOCK FILE CONTENTS AH = 5CH BX = file handle CX:DX = offset address of locked/unlocked area SI:DI = number of bytes to lock or unlock beginning at offset SET EXTENDED ERROR INFORMATION AH = 5DH AL = 0AH DS:DX = address of the extended error data structure This function is used by DOS version 3.1 or higher to store extended error information. NETWORK/PRINTER AH = 5EH AL = 00H (get network name) DS:DX = address of the ASCII-Z string containing network name

62H 65H 66H 67H 68H 6CH CL = netbios number if carry cleared AH = 5EH AL = 02H (define network printer) BX = redirection list CX = length of setup string DS:DX = address of printer setup buffer AH = 5EH AL = 03H (read network printer setup string) BX = redirection list DS:DX = address of printer setup buffer CX = length of setup string if carry cleared ES:DI = address of printer setup buffer GET PSP ADDRESS AH = 62H BX = segment address of the current program The function only works in DOS version 3.0 or higher. GET EXTENDED COUNTRY INFORMATION AH = 65H AL = function code ES:DI = address of buffer to receive information CX = length of country information The function only works in DOS version 3.3 or higher. GET/SET CODE PAGE AH = 66H AL = function code BX = code page number BX = active code page number DX = default code page number A function code in AL of 01H gets the code page number, and a code of 02H sets the code page number. SET HANDLE COUNT AH = 67H BX = number of handles desired This function is available for DOS version 3.3 or higher. COMMIT FILE AH = 68H BX = handle number ; otherwise, the date and time stamp is written to directory This function is available for DOS version 3.3 or higher. EXTENDED OPEN FILE AH = 6CH AL = 00H BX = open mode CX = attributes DX = open flag DS:SI = address of ASCII-Z string file name AX = error code if carry is set AX = handle if carry is cleared CX = 0001H file existed and was opened CX = 0002H file did not exist and was created This function is available for DOS version 4.0 or higher.