I am practicing the various data accessing modes in assembly. Here is what I have so far:
# Practicing the various Data Accessing methods
.globl main
main:
# Immediate mode
mov $7, %rbx
# Register addressing mode
mov %rbx, %rax
# Direct addressing mode?
ret
I understand the concept of moving the value at a memory address into a register, such as:
mov 0x0102030405060708, %eax
But my issue is, how is someone supposed to know where the (virtual) memory addresses are before the program compiles? Or if, for example, that memory address is even accessible (or that I might get a seg fault).
So, what might be a practical example that works for using Direct addressing mode?