I know similar questions have been asked, but listen anyway.
I've written quite a few Easy68k programs this semester, and I am curious why org directive is always set to $1000, or $2000, or $2500.
While the answer is "by personal convention", I am more interested in understanding the following:
- What are the benefits of setting org directive, CPU can execute anything from 0x0 to 0xffffffff, so what is the need to offset the program start all the way to 0x1000?
For instance:
org $1000
start:
moveq #9, d0
trap #15
end start
works, but is offset by 4096 bytes down
start:
moveq #9, d0
trap #15
end start
works also, but is not offset at all
So why is this directive needed? I am not reserving [0x0, 0x1000) for any particular purpose, so what is the point of keeping this offset?
Conclusions so far
- Easy68k does not have a default place for global variables, they are placed at pc (usually at the end of program by convention).
- Easy68k's default stack pointer is at 0, growing downwords to 0xffffffe, and downwards (it is word aligned): this means that there is no conflict with [0, 0x1000) region. In fact, it would corrupt the code before corrupting the [0, 0x1000) region.
I'm really curious.
Thanks ahead of time!
~Dmitry