Parallax Forums
  HomeLog InRegisterCommunity CalendarSearch the ForumHelp
   
Parallax Forums > Public Forums > Propeller Chip > Propeller ROM source code HERE  Forum Quick Jump
 
New Topic Post Reply Printable Version
36 posts in this thread.
Viewing Page :
 1  2 
[ << Previous Thread | Next Thread >> ] | Show Newest Post First ]

Chip Gracey (Parallax)
Forum Moderator



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Aug 2004
Total Posts : 1136
 
   Posted 2/24/2008 4:17 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
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.



File Attachment :
booter.spin   10KB (application/octet-stream)
This file has been downloaded 579 time(s).

File Attachment :
interpreter.spin   22KB (application/octet-stream)
This file has been downloaded 624 time(s).

File Attachment :
runner.spin   3KB (application/octet-stream)
This file has been downloaded 629 time(s).
Back to Top
 

dfletch
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jan 2008
Total Posts : 165
 
   Posted 2/24/2008 4:44 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
This is amazing! Thank you Hippy!

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

Back to Top
 

Chip Gracey (Parallax)
Forum Moderator



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Aug 2004
Total Posts : 1136
 
   Posted 2/24/2008 4:51 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
dfletch said...

Are we allowed to cherry pick stuff like the math operations for use in our own projects?
 
Of course you can! It's there to learn by and get utility out of.


 
Chip Gracey
Parallax, Inc.

Back to Top
 

potatohead
Do NOT taunt Happy Fun Ball!



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Sep 2006
Total Posts : 1979
 
   Posted 2/24/2008 4:54 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
Chip, you are just great.

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

Back to Top
 

dartof
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Sep 2007
Total Posts : 5
 
   Posted 2/25/2008 12:11 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
BRAVO! This was the missing piece that make this processor fully understandable like the CPUs of the 70's and 80's. I had put a small effort into unscrambling the code last year by programming a small disassembler with a bit unscrambler, but gave up due to shear number of permutations. Kudos to Hippy and others for the brilliant effort to get the right bit order and to Chip for sanctioning the effort. This has made my day.
Back to Top
 

Rayman
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2007
Total Posts : 3127
 
   Posted 2/25/2008 7:24 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
Nice.  Maybe somebody will write us a Spin based Spin compiler now?
Back to Top
 

stevenmess2004
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2007
Total Posts : 1076
 
   Posted 2/25/2008 1:10 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
Rayman said...
Nice. Maybe somebody will write us a Spin based Spin compiler now?

If nobody else starts than I might start one in the next couple of months. I want to finish a few other things first though... If I do I will be asking for help from everyone as it will be the first compiler that I have done. :-)
Back to Top
 

hippy
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2007
Total Posts : 1951
 
   Posted 2/25/2008 1:32 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
To be honest, a command line compiler suitable for porting to non-WinXP platforms would probably be more appreciated and useful than one written in Spin.

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.
Back to Top
 

Phil Pilgrim (PhiPi)
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2006
Total Posts : 7744
 
   Posted 2/25/2008 2:16 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
Spin may be a difficult language to write a compiler in. It's not impossible, but Spin's minimal string-handling capabilities will certainly make things awkward. However, if this can be done, a nice add-on would be a multi-threaded Spin byte-code interpreter that can run on a PC. For maximum portability, it should be written in Perl, Python, or some other thread-safe, multi-platform language (i.e. not VB6). It would be slower than Propeller-based Spin, certainly, but at least the Spin-compiler-in-Spin could run on other platforms besides the Propeller.

-Phil
Back to Top
 

VIRAND
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Aug 2007
Total Posts : 584
 
   Posted 2/25/2008 2:55 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
A Spin editor and compiler (plus PASM) running on the Propeller w/o PC would be awesome.
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

Back to Top
 

Jasper_M
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2006
Total Posts : 224
 
   Posted 2/25/2008 3:11 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
I've updated some info to the Propeller Wiki based on the source code. propeller.wikispaces.com/Spin+Byte+Code see if you can find any inaccuracies / something that's just plain wrong. And please do edit it, as it's not the simplest explanation of opcode structure probably. I'll keep updating the wiki on the subject as I learn.
Back to Top
 

hippy
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2007
Total Posts : 1951
 
   Posted 2/25/2008 4:18 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
Phil Pilgrim (PhiPi) said...
For maximum portability, it should be written in Perl, Python, or some other thread-safe, multi-platform language (i.e. not VB6).


But ... but ... but ... that's my favourite programming language of choice ! You are however entirely right.
Back to Top
 

Bob Lawrence (VE1RLL)
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Aug 2007
Total Posts : 506
 
   Posted 2/25/2008 4:36 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
Somebody said...
But ... but ... but ... that's my favourite programming language of choice !



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

Back to Top
 

dfletch
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jan 2008
Total Posts : 165
 
   Posted 2/25/2008 4:42 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
