Tuesday, 28 July 2015

Write a program to (a) prompt the user, (b) read first, middle, and last initials of a person's name, and (c) display them down the left margin Assembly language Easy Solution.

Write a program to (a) prompt the user, (b) read first, middle, and
last initials of a person's name, and (c) display them down the
left margin.
Sample execution:
ENTER THREE INITIALS: JFK
J
F
K
/*
    *
    * Prosen Ghosh
    * American International University - Bangladesh (AIUB)
    *
*/
TAG: EASY SOLUTION , 8086 MICROPROCESSOR, ASSEMBLY LANGUAGE CHAPTER 4 , PROGRAMMING EXERCISE .

Solution:

.MODEL SMALL
.STACK 100H
.DATA
    STR DB 'ENTER THRRE INITIALS: $'
    STR1 DB '',0AH,0DH
    FIRST DB ?
    STR2 DB '',0AH,0DH
    SECOND DB ?
    STR3 DB '',0AH,0DH
    THIRD DB ?
    STR4 DB '$'
.CODE
MAIN PROC
 
    MOV AX,@DATA
    MOV DS,AX
 
    MOV AH,9
    LEA DX,STR
    INT 21H
 
    MOV AH,1
    INT 21H
    MOV FIRST,AL
    INT 21H
    MOV SECOND,AL
    INT 21H
    MOV THIRD,AL
 
    MOV AH,9
    LEA DX,STR1
    INT 21H
 
    MOV AH,4CH
    INT 21H
 
    MAIN ENDP
END MAIN

No comments:

Post a Comment