Indexed addressing does not work
rlstrand opened this issue · comments
rlstrand commented
In the Indexed mode of addressing, the contents of the second
word of the instruction are added to the contents of the X Register to form
the address of the operand.
In the Indirect Indexed mode of addressing, the contents of the
second word of the instruction are used as an address pointer to the
contents of another, second, location, The contents of this second
location are added to the contents of the X Register to form the address
of the operand.
In get_address()
operand+memory[X] should be operand+X
memory[operand]+memory[X] should be memory[operand]+X
Michael Gardi commented
Actually since all of the "registers" are just in memory, I believe that
this code is correct. X in this case is defined as being a 2, the offset
into memory where the X register value resides. So memory[X] is the value
of the X register.
Mike
…On Fri, May 21, 2021 at 9:32 AM rlstrand ***@***.***> wrote:
In the Indexed mode of addressing, the contents of the second
word of the instruction are added to the contents of the X Register to form
the address of the operand.
In the Indirect Indexed mode of addressing, the contents of the
second word of the instruction are used as an address pointer to the
contents of another, second, location, The contents of this second
location are added to the contents of the X Register to form the address
of the operand.
In get_address()
operand+memory[X] should be operand+X
memory[operand]+memory[X] should be memory[operand]+X
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARSB2XOODTLNYOFZHYNWE73TOZOFHANCNFSM45JFFJEQ>
.
rlstrand commented
Yes you are correct, my mistake.