Page 1 of 1

asm syntax for V4 suppl code

Posted: Thu Jan 07, 2010 11:46 am
by jadiflow
Hi,

I'm trying some supplemental asm code in V4 for PIC but can't get it to compile without errors.
Example:

asm
{
movlw 0xff,0
movwf WPUB,0
}

I have verified that WPUB is recognized (if I use _WPUB I get 'unrecognised blabla'), so I guess I'm making a syntax error.
Can anybody point me in the right direction?

tia,

jan didden

Re: asm syntax for V4 suppl code

Posted: Thu Jan 07, 2010 12:23 pm
by jadiflow
Strangely enogh, while:
asm
{
movlw 0xff
movwf WPUB
}

gives an error,

asm
{
movlw 0xff
movlw WPUB
}

doesn't.
Seems movwf causes the error, no idea why....

jan didden

Re: asm syntax for V4 suppl code

Posted: Thu Jan 07, 2010 1:15 pm
by Steve
WPUB could simply be a definition of the register location, in which case it will simply be a number (which is why movlw works ok).

Have you tried "_wpub" or "wpub"?

Re: asm syntax for V4 suppl code

Posted: Thu Jan 07, 2010 2:46 pm
by jadiflow
Yes, 'movwf _wpub' works. In fact, when I did 'movwf wpub' I got the error message: 'did you forget the _ before wpub?'. Neat (but rare....).

But now I have somehow to find out that it interprets _wpub correctly as the reg location (which it is). Wish I could find the include file where this stuff is defined.

Edit: found the .h header with the reg definitions.

Also, when I tried 'iorwf option_reg' it also gives an unspecified error. And no, _option_reg doesn't clear it.
I checked the .fcd and 'option_reg' is used there, so it is known by the assembler I guess.

This trial and error isn't really a lot of fun; isn't there really any help file that addresses the syntax for asm and/or C supplementary code?

jan didden

Re: asm syntax for V4 suppl code

Posted: Thu Jan 07, 2010 2:59 pm
by jadiflow
Another step: the assembler doesn't use a default destination for an operation (which is what the microchip assmbler MPASM does), so you need to always specify it explicitly:

'iorwf _option_reg' causes an error, 'iorwf _option_reg, F' (or W) assembles OK.

jan didden

Re: asm syntax for V4 suppl code

Posted: Thu Jan 07, 2010 3:59 pm
by Steve
Hi Jan,

Thanks for the info. Your best source of information like this is probably the BoostC forum:
http://forum.sourceboost.com/