[Coco] SDCC and other C topics

KnudsenMJ at aol.com KnudsenMJ at aol.com
Fri Mar 18 12:35:36 EST 2005


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.







More information about the Coco mailing list