Shop OBEX P1 Docs P2 Docs Learn Events
Assembly Language for Non-Programmers — Parallax Forums

Assembly Language for Non-Programmers

«1

Comments

  • El PaisaEl Paisa Posts: 375
    edited 2007-04-03 16:59
    Hi, I started to read your book and first response is WOW!!!.
    Looks like something was missing in my dealings with propeller and this book found the answer for me.
    Looking forward to the next chapters.

    Thanks again.
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-03 17:17
    El

    I want this to be dyn-o-mite.

    and I love criticism.

    Rich
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-04-03 17:21
    That looks really nice!

    Two points:

    1) Spin is very good for putting a programs structure in place and dealing with the human interface. The closer you get to the human the slower the code can be so you may program an oscilloscope with the ADC is in assembly as well as the graphics engine but the menu system and overriding program is in Spin not least because it allows access to objects containing yet more fast assembly code along with a language closer to the human you are trying to interface with.

    2) There is no such thing as Spin assembly. There is SPIN and Assembly sometimes called PASM (propeller assembly).

    I'm actually doing more programming in assembly that in SPIN and I seem to know it better, once you really understand the representation of binary number and know what a carry bit is and understand 2's complement then the commands are very straight forward and honest, all the funny symbols in SPIN confuse me but that's because I have not learnt them or practised using them much.

    Graham
  • HarleyHarley Posts: 997
    edited 2007-04-03 17:43
    rjo_,

    Read your Assembly Language For Non-Programmers submission. Looking forward to the rest of the 'book'. Glad there are those who enjoy writing.

    Might there be a chapter outline available to 'drool' over?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
    h.a.s. designn
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2007-04-03 17:52
    {sound of a whip cracking} Keep Writing! Keep Writing!

    I'm looking forward to more of this..

    My favorite quote:
    "the Propeller is a gold mine, waiting for a few well placed charges."

    I too am starting to sound like I'm hyping the thing because of my feeling of discovered gold.

    Oldbitcollector
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-03 18:45
    Graham and Harely,

    Thanks.

    I actually don't have a chapter outline. But I AM trying to write a popular book...
    So, whatever anyone asks for... that will go somewhere after Chapter 3... I'll try to put things in the order of requests.

    What will hold the text together is a Rube Goldberg...type project. If you guys cooperate, it will be hysterical.



    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-03 19:46
    OldBitCollector

    Nice to hear from you.

    The book isn't even done... and already it is being quoted[noparse]:)[/noparse]

    I saw your request for an electronic version of the Hydra manual and you mentioned the fact that you were getting cataracts. If you say it, I'm sure you are right.
    I'm the same age... and I've noticed some little changes myself. You would think that for an eye doctor cataracts wouldn't be much of an issue. BUT in my case, the best cataract surgeon I know also happens to be my X (as in x-wife). I think we are getting along just fine... but I thought we were getting along just before everything blew up too!!!

    So, for you it is a matter of waiting... for me it is a little more complicated[noparse]:)[/noparse]

    One thing to remember... when we read, we don't blink... and (at our age) when we don't blink our eyes dry out... and the symptoms of a dry eye are exactly the same as cataracts.
    Ordinarily cataracts will change your glasses for a while... Usually (there are some exceptions... but not many) as long as you spend a fortune on your glasses, your reading vision stays pretty good... so if you are having problems at near, you might want to see your doc again.


    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-05 14:23
    Hi,

    Here is a stimple question:

    I've tried reordering the lines... I can't get any version of this to work.·
    I have tried putting both the "mov time,cnt"·· and the "add time,delay"·lines just before the loop.·
    This version lights the led.· If I do muxz outa,pinmask first and put muxnz outa,pinmask after the waitcnt then the led doesn't light... so the problem is in my waitcnt... but I've seen almost this exact code elsewhere.



    con
    · _clkmode = xtal1 + pll16x
    · _xinfreq = 5_000_000
    pub Toggle_Main
    · cognew(@toggle,0)
    dat
    ·········
    Toggle·· org·· 0
    ······· mov pin, #16
    ······· mov pinmask, #1
    ······· shl pinmask, pin
    ······· muxnz dira, pinmask
    :loop·· muxnz outa, pinmask
    ······· mov time,cnt
    ······· add time, delay
    ······· waitcnt time,delay
    ······· muxz outa, pinmask
    ······· jmp #:loop
    ·······
    pin res 1
    delay long 80_000_000
    time long 1
    pinmask res 1
    ············
  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-05 14:30
    Keep in mind that you rely on the fact that the zero flag gets cleared when the cog is started. The problem is that you need another "waitcnt time,delay" just before the JMP. You're leaving the LED at a logic high for a second, but it's at a logic low for maybe 100ns.
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-05 14:35
    Mike,

    In order to keep it in mind... I'd have to know it first[noparse]:)[/noparse]

    Thanks a lot...

    When I say, "Assembly For Non-Programmers"... I mean ..."me first."

    Thanks a lot... please keep an eye on me, I'm going to try to actually do this right.

    Rich
  • simonlsimonl Posts: 866
    edited 2007-04-05 15:15
    Rich,

    {Big round of aplause}

    I've been shying away from touching PASM -- wouldn't even know where to start, what with all those C & Z registers! But at last someone's writing the guide I've been longing for -- kudos to ya' mate, and I can't wait for more of it. Well done.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon

    BTW: I type as I'm thinking, so please don't take any offense at my writing style smile.gif

    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-05 15:36
    Simoni,

    Thanks for the encouragement. I am using myself as a guinea pig. I am studying... but only assembly.
    I am just about done with Chapter 1... which is both the easiest and the hardest. It is all about wz and the z flag... but then I got tired and left it out of my code segment.

    I am going to try to do as much as I can... all by myself.

    I took Mike's advice... my program works now... but in slow motion, and nothing that I do to delay seems to help.

    If I can't figure it out by tomorrow... then I hope Mike is around.

    Rich
  • potatoheadpotatohead Posts: 10,261
    edited 2007-04-05 15:45
    Excellent start!

    And BTW, I'm here for exactly the same reasons you are. The Prop is actually NEW and quite powerful. It's got that same spark that 8bit computing had for me in my teens. Back then I was connecting an Atari 400 to O-scopes, transmitters, motors, etc... Learned 6502 and 6809 assembly (friend had a CoCo) back then because at 1mhz, it's the only chance you have at actually having solid control of the machine and the ability to get cool things done.

    So far, it's been a very fun journey. Prop assembly is quite different from what I am used to, but it's also powerful and concise. I'm up for that!

    When you get your book done, consider a service like mylulu to publish hard copy and make yourself a few bucks! I suspect you will have an intertaining and informative read here. People will want hard copies and that's one risk free way to provide them.

    I like the why choose propeller section!

    I too am confused by "SPIN Assembly' Perhaps it is better to let people know how SPIN is closely modeled after the powerful assembly language? Now that I've read more, I think doing that, then using "Propeller Assembly Language" is probably a better choice.
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-05 16:42
    potatohead,

    I'm thinking that if the book is any good... it will be because of the guys here on the forum and the Parallax engineers. I know that it is worth the effort ... and once I commit to something ... I never de-commit. I've done things much harder than this, but this is an adventure!!!

    Once the book is done... and it is as good as I can make it, I'm planning to ask Parallax to have it published and offer the hard copy version for sale... with a reasonable percentage of the profits to go to either the Special Olympics or to a research oriented foundation...(not mine[noparse]:)[/noparse].

    I have an old friend that used to run the Bio-Electromagnetics lab for the EPA... so I know that the money can be targeted to great effect!!!!

    So any help I get... eventually will be translated into help for kids and adults that really need it.

    Quite a bargain, huh?


    Thanks

    Rich
  • potatoheadpotatohead Posts: 10,261
    edited 2007-04-05 17:54
    Totally agreed!


    Hope you have a lot of fun getting it all done.
  • Max WoodenMax Wooden Posts: 112
    edited 2007-04-05 19:01
    Wow, this is great, I can't wait for more!!
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-06 00:05
    Max...

    You are my kind of citizen[noparse]:)[/noparse]

    Please see attached.

    Rich
  • Max WoodenMax Wooden Posts: 112
    edited 2007-04-06 01:08
    Rich, I am loving this! I really enjoy the way incorporate the humor into it.
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-06 01:11
    Max...

    I love humor... I think it is a create way to supplement the content...but I never know when I am over the top and might offend people...
    If you see anything like that... please let me know ...offline?

    Thanks,


    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-06 18:57
    Hi,

    I was asked for a Chapter list.

    Everybody knows that I am going to need help. So, when you are doing whatever you do... and you come across something that might help... pieces of code, additional references for the readers, filling out the parts list... creating subsystems... this is where I'm headed at the moment:

    I call these Chapters... but they are probably going to end up as section headings. And by the time I get done... they might just be major topics...

    The first three Chapters are pretty well fixed... there are a lot of preliminaries to cover and it will take about 3 Chapters to nail them down.

    The best way to hold a reader's attention, while we are doing this, is to involve them in a project... whether they actually build it or not is less important... as long as the project is interesting and easily visualized.

    The first chapter includes a little project... that doesn't take much code. The general idea is to begin building a Propeller hat... so I thought I would start out with the projector system. That will include code object references, some of which will be explained later in the book. The projector systems is broken out in two parts... the world's tiniest POV system... which can then be converted to a in-hat projector by adding some inexpensive optics. This should be the easiest chapter to write from a content stand-point.

    The second chapter deals with inputs... the project for this chapter is the world's cheapest brain mapping system. I don't know if we will complete this project or leave it at the component level. We will continue our work on the Propeller hat by looking at the video system. I will need help with the electronics.

    The third chapter will include everything not in Chapters 1 and 2... which are required facts, understandings, etc.... Right now... this is looking like a pretty dry chapter.

    When I get that far, I am going to take a breath and ask everyone to go over it... and make sure that it has touched all the essentials. At that point the goal of the book is satisfied and the rest is gravey.

    The fourth chapter is about numerics... but not in just any old way. I'll be using Cabballa, to talk generally about numerics and I'm going to throw in a little about statistical mechanics. The virtual Project in this Chapter is to build an equidistant number analyzer ... adequate for Madonna's purposes.
    The numeric part is easy for me... there are some other parts that I will have to brush up on... if you don't see any Cabbala... I ran into a problem, which didn't interest me and I'll find another way to talk about the same kinds of things

    Chapter Four will extend the conversation in Chapter 3 and the project is to build a string based numerical compiler.

    Chapter 5 will be about control theory... this will probably be another virtual project in which we build a self-assembling prime number generator... sound's like a joke, but it isn't. The only part that worries me is the pick and place robot[noparse]:)[/noparse] This will use the compiler built in Chapter 4. This will also require a multiprocessor implementation... which will have to be discussed first... but I'm not sure where I'll introduce it. I don't think of mult-processing as an essential element, which belongs in the first three chapters(sections), but I think it is one of the most important aspects of the Propeller... so it has to be in the book somewhere.

    This chapter will also discuss the future of computing... and I will be using the logical core of the prime number generator to discuss how this kind of computation can be done with molecular computers.

    The other reason that I thought it might be a good idea to convey this information is because I intend to use Chapter Headings that might not make it clear what is actually in each chapters...
    The first time someone opens the Special Olympics Hard Copy version.... and they look at the Chapter headings I want them to wonder..."What does any of that have to do with assembly language programming?"

    Thanks for all the feedback.

    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-06 19:04
    OH... I forgot... the Appendix.

    I would very much like to have a section describing your project... so long as it is described in detail and includes at least a little assembly language.

    Rich
  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-04-06 20:21
    entertaining to say the least .... well done

    Quattro

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Necessity is the mother of invention'
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-06 21:42
    Quattro

    Modesty is not one of my virtues...

    as a matter of fact... where did I put those virtues?

    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-06 22:02
    Another Post?... don't I ever quit?

    No.

    I forgot to mention somthing, which will would only mildly interest a mathematician... The prime number generator, which will be a translation from a previous java incantation... with a robot attached... isn't based on the sieve of Erosthenes. It casts primes into a modular form and then uses indexing. There is a basic form available on the ImageJ web sit... Werner Bailey did the actual coding... I didn't know much java at the time ... so I ran a contest. Werner won the contest. I asked Werner to check around and see if the method had been reported before... and according to his profs... it hadn't.

    For the non-mathematicians and for the folks at Parallax... prime numbers are not really all that interesting. Every mathematician plays with them when they are growing up. I'm trying to interest the number theory guys in this achitecture... This will be so cute, they are bound to hear about it. And when they hear about it... it will bring up fond memories from their youth.

    Werner forwarded a question from his profs ... which at the time I couldn't answer... I knew the answer... I just didn't think it was a good idea to answer it. This implementation will allow them to answer the question for themselves.

    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-06 22:11
    This is also important to me... because I think it will allow me to test a general statement regarding partition theory... which pertains to computational efficiency and parallel processing.
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-08 17:38
    OK... back to Earth.

    I am still struggling with the code snippet posted above. My problem is not getting a pin to blink the way I want... AssemblyToggle.spin from either the Guts pdf or the manual does that just fine...

    I'm trying to figure out what I'm doing wrong with the mux instructions... I thought I understood exactly what muxz and muxnz are doing but when I thow them in rather than an XOR... the thing toggles... but at an incredibly slow rate...

    I've done my due diligence... went back to the right sections in the documents. Moved things around every which way I can think of ... changed the addressing. I did all of that after puting in Mike's suggestions... nothing.

    Could someone please post a toggle routine (assembly) using the muxz and muxnz.

    AND... can anyone tell me where to go to find out more about the specific LEDs in the demo board?

    Thanks,

    Rich
  • CJCJ Posts: 470
    edited 2007-04-08 18:28
              mov    dira, pinmask  
              mov    time, #0   wz
              mov    time, cnt
              add     time, delay
    loop    waitcnt time, delay
              muxz outa, pinmask
              waitcnt time, delay
              muxnz outa, pinmask
              jmp #loop
    delay  long 80_000_000
    pinmask long |< 16
    time     res 1
    
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax Forums - If you're ready to learn, we're ready to help.
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-08 19:12
    Thanks a bunch.

    It looks just like what I had... I trashed it of course!!!

    When I figure out what I was doing wrong... it will be worthy of reporting[noparse]:)[/noparse]

    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-08 19:14
    Cj...

    It will take me some time to break it again... but when I do, I'll get back to you with another question.

    Rich
  • CJCJ Posts: 470
    edited 2007-04-08 19:17
    the biggest thing about the propeller is that you have full control over the flags, when they are changed and when they are used, I noticed that the snippet you posted lacked the wz and had one of the muxes outside the loop, making it only affect once

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax Forums - If you're ready to learn, we're ready to help.
Sign In or Register to comment.