Click here for Getting Offer
CS401 ASSIGNMENT NO 2 IDEA SOLUTION
Computer Architecture and Assembly Language Programming (CS401) Assignment # 02 Due date 12-06-2020 |
Please carefully read the following instructions before attempting assignment. RULES FOR MARKING It should be clear that your assignment would not get any credit if:
You should concern the recommended books to clarify your concepts as handouts are not sufficient. You are supposed to submit your assignment in .doc or docx format. Any other formats like scan images, PDF, zip, rar, ppt and bmp etc. will not be accepted. Topic Covered: · Addressing Modes · Branching · Subroutines |
NOTE No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least two days before its closing date. If you people find any mistake or confusion in assignment (Question statement), please consult with your instructor before the deadline. After the deadline no queries will be entertained in this regard. For any query, feel free to email at: |
Q1. Write a subroutine that will take two arrays Array1 & Array2. Array1 will contain uppercase alphabets from A-M and the Array2 will contain lower case alphabets from n-z. Your subroutine should work in such a way that it will convert array1 elements to lower case and array2 elements to uppercase and populate them in a 3rd array.
(Marks 20)
For example:
Array1 = A,B,C,D,E,F,G,H,I,J,K,L,M
Array2= n,o,p,q,r,s,t,u,v,w,x,y,z
Output should be:
Array3= a,b,c,d,e,f,g,h,I,j,k,l,m,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
Note: You can consult to alphabet’s ASCII values through this link: https://vulms.vu.edu.pk/Courses/CS401/Downloads/ASCII%20codes.doc
“The End”
SOLUTION.
[org 0x0100] ;offset
jmp start ; jump to start label
Array1: db 'A','B', 'C' ,'D', 'E', 'F' ,'G' ,'H' ,'I' ,'J' ,'K','L','M'
Array2: db 'n' ,'o' ,'p' ,'q' ,'r' ,'s', 't' ,'u', 'v', 'w' ,'x' ,'y' ,'z'
Array3: db '', '', '', '' ,'' ,'','','','','','','','','','','','','','','','','','','','',''
start:
mov bx, 0
mov cx, 13
lower_case:
mov al, [Array1+bx]
mov dl ,al
add dl, 32
mov [Array3+bx],dl
add bx,1
loop lower_case
mov bx,0
mov cx,13
upper_case:
mov al, [Array2+bx]
mov dl ,al
sub dl , 32
mov [Array3+bx+13], dl
add bx,1
loop upper_case
mov bx,0
mov cx,26
print_result:
mov al,[Array3+bx]
mov dl ,al
mov ah ,02
int 21h
add bx,1
loop print_result
exit:
int 0x10
mov ax,0x4c00
int0x21
SAMPLE CODE WITH OUTPUT.
ASSINGMENT NO 2 CS401
SOLUTION
STUDENT NAME = EHTISHAM
STUDENT ID =MC180200301
; Name: EHTISHAM
; STD ID: MC180200301
[org 0x0100]
jmp start
msg: db'E'
wait_for_key:
mov ah,0
int 16h
cmp ah,12h
jne wait_for_key
mov ah,0x13
mov al,1
mov bh,0
mov bl,7
mov dx,0x0000
mov cx,01
push cs
pop es
mov bp,msg
int 0x10
mov ax,0x4c00
int 0x21
start:
jmp wait_for_key
OUTPUT
AFTER PRESSING CLS AND HIT ENTER SCREEN WILL BE CLEAR
PRESS E First alphabet of your name
bro plz help me error occur
ReplyDelete