CSE 322 Fall 2018 Lab 1

      No Comments on CSE 322 Fall 2018 Lab 1

Problem #1

General structure of Assembly code and printing characters.

//Solution
.MODEL small
.STACK 100h
.DATA

.CODE
MAIN PROC
mov ah, 2
mov dl, 41h
int 21h 
mov dl, 0ah
int 21h
mov dl, 0dh
int 21h
mov dl, 41h
int 21h

ENDP MAIN

end MAIN

Proiblem #2

Input and output of characters

//Solution
.MODEL small
.STACK 100h
.DATA

.CODE
MAIN PROC
mov ah, 1
int 21h
mov bl, al 
mov ah, 2
mov dl, 0dh
int 21h
mov dl,0ah
int 21h
mov dl, bl
mov ah, 2
int 21h 

ENDP MAIN

end MAIN

Problem #3

//Solution
.MODEL small
.STACK 100h
.DATA

.CODE
MAIN PROC
mov ah, 2
mov dl, 'H'
int 21h
mov dl, 'E'
int 21h
mov dl, 'L'
int 21h
mov dl, 'L'
int 21h
mov dl, 'O'
int 21h
mov dl, ' '
int 21h 
mov dl, 'W'
int 21h
mov dl, 'O'
int 21h
mov dl, 'R'
int 21h
mov dl, 'L'
int 21h
mov dl, 'D'
int 21h

ENDP MAIN

end MAIN

Problem #4

String print

//Solution
.MODEL small
.STACK 100h
.DATA
str dl "Hello World$"
.CODE
MAIN PROC
mov ax, @data
mov ds, ax

mov ah, 9
lea dx, str
int 21h 
ENDP MAIN

end MAIN

Problem #5

Uppercase to lower case

//Solution
.MODEL small
.STACK 100h
.DATA

.CODE
MAIN PROC 
mov ah,1
int 21h
add al, 32
mov ah, 2
mov dl, al
int 21h

ENDP MAIN

end MAIN

Problem #6

Lowercase to uppercase

//Solution
.MODEL small
.STACK 100h
.DATA

.CODE
MAIN PROC 
mov ah,1
int 21h
sub al, 32
mov ah, 2
mov dl, al
int 21h

ENDP MAIN

end MAIN

Problem #7

Take 2 numbers less than 5 as input and print their sum in next line.

//Solution
To be done by students

Leave a Reply

Your email address will not be published. Required fields are marked *