Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 7 Programming with DOS and BIOS Function Calls Objectives: The use of DOS and BIOS function call How to read the PC’s keyboard How to send text.

Similar presentations


Presentation on theme: "Chapter 7 Programming with DOS and BIOS Function Calls Objectives: The use of DOS and BIOS function call How to read the PC’s keyboard How to send text."— Presentation transcript:

1 Chapter 7 Programming with DOS and BIOS Function Calls Objectives: The use of DOS and BIOS function call How to read the PC’s keyboard How to send text to the video display The operation of the PC’s speaker How to control the printer The structure of the command segment prefix How to use DOS’s command-line interface EE314 Microprocessor Systems Based on "An Introduction to the Intel Family of Microprocessors" by James L. Antonakos

2 DOS BIOS INT10 Video services INT13 Disk Services INT16 Keyboard functions INT17 Parallel printer functions 7.1 Introduction BIOS functions (Basic Input/ Output System) DOS functions (Disk Operating System) INT21 keyboard display printer disk date/time memory management program control Reserved INTs Hardware system DOS functions BIOS functions Applications (.com or.exe files) PWB.EXE Your.exe file (under debugging)

3 7.2 Using the Keyboard DOS INT 21, function 01H: Wait for Keyboard Input Specification: waits for the user to press a key on the keyboard and returns the ASCII code. Input: AH = 01 (function code) Output: AL = ASCII code of the pressed key. The character is echoed to the video display. Constrain: doesn’t return the control to the main program until a key is pressed. DOS INT 21, function 08H: Console Input without Echo Specification: similar to function 01 but no echo on video display. If the key correspond to an extended ASCII code, AL returns 00. The next INT 21, function 01 returns in AL the extended ASCII code. BIOS INT 16, function 00H: Read keyboard Input Specification: similar to INT21 function 01 but if the pressed key correspond to an extended ASCII code, AL returns 00 and AH returns the extended ASCII code. No echo to display. BIOS INT 16, function 01H: Read keyboard status Specification: doesn’t wait. If the keyboard buffer is empty, ZF is set to 1. If not, returns the first ASCII code from buffer in the same way like function 00, and clear ZF. BIOS INT 16, function 02H: Return Shift Flag Status Specification: waits for the user to press a key on the keyboard and returns the ASCII code. Input: AH = 02 (function code) Output: AL = Status of the special function keys: B7=Insert, B6=Caps Lock, B5=Num Lock, B4=Scroll Lock (active bit=1 => function active) B3=Alt, B2=Ctrl, B1=Left Shift, B0=Right Shift (active bit=1 => button pressed )

4 7.3 Controlling the Video Display DOS INT 21, function 02H: Display Output Specification: writes a single character to the display screen, at the current cursor position. Input: AH = 02 (function code), DL = ASCII character to be sent to display. DOS INT 21, function 09H: Display String Specification: Send to display a string in the current data segment. The string ends with ’$’ character (not displayed). Control characters perform their specific action (0DH = Carriage Return, 0AH = Line Feed, 08H = Backspace, etc.). BIOS INT 10, function 00H: Set Video Mode Specification: set video mode of the display (ex: mode 1 = 25 linesX40 characters, mode 3 = 25 linesX80 characters). BIOS INT 10, function 0FH: Read Current Video Mode Specification: returns video mode of the display. BIOS INT 10, function 02H: Set Cursor Position Specification: moves the cursor to specified position (in text mode). Input: AH = 02 (function code), DH = the row (0-24), DL column (0-79), BH = page (0) Input: AH = 09 (function code), DX = The offset of the first character in the string. Input: AH = 00 (function code), AL = The desired video mode. Input: AH = 0F (function code) Output: AL = The current video mode. BIOS INT 10, function 03H: Read the Current Cursor Position Input: AH = 02 (function code), BH = page (0) Output: DH = the row (0-24), DL column (0-79)

5 7.3 Controlling the Video Display BIOS INT 10, function 0AH: Write Character to Screen Specification: write multiple times a character to screen at current cursor position. BIOS INT 10, function 09H: Write Character/Attribute to Screen Specification: write multiple times a character to screen at current cursor position. Specify the video attribute of the character: B7 = blink, (B6 = red, B5 = green, B4 = blue)=background, B3 = intensity, (B2 = red, B1 = green, B0 = blue)=foreground BIOS INT 10, function 08H: Read Character/Attribute from Screen Input: AH = 08 (function code), BH = display page (0) Input: AH = 0A (function code), AL = ASCII code, BH = page number, CX = repeat value. Input: AH = 09 (function code), AL = ASCII code, BH = page number, BL = character’s attribute, CX = repeat value. Output: AL = The Character code at the current cursor position, AH = the attribute byte. BIOS INT 10, function 06H: Scroll Current Page Up Input: AH = 06 (function code) AL = Number of rows to scroll up (0 for entire region) BH = attribute for scrolled region CH = Row number at top of region CL = Column number at left of the region DH = Row number at bottom of region DL = Column number at right of the region Examples: in the textbook!


Download ppt "Chapter 7 Programming with DOS and BIOS Function Calls Objectives: The use of DOS and BIOS function call How to read the PC’s keyboard How to send text."

Similar presentations


Ads by Google