Shop OBEX P1 Docs P2 Docs Learn Events
Learning PASM — Parallax Forums

Learning PASM

SciNemoSciNemo Posts: 91
edited 2009-05-14 23:03 in Propeller 1
I have been learning to program computers for something like 9 years now, but I've only really worked with high level languages. I've always shied away from assembly because its been described to me as very difficult to learn. Recently I found a book in my school library (a 30 year old book blush.gif ) that teaches you assembly (specifically for a really old Motorola microcomputer). I've been reading it, and it's been amazing. So many gaps in my knowledge of the inner workings of computers have been filled in. Still, I can't really use the assembly stuff I'm learning because the micro in the book is very old and outdated.

I was wondering where someone would start learning PASM, what kind of projects to start with, and whether it is possible that I might destroy my beloved demo board by messing around with this. Please keep in mind that I am 15 years old and have no direct experience with the early days of computers that everyone here seems to be very close to (and still trying to get back to smile.gif ).

Any helpful thoughts are welcome.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Not the fish.
sites.google.com/site/bitwinproject/

Comments

  • PhilldapillPhilldapill Posts: 1,283
    edited 2009-05-12 20:04
    Look up Desilva's PASM guide. Really good, and full of German humor...... You can decide if that's good or bad. [noparse]:)[/noparse]
  • KyeKye Posts: 2,200
    edited 2009-05-12 20:23
    I would reconmend just trying to understand how some of the drivers already posted work.

    Just go through the obex and look how something is done in a driver. Once you understand how the driver works, write your own version of it from scratch.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2009-05-12 20:44
    Assembly Language Primer for the Absolute Beginner
    http://forums.parallax.com/attachment.php?attachmentid=58857

    Assembly Code Examples for the Beginner
    http://forums.parallax.com/showthread.php?p=601870

    Quick Reference Guide for Propeller Assembly
    http://forums.parallax.com/attachment.php?attachmentid=44331

    Programming the Parallax Propeller using Machine Language
    An intermediate level tutorial by deSilva © 2007
    Version 1.21 2007-08-21
    http://forums.parallax.com/attachment.php?attachmentid=48819

    Wikispaces /Assembly+Programming
    propeller.wikispaces.com/Assembly+Programming

    Assembler for the Parallax Propeller
    www.cliff.biffle.org/software/propeller/propasm/

    Propeller Assembler Source-code Debugger
    propeller.wikispaces.com/PASD

    How is RES different from LONG?
    propeller.wikispaces.com/LONG+vs+RES

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Aka: CosmicBob
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-05-12 20:48
    I would suggest to read the following first:
    http://iiusaedu.com/~murdocca/POCA/slides/

    Just found it this day and copied all the PDFs even if I deal with Microprocessors and Assembler since more than 20 years. It's a good start to learn about the internals of a processor before starting with a special assembler dialect.
  • RiJoRiRiJoRi Posts: 157
    edited 2009-05-12 21:46
    "Still, I can't really use the assembly stuff I'm learning because the micro in the book is very old and outdated."

    May I ask which micro?

    The micro may be outdated -- one of my first micros was the 6809 -- but things I learned with it and the Z-80 came in handy for the 6502, 8085, COP-8, 8051, etc., etc., etc. all the way up to the PIC, the AVR, and the Propeller. For instance, the index registers in the 6809 made the concept of C's pointers click into place when I realized "Pointers are just like the Index Registers!"

    Good Luck,
    --Rich
  • SciNemoSciNemo Posts: 91
    edited 2009-05-12 22:50
    The micro is the Motorola MC6800 (just found out it was the first micro motorola made). The book is "An Assembly Language Course" by Mark E. Fohl.

    I get what you mean about the ideas carrying over (and that flow of ideas makes me feel warm and fuzzy inside smile.gif ), but what I mean are that the specific opcodes that I've memorized are completely different (with some added, some changed, and some absent) from the ones that the PASM assembler uses.

    Thank you so much for all the info, I have a feeling it is going to take longer than the time it takes to read the book to digest all this info.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Not the fish.
    sites.google.com/site/bitwinproject/
  • SRLMSRLM Posts: 5,045
    edited 2009-05-12 22:51
    I'm taking a uni course right now that is "Machine Organization", and the programming component is all assembly (not Propeller, unfortunately...). It has really made it click, and just last weekend I took a look at Potatohead's tutorial and found: I know all this! So, taking a course would probably be the best way to learn. Otherwise, reading is a good start. The book "Introduction to Computing Systems" by Patt and Patel is a good start to learn how a computer is organized (and, hence how assembly works).
  • James LongJames Long Posts: 1,181
    edited 2009-05-13 01:51
    Kye said...
    I would reconmend just trying to understand how some of the drivers already posted work.

    Just go through the obex and look how something is done in a driver. Once you understand how the driver works, write your own version of it from scratch.

    Kye,

    I have to admit, most people may find going through other peoples code helpful, but I found parts of it confusing. This does depend on what code chosen to be the tutor.

    I was looking at Mike Green's I2C driver and it was just baffling me. I had to actually have another member (you know who you are) step me through the parts which were giving me trouble. The commands themselves made a lot of sense, it was passing of variables which was a major problem for me. But I have played with the propeller for a long time, which probably helped.

    As a side note, why do certain people always jump into a project which is beyond complicated. I have a tendency to do this myself, but do not understand why. I figure it is due to what I'm trying to accomplish, and it is never simple. Oh well, I learn a lot during the process, even though sometimes I feel like destroying every computer I see, from frustration.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer

    Lil Brother SMT Assembly Services
  • SRLMSRLM Posts: 5,045
    edited 2009-05-13 02:51
    James Long said...
    As a side note, why do certain people always jump into a project which is beyond complicated.

    "Jumping" into projects that aren't complicated is boring, since you already know how to do all of it. That's what work is...
  • James LongJames Long Posts: 1,181
    edited 2009-05-13 06:16
    SRLM said...
    James Long said...
    As a side note, why do certain people always jump into a project which is beyond complicated.

    "Jumping" into projects that aren't complicated is boring, since you already know how to do all of it. That's what work is...

    I just wish I would jump into a project that didn't take me months or years to complete. It really gets to be old after a while. I do have some neat projects. Just wish I could get one or some of them finished.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer

    Lil Brother SMT Assembly Services
  • SciNemoSciNemo Posts: 91
    edited 2009-05-14 23:03
    Ok, so now I've finished that book and digested a small portion of the resources that were posted here and I'm moving onto trying some simple PASM programs.

    Here is what I'm trying as a first project:

    Modify the code for the microphone to vga program that was made a while ago so that a screen of cyan (or white if I want) alternates with a screen of black. I've sort of dissected the original code, and took out what I thought I didn't need, which resulted in this skeleton code (only asm, rest is not included):

    DAT
    
                  org
    
    asm_entry     mov       xpos,#0
                  
                  mov       asm_cnt,cnt                     'prepare for WAITCNT loop
                  add       asm_cnt,asm_cycles
    
                  
    :loop         waitcnt   asm_cnt,asm_cycles              'wait for next CNT value (timing is determinant after WAITCNT)
    
    ' Plot
    plot          mov       asm_mask,#1                     'compute pixel mask
                  shl       asm_mask,x
                  shl       y,#6                            'compute pixel address
                  add       y,asm_pixels
                  shr       x,#5
                  shl       x,#2
                  add       y,x
                  rdlong    asm_data,y                      'xor pixel
                  xor       asm_data,asm_mask
                  wrlong    asm_data,y
    
    plot_ret      ret                            
    '
    '
    ' Data
    '
    asm_dira      long      $00000200                       'output mask
    asm_pixels    long      0                               'pixel base (set at runtime)
    mode          long      0
    asm_cycles    long      |< bits - 1
    
    asm_data      res       1
    asm_mask      res       1
    asm_cnt       res       1        
    xpos          res       1
    x             res       1
    y             res       1
    



    Now what I think I want to do is alternately fill the screen buffer (located at the asm_pixels pointer) with 1s and 0s. I'm at a loss of where to start. I think the first order of business is making some code that shifts through every x and y address, with calls to the plot sub routine inside the loop. That way the code can just be pasted twice (one for filling with 1s, and the other for the 0s) to get what I want.

    Are all my assumptions right, and is this a good place to start PASM?

    Btw, I know it would cause some serious seizures because of the speed of execution, but I am guessing that modifying the value in asm_cycles will remedy that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Not the fish.
    sites.google.com/site/bitwinproject/
Sign In or Register to comment.