0% found this document useful (0 votes)
45 views18 pages

Basic Assembly Instructions Used in DEBUG: Julius Bancud

Functions for keyboard input, display output, and exiting DOS

Uploaded by

Red Streak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views18 pages

Basic Assembly Instructions Used in DEBUG: Julius Bancud

Functions for keyboard input, display output, and exiting DOS

Uploaded by

Red Streak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Basic Assembly Instructions

used in DEBUG

Julius Bancud
ASCII CODE
INT 21h FUNCTIONS

AH = 01h KEYBOARD INPUT. This function waits for you to type a character on
the keyboard. It echoes the character to the screen and returns the ASCII
character in the AL register
AH = 02h DISPLAY OUTPUT. This function displays one character on the screen.
DL = character to display on screen
AH = 08h KEYBOARD INPUT WITHOT ECHO. This function reads a character from
the keyboard but doesn’t display the character on the screen.
AL = Character read from the keyboard.
AH = 09h DISPLAY STRING. This function displays the string pointed to by the
DS:DX pair of registers.
The end of the string should be marked with the $ symbol.
AH = 0AH READ STRING. This function reads the string from the keyboard.
AH = 4Ch EXIT DOS. This function allows you to go back to DOS environment.
AL Return Code
- normally sets to zero (0)
TRY TO CODE IN YOUR
DEBUG!!!!!!!!
Example 1

Displaying a character (Uppercase ‘A’) on screen.


MOV AH, 02 ;request for display character
MOV DL, 41 ;character display (ASCII code for
A)
INT 21 ; call interrupt service
INT 20 ; END
Code and Output
EXAMPLE 2

Displaying character (lowercase ‘b’) twice on screen.

MOV AH, 02 ; request display character


MOV DL, 62 ;character to display
INT 21 ; call interrupt service
INT 21 ; call interrupt service
INT 20 ; end
Code and Output
EXAMPLE 3
Displaying the same character(lowercase ‘z’) thirty times using
LOOP on screen.

MOV CX, 001E ; setting the number of loops


MOV AH, 02 ;request display character
MOV DL, 7A ;character to display
NEXT: INT 21 ; call interrupt service
LOOP NEXT ; go to offset
INT 20 ; end
Code and Output
Example 4
Displaying different characters (‘A to Z’) using LOOP on the same line.

MOV CX, 001A ; setting the number of loops


MOV AH, 02 ;request display character
MOV DL, 41 ; character ‘A’
INT 21 ;call interrupt service
INC DL ; add 1 to the value of DL
LOOP NEXT ; go to offset
INT 20 ; end
Code and Output Output
Example 5
Displaying different characters (‘0’ to ‘9’) using LOOP vertically.

MOV CX, 000A ; Setting the number of loops


MOV AH, 02 ; request display character
MOV DL, 30 ; character ‘0’
NEXT: INT 21 ; call interrupt service
MOV BL, DL ; temporarily store the value of DL to BL
MOV DL, 0A ; line feed character
INT 21 ; call interrupt service
MOV DL, 0D ;carriage return character
INT 21 ; call interrupt service
MOV DL, BL ;BL transfers back the value of DL
INC DL ;add 1 to the value of DL
LOOP NEXT ; go to offset
INT 20 ; end
Code and Output
Output
Example 7

Displaying string (‘computer’) on screen.


Step 1. code the instruction at –A 0100
Step 2. input the hex code of every character of the
string at E -0200
Code and Output
!!!!!!TRY!!!!!!
1. Construct a DEBUG program that will display the
different characters (‘0’ to ‘9’) using LOOP with
separator (underscore) horizontally.
2. Construct a DEBUG program that will display the
first 10 letters in alphabet horizontally.

If you have questions, feel free to ask in our GC.!!!

You might also like