Microprocessors - CH 4
Microprocessors - CH 4
I N T 2 1H
Programming
The x86 PC
Assembly Language, Design, and Interfacing © 2010, 2003, 2000, 1998 Pearson Higher Education, Inc.
By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey Pearson Prentice Hall - Upper Saddle River, NJ 07458
OBJE CT IVES
this chapter enables the student to:
The x86 PC
Assembly Language, Design, and Interfacing © 2010, 2003, 2000, 1998 Pearson Higher Education, Inc.
By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey Pearson Prentice Hall - Upper Saddle River, NJ 07458
4 . 0: I NT 21 H
The x86 PC
Assembly Language, Design, and Interfacing © 2010, 2003, 2000, 1998 Pearson Higher Education, Inc.
By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey Pearson Prentice Hall - Upper Saddle River, NJ 07458
4 . 2: DOS INTERRUPT 2 1H
The x86 PC
Assembly Language, Design, and Interfacing © 2010, 2003, 2000, 1998 Pearson Higher Education, Inc.
By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey Pearson Prentice Hall - Upper Saddle River, NJ 07458
4 . 2: D OS INTERRUPT 2 1H Option 09
outp ut ting a data string the m on it or
• INT 21H can send a set of ASCII data to the monitor.
– Set AH = 09 and DX = offset address of the ASCII data.
• Displays ASCII data string pointed at by DX until it encounters
the dollar sign "$".
• The data segment and code segment, to display the
message "The earth is but one country" :
The x86 PC
Assembly Language, Design, and Interfacing © 2010, 2003, 2000, 1998 Pearson Higher Education, Inc.
By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey Pearson Prentice Hall - Upper Saddle River, NJ 07458
4 . 2: D OS INTERRUPT 2 1H Option 02
outp ut ting a single character
• To
To output
output only
only aa single
single character,
character, 02
02 is
is put
put in
in AH,
AH,
and DL is loaded with the character to be displayed.
• The following displays the letter "J" :
The x86 PC
Assembly Language, Design, and Interfacing © 2010, 2003, 2000, 1998 Pearson Higher Education, Inc.
By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey Pearson Prentice Hall - Upper Saddle River, NJ 07458
4 . 2: D OS INTERRUPT 2 1H Option 01
inpu tt ing a single character, wi th e ch o
• This functions waits until a character is input from
the keyboard, then echoes it to the monitor.
– After the interrupt, the input character will be in AL.
The x86 PC
Assembly Language, Design, and Interfacing © 2010, 2003, 2000, 1998 Pearson Higher Education, Inc.
By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey Pearson Prentice Hall - Upper Saddle River, NJ 07458
4 . 2: D OS INTERRUPT 2 1H Option 0A H
inpu tt ing a data string from t he k ey b oa rd
• A means by which one can get keyboard data from &
store it in a predefined data segment memory area.
– Register AH = 0AH.
– DX = offset address at which the string of data is stored.
• Commonly referred to as a buffer area.
• DOS requires a buffer area be defined in the data
segment.
– The first byte specifies the size of the buffer.
– The number of characters from the keyboard is in the
second byte.
– Keyed-in data placed in the buffer starts at the third byte.
The x86 PC
Assembly Language, Design, and Interfacing © 2010, 2003, 2000, 1998 Pearson Higher Education, Inc.
By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey Pearson Prentice Hall - Upper Saddle River, NJ 07458
4 . 2: D OS INTERRUPT 2 1H
usin g LABEL to define a string b uf fe r
• Use this directive to define a buffer area for the
string keyboard input:
The x86 PC
Assembly Language, Design, and Interfacing © 2010, 2003, 2000, 1998 Pearson Higher Education, Inc.
By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey Pearson Prentice Hall - Upper Saddle River, NJ 07458