Is there any Spin compiler written in Pascal?
pik33
Posts: 2,366
There is an Ultibo environnment for bare metal Raspberry Pi written in Pascal (fpc). Having a Spin compiler in Ultibo would allow to connect P1 to Ultibo running on Pi and using this Pi to compile and upload programs to the Propeller.
There is an OpenSpin repository; the code is in C/C++ but then there are comments that this is a translation from Pascal. It can be of course translated backward but if there is a Pascal code hidden somewhere, this could save several hours of work.
I am posting this after several failed attempts to find this: maybe I am searching for what is not hidden but I can't see it.
There is an OpenSpin repository; the code is in C/C++ but then there are comments that this is a translation from Pascal. It can be of course translated backward but if there is a Pascal code hidden somewhere, this could save several hours of work.
I am posting this after several failed attempts to find this: maybe I am searching for what is not hidden but I can't see it.
Comments
Open Spin is a C++ recreation of the compiler. I'm not sure if the x86 assembler source was made available to the author, Rot Eltham, to enable this.
There is the BST Spin compiler that was written in Pascal: http://www.fnarfbargle.com/bst.html BradC did not open source that either.
As far as I know you are out of luck in the Pascal department.
I'm crazy enough to have translated OpenSpin from C++ to JavaScript so that one could compile Spin code in a web browser. But I cheated and used the Emscripten compiler to do that.
Translating OpenSpin to some archaic language for a OS that no one uses would be a bit too crazy for me. But I do see the motivation.
Presumably there is a way build and run assembler language programs on Ultibo. Or assemble them into a library that can be used from Pascal.
In which case perhaps one could compile OpenSpin into assembler. Then use Free Pascal to incorporate that assembler into a program or library.
Of course OpenSpin depends on the standard C library which you don't have. That was true for the Javascript translation. One just has to find all the places this happens and provide the feature required. It's not much, open, close, read, write, etc.
Of course yes I wrote a SID emulator for Ultibo in asm, as well as the noise shaping audio driver. Both inspired by P1 programs (SidCOG and audio driver)
If it depends on standard C library (and not C++), then we have it and no translation will be needed, only compiling into the static library. This is supported by Ultibo. That way I have an Amiga module and mp1-2-3 player added to my Ultibo based audio player
Maybe actual compilers superseded it, no idea.
Chip did provide the source for the x86 asm for me to reference when building OpenSpin. (Also, are you trying to imply something by calling me Rot?
One big thing for me is the Pi booting in 2 seconds. There is no operating system so, it's pretty much instant. I did a little test here with it: fixstuff-thots.blogspot.com/2016/03/very-interesting-new-project-on-pi.html
edit: Lol. We even had this discussion a while back.. https://forums.parallax.com/discussion/163686/interesting-concept-for-baremetal-pi
As well as some Prop tools, there is fasmg (advanced Macro Assembler) in x86 assembler, & I played about with PASM in that.
I believe the PropBASIC Spin is limited to launch wrappers for the PASM, so that shifts the problem to finding an assembler - either modify an existing one, or expand PropBASIC to emit located HEX ?
I am very impressed.
It's even more weird that the original x86 assembler ended up as Javascript with OpenSpin.js
It's totally the wrong way to build a compiler or any other software but never mind.
Sorry about the "Rot" thing. Just a typo. Or is it a contraction of Roy elTham ?
Does the FPC Exec command still work in Ultibo ? (calls a command line executable with params)
https://www.freepascal.org/docs-html/rtl/dos/exec.html
I knew it was just a typo, but I had to poke at it, for fun.
Chip's x86 asm is pretty clean and reasonably well commented. That made it a LOT easier to do, than if I had disassembled the binary and reversed it.
David Betz,
I bet if you asked Chip he would share it with you. I was asked not to share it, but that was ages ago. They've opened the P1 and gone heavy on Open Source since then. Who knows, maybe they'll release the x86 asm source for all?
It's not usable on it's own, you have to wrap it with a bunch of code , but you can see OpenSpin for a rough idea on that (although I have evolved things a bit since the original port).
We could get by with using an Editor such as NotePad++ or similar on various platforms.
SimpleIDE stared out with great enthusiasm by jazzed. Unfortunately development faltered and it seems its not in a usable form any more.
I am not sure if PropLoader works on all platforms, nor if it is reliable anyway. Something like this is required.
There are Terminal Programs that work on different platforms.
But these 4 pieces need to be tied together for each platform. Don't hold your breath - we have been waiting for a decade now
bst was the closest and it worked reliably at the time. There was absolutely no support from Parallax. It's a real shame.
So the basics are there. Just need to tie the pieces together on each platform.