[Coco] OS-9 Question, GCC stuff

tim lindner tlindner at ix.netcom.com
Fri Jul 22 19:09:22 EDT 2005


James Diffendaffer <jdiffendaffer at yahoo.com> wrote:

> What limitations does OS-9 place on the use of page 0 and DP usage by
> programs?  I'm guessing Page 0 is reserved for the OS but the DP would
> be ok to use for a user program... but I don't have any OS-9 docs so I
> wan't to make sure.  

Here is the memory map from Microware's C Compiler manual:


         |      High addresses      |
         |                          | SBRK() adds more memory here
         |                          |
         +--------------------------+ <- memend (global var set by 
         |        Parameters        |      cstart.a)
         +--------------------------+
         |                          |
         |           stack          |
         |                          |
         |                          |
         |. . . . . . . . . . . . . | <- S register
         |            V             |
         |                          |
         |        Free memory       |
         |                          |
         |                          |
         |            ^             |
         |. . . . . . . . . . . . . | <- IBRK( changes this memory
         |                          |    bound upward
         |                          |
         |                          |
         |     requested memory     |
         |                          |
         +--------------------------+ <- end (global var set by 
         |      Uninitialized       |      cstart.a)
         |       global data        |
         +--------------------------+ <- edata (global var set by 
         |       Initialized        |      cstart.a)
         |       global data        |
    .    +--------------------------+ 
    |    |      Uninitialized       |
    |    |    direct page data      |
  dpsiz  +--------------------------+ 
    |    |       Initialized        |
    |    |    direct page data      |
    !    +--------------------------+ <- Y and DP registers



dpsiz is a global var set by the linker

Some notes: The shell does not include argv[0] in the parameter area.
The linker attaches the program name to the end of the executable and
cstart.a adjust argv[0] to point to it. Then cstart.a parses the
parameter area creating argc and the rest of the argv pointers.

-- 
tim lindner
tlindner at ix.netcom.com                                            Bright



More information about the Coco mailing list