Shop OBEX P1 Docs P2 Docs Learn Events
Beginner assembly options — Parallax Forums

Beginner assembly options

TCTC Posts: 1,019
edited 2010-10-02 19:51 in General Discussion
I just won a SX Tech Board (Thank You Parallax!!!!). But I have a problem; I have never worked with assembly language before. Now I do have a Propeller stick that I have not really worked with.

My question is what would be my best option to learn assembly on? And what books should I look up.

To me I think the prop would be a good choice because of the forum support.

Thanks TC

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-20 16:16
    The Prop is much easier to program in assembly than the SX. The SX has a much more primitive instruction set, and its address space is highly segmented. Both factors conspire to make assembly programming rather awkward. Plus the SX is EOL, so learning to program the Prop instead would be a much better use of your time.

    BTW, I love your avatar! I hope the dog and the crab didn't actually tangle. Those claws can really hurt. What kind of crab is that? It has much bigger claws (the left one, anyway) than the Dungeness variety we get around here. Other than that, it looks like a Dungeness. A mutant, perhaps?

    -Phil
  • TCTC Posts: 1,019
    edited 2010-09-20 16:33
    PhiPi: Thank you for the quick responce. The only thing I like about the SX is the debuger, i can step the program so i can see what happens. Is there a way the prop can do this?

    I found the picture along time ago, so i have no idea about the dog or the crab. i just thought that dog has a bigger set of coconuts than I would to get that close to somthing like that.

    And I thought my signature would be a perfect fit.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-20 16:41
    TC wrote: »
    The only thing I like about the SX is the debuger, i can step the program so i can see what happens. Is there a way the prop can do this?
    Not natively, like the SX. There is some third-party debugging software available; but I don't use a debugger, so I'm not familiar with any of them.

    -Phil
  • TCTC Posts: 1,019
    edited 2010-09-20 16:54
    PhiPi: I will check third party debuggers out thanks.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-09-21 04:36
    Use the SX Tech Board with SX/B and it will be very handy.
  • TCTC Posts: 1,019
    edited 2010-09-21 04:43
    Use the SX Tech Board with SX/B and it will be very handy.

    I do like SX/B but I want to learn assembly.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-09-21 10:41
    Start with the Propeller and you will find yourself moving ahead more quickly. Nearly all the tutorials are free and readily available.

    With the SXes, it is still worth learning - but do you have the right resources? Of course I assume you have an SX Key or SX Blitz. And there is a website called www.sxlist.com that may stick around to offer some ideas.

    But the real important resource is Gunther's text. You likely need a copy of that to move ahead with some comfort.

    It has been difficult for me to accept that the SXes are at EOL and I've stocked up on an extra SX-Key and am willing to go ahead on my own. But it is really unfair to tell a newbie that they should start at such a position.

    With the Propeller there is a very lively group that will help out.
  • TCTC Posts: 1,019
    edited 2010-09-21 15:29

    With the SXes, it is still worth learning - but do you have the right resources? Of course I assume you have an SX Key or SX Blitz.

    But the real important resource is Gunther's text. You likely need a copy of that to move ahead with some comfort.

    It has been difficult for me to accept that the SXes are at EOL and I've stocked up on an extra SX-Key and am willing to go ahead on my own.

    I just bought Gunthers book and 2 SX's before they disappear and people are forced to go to there local corner pharmacist to see if he has a SX28AC.

    I would like to apologize up front for any ignorance or obvious solutions to the questions that i will ask while I am learning.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-09-23 07:31
    It is definitely worthwhile to pursue learning to program the SXes as PIC has micro-controllers that are the same pin-out and nearly the same architecture (except for programing interface and the ability for clock speeds in excess of 20Mhz).

    In other words, all your efforts to learn SX/ASM are likely to be useful and transferable to Microchip products with some minor differences is Assembler mnemonics.

    Aside from Gunther's text, there is a Senix pdf that is a guideline for programing with ISRs (interrupt service routines) as Virtual Peripherals. I believe you can still download that from Parallax and you should take a good look at it and keep it for future study.

    Because of the 8 bits, the SXes have paged EEPROM memory and RAM that is divided into segments as well. So unlike the Propeller, there are some housekeeping chores to use all of it.

    Like what? Well, the processor is 8 bits, but the program memory have addresses that go beyond the 8bit boundary. So a second register has to provide a pointer to which page. Similarly, to get more RAM, another special register points to segmented RAM as well. Wisely, their is also some global RAM that can be used no matter where the RAM pointer is and that includes all the special registers and the I/O Ports. But, you generally have to keep the two pointers in mind as you create programs. On the Propeller, you don't have to deal with such complexities as addresses are more directly handled, each Cog has a 2K space that is directly addressed by 9bits.

    I'll stop here as I am sure Gunther explains the details better that I ever might do so. But those two factors and the ISR are the features that are so different from the Propeller (The Propeller doesn't use ISRs).
  • User NameUser Name Posts: 1,451
    edited 2010-09-23 09:36
    I guess everyone's experience is different. I wish I understood the Prop one tenth as well as I understand the SX. Another word for primitive is simple. Simple, fast, and small are my three favorite words in computerdom. When simple, fast, and small are combined with something as outstanding as Chip's SX-Key, the results are truly sublime.

    Success with the SX is all about the clever use of its ultrafast deterministic interrupt. And a WHOLE LOT can be done there. I've written applications where the ISR took six or seven pages of flowcharts (in Visio) to document what it was doing.

    Once that's all packed away, the rest of the coding is a breeze.
  • kwinnkwinn Posts: 8,697
    edited 2010-09-23 15:19
    The PASD debugger allows single stepping PASM programs. I am using it and find it very helpful.
  • TCTC Posts: 1,019
    edited 2010-09-23 18:27
    @Loopy Byteloose. Thank you for the information. One main reason I wanted to learn assembly is because of the PIC, there is a few projects I have that I am using a BS2 on and it is a little overkill

    @User Name. I too am having trouble understanding spin, but I am not letting that stop me.

    @kwinn. Where can I find info on PASD? Tried googling it and came up with info for a school district.
  • Invent-O-DocInvent-O-Doc Posts: 768
    edited 2010-09-27 14:42
    Recommend you do SX/B on the SXs and learn ASM on the Prop. The reason is that you have to bank switch ram and a whole bunch of complicated stuff on the SX and why bother when you only have a few chips??? SX/B is really fast (compiles) anyway.

    When you learn ASM on the prop, please write a book so I can learn it too!
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-09-29 07:56
    The primary 'weirdness' of Spin Assembly is that you have 8 cogs sharing a clock. At the assembly language level, timing is extremely important. But the Propeller has had to take a very different approach to timing and clocking- synchronization and waiting via the 4 wait commands are quite important.

    Mostly people just understand WAITCNT, but the WAITVID is at the core of video timing. And then there are the other two wait commands.

    In the SX environment, you would create your own delays, or you would use the ISR cyclical waits. The two approaches seem nearly diametric opposites to me.

    The 'other thing' with the Propeller is that it has so much more to offer than you end up just spending a lot more time pondering the potential of every aspects. The best thing is to just jump in and try to make something work. And then ponder why.
  • localrogerlocalroger Posts: 3,452
    edited 2010-09-29 16:04
    User Name said: I've written applications where the ISR took six or seven pages of flowcharts (in Visio) to document what it was doing.

    A primary designed-in advantage of the Prop is that with eight separate core CPU's that don't have interrupts at all, you don't have to do things like this to get the same kind of results.
  • TCTC Posts: 1,019
    edited 2010-09-30 09:55
    @Invent-O-Doc: I have 1 prop, and 3 SX’s. If I blow one up I have backups. Also I want the more complicated stuff first then everything else would be easier to learn. (I hope!) I do have a book out it is called “How to make a Microcontroller not do what you want it to do” :)

    @Loopy Byteloose: That is why I have decided to start learning with the SX (only one thing at a time) then after I get a handle on it I will advance to the prop. I have an idea for my first project, an M&M sorter.
  • User NameUser Name Posts: 1,451
    edited 2010-09-30 16:56
    localroger wrote: »
    User Name said: I've written applications where the ISR took six or seven pages of flowcharts (in Visio) to document what it was doing.

    A primary designed-in advantage of the Prop is that with eight separate core CPU's that don't have interrupts at all, you don't have to do things like this to get the same kind of results.

    Understood. In those applications where my limited knowledge of SPIN and PASM have sufficed, the Prop has been a minor miracle! Or a major miracle! I really love the way multiple processors provide virtually independent functionality, even in the case of very intensive tasks like VGA generation.

    Then, a couple months later, I look at my Propeller code and it's like someone else wrote it. Much of it completely baffles me, and it takes me almost as long to figure out what I did as it did to write it in the first place.

    In contrast, I can look at SX assembly programs I wrote 10 years ago and understand almost every detail. I can dive right in, making changes or copying and pasting pieces into another project.

    The difference is that I have the SX memorized - partly because it's such a simple chip. I doubt I'll ever have SPIN and PASM memorized. There are just too many details. I'll forever be plowing through the wordy manual trying to find what I need, or staring at confusing code trying to figure out even the simple stuff.

    Most of the coding examples I see posted on the Propeller forum are totally Greek to me.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-10-02 02:35
    Regardless of the silicon, assembly language requires a complete understanding of that particular chip. I suspect that learning both really offers the best insight into what assembly language is about.

    Certainly ISRs can become very complex, but often a simple ISR willl suffice.
  • localrogerlocalroger Posts: 3,452
    edited 2010-10-02 11:26
    Propeller Cog PASM is actually one of the simplest assembly languages out there; it's just that, like any of them, you need to work with it enough to stay familiar with its quirks, and has some significant differences from most others.

    Spin does have some depth and serious differences from everything else, but for most purposes you don't need full speed or optimization so you can afford to use the subset that's easily associated with your other experience and dive into the manual mainly when you need an extra boost or byte of Hub RAM.
  • User NameUser Name Posts: 1,451
    edited 2010-10-02 19:51
    You are right on the money, localroger. You've got to give credit to Chip Gracey for putting some real depth into Spin - and doing so in 500 longs! I like his idea of replacing punctuation with indentation. But other deviations from C create confusion for me because of how much time I spend every day with C.

    Anyway, like you said so well, there is a subset of SPIN that is easily associated with prior experience, and on the strength of that, folks like me get by.

    As for PASM, it may turn out to be as easy and useful as SX assembly. What's needed is a massive project that forces me to get busy using it.
Sign In or Register to comment.