The Propeller Chip

Published February 14, 2008
Advertisement
It's time for me to get up close and personal with the Propeller chip. As you already know from reading my earlier post, the Propeller chip has 8 independent cores running at up to 80MHz, although it can be overclocked for even higher speeds. The Propeller chip also has 32KB of main memory that can be accessed by any core, and 2KB of memory that is local to each core. There is also a built in 32KB ROM table, containing a high-level language interpreter, sine and log tables, and a font table.

The Propeller is programmed using a unique combination of two languages: Propeller ASM, and Spin. The ASM is run on a per-core basis, whereas Spin is run by the included interpreter and reads instructions out of main memory. When the Propeller first boots up, it checks the attached EEPROM for a binary image. If one is found, it loads it into the first core and starts up the interpreter to read Spin code. Once this has started, you are free to start up new cores as you need them, either in Spin mode or ASM.

Spin is a strange language which acts like a combination of of C, Python, and Pascal. Following is a code snippet of an LED flasher program written in Spin. (I wonder how this will look with the colorizer).

CON  _clkmode = xtal1 + pll16x  _xinfreq = 5_000_000PUB Start  DirA[16] := %1  Repeat 5    OutA[16] := 1    WaitCnt(40_000_000 + Cnt)    OutA[16] := 0    WaitCnt(40_000_000 + Cnt)


The previous snippet will turn an LED connected to pin 16 of the Propeller on and off 5 times. As you can see, the language doesn't use braces or ends, but instead uses indentation. Also, casing is not important. These two features, as well as several others, make me dislike the language a little.

I have an idea for a new language that will compile down to both Spin/ASM and C#, which will have three benefits: first, every game I write for the Propeller in that language will also be usable from windows via C#. Second, I won't have to interact with Spin/ASM on a daily basis, which seems like a good thing to me. Third, I will integrate my language with Visual Studio, which is a much nicer editor than the included Propeller Tool. Not that it is horrible, but Visual Studio takes the cake. More on the custom language much further down the line.

As you can see, I setup a nice task list on the top of my journal (the first person to guess where I got... my inspiration... for it gets a cookie). The next task to conquer is getting the Propeller hooked up to a TV and displaying some graphics. I mean, what's a video game console without the video aspect?

You know the drill. Read. Enjoy. Post feedback. Wait for my next update.
Previous Entry New Toys
Next Entry TV & ASM
0 likes 8 comments

Comments

bladerunner627
Why can't you just use C or C++?
February 14, 2008 06:55 PM
Mike.Popoloski
Because the chip only knows ASM and Spin...
February 14, 2008 09:31 PM
Evil Steve
Do I get a cookie? [smile]

I was considering making my own scripting language that compiles to x86 asm actually, and then I realised it was rubbish, Lua was better, and compiling to asm is A Really Bad Idea.

A scripting language that compiles to Propeller ASM sounds cool. What does the Propeller ASM look like?
February 15, 2008 03:56 AM
bladerunner627
Quote:Original post by Mike.Popoloski
Because the chip only knows ASM and Spin...


Yea, I thought it was generally excepted that most chips ran C.
February 15, 2008 07:30 AM
Washu
Quote:Original post by bladerunner627
Quote:Original post by Mike.Popoloski
Because the chip only knows ASM and Spin...


Yea, I thought it was generally excepted that most chips ran C.

Eh, what? Nothing runs C at all. C gets compiled down to assembly (ASM). As far as most embedded systems having compilers for it...depends, a lot of the newer multi-core systems (like the Propeller), find C to be highly restrictive when attempting to work with them.
February 15, 2008 01:50 PM
Mike.Popoloski
*Gives Evil Steve a cookie.*

Yea, the Propeller ONLY runs ASM and Spin.

Evil Steve: I'm not sure what to compare it to, as I've never done any ASM programming before. I'll post an example in my next journal entry, and you can make the observations yourself.
February 15, 2008 01:50 PM
bladerunner627
Quote:Original post by Washu
Quote:Original post by bladerunner627
Quote:Original post by Mike.Popoloski
Because the chip only knows ASM and Spin...


Yea, I thought it was generally excepted that most chips ran C.

Eh, what? Nothing runs C at all. C gets compiled down to assembly (ASM). As far as most embedded systems having compilers for it...depends, a lot of the newer multi-core systems (like the Propeller), find C to be highly restrictive when attempting to work with them.


Obviously I know nothing runs straight C code. I guess your second sentence answers my question though.
February 15, 2008 03:09 PM
Evil Steve
Quote:Original post by Mike.Popoloski
Evil Steve: I'm not sure what to compare it to, as I've never done any ASM programming before. I'll post an example in my next journal entry, and you can make the observations yourself.
Woo! I've got a basic writing knowledge of x64/x86 asm, and I've read Atari ST assembly, ARM-9 asm and x86 / x64 asm. I'm interested with this now [smile]

Spin looks suspiciously similar to asm actually. I wouldn't be surprised if it just adds simple stuff like arrays and expressions to the asm code.
February 15, 2008 06:55 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement

Latest Entries

New Blog

1983 views

Progress Update

1538 views

Start of Project

1506 views

New Job

2179 views

The Downward Spiral

2833 views

Job Interviews

1439 views
Advertisement