Docsity

Lab Session 2b: Assembling and Manipulating Data in Assembly Language, Exercises of Microprocessors

Toggle sidebar
bg1
Lab Session 2b
Q1: (CS 3000, DS at 5000 SS at 7000)
i) assemble the code at the address 3000:0100
ii) Store 5 numbers each two byte long starting from memory location
50300H. using assemble mode (use proper index register)
iii) Write a code that adds 10 to each numbers stored and then stores the
results to another location with address starting from 50500H. (use proper
index register and loop instruction). Unassembled the code.(copy the code
in txt file for future ref)
iv) Save the code as lab2b.com, quit the debugger. Load and trace the code
v) Show the result of memory (i.e. DS:XXXX) to the demonstrators
Q2: assemble mode should be used for initializing internal registers and code
i) Exchange the numbers stored in AX , BX register and CX,DX registers
using stack. Compare the results with XCHG AX, BX and XCHG CX, DX.
ii) Initialize the contents of stack segment register to 7000H and SP register
to 00FF. Store FFBBH in DX and push DX to stack and observe the
contents of SP after the execution of the code. What did you observe? Push
DL register to stack. What did you observe? What do you conclude?
iii) Initialize the contents of SP to 0FEEH. Store any value in the GPRs (in
assemble mode
iv) What will be contents of the SP register after the execution of the code
given below? Also comment on the contents of the SP register after the
execution. PUSH AX
PUSH BX
PUSH CX
PUSH DX
v) Now append the following code
POP AX
POP BX
POP CX
POP DX
vi) What happens to the contents of GPRs
vii) When you trace the code in (vi) again then is there any change in the
contents of GPRs, why or why not
docsity.com

Partial preview of the text

Download Lab Session 2b: Assembling and Manipulating Data in Assembly Language and more Exercises Microprocessors in PDF only on Docsity!

Lab Session 2b

Q1: (CS 3000, DS at 5000 SS at 7000)

i) assemble the code at the address 3000: ii) Store 5 numbers each two byte long starting from memory location 50300H. using assemble mode (use proper index register) iii) Write a code that adds 10 to each numbers stored and then stores the results to another location with address starting from 50500H. (use proper index register and loop instruction). Unassembled the code.(copy the code in txt file for future ref) iv) Save the code as lab2b.com, quit the debugger. Load and trace the code v) Show the result of memory (i.e. DS:XXXX) to the demonstrators

Q2: assemble mode should be used for initializing internal registers and code i) Exchange the numbers stored in AX , BX register and CX,DX registers using stack. Compare the results with XCHG AX, BX and XCHG CX, DX. ii) Initialize the contents of stack segment register to 7000H and SP register to 00FF. Store FFBBH in DX and push DX to stack and observe the contents of SP after the execution of the code. What did you observe? Push DL register to stack. What did you observe? What do you conclude? iii) Initialize the contents of SP to 0FEEH. Store any value in the GPRs (in assemble mode iv) What will be contents of the SP register after the execution of the code given below? Also comment on the contents of the SP register after the execution. PUSH AX PUSH BX PUSH CX PUSH DX v) Now append the following code

POP AX POP BX POP CX POP DX vi) What happens to the contents of GPRs vii) When you trace the code in (vi) again then is there any change in the contents of GPRs, why or why not

docsity.com