Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#128 movff PLUSW2,POSTDEC2 followed by pushl not working on "run"

closed-fixed
Robert Pearce
None
5
2012-01-05
2011-05-30
Anonymous
No

Hello,

BTW, the below code executes fine when I "step" through the code. The bug with the stack
pointer manipulation seems to crop only when I "run" through the code with a "break e endp".

With the below code, I expected the stack to be:

0x4ff = 0x06
0x4fe = 0x05
0x4fd = 0x04
0x4fc = 0x03
0x4fb = 0x02
0x4fa = 0x01
0x4f9 = 0x06
0x4f8 = 0x08
0x4f7 = 0x07

but, the actual stack is :

0x4ff = 0x06
0x4fe = 0x05
0x4fd = 0x04
0x4fc = 0x03
0x4fb = 0x02
0x4fa = 0x01
0x4f9 = 0x08 -- missing 0x6
0x4f8 = 0x07

If I have multiple "movff PLUSW2,POSTDEC2", only the last POSTDEC2
seems to get overridden by the following pushl.

;==== test.asm BEGIN

errorlevel 0
   list p=18f4455 ; set processor type
   list n=0 ; supress page breaks in list file
   include <p18f4455.inc>
   CONFIG XINST   = ON

RESET_VECTOR CODE 00000h ; Reset and Interrupt Vectors
   pagesel start
   goto start
MAIN CODE
   global start
start
   lfsr 2,0x4ff
   pushl 0x6
   pushl 0x5
   pushl 0x4
   pushl 0x3
   pushl 0x2
   pushl 0x1
   movlw 0x6 
   movff PLUSW2,POSTDEC2
   ;movff PLUSW2,POSTDEC2
   ;movff PLUSW2,POSTDEC2
   pushl 0x8
   pushl 0x7
   global endp
endp
   goto start
end

;==== test.asm END

Discussion

  • Robert Pearce
    Robert Pearce
    2011-06-01

    This looks like another case of too much cacheing - the indirect registers keep a local copy of their FSR but don't always maintain it in step.

     
  • Robert Pearce
    Robert Pearce
    2011-06-01

    My first attempt at a fix turned out to be wrong - it fixes the simple case but breaks (differently) when the other movff lines are uncommented.
    Similar problems exist when using movsf after a pushl, or indeed after use of postdec2. The whole 16bit indirect architecture is too convoluted for its own good.

     
  • Robert Pearce
    Robert Pearce
    2011-06-02

    Fix committed at SVN r2178, by moving all the indirection handling out of the 16bit-processor file into the indirection class that should know how to handle its own quirks.

     


Anonymous


Cancel   Add attachments