PDA

View Full Version : converting from c to pascal :-(



noeska
09-04-2007, 06:36 PM
Once again i find that converting code from c to pascal is a hard thing to do:
For the efika there is an basic bootloader witch c source code, looking at it, it seems simple enough, but converting it to pascal is anohter thing.

Here is the original: http://www.powerdeveloper.org/article.php?article=openfirmwarekernels

This is my attempt: http://www.noeska.com/downloads/newos.zip

I hope some people here want to take a look at it and give their opinion.
Maybe i using the wrong types or wrong procedure declerations etc.

Another idea came to my mind:
should i use the c loader to load my pascal code?
How would i load the pascal code from c?

Thanks for your answers in advance!

{MSX}
10-04-2007, 04:56 PM
Ehm sorry, wrote the answer on the wrong topic :mrgreen:

noeska
10-04-2007, 06:53 PM
Ehm sorry, wrote the answer on the wrong topic :mrgreen:
Where?

noeska
10-04-2007, 06:58 PM
I got to start a procedure in a pascal unit from the c loader and call from the pascal unit the fo_printf from fo.h http://www.noeska.com/downloads/newos2.tar.gz

So i think i abandon converting the c loader source to pascal.

Ñuño Martínez
11-04-2007, 02:29 PM
Did you see the TORO operating system (http://toro.sourceforge.net/eng/index.html)? I didn't check it but may be you can find it there.

noeska
11-04-2007, 06:21 PM
No i did not know of toro before. It seems to be x86 coded using assembly routines. The efika is ppc (powerpc) based. So it may not be of use to me. I might learn from it what i should include in a custom rtl for the efika, thanks! But i am now already able to execute code compiled with free pascal from the c loader. I am happy with this for now.

The hard part of getting the c loader into pascal will be getting the address of the efika bios (open firmware) via register 5 into pascal. Next hard part is getting the right record like structure for actaly calling bios functions. I myself will not put time into this subject as the c loader is capeable of starting pascal compiled code.