NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: maplesirop on April 16, 2013, 03:33:17 AM

Title: Is this indirect addressing?
Post by: maplesirop on April 16, 2013, 03:33:17 AM
Add X

MAR <- X
MBR <- M[MAR]
AC <- MBR

I read that this is direct addressing, but we are passing the value X into MAR, which is used as an index to the memory.

AddI X

MAR <- X
MBR <- M[MAR]
MAR <- MBR
MBR <- M[MAR]
AC <- AC + MBR

In this case the address (or index) is used to contain the address that contains the value.
Title: Re: Is this indirect addressing?
Post by: Frank Kotler on April 17, 2013, 07:39:39 PM
I'm not sure I understand your notation, Maplesirop. "<" implies a "mov", not "less than", right? And I'll bet "MBR" doesn't mean "Master Boot Record", either...

Are you trying to do something like...
Code: [Select]
string1 db "hello world", 0
string2 db "goodbye world", 0
stringptr dd string1
...
...
; if command is "quit"
mov dword [stringptr], string2

Or... ?

Best,
Frank

Title: Re: Is this indirect addressing?
Post by: maplesirop on April 18, 2013, 09:07:45 PM
Thanks for replying,

MBR = memory buffer address

<- direction of data