CSE 322 Summer 2018 Lab 3

June 3, 2018

Task 1 (eg 6.1)

//code

mov ax, 70h
mov bx, 60h 

cmp ax, bx
jg label1
jl label2

label1:
mov cx, ax
jmp end_ 
label2:
mov cx, bx 
end_:

Task 2

Take 2 input and if the first input is greater that the second input print ‘>’ if less print ‘<‘ and if both input are same print ‘=’

//code

mov ah, 1
int 21h
mov bl, al

int 21h
mov bh, al

cmp bl,bh
jg label1
jl label2
je label3

label1:
mov ah, 2
mov dl, '>'
int 21h 
JMP END_
label2: 
mov ah, 2
mov dl, '<'
int 21h 
jmp end_

label3: 
mov ah, 2
mov dl, '='
int 21h


END_:

Task 3

Print 80 star using condition

//code 1
mov cx, 80 
top: 
mov ah, 2
mov dl, '*'
int 21h 
loop top

//code 2
mov bl, 10 
top: 
mov ah, 2
mov dl, '*'
int 21h
dec bl
cmp bl, 0 
je _end
jmp top

_end: 

//code 3 
mov bl, 0 
top: 
mov ah, 2
mov dl, '*'
int 21h
inc bl
cmp bl, 100 
je _end
jmp top

_end:

Task 4 (eg 6.2)

Replace.the number in AX by its absolute value.

//code

mov ax, 10

cmp ax, 0
jl label1
jmp end_

label1:
neg ax

end_:

Task 5

Suppose AL and BL contain extended ASCII characters. Display the one that comes first in the character sequence.

//code

mov ah, 1
int 21h
mov bl, al
int 21h
mov bh, al

cmp bl, bh
jle label1

mov ah, 2
mov dl, bh
int 21h
jmp end_

label1:
mov ah, 2
mov dl, bl
int 21h

end_:

Task 6 (section a)

Print 1 1010 box with star () without using string and using conditions

//code
to be done by students

Task 6 (section b)

print a 10*10 triangle with stars using nested loop and without using strings.

//Code
To be done by students

 

Leave a Reply