[Coco] SDCC and other C topics

L. Curtis Boyle curtisboyle at sasktel.net
Fri Mar 18 13:06:30 EST 2005


On Fri, 18 Mar 2005 12:35:36 -0500 (EST), <KnudsenMJ at aol.com> wrote:

> In a message dated 3/17/05 2:47:35 PM Eastern Standard Time,   
> james at skwirl.ca
> writes:
>
>>>  PCR relative is best used when you want position independent  code.
>>
>> Exactly, and that's what I'd like to see in any C  compiler we have. I
>> think, but am not sure, that it's a precondition  to OS-9 modules.
>
> PCR is "officially" required for any OS-9 module.  Definitely needed   
> for any
> system module (driver, descriptor, etc.) that just gets crammed into the
> boot wherever it will fit, since these modules never know where they'll  
> end  up.
> However, for Level 2 *user* programs, PCR is not required, since the
> relocation registers (DATs) in the GIME make every program think it's  
> running at
> address 0.  So absolute addressing can be used there (this includes  
> games,  MIDI
> players, games, utilities, games, editors, and games).  Absolute code   
> is a
> little smaller and runs a little faster.
> Long ago I wrote and published a filter, CNoY, that takes the assembler   
> code
> output by c.pass2 or c.comp and simplifies the PCR instructions back to
> absolute equivalents.  Every version of UltiMusE-II out there has been  
> run  thru
> this filter, so you know it works OK.
> Since Nitros9 is Level 2, this should work there too.  (Is there a   
> Nitros
> L1?).
> --Mike K.

     Actually, there are two expections that one _could_ use ,PC in the  
system modules - in the main kernal (BOOT, REL and OS9P1), and if GRFDRV.  
This is because both of these always get mapped exacly the same (once the  
MMU registers are set up correctly, of course). I believe I actaully used  
that in the last version of GRFDRV I worked on, to save some cycles and  
space.

L. Curtis Boyle



More information about the Coco mailing list