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
asm syntax for V4 suppl code
-
- 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
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
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
- 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
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"?
Have you tried "_wpub" or "wpub"?
-
- 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
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
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
-
- 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
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
'iorwf _option_reg' causes an error, 'iorwf _option_reg, F' (or W) assembles OK.
jan didden
- 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
Hi Jan,
Thanks for the info. Your best source of information like this is probably the BoostC forum:
http://forum.sourceboost.com/
Thanks for the info. Your best source of information like this is probably the BoostC forum:
http://forum.sourceboost.com/