| When DOS starts a process, it starts it at the first location in
the first hunk in the program. There are no other considerations
for program start address outside of that constraint. Note that
I really mean the first location in the first hunk in the program,
and not just the first location in the first code hunk in the program.
This means that whatever module you have that contains the startup
code should be the first module you give to the linker, and probably,
the first segment within the module (unless you can get the linker
to sort by segment name or something).
Personal opinion: This sorta sucks a whole bunch.
A commented excerpt of the DOS library code from the ROM that gets
called when processes are created/started. Fortunately, this piece
looks to be coded in assembler, so it isn't as contorted looking as the
BCPL stuff:
; Looks like all we have to do is find the starting PC (first code
; in the first segment of our seglist) and the final PC (the process
; exit code), then start the process. (Hunk list BPTR in D6)
FF475A LSL.L #2,D6 ; Convert BPTR to APTR
FF475C MOVEA.L D6,A2 ; Copy user's seglist pointer
FF475E LEA 4(A2),A2 ; Get first code address as initial PC
FF4762 LEA ProcessFinalPC(PC),A3 ; Get final PC
FF4766 JSR _LVOAddTask(A6) ; Fire the task up
|