Shop OBEX P1 Docs P2 Docs Learn Events
PASM help needed — Parallax Forums

PASM help needed

PliersPliers Posts: 280
edited 2011-11-23 06:27 in Propeller 1
​​​​Why do I need a Dummy register or a NOP and the end?
Either works, but neither does not.
I’m just exploring and there is no rush on this.
It did take a while to stumble upon a working solution.
It is probably a poor programing practice issue :innocent:
CON
  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000
OBJ
  Num   :  "Numbers"
  TV    :  "TV_terminal"
PUB Main 
  Num.Init                        'Initiate numbers
  TV.Start(12)                    'Start TV Terminal                                                            
  TV.Str(string("TESTING") )       ' Display "TESTING"
  TV.Out(13)                       ' New line
cognew(@start,@data)
waitcnt (1500 + cnt)     ' Time delay for the PASM to run                                                                      
 TV.Out(13)
 TV.Str(Num.ToStr(data,Num#DDEC))       ' Display the data value     

DAT
            org       0 
start            
                 mov address,par               
                 mov data,datax                    
                wrlong data,address         
datax       long    999          
data        long    777
Address long    0
     nop                   ' I have to have this
    Dummy long 0      ' or this to make it work
fit 496             

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-11-23 06:02
    Once the wrlong is executed the cog continues to interpret data as instructions (unless told otherwise). cog memory is not necessarily cleared (whatever happens to be in hub memory after your DAT section is loaded into cog RAM). So I suggest you finalise your code with a waitpeq $, #0 or another form of controlled stop.
  • PliersPliers Posts: 280
    edited 2011-11-23 06:08
    Thanks for the quick answer Kuroneko.
  • PliersPliers Posts: 280
    edited 2011-11-23 06:20
    I can't find where I can change the subject header to show it has been "SOLVED".
  • kuronekokuroneko Posts: 3,623
    edited 2011-11-23 06:27
    Pliers wrote: »
    I can't find where I can change the subject header to show it has been "SOLVED".
    Edit top post in advanced mode. BTW, depending on what you do when with data you might want to increase your delay (after cognew) to 8K cycles (or more depending on overhead generating the data).
Sign In or Register to comment.