March 04, 2012
Write a set of instructions to read and complement the contents of the flag register.
Apparatus Used: Microprocessor Kit, Keyboard
Assumption: In 8085, the contents of flag register and the accumulator together are called program status word (PSW). The PSW can be accessed by only using PUSH and POP instructions. The PUSH instructions move the flag register contents (as lower byte order) and the accumulator contents (as higher byte order) of the stack.
Algorithm:
- Push the contents of the accumulator and the flag register onto the stack.
- Bring the PSW to HL pair
- Move the contents of the flag register to the accumulator
- Complement the accumulator
- Store the complemented flags in register L
- Push the contents of the HL register pair onto the stack
- Pop it back to the PSW
- End the Program
Program:
Memory Address
|
Op-code
|
Operand
|
Comments
| |
2000
|
PUSH
|
PSW
|
Push the contents of A and Flag in Stack
| |
2003
|
POP
|
H
|
Store PSW in H-L pair
| |
2004
|
MOV
|
A,L
|
Move the contents of Flag Register in A
| |
2007
|
CMA
|
A,E
|
Complement the Accumulator
| |
2009
|
MOV
|
L,A
|
Store complemented flag in register L
| |
200A
|
PUSH
|
H
|
Push the contents of HL pair onto stack
| |
2010
|
RST
|
5
|
Set Break Point(Optional)
| |
2011
|
END
|
End the program
| ||
Used Instruction:
PUSH: This instruction pushes the contents of the register pair onto a stack.
POP: Pops the top two memory locations on the stack on a register pair.
MOV rd, rs: This instruction copies data from the source register into destination register.
CMA: Complements the contents of accumulator.
RST 5: This instruction is used to set break-point for the execution.
END: This instruction is used to execute the program.
Subscribe to:
Post Comments (Atom)
Attractive component of content. I just stumbled upon your web site and in accessioon capital tto assert that
ReplyDeleteI acquire actally loved account your blog posts. Any
way I'll be subbscribing in your augment and even I achievemennt you access persistently fast.
Also visit my blog post - xbox live codes generator