[Coco] gcc-coco revisited
KnudsenMJ at aol.com
KnudsenMJ at aol.com
Fri Oct 31 21:52:16 EST 2003
In a message dated 10/31/03 12:24:31 PM Eastern Standard Time,
dbree at duo-county.com writes:
> > You can't write really efficient 6809 code without it! Global variables
> rule!
>
> Exactly! "Direct" is a must. Actually, we would need this in the RSDOS
> version, too.
Fer sure, you want it in RSDOS too. Nobody would write RSDOS assembler by
hand without Direct.
BTW, years ago BYTE or some other mag listed some standard speed test
programs in C. I copied one to OS-9 C on the Coco3, in three versions:
(1) All variables were local/automatic on the stack frame. Ran pretty slow,
as expected.
(2) All vars were declared global (outside of main() ), but not Direct. Ran
slow, maybe even slower than (1), due to the clunky U-relative PIC addressing.
(3) Like (2) but I added Direct to all globals. Tore up the town! Maybe 4X
faster.
BTW, there is a major issue with Direct vars. The Linker needs to issue
stern warnings if the total number of Direct global vars exceeds the 256 bytes in
DP. When code assembled to use Direct addressing goes after a variable that
didn't make it onto Direct Page, it's fireworks time!
In Microware OS-9 C, if you suspected this, you had to give the linker the
option to generate a symbol table and memory map, and verify that all your
direct vars really fit in DP. Even in a mongo program like UltiMusE, I never quite
blew the limit, but you can't be too careful. --Mike K.
More information about the Coco
mailing list