←back to thread

168 points chmaynard | 1 comments | | HN request time: 0.259s | source
Show context
OnlyMortal ◴[] No.42066401[source]
Back in the day on the Mac, the order of source files in your project would determine locality in the binary.

If memory serves, this was with MPW C or maybe CodeWarrior.

You could see the jump (jmp) instructions use short jumps rather than long ones.

replies(4): >>42067152 #>>42068345 #>>42072091 #>>42074191 #
1. teo_zero ◴[] No.42074191[source]
Not only jumps. The Motorola 68000 has a relative addressing mode where any sufficiently near address can be expressed as PC+offset. Offset is 16 bits, thus covering a local range of ±32kB, with the additional benefit of being position-independent, a valuable feature for systems without virtual memory.

Having learned to program for the Amiga before Intel-based PCs, I was shocked when I realized that the latter are missing that basic feature and position-independent executables must go through run-time relocation!