mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-21 00:31:47 +00:00
Updated Technical Note PT37: Using MPW for Non Macintosh 68000 Systems (markdown)
parent
ff7dbdddd6
commit
2d803eae57
@ -227,11 +227,11 @@ The Pascal and C compilers do some hidden work to initialize the run-time enviro
|
||||
|
||||
With Pascal, most of this initialization is automatically inserted into your main procedure. There is very little you can do about it except to put all of your Pascal routines into separately compiled UNITs and write your entry point in C or assembly.
|
||||
|
||||
In the case of C, this initialization is performed by a routine in the file CRuntime.o called `CMain()`. The following is a description of what happens to your source code from the time the C compiler gets it to the time the code you have written is executed:
|
||||
In the case of C, this initialization is performed by a routine in the file `CRuntime.o` called `CMain()`. The following is a description of what happens to your source code from the time the C compiler gets it to the time the code you have written is executed:
|
||||
|
||||
* MPW C compiles all of the source files and creates object files for the linker. All functions are compiled in exactly the same way, including `main()`.
|
||||
* These files are linked together. If you do not link with the file CRuntime.o, these routines will link together, but they will not have an entry point; the linker will not have any routine explicitly defined as the first one to be called, and it will default to setting up the first routine that it finds as the entry point.
|
||||
* If you do link with the file CRuntime.o, then you will be linking with a routine called `CMain()`. This routine is marked as being an Entry routine, and it will be the routine that is executed when you launch the Macintosh program.
|
||||
* These files are linked together. If you do not link with the file `CRuntime.o`, these routines will link together, but they will not have an entry point; the linker will not have any routine explicitly defined as the first one to be called, and it will default to setting up the first routine that it finds as the entry point.
|
||||
* If you do link with the file `CRuntime.o`, then you will be linking with a routine called `CMain()`. This routine is marked as being an Entry routine, and it will be the routine that is executed when you launch the Macintosh program.
|
||||
|
||||
`CMain()` performs the following steps:
|
||||
|
||||
@ -251,7 +251,7 @@ This is what `_RTInit` does:
|
||||
|
||||
This is what `_DataInit()` does:
|
||||
|
||||
1. Assume that A5 is valid, and that there is data appended to the end of DataInit that is used to initialize the globals. This will be done by the linker automatically.
|
||||
1. Assume that A5 is valid, and that there is data appended to the end of `DataInit` that is used to initialize the globals. This will be done by the linker automatically.
|
||||
2. Determine the size of the globals and zero it out.
|
||||
3. Read the data at the end of the procedure and use it to initialize the globals. Normally, this process will attempt to use `_BlockMove` on sufficiently large blocks of data, and a small loop for small blocks of data. A version of `DataInit()` that does not call `_BlockMove` is available from Macintosh Developer Technical Support. However, this limits you to 64K of contiguous pre-initialized storage.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user