Shop OBEX P1 Docs P2 Docs Learn Events
PASM enhancement in Propeller Tool — Parallax Forums

PASM enhancement in Propeller Tool

mirrormirror Posts: 322
edited 2008-04-13 16:41 in Propeller 1
The Propeller encourages the writing of self-modifying code.
A nice shortcut would be if in assembly code I could write something like:

        movi :dest, #or
        nop
:dest   and  var1, var2      'The and in this line will be replaced with an or
 
-- instead of --
 
        movi :dest, #%011010001
        nop
:dest   and  var1, var2

 

Comments

  • AleAle Posts: 2,363
    edited 2008-04-01 05:25
    if you define a constant like k_or = %011010001, you could write almost that wink.gif
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-04-01 05:49
    I second the request but you have to remember that this will also include the wr, wc and wz flags which will make it a bit hard.
  • hippyhippy Posts: 1,981
    edited 2008-04-01 10:09
    movi [noparse]:D[/noparse]est,#k_OR | k_WC

    The problem comes with NR where to override a default WR it would have to be specified as "& ! k_NR"

    or specify more complex opcode constants ...

    k_OR
    k_OR_WC
    k_OR_NR

    etc
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-04-01 10:13
    Nice solution. You could always set the WR flag manually smile.gif

    So you would need to define all the instructions plus WR, WZ and WC. Too easy who will be the first to do it?
  • hippyhippy Posts: 1,981
    edited 2008-04-01 12:50
    If no one steps forward I'll create a file with all the possibly named constants in it. That won't be for a few hours though as I have other things to do.
  • hippyhippy Posts: 1,981
    edited 2008-04-02 21:51
    Not as easy as I thought it would be. PropTool 1.1 only seems to allow 457 CON definitions before it throws a tantrum, which discounts a complete list of constant opcodes with attributes as part of the named constants.
  • mirrormirror Posts: 322
    edited 2008-04-02 22:13
    In my case I needed 20 different instructions, but only two of them were used more than once, so I just hardcoded the numbers into my PASM source.

    The reason for my request was that this information is already available to the Propeller Tool - otherwise it wouldn't be able to compile the source!

    Thanks for the thoughts and efforts of those who replied - and not only to my post, I learn so much by reading through the other posts on this forum.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-04-02 22:20
    That's a weird number. Just make the condition codes seperate then. Does the same thing happen if you use more than one CON block?
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-04-13 10:03
    hippy, I'm just going through and looking for threads to put in the prop magazine and found this. Did you ever finish the file?
  • hippyhippy Posts: 1,981
    edited 2008-04-13 16:41
    I stopped at creating a list of named opcode value constants with the default WR/NR bit setting as it would be with neither specified, and bit masks for WC, WZ, WR and NR, so all these are compares...

    movi [noparse]:o[/noparse]pc , #k_CMP
    movi [noparse]:o[/noparse]pc , #k_CMP & k_NR
    movi [noparse]:o[/noparse]pc , #k_SUB & k_NR

    These are subtracts ...

    movi [noparse]:o[/noparse]pc , #k_SUB
    movi [noparse]:o[/noparse]pc , #k_SUB | k_WR
    movi [noparse]:o[/noparse]pc , #k_CMP | k_WR

    I haven't gone through the file a line at a time to check the bit values are right though !
Sign In or Register to comment.