
e3328d633248b841ffd618a6b93d40d8.ppt
- Количество слайдов: 5
EE 314 Microprocessor Systems 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 Based on "An Introduction to the Intel Family of Microprocessors" by James L. Antonakos
7. 1 Introduction Applications (. com or. exe files) DOS Your. exe file (under debugging) Reserved INTs BIOS functions (Basic Input/ Output System) • INT 10 Video services • INT 13 Disk Services • INT 16 Keyboard functions • INT 17 Parallel printer functions DOS functions • INT 21 (Disk Operating System) • keyboard • display • printer • disk • date/time • memory management • program control BIOS Hardware system BIOS functions DOS functions PWB. EXE
7. 2 Using the Keyboard DOS INT 21, function 01 H: 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. 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. DOS INT 21, function 08 H: Console Input without Echo Specification: similar to function 01 but no echo on video display. BIOS INT 16, function 00 H: Read keyboard Input Specification: similar to INT 21 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 01 H: 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 02 H: 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: B 7=Insert, B 6=Caps Lock, B 5=Num Lock, B 4=Scroll Lock (active bit=1 => function active) B 3=Alt, B 2=Ctrl, B 1=Left Shift, B 0=Right Shift (active bit=1 => button pressed )
7. 3 Controlling the Video Display DOS INT 21, function 02 H: 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. Control characters perform their specific action (0 DH = Carriage Return, 0 AH = Line Feed, 08 H = Backspace, etc. ). DOS INT 21, function 09 H: Display String Specification: Send to display a string in the current data segment. The string ends with ’$’ character (not displayed). Input: AH = 09 (function code), DX = The offset of the first character in the string. BIOS INT 10, function 00 H: Set Video Mode Specification: set video mode of the display (ex: mode 1 = 25 lines. X 40 characters, mode 3 = 25 lines. X 80 characters). Input: AH = 00 (function code), AL = The desired video mode. BIOS INT 10, function 0 FH: Read Current Video Mode Specification: returns video mode of the display. Input: AH = 0 F (function code) Output: AL = The current video mode. BIOS INT 10, function 02 H: 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) BIOS INT 10, function 03 H: Read the Current Cursor Position Input: AH = 02 (function code), BH = page (0) Output: DH = the row (0 -24), DL column (0 -79)
7. 3 Controlling the Video Display BIOS INT 10, function 0 AH: Write Character to Screen Specification: write multiple times a character to screen at current cursor position. Input: AH = 0 A (function code), AL = ASCII code, BH = page number, CX = repeat value. BIOS INT 10, function 09 H: Write Character/Attribute to Screen Specification: write multiple times a character to screen at current cursor position. Specify the video attribute of the character: B 7 = blink, (B 6 = red, B 5 = green, B 4 = blue)=background, B 3 = intensity, (B 2 = red, B 1 = green, B 0 = blue)=foreground Input: AH = 09 (function code), AL = ASCII code, BH = page number, BL = character’s attribute, CX = repeat value. BIOS INT 10, function 08 H: Read Character/Attribute from Screen Input: AH = 08 (function code), BH = display page (0) Output: AL = The Character code at the current cursor position, AH = the attribute byte. BIOS INT 10, function 06 H: 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!