Asm Error PCL, TOSL, TOSH, or TOSU cannot be a destination of MOVFF or MOVSF

Started by kcsl, Feb 01, 2025, 07:50 PM

Previous topic - Next topic

kcsl

I'm getting the above assembler error at line 6216. The attached pictures shows the assembler in the affected area & the error

Near the top of the program I declare a variable which is used all over the place.
Dim gfDevId as byte


A long way down there is a procedure:

Proc GenCANId(pPri As Byte, pPGN As Dword), Dword
    Dim rTemp                  As Dword     
    Dim xxx                    As Byte

    rTemp.Byte0 = xxx        <<<<<<<<<<<<<<<< THIS COMPILES OK
    rTemp.Byte0 = gfDevId    <<<<<<<<<<<<<<<< THIS LINE GIVES THE ASSEMBLER ERROR 

EndProc

The only difference I can see is that gfDevId is declared outside the procedure near the top of the program, and xxx is declared within the procedure.

Just declared a byte within the procedure, copied gfDevId  into that and used this variable instead of gfDevId and it compiles fine.

I extracted just the code lines of interest, dropped them into a new program and it compiled OK, so looks like something in the main program is confusing things.

Running Version 4.0.4.7
 
Any suggestions ?

Regards,
Joe

There's no room for optimism in software or hardware engineering.

kcsl

OK, I've found the cause I think.
There was a
     Dim bytBuffer[2462] as byte
at the start of the program.
Changing this to [10] (just to test the theory) solved the issue.

So I scanned the manual for anything on arrays and found this:
        Declare Auto_Heap_Arrays = On
which seems to have done the trick... though I don't pretend to know why.

Regards,
Joe
There's no room for optimism in software or hardware engineering.

trastikata


kcsl

Quote from: trastikata on Feb 02, 2025, 10:29 AMHi kcsl, try declaring that array as heap.
Hi Trastikata,
Just tried your suggestion and that works.
Thanks for your response.

Regards,
Joe
There's no room for optimism in software or hardware engineering.