[Coco] DECB development under OS9
Bill Pierce
ooogalapasooo at aol.com
Sat May 12 13:07:52 EDT 2018
As stated, the cstart would have to be modified (I have done this) as well as the libraries, but the real problem is in the assembly process used once the c code has been compiled into assembler code.
After the compiler (c.pass1 & c.pass2 or c.comp) compiles the sources into asm sources, the resulting code is assembled (by c.asm or rma) into "object" files. These object files have a very complex header. The header contains references to all variables, procedures and library calls used so the linker (c.link or r.link) can check between multiple sources to locate and build the variable tables, connect procedure calls between sources, and library calls. The linker does all the checking for missing variables and procedures, moves all variables to direct page and global areas as needed, then merges all modules into one (or more) files and creates the OS9 header.
Another thing is that C uses the stack for "local" variables declared only within the procedure. This method is fast, but sometimes clunky when using large locals like large string buffers and the like. It also makes for confusing asm code.
My guess would be to extract the asm source at the compiler stage, manually massaging those sources into something you could use. There is a couple of useful cmd line parameters in the C compiler front-ends (cc1, cc2 etc) that can help... one stops the process after the compiler, leaving the compiled asm source. Another will leave the original C source as comments to each operation in the asm source (needed to know what variables are what).
It would not be an easy task, but I guess it could be done.
Bill Pierce
"Charlie stole the handle, and the train it won't stop going, no way to slow down!" - Ian Anderson - Jethro Tull
My Music from the Tandy/Radio Shack Color Computer 2 & 3
https://sites.google.com/site/dabarnstudio/
Co-Contributor, Co-Editor for CocoPedia
http://www.cocopedia.com/wiki/index.php/Main_Page
E-Mail: ooogalapasooo at aol.com
-----Original Message-----
From: Gregory Law <glaw at live.com>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Sat, May 12, 2018 12:33 pm
Subject: Re: [Coco] DECB development under OS9
I can't imagine it will be easy to use the OS-9 C Compiler for RS-DOS.
You'll need to replace the cstart.r module with one that is not
dependent on OS-9 system calls, create your library functions that are
not dependent on OS-9 system calls, create your memory management code,
and patch the OS-9 header on the executable module with the appropriate
RS-DOS LOADM header. The compiler itself doesn't really generate OS-9
specific code per se, but the cstart module and a lot of the library
functions are heavily dependent on OS-9.
In the end I imagine it will be easier to use something like CMOC on a
PC.
On 5/11/2018 11:14:22 PM, "Dave Philipsen" <dave at davebiz.com> wrote:
>Thanks for the comments guys. Anyone care to comment upon whether an
>OS9 C program with minimal system calls could theoretically be
>patched/converted to run under DECB? I’m thinking it might even be
>able to be run unpatched if you simply created an add-on that serviced
>the SWI in DECB. Of course, there would be a lot of system calls that
>simply wouldn’t make sense under DECB but it would seem like the
>stdin/stdout stuff could be made to work among some others.
>
>Just an idea I was thinking of...
>
>Dave
-- Coco mailing listCoco at maltedmedia.comhttps://pairlist5.pair.net/mailman/listinfo/coco
More information about the Coco
mailing list