A problem with coding in 8085 microprocessor

  • Thread starter Thread starter dragonflyv2
  • Start date Start date
  • Tags Tags
    Coding
Click For Summary
SUMMARY

The forum discussion centers on a coding issue encountered while using the 8085 microprocessor simulator. The user attempted to load the value 01H into memory location 0002H but faced unexpected results. The provided code successfully stores 00H at address 0001H and 01H at address 0002H, but the logic for transferring values is flawed. The error lies in the misunderstanding of how the MOV and STAX instructions interact with memory addresses.

PREREQUISITES
  • Understanding of 8085 microprocessor architecture
  • Familiarity with assembly language programming
  • Knowledge of memory addressing in microprocessors
  • Experience with the 8085 simulator tools
NEXT STEPS
  • Review the 8085 instruction set, focusing on MOV and STAX operations
  • Practice coding with the 8085 simulator to reinforce memory management concepts
  • Explore debugging techniques for assembly language programs
  • Learn about effective use of look-up tables in 8085 programming
USEFUL FOR

Students, hobbyists, and engineers working with the 8085 microprocessor, particularly those interested in assembly language programming and debugging memory operations.

dragonflyv2
Messages
1
Reaction score
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.
 
Technology news on Phys.org
dragonflyv2 said:
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:

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K