asm syntax for V4 suppl code

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times

asm syntax for V4 suppl code

Post 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

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times

Re: asm syntax for V4 suppl code

Post 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

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: asm syntax for V4 suppl code

Post 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"?

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times

Re: asm syntax for V4 suppl code

Post 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

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times

Re: asm syntax for V4 suppl code

Post 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

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: asm syntax for V4 suppl code

Post by Steve »

Hi Jan,

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

Post Reply