PDA

View Full Version : Compilation error Block overflow for ENDASM



sougata
- 22nd March 2006, 07:36
Hi,

I wrote a lengthy asm ISR in my prog and stumbled at this error Block overflow for ENDASM. Is it a PBP limitation, crossing boundary or else. Please help.

BigWumpus
- 22nd March 2006, 07:46
OK,
it's a PBP limitation. Just insert an endasm and asm in the middle of the block and it works...

sougata
- 22nd March 2006, 07:53
Hi,

Thank you for the prompt reply. I will try it now keeping my fingers crossed as it is my ISR. Just a thought. While inside the ISR we are using asm. What if I start the ISR in asm. Put an endasm before a retfie.Put some PBP code and then start an asm and fire the retfie from there after restoring context. Any thoughts or insite.

Darrel Taylor
- 22nd March 2006, 08:56
sougata,

The compiler will allow you to do that. And in some cases, you can get away with it, as in the Elapsed Timer Demo that uses several PBP statements in an ASM interrupt.

The problem arises when you run a PBP statement that uses any of PBP's system variables such as R0-R8, RM1 RM2, etc.   Anytime you overwrite any of those variables in an interrupt routine, the code that got interrupted will get completely lost because the variables aren't what they are supposed to be anymore.

In general, any non-arrayed variable assignments are safe.

Abit = Bbit
Abyte = Bbyte
Aword = Bword

and "Simple" IF structures. "Simple" means no AND's, no OR's, and no formula's in the expression.

IF Abyte = Bbyte THEN
   Aword = Bword
ENDIF

Anything like that will be OK. But a PAUSE or a SEROUT or 90% of everthing else will not work.
<br>

sougata
- 22nd March 2006, 11:49
Hi,

Thanks Darrel. I understand that. I need to study how PBP works internally. (Don't know when I will get time to do that.) My need for the ISR was the speed so I will not anyway like to use PBP inside the ISR. However while developing and testing program flow it comes handy to do a little "IF-THENs" then port them to asm. BTW I could not find out if PBP uses the additional instructions that PIC18 supports. Like the compare and multiply instructions. I am finding that most of times I have to use asm blocks to optimize speed.

BigWumpus
- 22nd March 2006, 20:44
Hi,

Inside an ISR I will only use assembler (each part in an own asm-endasm-block),
but outside ... PBP is tough enough to strike assembler, when you choose the right commands and optimize your code ! ;-)

sougata
- 23rd March 2006, 01:20
Hi,

Being a self-taught (as we are all!) coding in assembly is a great adventure(insane sometimes for me). But as Steve says "Learning Opportunities". I stumble into problems and asm is the only way to get through. Imagine life with only asm and no PBP!!! Thanks BigWumpus again I solved my problem with your suggestion.