Lab Sheets #03
Lab Sheets #03
[1] Write a program that reads a character and then prints it. Write, run, and save the
program using Emu8086 software:
.model small
.stack 100h
.code
Main proc
MOV AH, 01
INT 21h
MOV DL, AL
MOV AH, 02
INT 21h
MOV AH,4CH
INT 21
Main endp
END main
[2] Change the previous program to read a string of 3 characters and then to print it.
Write, run, and save the program using Emu8086 software:
.Model small
.Stack 100h
.Code
Main proc
MOV AH, 01h
INT 21h
MOV BL,AL
INT 21h
MOV BH,AL
INT 21h
MOV CL,AL
MOV AH, 02h
MOV DL, BL
INT 21h
MOV DL, BH
INT 21h
MOV DL, CL
INT 21h
Mov AH,4Ch; exit to DOS
Int 21h
Main endp
End main ; stops the program
|Page1
[3] Write and run the following program using Emu8086 software, then save the program:
.model small
.stack 100h
.DATA
MSG DB 'HELLO!$'
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
LEA DX,MSG
MOV AH,9
INT 21H
MOV AX,4CH
INT 21H
MAIN ENDP
END MAIN
[4] Write and run the following program using Emu8086 software, then save the program:
.model small
.stack 100h
.DATA
CR EQU 0DH
LF EQU 0AH
MSG1 DB 'ENTER A UPPER CASE LETTER : $’
MSG2 DB CR,LF,'IN LOWER CASE IS: ‘
CHAR DB ?,’$’
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
LEA DX,MSG1 ;print user prompt
MOV AH,9
INT 21H
MOV AH,1 ;input a character and convert into upper case
INT 21H
ADD al,20H
MOV CHAR,al
LEA DX,MSG2 ;print second message and upper case letter
MOV AH,9
INT 21H
MOV AX,4CH
INT 21H
MAIN ENDP
END MAIN
|Page2
[5] Write and run the following program using Emu8086 software, then save the program:
.model small
.stack 100h
.DATA
CR EQU 0DH
LF EQU 0AH
MSG1 DB 'ENTER A LOWER CASE LETTER : $’
MSG2 DB CR,LF,'IN UPPER CASE IS: $ ‘
CHAR DB ?
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
LEA DX,MSG1 ;print user prompt
MOV AH,9
INT 21H
MOV AH,1 ;input a character and convert into upper case
INT 21H
SUB al,20H
MOV CHAR,al
LEA DX,MSG2 ; print second message
MOV AH,9
INT 21H
MOV AH,2 ; print upper case letter
MOV DL,CHAR
INT 21H
MOV AX,4CH
INT 21H
MAIN ENDP
END MAIN
|Page3