0% found this document useful (0 votes)
485 views

Assembly Language Practice Questions

This document contains 4 questions related to assembly language programming. Each question provides sample code for a task such as copying numbers between arrays, converting strings to uppercase, or replacing capital letters in a string. The questions cover concepts like procedures, conditional jumps, string manipulation, and testing program logic.

Uploaded by

Wardah Nisar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
485 views

Assembly Language Practice Questions

This document contains 4 questions related to assembly language programming. Each question provides sample code for a task such as copying numbers between arrays, converting strings to uppercase, or replacing capital letters in a string. The questions cover concepts like procedures, conditional jumps, string manipulation, and testing program logic.

Uploaded by

Wardah Nisar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Computer Organization and Assembly Language

Question # 1:
Write a program that copies unsigned numbers from one array to another but it copies
numbers that are in range of >10 to <101. Write chkRange procedure first, this procedure is
called by the main procedure.

Code:
.model small inc si

.stack 100h inc di

.data dec cx

array1 db 10,20,30,40,50 jnz l1

array2 db 5 dup (?) No:

array3 db 'Out of Range$' lea si,array3

.code mov ah,09

chkRange proc int 21h

lea si,array1 ret

lea di,array2 chkRange endp

mov cx,5 main proc

l1: mov ax,@data

mov bl,[si] mov ds,ax

cmp bl,10 call chkRange

JL No mov ah,4ch

int 21h

cmp bl,101 main endp

JG No end main
Question # 2:
Write a program that copies signed numbers from one array to another but it copies
numbers that are in range of -10 and -100

Code:
.model small inc si

.stack 100h inc di

.data dec cx

array1 db -10,20,-30,40,-50 jnz l1

array2 db 5 dup (?) No:

array3 db 'Out of Range$' lea si,array3

.code mov ah,09

chkRange proc int 21h

lea si,array1 ret

lea di,array2 chkRange endp

mov cx,5 main proc

l1: mov ax,@data

mov bl,[si] mov ds,ax

cmp bl,’-10’ call chkRange

Jg No mov ah,4ch

cmp bl,’-100’ int 21h

Jl Nomov [si],bl main endp

mov bh,[si] end main

mov [di],bh
Question # 3:
Write a procedure that coverts a mixed alphabetic string to all Capital letters and displays it

Code:

.model small cmp dl,'z'

.stack 100h jl printString

.data printString:

var1 db 'computer',0 sub dx, 32

.code mov ah,2

main proc int 21h

mov ax,@data inc si

mov ds,ax dec cx

mov cx,8 ; jnz l1

lea si,var1 mov ah,4ch

l1: int 21h

mov dl,[si] main endp

cmp dl,'a' end main

jg printString

Question # 4:
Write a program that replaces all capital letters of a string to #, test this program logic
thoroughly with test sets.
Code:
model small jle printString

.stack 100h

.data printString:

var1 db 'COMPUTER',0 sub dl,32

.code mov ah,2

int 21h

main proc

mov ax,@data inc si

mov ds,ax dec cx

jnz l1

mov cx,8

lea si,var1 mov ah,4ch

int 21h

l1:

mov dl,[si] main endp

cmp dl,65 end mai

jge printString

cmp dl,90

You might also like