Islamic Azad University, Central Branch, Faculty of Technology – Computer Dep.
Machine and Assembly Language Programming- Code:3672 – BSc Computer Eng.
2nd Semester 83-84 - Date: 7/4/84 - Time allowed: 2 hours
A signed packed BCD number is stored in AX. Write a program to display the contents of AX on monitor. Store the converted BCD number to ASCII in a location called adadbcd. To display the converted number use Function 09. Convert in tabdil proc near. Use bitwise operations. (4)
a) Write a program for adding two 2 byte numbers a1 and a2 stored in data segment 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. (2)
b) Write the main and add2 procs in two different files.(0.5)
c) What are the stages of generating main.exe if the main proc is in main.asm and add2 in procs.asm. (0.5)
d) Using appropriate diagrams show the way the data is stored in data and stack segments, show location of SP and BP and also indicate the offset of each data unit. (1)
a) 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 ( taking into account the first and last characters ) and using function 09 display the message “number of a’s 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)
a) Write the execution stages of push ax and pop ax. (1)
c) Why programs in assembly execute faster than equivalent programs in high level languages?(1)
a) What is the binary representation of -0.35 using format below? (1)
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)
What is the effect of test ah,20h with AH=61h on ZF?
What is the effect of neg ah with AH=80h on SF and OF?
What is the effect of sub ah,40h with AH=30h on CF? (1)
Write the object code and location counter for the following program (3)
Which addressing mode is used for data type structures in assembly, explain. (0.5)