CSE 322 Summer 2018 Lab 1

      No Comments on CSE 322 Summer 2018 Lab 1

Task 1

Usage of mov & add instruction

Task 2

Input output

//Code
 .MODEL small
 .STACK 100h
 .DATA
 ;declarations
 .CODE
 MAIN PROC
 mov ah,1
 int 21h
 mov bl, al
 add bl, 1
 mov ah, 2
 mov dl, ' '
 int 21h
 mov dl, bl
 int 21h
 ENDP MAIN
 ;other procs (if any) go here
 end MAIN

//Code 2 with newline

.MODEL small
 .STACK 100h
 .DATA
 ;declarations
 .CODE
 MAIN PROC
 ;input
 mov ah,1
 int 21h
 ;move the value of ascii to bl
 mov bl, al
 ;add 1 to bl to find the next ascii code
 add bl, 1
 ;enter output mode
 mov ah, 2
 ;newline starts
 mov dl, 0dh
 int 21h
 mov dl, 0ah
 int 21h
 ;newline ends
 ;printing the next character from input
 mov dl, bl
 int 21h
 ENDP MAIN
 ;other procs (if any) go here
 end MAIN

Task 3

//Code 3
 .MODEL small
 .STACK 100h
 .DATA
 ;declarations
 .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
 ;other procs (if any) go here
 end MAIN

Task 4

Printing string

//Code
.MODEL small
 .STACK 100h
 .DATA
 shp db 'Hello World$'
 .CODE
 MAIN PROC
 mov ax, @data
 mov ds, ax
 mov ah, 9
 lea dx, shp
 int 21h

ENDP MAIN
 ;other procs (if any) go here
 end MAIN

Task 5

Uppercase to lowercase

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

.CODE
 MAIN PROC
 mov ax, @data
 mov ds, ax
 mov ah,1
 int 21h
 add al, 20h
 mov ah,2
 mov dl, al
 int 21h

ENDP MAIN

end MAIN

Task 6

Lowercase to uppercase

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

.CODE
 MAIN PROC
 mov ax, @data
 mov ds, ax
 mov ah,1
 int 21h
 sub al, 20h
 mov ah,2
 mov dl, al
 int 21h

ENDP MAIN

end MAIN

Task 7

Adding 2 number and printing their sum

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

.CODE
 MAIN PROC
 mov ax, @data
 mov ds, ax

mov ah,1
 int 21h
 mov bl, al
 sub bl, 30h
 mov ah, 1
 int 21h
 add bl, al
 mov ah, 2
 mov dl, bl
 int 21h

ENDP MAIN

end MAIN

Leave a Reply

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