90 likes | 387 Views
Basic Input Output System BIOS. BIOS refers to a set of procedures or functions that enable the programmer have access to the hardware of the computer. A BIOS function is invoked using the INT instruction. The actual function is specified by the contents of AH.
E N D
Basic Input Output SystemBIOS BIOS refers to a set of procedures or functions that enable the programmer have access to the hardware of the computer. A BIOS function is invoked using the INT instruction. The actual function is specified by the contents of AH. ROM BIOS refers to BIOS procedures that are stored in a ROM placed on the motherboard. Some typical ROM BIOS are: INT 10H Video Driver INT 13H Disk Driver INT 14H Serial Port Driver INT 16H Keyboard Driver DOS BIOS refers to BIOS that are loaded from a disk after the computer is booted up. Most DOS BIOS are invoked using the INT 21H instruction. BIOS
Character Input from keyboard with Echo • INT 21H Function 01H: • Call With: AH = 01H • Returns: AL = ASCII character pressed. • Note: If AL is zero, then a function key is pressed. • Example: The following macro reads a one digit number from the keyboard and returns the corresponding binary value in AL. GET1 MACRO MOV AH,01 ;Specify function 01 INT 21H ;Call DOS BIOS AND AL,0FH ;Convert from ASCII to binary GET1 ENDM BIOS
Display Character on Standard Output Device • INT 21H Function 02H: • Call With: AH = 02H DL = ASCII code of character to be displayed • Returns: AL = ASCII code of character displayed • Note: Standard output device is normally the monitor. • Example: The following macro displays a one digit number on the screen. The number is passed in DL as a binary number. DSP1 MACRO OR DL,30H ;Convert from binary to ASCII MOV AH,02 ;Specify function 02 INT 21H ;Call DOS BIOS DSP1 ENDM BIOS
Display a Character String • INT 21H Function 09H: • Call With: AH = 09H DS:DX = Segment:Offset address of the string. • Returns: All registers unchanged. • Note: Displays a character string up to the first occurrence of the dollar sign "$". • Example: The following macro displays the character string MSG on the screen. DMSG MACRO MSG MOV DX, Offset MSG ;Point to MSG MOV AH,09 ;Specify function 09 INT 21H ;Call DOS BIOS DMSG ENDM BIOS
Buffered Keyboard Input • INT 21H Function 0AH: • Call With: AH = 0AH DS:DX = Segment:Offset address of the buffer The first byte in the buffer should be loaded with the size of the buffer, i.e. the maximum number of characters to be input. • Returns: All registers unchanged. The second byte in the buffer is equal to the number of characters entered. The characters entered are stored in the buffer starting from the third byte. • Note: The functions ends if the user has typed in a number of characters equal to the first value in the buffer, or if the user has pressed the “Enter” key. BIOS
Buffered Keyboard Input:- Example The following procedure prompts the user to type in a text up to 30 characters long. The text entered is stored in the buffer BUF1. The procedure uses the DSPM macro of the previous example. ORG 100H MSG1 DB ‘Type in a text up to 30 characters long’, 0AH, 0DH,’$’ BUF1 DB 30, 00, 30 DUP(?) MAIN PROC NEAR DSPM MSG1 ;Display MSG1 MOV DX, Offset BUF1 ;Point to BUF1 MOV AH,0AH ;Specify function 0A INT 21H ;Call DOS BIOS RET MAIN ENDP BIOS
ASCII Codes • ASCII code is a standard 8-bit binary code for alphanumeric characters. • It defines: • a group of control characters (00H to 20H and 7FH for Delete) • a group of printable characters (21H to 7EH) • a group of special graphics or multilingual characters (80H to FFH) 00 NUL 01 SOH 02 STX 03 ETX 04 EOT 05 ENQ 06 ACK 07 BEL ASCII Control Characters 08 BS 09 HT 0A LF 0B VT 0C FF 0D CR 0E SO 0F SI 10 DLE 11 DC1 12 DC2 13 DC3 14 DC4 15 NAK 16 SYN 17 ETB 18 CAN 19 EM 1A SUB 1B ESC 1C FS 1D GS 1E RS 1F US BIOS
ASCII Codes - Printable Characters 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 3A : 3B ; 3C < 3D = 3E > 3F ? 40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4A J 4B K 4C L 4D M 4E N 4F O 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5A Z 5B [ 5C \ 5D ] 5E ^ 5F _ 60 ` 61 a 62 b 63 c 64 d 65 e 66 f 67 g 68 h 69 i 6A j 6B k 6C l 6D m 6E n 6F o 70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w 78 x 79 y 7A z 7B { 7C | 7D } 7E ~ 7F Del 20 Space 21 ! 22 ” 23 # 24 $ 25 % 26 & 27 ’ 28 ( 29 ) 2A * 2B + 2C , 2D - 2E . 2F / BIOS