mid2longqمعالجات

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Mid2 long questions

11. Consider the following main program, subroutine and memory content.

1000 LXI SP,FFFF 1050 MYSUB: PUSH PSW Memory


1003 LXI H,2000 1051 LOOP: INR M
2000 05
1006 MVI C,05 1052 INX H
2001 0D
1008 CALL MYSUB 1053 DCR C
100B MVI A,00 1054 JNZ LOOP 2002 01
100D HLT 1057 POP PSW 2003 03
1058 RET 2004 11
2005 0B
2006 14
… …

Answer the following questions:


a) What is the content of the Stack Pointer after the execution of the first instruction located
at 1000H? (0.5M)
SP = FFFFH
b) Specify the stack locations (memory address) and their contents after the execution of the
CALL instruction located at 1008 (1 Mark)
Stack

FFFD 0B
FFFE 10

c) Specify the content of the stack pointer after the execution of the instruction PUSH PSW
in the subroutine. (1Mark)
SP = FFFBH
d) Specify the contents of the memory after the termination of the loop. (1Mark)
Memory
2000 06
2001 0E
2002 02
2003 04
2004 12
2005 0B
2006 14
… …
e) Specify the content of the program counter after the execution of the instruction RET in the
subroutine. (0.5 Mark)
PC = 100BH
10. Write an interrupt service routine to perform the following:

 Push the content of accumulator and flags on the stack.


 Add A9H to the accumulator
 Store the result in memory location 1980H.
 Pop the content that was pushed
 Enable the interrupts
 Return to the main program

PUSH PSW (1M)


ADI A9 (0.5M)
STA 1980 (0.5M)
POP PSW (0.5M)
EI (1M)
RET (0.5M)

Q7 Write a program to disable the interrupt RST 6.5 only.

EI
MVI A,0A
SIM

Q8. Write a program to perform the following:

 Initialize Stack pointer to 00FFH.


 Load the Register Pairs B and H with 1987H and 2215H, respectively.
 Exchange the contents using PUSH and POP instructions

LXI SP,00FF
LXI B,1987
LXI H,2215
PUSH B
PUSH H
POP B
POP H
HLT

You might also like