0% found this document useful (0 votes)
27 views2 pages

CPE 005 Assignment No. 6 CN: 02 Name: Abelgas, Arnold Jay M. Section: CPE42FB2 Date: 12-11-16

This document discusses INT 21h function 9 which prints a valid string terminated with '$' without needing a null terminator. It provides an example that gets a character from the user, prints it twice, and uses INT 21h function 9 to print the prompt string "ENTER: $". It also shows how the digits 0-3 can be printed by passing their ASCII values to INT 21h function 2.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

CPE 005 Assignment No. 6 CN: 02 Name: Abelgas, Arnold Jay M. Section: CPE42FB2 Date: 12-11-16

This document discusses INT 21h function 9 which prints a valid string terminated with '$' without needing a null terminator. It provides an example that gets a character from the user, prints it twice, and uses INT 21h function 9 to print the prompt string "ENTER: $". It also shows how the digits 0-3 can be printed by passing their ASCII values to INT 21h function 2.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CPE 005

Assignment no. 6
CN: 02 Name: Abelgas, Arnold Jay M. Section: CPE42FB2 Date: 12-11-16

SERVICE #9 AND INTERRUPT 21

INT 21h, function 9 print 'valid' string ('$' terminated) (not ASCIIZ string 0 terminated)
input: AH: 9
DX: address (offset) of valid string in memory
output: none

CR EQU 0Dh ; carriage return


LF EQU 0Ah ; line feed, need both for DOS new line
QMRK EQU '?'
.data
PRMPT DB 'ENTER: $'
uchr DB ?
.code
...
; write the question mark on the screen
mov AH, 2
mov DL, QMRK
int 21h
; get a character input from keyboard
mov AH, 1
int 21h
mov uchar, AL
; move screen to next line
mov AH, 2
mov DL, CR
int 21h
mov DL, LF
int 21h
; let's write the character we got back twice
mov DL, uchar
int 21h
int 21h
mov DL, CR
int 21h
mov DL, LF
int 21h

What's output?

mov DL, 65
mov AH, 2
int 21h
mov AH, 9
lea DX, PRMPT
int 21h

What about printing digits?

mov AH, 2
mov AL, 30h ; same as '0'
int 21h
mov AL, 31h ; same as '1'
int 21h
mov AL, 32h ; same as '2'
int 21h
mov AL, 33h ; same as '3'
int 21h

You might also like