A problem with coding in 8085 microprocessor

  • #1
dragonflyv2
1
0
After i had studied and implemented codes to perform basic arithematic operations, factorial of a number, look-up tables, i got stuck at a pretty silly problem, while coding with the 80085 simulator:

MVI A,000H
STA 0001H
MVI A,0001H
STA 0002H
LXI H,0001H
MOV A,M
LXI B,0002H
STAX B
HLT
This piece of code is supposed to load the value 01H in the memory location 0002H. But it doesno't go as i expected. Where is the error with my logic.
 

Answers and Replies

  • #2
uart
Science Advisor
2,797
21
MVI A,000H
STA 0001H
MVI A,0001H
STA 0002H
LXI H,0001H
MOV A,M
LXI B,0002H
STAX B
HLT
This piece of code is supposed to load the value 01H in the memory location 0002H. But it doesno't go as i expected. Where is the error with my logic.


Assuming that you have RAM at memory address 0000...?, then that program should store zero at both address 0000 and 0001, though it's a convoluted way of doing it. What are you actually trying to achieve?

Basically your program does the following
- stores 00 at location 0001
- stores 01 at location 0002
- transfers the contents of 0001 to 0002
 
Last edited:

Suggested for: A problem with coding in 8085 microprocessor

  • Last Post
Replies
6
Views
167
Replies
15
Views
887
Replies
2
Views
393
Replies
1
Views
384
  • Last Post
Replies
30
Views
1K
Replies
21
Views
758
Replies
11
Views
596
  • Last Post
Replies
21
Views
1K
Replies
4
Views
581
Top