Why is LDAA 0,X Equivalent to LDAA 1,X+?

  • Thread starter Thread starter seang
  • Start date Start date
  • Tags Tags
    Equivalent
Click For Summary
SUMMARY

The discussion clarifies the equivalence between the assembly instructions LDAA 0,X and LDAA 1,X+. LDAA 0,X loads the A accumulator with the value at the address pointed to by the X register without incrementing X. In contrast, LDAA 1,X+ loads the A accumulator with the value at the address pointed to by the X register plus an offset of 1, and then increments the X register. The confusion arises from the post-increment behavior of the X register, which necessitates the use of the offset 1 in the second instruction.

PREREQUISITES
  • Understanding of HC12 assembly language syntax
  • Familiarity with the function of the A accumulator in assembly
  • Knowledge of register operations, specifically the X register
  • Comprehension of post-increment addressing modes
NEXT STEPS
  • Study HC12 assembly language addressing modes
  • Learn about the A accumulator's role in HC12 assembly
  • Explore the implications of register post-increment in assembly programming
  • Investigate other assembly instructions that utilize offsets and register increments
USEFUL FOR

Assembly language programmers, particularly those working with HC12 architecture, and students learning about low-level programming concepts related to registers and memory addressing.

seang
Messages
184
Reaction score
0
I cannot understand why the following bits are equivalent:

Code:
LDAA 0,X
INCX
;and
LDAA 1,X+


The 1 is throwing me off. Since the X register is post incremented, why is it necessary? I would think that LDAA 0,X+ would be equivalent to the first bit of code. What am I missing?
 
Engineering news on Phys.org
I don't program in HC 12 assembly, but is the first arguent to the LDAA instruction the register number?
 
Right, I was thinking that might be a problem.

LDAA 0,X loads the A accumulator with the address stored in the X register, plus the offset (0, in this case).

LDAA 1,X+ loads the A accumulator with the address in the X register, plus the offset (1 in this case), and then increments the X register.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
911
  • · Replies 8 ·
Replies
8
Views
1K
  • · Replies 19 ·
Replies
19
Views
1K
  • · Replies 16 ·
Replies
16
Views
1K