I'm thinking of starting a C project using Bison for the parser. Lexers and parsers written in procedural code or OO always seemed very clumsy to me after learning Flex/Bison :-) Just not 100% sure at the moment about Flex and unicode. May have to write a custom lexer instead of Flex.

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

Back to Top
 

Phil Pilgrim (PhiPi)
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2006
Total Posts : 7744
 
   Posted 2/25/2008 5:58 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
Hippy said...
But ... but ... but ... that's my favourite programming language of choice !

I hear ya. I thought VB3 was the cat's meow. Then I "upgraded" to VB6 and thought, "OMG! They ruined it! It's GINORMOUS!" That's when I switched to Perl and haven't looked back. It's an acquired taste, though, and the shortest programs can produce huge executables when run through perl2exe. One reason is that, due to the eval function, the embedded interpreter has to include the compiler, too. But Perl's expressiveness (if you can read it a month down the road) and text-handling capabilities are legendary. Plus, it runs on almost any platform.

Hippy, have I whetted your appetite any? :-)

-Phil
Back to Top
 

Phil Pilgrim (PhiPi)
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2006
Total Posts : 7744
 
   Posted 2/25/2008 6:12 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
dFletch,

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
Back to Top
 

JT Cook
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Apr 2006
Total Posts : 373
 
   Posted 2/25/2008 6:55 PM (GMT -7)    Quote This PostAlert An Admin About This Post.

Chip:

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?

Back to Top
 

dfletch
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jan 2008
Total Posts : 165
 
   Posted 2/25/2008 7:20 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
Good point, Phil. I'll leave unicode support for "Phase 2". Isn't that what PHB's usually say when a feature gets squeezed out due to other priorities? :p

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

Back to Top
 

hippy
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2007
Total Posts : 1951
 
   Posted 2/25/2008 7:23 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
@ Phil : I guess I have to now own up to still using VB3. What's amazing is that the same code which compiles under VB3 in the blink of an eye takes seconds to minutes with VB6.

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" ?
Back to Top
 

Chip Gracey (Parallax)
Forum Moderator



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Aug 2004
Total Posts : 1136
 
   Posted 2/25/2008 7:59 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
JT Cook said...

Chip:

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?

PNut was what I called the Propeller project during development, for lack of a better name. None of us here knew what to name the chip, until the very end. This was a frustration to me, because I usually have well-formed ideas about such basic things. We held an internal naming contest, and I think it was my brother Ken that came up with "Propeller". Then, in drawing various logos containing propellers, the hat idea popped up, which made everything else make sense.


 
Chip Gracey
Parallax, Inc.

Back to Top
 

dfletch
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jan 2008
Total Posts : 165
 
   Posted 2/26/2008 12:52 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
I've gotten an interesting start on an open source Spin compiler. I wrote a (hopefully complete!) LALR grammar for Spin language.

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



File Attachment :
spin.lalr   14KB (application/octet-stream)
This file has been downloaded 175 time(s).
Back to Top
 

wastehl
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2006
Total Posts : 188
 
   Posted 2/26/2008 1:10 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
IMHO Parallax is to be commended for this release, it is sure to spark considerable activity. Kudos to Chip and Ken...

Bill


The Propeller, Revolutionary Power...

Back to Top
 

Phil Pilgrim (PhiPi)
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2006
Total Posts : 7744
 
   Posted 2/26/2008 2:39 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
dfletch,

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:


<expression> ::= <expression> "+" <factor> | <expression> "-" <factor> | <factor>
<factor> ::= <factor> "*" <term> | <factor> "/" <term> | <term>
<term> ::= <constant> | <variable> | "(" <expression> ")"


In your grammar, all operators seem to have the same precedence. Were you planning to refine this later?

-Phil
Back to Top
 

dfletch
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jan 2008
Total Posts : 165
 
   Posted 2/26/2008 2:59 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
Phil, yep that's definitely one of the things I've glossed over. Now that you mention it, there's no group expression with parenthesis either!

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

Back to Top
 

hippy
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Feb 2007
Total Posts : 1951
 
   Posted 2/26/2008 5:23 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
Other things not in the grammar so far ...

if / if-else
case
return / abort
quit
in-built functions ( lookup, lookdown, strsize, strcomp etc )
unaries as statements ( var++ , --word[expr] )
multiple assignments ( var := var := expr, if (var:=expr) == expr )
Back to Top
 
[ << Previous Thread | Next Thread >> ]
New Topic Post Reply Printable Version
36 posts in this thread.
Viewing Page :
 1  2 
 
Forum Information
Currently it is Thursday, July 29, 2010 5:17 PM (GMT -7)
There are a total of 462,440 posts in 62,066 threads.
In the last 3 days there were 90 new threads and 803 reply posts. View Active Threads
Who's Online
This forum has 20143 registered members. Please welcome our newest member, ME01.
56 Guest(s), 9 Registered Member(s) are currently online.  Details
John Abshier, Rayman, BradC, prof_braino, Sapieha, Gene Bonin, laser-vector, localroger, Nick McClick