Shop OBEX P1 Docs P2 Docs Learn Events
Prop Assembly - ground up — Parallax Forums

Prop Assembly - ground up

ALIBEALIBE Posts: 299
edited 2006-09-18 17:28 in Propeller 1
I am trying to start w/ prop asm. CAn someone recommend a good set of resources for both asm and prop asm instr for beginners. I have RAndy Hyde's art of asm book - but, not very impressed w/ hla.

thanks

Nagi

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
ALIBE - Artificial LIfe BEing. In search of building autonoumous land robot

http://fstop.crosscity.com/
http://icar.crosscity.com/
·

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-09-16 01:27
    Are you trying to learn assembly because you are finding Spin to be inadequate for a project or because you are curious?

    The reason I ask, is there aren't really any well suited "Assembly for Beginners" text that I am aware of outside of a university bookstore. Assembly by it's nature varies wildly depending on the platform, which means books are written for a particular platform. The Propeller's assembly diverges considerably from the platforms typically used to teach assembly (Motorola's 68K and Intel's 8051).

    My advice is if you are serious enough about learning it, you'll slowly pick it up. Read, re-read and read again chapter 5 of the Propeller manual. Sleep with it under your pillow if you think osmosis will work. Start with the program page 340 of the manual and tinker with it until you understand whats going on, then try to expand on it in incremental steps. I will be releasing an application next week (functionally its done, all thats left is some touching up). It has a few assembly routines within it and every line of code has comments, read it until you understand it. Look at every object that contains assembly·and try your best to follow whats going on (though this probably wont be much help until I get to expanding the comments within them).

    I first learned assembly on the Tandy Color Computer, I bought the companion book that explained (in technical terms) the assembly language for the computer. I took the book wherever I went, and read it until the spine broke and pages started falling out. I wrote maybe two programs on the platform and most of the concepts of programing assembly didn't gell until the immersion by fire in college. IOW it is quite a steep learning curve for most people.

    If somone knows of a commonly availible book for learning assembly, please chime in.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.

    Post Edited (Paul Baker (Parallax)) : 9/16/2006 1:32:55 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2006-09-16 02:38
    I would add that assembly language is much more about understanding the computer architecture and how the actual instructions operate rather than learning a programming language per se. That's why it's so platform specific. One of the people who frequent this forum has been working on an emulator for the Propeller that runs on a PC. I don't have a link to that thread, but try searching for "emulator". That may be a great way to understand how the instructions work. Like most emulators, you can step through instructions one at a time and watch the registers and memory locations change.
  • CJCJ Posts: 470
    edited 2006-09-16 02:52
    I don't know of any books on the topic, but with the power and flexibility of Propeller Assembly you don't have to abstract your thinking very far from the high level language.

    start by just reading through the manual to get a grasp on how the instructions affect the data

    think about how they combine to form the operations that we've all become acustomed to

    add in the conditional execution and flag/result effects

    and finally the timing event instructions

    Basically just play around with it, adding complexity as you become comfortable with it

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who says you have to have knowledge to use it?

    I've killed a fly with my bare mind.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-09-16 06:09
    The downside of having the Propeller's be your first assembly language is that it will spoil you rotten for programming other controllers. It's like sipping a glass of fine Bordeaux before savoring the olfactory undertones of Mad Dog's July vintage. You'll forever wonder why the other guys didn't make setting the condition codes optional or allow any instruction's execution to be conditional upon them, or why in heaven's name they didn't provide an and-not instruction when it's so obviously indispensible. And once you've been to Thirty-two-bit Land, how can you ever find solace in Eightville?

    But seriously, the Propeller's as good as any processor to start on. Don't waste your time looking for general assembly language how-to books, though. Just dig in, and get your hands dirty. Read other people's code. Try to figure out what they've done. Modify their code and see what happens. Blink some lights. Make a game of it, and have fun playing.

    And, above all, don't take too much of what you learn for granted if you're ever called upon to program an 8051! smile.gif

    Good luck!
    Phil
  • ALIBEALIBE Posts: 299
    edited 2006-09-16 15:09
    thanks all for your input and pointers. I will try to keep my feelers in to the manual's asm section.

    My interest is purely out of curiosity rather than by need.

    Nagi

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ALIBE - Artificial LIfe BEing. In search of building autonoumous land robot

    http://fstop.crosscity.com/
    http://icar.crosscity.com/
    ·
  • potatoheadpotatohead Posts: 10,260
    edited 2006-09-17 07:12
    Greets everyone,

    Just joined the forum because I'm looking hard at getting a Prop system running. What an interesting piece of hardware! My interest is at the hobby level for now. I really enjoy working on older, simpler hardware. I saw this as a modern alternative that appears to have all the fun elements, while not having anywhere near the limitations.

    Saw this thread and wanted to comment on Assembly language learning. I learned on the 6502, then 6809, then some Intel after that. (--still have my tattered Moto data book, for 6809.)

    The advice given here, for beginning the assembly learning process is solid. One thing I want to toss out here is something my mentor had me do long ago: print out an assembly listing that is not too long. Get a set of highlighters and color code each instruction as to it's overall purpose. Jumps, data transfer to I/O, calculation, branch (well, lots of instructions can be either executed or not on this chip, so maybe color them as to wether or not they are supposed to execute often or not so often, and or by type.), also color data -vs- addresses as these appear to be in different placement for some classes of instructions.

    (Why was this, BTW? Seems to add a layer of confusion to a fairly rigid structure. I'm curious about this.)

    From this, you will see subroutines and data areas emerge, finally giving you a better picture of the routine as a whole.

    This worked very well on the older CPU's as it helped to assemble the clues each instruction provides as to function, while keeping focus. (IMHO, the distractions and tangents make things difficult.) It's an old technique, but it seems to work well for relating instructions to functions for me. The goal is to become familiar with the core elements of the program listing, thus freeing you up for the higher level interpetation necessary to begin to really work with the system.

    Take it for what it's worth.

    Regarding this particular assembly language, I find the listings so far very intriguing. The ability to set conditional execution as a parameter really helps to pack things in, thus making the most of every instruction. (I really want to call, what I would think of as an opcode, something more like an instruction set.)

    The fairly steep instruction limits at first turned me off, but after looking at the fragments posted so far, it's obvious that far fewer instructions are needed to accomplish something than would otherwise be required on many other CPU's. Should be a fun ride.
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2006-09-17 08:51
    Nagi, I've programmed a bit in assembly with other processors but never really got any good. The propeller has been good because you can bulid a program framework and if something isn't fast enough you start thinking about assembly for that part.

    Don't put assembly programming on a pedestal, it is "just" moving numbers around between registers. The manual does a good job of explaining what the commands do and examples can show how to use those commands, your own applications will provide a good driving force to actually learn something. Rather than just reading you think "how can I do this" and then you look into it.

    The sticky thread with the assembly examples should be a good start, if you don't have the manual then print out the assembly chapter and bind it somehow or just have the PDF open and use the search facility.

    Be patient and just get stuck in.

    Graham
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-09-17 12:02
    Why not look at the SX chips? There are plenty of resources on the Parallax website, and with SX-Sim, you can start without any hardware whatsoever.
  • ALIBEALIBE Posts: 299
    edited 2006-09-17 14:25
    PotatoeHead, thanks for the tip on color coding instr set and calls. I think that will get me an understanding of how instrs are used in diff scenarios. I might actually give that style a shot.

    Graham, I looked at the ASM for beginners sticky thread. What I don't find in there is a "code walk-thru" or a "step-by-step" examples that help teach asm in prop. I am looking for something that is similar to the spin examples in the manual's first half - only in asm. Do you know if and where they might be found in this forum?

    thanks both, Nagi

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ALIBE - Artificial LIfe BEing. In search of building autonoumous land robot

    http://fstop.crosscity.com/
    http://icar.crosscity.com/
    ·
  • potatoheadpotatohead Posts: 10,260
    edited 2006-09-17 20:25
    Why not SX?

    Good question, though starting to get OT for this thread.

    Guess it comes down to this: The prop is really different and very flexible. Having to invest a little to get a hobby system running is no biggie really. The learning is where the real investment is at. I like multi-cpu systems a lot. By day, I do systems engineering and administration. My years working with SGI NUMA systems have largely come to an end, leaving me with mostly Intel system sets running win32 or maybe Linux. (Hopefully more Linux as time goes on!)

    While it pays the bills, it's not as much fun these days.

    The prop is a very interesting design in this regard, yet it's scale is such that someone interested in computing can achieve their goals without huge investments. The design is a holistic one, with language and hardware melded into one mini-environment. IMHO, that's really new and worth some time learning about. This newness also means we really don't know what it is really capable of just yet. That's attractive for what should be obvious reasons.

    Over time, it will be very interesting to see how parallax decides to scale the prop. It's a really unique means of computing.

    Post Edited (potatohead) : 9/17/2006 8:31:24 PM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-09-18 17:28
    Ive had a weekend to think about this thread (wont get home internet access until tomorrow). I was concerned my post would be read as being harsh, glad it wasn't.

    Nagi, as potatohead alluded to, assembly instructions fit into 3 catagories: flow control, data transfer and data manipulation. Flow control dictates the path of execution through the code, in Spin this is the commands IF, REPEAT, CASE etc. Data transfer is moving data from one location to another, and data manipulation is the math that is performed on the data. Understanding these categories and how they fit into an assembly program will help you understand any code that you are reading.

    A few topics you should learn (or brush up on if you already know them) is logic equations, binary representation of numbers and 2's compliment notation. Understanding these concepts will help you understand the data manipulation instructions.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
Sign In or Register to comment.