Shop OBEX P1 Docs P2 Docs Learn Events
(Solved) Using MOVI for modifying instruction - potential trap — Parallax Forums

(Solved) Using MOVI for modifying instruction - potential trap

pemspems Posts: 70
edited 2008-10-05 23:56 in Propeller 1
EDIT: not a problem - read my post below. I didn't realize MOVI only modifies 9bits

Hi

Bringing to everyone attention something that has taken about 2hrs of my life which i won't get back

tried using MOVI like so

                movi store, store_instr
                movd store, <blah>
                movs store, <bleh>
...
...

store       wrlong, 0-0, 0-0  ' wrlong here doesn't really matter, can be anything really

...
...

store_instr    LONG   $20f   ' correct value for wrlong instruction with indirect source





and it doesn't work!!!
i did find what was wrong, and the following code does work as expected

                mov  temp, #store
                movi temp, store_instr
                movd store, <blah>
                movs store, <bleh>
...
...

store       wrlong, 0-0, 0-0

...
...

store_instr    LONG   $20f
temp             LONG    $0




seems like MOVI wants it's dest to be indirect, which is inconsistent with the way MOVS and MOVD work

trap?

Post Edited (pems) : 10/6/2008 1:10:06 AM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-05 23:46
    Not a trap. The destination field of MOVI works exactly the same as the destination field of any other instruction including MOVD and MOVS.
    The problem is that the instruction field (6 bits) plus the flags field (3 bits) does not include the indirect bit. It includes only the ZCR bits.
    The MOVI instruction deals only with the most significant 9 bits of the destination.
  • pemspems Posts: 70
    edited 2008-10-05 23:56
    Thanks for your lightning-fast reply Mike

    Indeed, as i've just discovered searching the forum, the MOVI only modifies most significant 9 bits, and not 14 as i have assumed

    oh and forget about the indirection working (as shown in my last post), it was simply modifying different location and not the 'store' itself, so the store was using the wrlong that was there to begin with, so everything still worked.
Sign In or Register to comment.