A problem with coding in 8085 microprocessor

  • #1

Main Question or Discussion Point

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,776
9
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:

Related Threads on A problem with coding in 8085 microprocessor

  • Last Post
Replies
3
Views
828
Replies
4
Views
6K
Replies
3
Views
2K
  • Last Post
Replies
10
Views
5K
  • Last Post
Replies
4
Views
1K
Replies
4
Views
10K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
2
Views
4K
Replies
5
Views
879
  • Last Post
Replies
8
Views
3K
Top