Islamic Azad University, Central Branch, Faculty of Technology Computer Dep.

Machine and Assembly Language Programming- Code:3672 BSc Computer Eng.

2nd Semester 82-83 - Date: 31/3/83 - Time allowed: 2 hours

Rafi Allameh

Q1

System time can be set using function ah=2D of int 21h. CH is hour (0-23) , CL is minutes (0-59), DH seconds and DL hundredths of seconds. Write a program for inputting the time using function 0A in the hh:mm format and storing it in location time. Convert the input string into an integer in a Far proc named integer . Then by giving the above registers the correct value (DL=DH=0) set system time. Use bitwise operations where possible. (4)

 

Q2

a) Write a program for adding two 2 byte numbers pushed into stack by the main program prior to calling proc add2 far ( proc for adding two numbers). Use BP to transfer the numbers to proc add2. Draw the status of SP and BP in the stack at various stages(.(2

 

b) Write the main and add2 procs in two different files.(1)

 

c) What are the stages of generating main.exe if the main proc is in main.asm and add2 in procs.asm. (1)

 

Q3

Write a program for inputting a line of string of with maximum of 80 characters using function 0A. Use repne and scasb to count the number of a s in this string and using function 09 display the message number of as are=# # on the screen. Convert the numbers into ASCII using proc itoa especially written for converting non-signed two figure numbers utilizing bitwise operations.(4)

 

Q4

a) Draw an appropriate diagram to explain pipelining. (1)

 

b) Explain the stages of Read and transferring of sum to ALU from main memory in execution of add sum,05. (0.5)

 

c) Why is the source of script programs transferred to the client in the Internet?(0.5)

 

Q5

a) What is the denary equivalent of the floating number C4642000  (1.5)

0

22

23

30

31

m

e'

s

m=mantissa, s= sign, b=number of bits allocated to e , e= e+2b-1

 

b) what is the BCD representation of -1?(0.5)

 

Q7

What is the effect of test ah,20h with AH=61h on ZF?

What is the effect of sar ah,1 with AH=81h on SF and OF?

What is the effect of sub ah,40h with AH=30h on CF? (1)

 

Q8

Write the object code and location counter for the following program (3)

 

datasg

segment

 

aa

dw ?

 

bb

dw 250,10,-1

 

x

db 5 dup(A)

 

datasg

ends

 

 

 

 

codesg

segment

 

 

assume cs:codesg,ds:datasg

 

main

proc far

mov ax,seg datasg =B8 + Reserve 2 byte for datasg 

 

mov ax,seg datasg

mov ds,ax=8E D8

 

mov ds,ax

mov ax=A1

 

mov ax,aa+1

push ax=  50

 

push ax

mov ax=B8

 

mov ax,0

inc ax= 40

l1:

inc ax

cmp al=3C

 

cmp al,5

jne=75

 

jne l2

mov cx=8B0E

 

mov cx,bb+2

loop=E2

 

loop l1

ret=CB

l2:

ret

 

main

endp

 

codesg

ends

 

 

end main