Propeller ROM source code HERE
cgracey
Posts: 14,155
Here·are all the source codes for the executable portions of the Propeller's ROM.
The booter and interpreter·binaries·appear scrambled when the ROM is read normally, but automatically unscramble when loading into a cog. Since Hippy succeeded in reversing the scrambling pattern in response to my·challenge, I'm revealing the source codes. I·hope this will yield more progress than headaches.
Note that the executable portion of the ROM ($F004-$FFFF)·was pre-filled with longs randomly picked from the interpreter's scrambled binary before the actual code was laid in. This was a feeble measure to obscure the boundaries of the interpreter and booter codes. It was not much of a deterrent to Hippy, however, as I'm not even sure that he noticed.
Here is a map of the executable portion of the ROM:
$F004 - Interpreter binary (scrambled)
$F800 - Booter binary (scrambled)
$FF00 - Copyright message (ascii, 32 columns/row)
$FF70 - Runner bytecode (Spin code which builds initial stack frames for Spin processes)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
The booter and interpreter·binaries·appear scrambled when the ROM is read normally, but automatically unscramble when loading into a cog. Since Hippy succeeded in reversing the scrambling pattern in response to my·challenge, I'm revealing the source codes. I·hope this will yield more progress than headaches.
Note that the executable portion of the ROM ($F004-$FFFF)·was pre-filled with longs randomly picked from the interpreter's scrambled binary before the actual code was laid in. This was a feeble measure to obscure the boundaries of the interpreter and booter codes. It was not much of a deterrent to Hippy, however, as I'm not even sure that he noticed.
Here is a map of the executable portion of the ROM:
$F004 - Interpreter binary (scrambled)
$F800 - Booter binary (scrambled)
$FF00 - Copyright message (ascii, 32 columns/row)
$FF70 - Runner bytecode (Spin code which builds initial stack frames for Spin processes)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
Comments
Are we allowed to cherry pick stuff like the math operations for use in our own projects?
Maybe someone will start an open source spin compiler project now. If so, count me in!
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
If somebody makes a headache over this, bad on them.
Appreciated and have a great weekend.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
Post Edited (potatohead) : 2/25/2008 4:17:16 AM GMT
Writing a Spin compiler never required the ROM Interpreter code to be known but if that's the spur for people to embark on such a project having it is a good enough excuse.
-Phil
As examples, I love the PC-independent nature of femtobasic...And also 8052AH-BASIC.
That reminds me, it seems to me that ATARI 800 BASIC handled strings similarly to Spin,
and I once wrote a compiler in it.
Post Edited (VIRAND) : 2/25/2008 10:15:15 PM GMT
But ... but ... but ... that's my favourite programming language of choice ! You are however entirely right.
Maybe you can use your VB with Mono
The Mono Project on Feb. 20 announced that it has developed a Visual Basic compiler that will enable software developers who use Microsoft Visual Basic to run their applications on any platform that supports Mono, such as Linux, without any code modifications.
Website:
www.linuxdevices.com/news/NS9725385854.html
Mono Project website:
www.mono-project.com/VisualBasic.NET_support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob
I'll keep you posted on my progress. Come to the IRC channel if you want to chat.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
Hippy, have I whetted your appetite any?
-Phil
I wouldn't worry too much about the Unicode thing. It has always seemed a rather steep price to pay just to get a few graphics widgets onscreen anyway. I'm sure most people don't care and would be fine with ASCII. When I was doing my preprocessor in Perl, all the funny characters got replaced with question marks, and I thought, "Hey, that works!"
-Phil
Looking at the source for the booter, it had the title for the micro as PNut. I remember early during the Hydra dev that Parallax was trying to deside on a name for the chip, but I was wondering how it got the name PNut?
I'm thinking I'll put the parser alone in it's own shared library. It would build and return a tree and have some nice high level functions e.g. spinParseFile(...). The compiler part can then simply use the parsing library and focus on output. Other projects could then use this lib without the compiled output for other purposes (e.g. syntax highlight, auto-complete, etc.)
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
I have a quite bizarre development cycle. I usually code in PowerBasic for MS-DOS as 'the lowest common denominator', and I have a home-grown program which auto-ports to VB3 ( for 16-bit ) and VB6 ( for 32-bit ). The GUI front-ends are written in native VB3 ( and again auto-ported to VB6 ) or written in native VB6 for the specific application. My program also auto-ports to Perl for platform independence but I seem to have a bug in that at present which is proving to be a pain to track down. It was working.
Theoretically it can also port to REALbasic, C# and VB.Net but I've not maintained the libraries to do that recently.
It means adopting a particular coding style but it does have the advantage that the desirability of splitting the GUI front-end from the back-end and platform specific hardware interfacing is absolutely enforced. It also means minimal maintenance when the back-end changes.
@ JT Cook : "Peanut" ? Or maybe "nut" is a pun on kernel; "Propeller Kernel" ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
This is a rough first pass, but if anyone's interested I'm attaching what I've got so far. I'd love to hear opinions on the structure and I'm sure I've missed some things, so hopefully a few eyeballs on it can help make it better.
Stuff to note:
1) The quoted items will be lexer terminals, they're in this document for clarity.
2) Items with {} are typed terminals coming from the lexer. They will be read using some pretty simple regexes.
3) Due to the nature of Spin where the number of spaces before a line of code is important, we must supply whitespace to the parser. The actual implementation will have a lot more WS (whitespace) rules everywhere. They're left out here for clarity.
Cheers,
--fletch
UPDATE: The CON parser is definitely weak. Constant expressions should be expanded like the runtime expressions are.
UPDATE2: Yep just remembered 2 language constructs which need to be included. The function call in COGNEW and string(). There's probably more I'll continue tomorrow.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
Post Edited (dfletch) : 2/26/2008 8:39:33 AM GMT
Normally, operator precedence rules are defined by the grammar itself. For example, in this simple grammar, multiplication and division have a higher precedence than addition and subtraction:
In your grammar, all operators seem to have the same precedence. Were you planning to refine this later?
-Phil
I'll have a much improved version up tomorrow.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
if / if-else
case
return / abort
quit
in-built functions ( lookup, lookdown, strsize, strcomp etc )
unaries as statements ( var++ , --word[noparse][[/noparse]expr] )
multiple assignments ( var := var := expr, if (var:=expr) == expr )
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
Did I mention theyre faster?
By the way, we've moved the Spin compiler discussion to another thread. Let's please stick there to keep ontopic.
Cheers,
--fletch
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Join us in the Un-Official Propeller IRC channel: irc.freenode.net #propeller
Newbies, oldies, programmers, math professors, and everyone in-between welcome!
Propeller IRC howto
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 2/27/2008 3:06:17 AM GMT
shades of the Parallax SX - SX/A and SX/B!
Cool.
Should be a sticky topic!^^