Lab Session 6: Hexadecimal Coding and Interrupts, Exercises of Microprocessors

Instructions for a lab session on hexadecimal coding and interrupts. It includes defining codes, assembling instructions, and writing subroutines to perform specific tasks. Students are required to write code using int30 and int64 instructions, and to understand the role of flags and stack in interrupt handling.

Typology: Exercises

2011/2012

Uploaded on 07/07/2012

kali
kali 🇮🇳

4.5

(37)

109 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page 1 of 1
Lab Session 6 April 5, 2012
Note: every number is in hexadecimal. Define code at 1000:100 Define SS at 2000
Bit0 is the first bit in a byte / word
Q1: Assemble the code at 1000:100
mov al,1
mov bl,2
int32
nop
dump the contents of int32 . write the contents of CS:IP
Now append the following code at this CS:IP
MOV al,ff
MOV bl,02
add al,bl
iret
i) What is the contents of flag register before the int32 instruction
ii) What happens to the flag register after the execution of int32 instruction
iii) Dump the contents of stack what it shows write the contents along with register information
iv) Does the ISR executes properly? If not then use another valid interrupt type
v) What happens to flag register after the instruction add al,bl
vi) Does iret retrieves the flag status
vii) What happens if iret is replaced by retf. Does nop instruction execute in this case?
**************
Q2: Write a code using int64 which copies the positive number to the location 3000:700 and the negative
number using to the location 3000:800 from a memory location 2000:500 (10 bytes)
2000:500 30 F0 FF 02 20 80 AE 03 20 D0 1E 03 20 A1 20 7E
1. what are the contents of status register before and after the execution of “int” instruction
2. Trace the code and show the contents to the lab instructor.
Q3: Write the subroutine to tell how many times 07 number appears in the memory 2000:300 (20 bytes)
02 07 50 01 07 50 60 70 0A 07 20 05 07 02 10 07 03 05 07 06 05 07 03 07 02 30 50 01 07 50 07 70
using loopne
1. Pass the parameters using
i) register
ii) specific memory (using pointer register)
iii) stack
to observe the contents of CX and Zero flag before the execution of loopne instruction. Write down the
contents. Now trace the code and check when the loop terminates write the contents of CX now.
*************
Q4: What is the CS and IP for int21 instruction can you show the memory location where it is stored.
What is the command for that? Un assemble few lines of the code written for int21.
Write a short program to call int21 and trace to check whether the program control executes those
instructions
Q5: Initialize SS=2000 SP=FFFC
Write following code
POP AX
POP BX
POP CX
POP DX
i) Does the code fully executes what is the contents of SP when there is problem?
ii) What is the remedy to solve the problem
docsity.com

Partial preview of the text

Download Lab Session 6: Hexadecimal Coding and Interrupts and more Exercises Microprocessors in PDF only on Docsity!

Page 1 of 1

Lab Session 6 April 5, 2012

Note: every number is in hexadecimal. Define code at 1000:100 Define SS at 2000

Bit0 is the first bit in a byte / word Q1: Assemble the code at 1000: mov al, mov bl, int nop dump the contents of int32. write the contents of CS:IP Now append the following code at this CS:IP MOV al,ff MOV bl, add al,bl iret i) What is the contents of flag register before the int32 instruction ii) What happens to the flag register after the execution of int32 instruction iii) Dump the contents of stack what it shows write the contents along with register information iv) Does the ISR executes properly? If not then use another valid interrupt type v) What happens to flag register after the instruction add al,bl vi) Does iret retrieves the flag status vii) What happens if iret is replaced by retf. Does nop instruction execute in this case?


Q2: Write a code using int64 which copies the positive number to the location 3000:700 and the negative number using to the location 3000:800 from a memory location 2000:500 (10 bytes)

2000:500 30 F0 FF 02 20 80 AE 03 20 D0 1E 03 20 A1 20 7E

  1. what are the contents of status register before and after the execution of “int” instruction
  2. Trace the code and show the contents to the lab instructor. Q3: Write the subroutine to tell how many times 07 number appears in the memory 2000:300 (20 bytes) 02 07 50 01 07 50 60 70 0A 07 20 05 07 02 10 07 03 05 07 06 05 07 03 07 02 30 50 01 07 50 07 70 using loopne
  3. Pass the parameters using i) register ii) specific memory (using pointer register) iii) stack to observe the contents of CX and Zero flag before the execution of loopne instruction. Write down the contents. Now trace the code and check when the loop terminates write the contents of CX now.

Q4:** What is the CS and IP for int21 instruction can you show the memory location where it is stored. What is the command for that? Un assemble few lines of the code written for int21. Write a short program to call int21 and trace to check whether the program control executes those instructions Q5: Initialize SS=2000 SP=FFFC Write following code POP AX POP BX POP CX POP DX i) Does the code fully executes what is the contents of SP when there is problem? ii) What is the remedy to solve the problem

docsity.com