Reply by sergio masci March 19, 20042004-03-19

----- Original Message -----
From: <>
To: <>
Sent: Friday, March 19, 2004 3:51 AM
Subject: [piclist] Re:MPLAB 6.40 vs MPLAB 5.6x assembler error > The problem is solved!
>
> I used the MPLAB v6.40 "converter" utility to convert an existing project
from
> the old '.pjt' format to the new '.mcp' format and there was some
corruption
> in
> the new project file every time. I used the project wizard to create a
new
> project
> and all is well.
>
> Somehow the converted project was forcing MPLAB to assemble in relocatable
> mode. It now assembles in absolute mode and all is well.
>
> Jim
>

So my guess that your problem was to do with relocatable mode was correct
them.

Regards
Sergio Masci

http://www.xcprod.com/titan/XCSB - optimising structured PIC BASIC compiler



Reply by March 18, 20042004-03-18
The problem is solved!  
 
I used the MPLAB v6.40 "converter" utility to convert an existing project from
 the old '.pjt' format to the new '.mcp' format and there was some corruption in
the new project file every time.  I used the project wizard to create a new project
and all is well.
 
Somehow the converted project was forcing MPLAB to assemble in relocatable
mode.  It now assembles in absolute mode and all is well.
 
Jim  


Reply by Phil March 17, 20042004-03-17
--- In , "sergio masci" <smypl@x> wrote:
>
...
> > should be commended for picking C as their model.
>
> Sorry I can't agree. The assembler feels like it's been hacked from
a C
> pre-processor and the C syntax is inhereted more by luck than
design.

whether by intent or not, it beats the more common gawd-awfoool-mess
that most assemblers use.


Reply by sergio masci March 17, 20042004-03-17

----- Original Message -----
From: <>
To: <>
Sent: Wednesday, March 17, 2004 5:42 PM
Subject: [piclist] RE: MPLAB 6.40 vs MPLAB 5.6x assembler error > >Phil writes:
> >Try this, it also assembles ok (in 6.30):
> >if (($+4) & 0xFF00) != (($+8) & 0xFF00)
>
> No luck, same error. It seems that the "if" directive is unable to
evaluate
> the
> program counter in v6.40. Even "if $" or "if SOME_LABEL" gives the 151
> error.
>
> I cannot make the "if" directive work if the evaluation contains a program
> location (either $ or a label). It seems to work fine with complex
> expressions
> that contain variables, defines, or literal values
>
> >"Wilson writes:
> > I though that conditional "!=" was a C conditional only.
>
> It's a valid conditional. It's listed in the v6.40 MPASM help file
> as "=" but the usage example correctly shows it as "!="
>
> the following also gets the 151 error
> if !(high ($+4) == high ($+8))
>
> but the following assembles properly
> if (high (0xff55+4) != high (0xff55+8))
>
> Jim
>

I don't have a deep knowledge of MPASM but could the problem be to do with
the mode of the generated object file? Are you generating a relocatable
object file instead of an absolute object file?

Maybe at the point at which you are using this condition you have not yet
defined the origin of the code segment?

I can see how the assembler might get upset if you tried to do something
with a 'non-fixed' label.

Regards
Sergio Masci

http://www.xcprod.com/titan/XCSB - optimising structured PIC BASIC compiler


Reply by sergio masci March 17, 20042004-03-17

----- Original Message -----
From: Phil <>
To: <>
Sent: Wednesday, March 17, 2004 5:01 PM
Subject: [piclist] Re: MPLAB 6.40 vs MPLAB 5.6x assembler error > look at the expression definitions for mplab assembler. they clearly
> used C syntax as the starting point. makes sense to me...
>
> most assemblers I've ever used (somewhere around 10...) have some
> sort of high level directive syntax. I think the microchip designers
> should be commended for picking C as their model.

Sorry I can't agree. The assembler feels like it's been hacked from a C
pre-processor and the C syntax is inhereted more by luck than design.

> Though I have to
> say they muffed the constants - I still look at movlw a'a' and think
> its gibberish for a second.

If they had used an 'immediate' prefix operator instead of special
instructions to distinguish between addressing mode you would be able to
write MUCH more useful macros.

e.g.
mov w,#123
mov w,fred
mov jack,w

instead of
movlw 123
movf fred,w
movwf jack

you could use macros like

ld macro arg1,arg2
mov w,arg2
mov arg1,w
endm

ld jack,fred
ld jack,#123

you could easily have an assembler function to determin the type of a macro
argument used and do things like

ld16 macro arg1,arg2
if immediate(arg2)
mov w, arg2 & 0xff
mov arg1,w
mov w, (arg2 >> 8) & 0xff
mov arg1+1,w
else
mov w, arg2
mov arg1,w
mov w, arg2 +1
mov arg1+1,w
endif
endm

Regards
Sergio Masci

http://www.xcprod.com/titan/XCASM - ass kicking meta assembler



Reply by Phil March 17, 20042004-03-17
this sound like such a blatant error that I wonder if there is
something earlier in your program that was ok in 5 but not in 6.

have you tried a standalone snippet? also, have your tried:
foo = $
if HIGH(foo+4) ...

Have you reported this to Microchip? Guess I'm not upgrading to 6.4
anytime soon.

Phil

--- In , jscorse@a... wrote:
> >Phil writes:
> >Try this, it also assembles ok (in 6.30):
> >if (($+4) & 0xFF00) != (($+8) & 0xFF00)
>
> No luck, same error. It seems that the "if" directive is unable to
evaluate
> the
> program counter in v6.40. Even "if $" or "if SOME_LABEL" gives
the 151
> error.
>
> I cannot make the "if" directive work if the evaluation contains a
program
> location (either $ or a label). It seems to work fine with complex
> expressions
> that contain variables, defines, or literal values
>
> >"Wilson writes:
> > I though that conditional "!=" was a C conditional only.
>
> It's a valid conditional. It's listed in the v6.40 MPASM help file
> as "=" but the usage example correctly shows it as "!="
>
> the following also gets the 151 error
> if !(high ($+4) == high ($+8))
>
> but the following assembles properly
> if (high (0xff55+4) != high (0xff55+8))
>
> Jim




Reply by Wilson - Engenharia Contemp March 17, 20042004-03-17
Thanks Jim. Thats a new issue for me!!! Wilson Antonieti Engenharia de Desenvolvimento Tel.: (11) 4223-5117 Fax.:
(11) 4223-5103 Visite nosso site:
www.contemp.com.br PRECIS AO SEU ALCANCE!!!
----- Original Message -----
From: "Phil" <>
To: <>
Sent: Wednesday, March 17, 2004 2:01 PM
Subject: [piclist] Re: MPLAB 6.40 vs MPLAB 5.6x assembler error look at the expression definitions for mplab assembler. they clearly
used C syntax as the starting point. makes sense to me...

most assemblers I've ever used (somewhere around 10...) have some
sort of high level directive syntax. I think the microchip designers
should be commended for picking C as their model. Though I have to
say they muffed the constants - I still look at movlw a'a' and think
its gibberish for a second.

--- In , "Wilson - Engenharia Contemp"
<engenharia3@c...> wrote:
> Hi Jim,
>
> Well... Let me see...
> First, its my own question: i did not know that the statement:
>
> if HIGH($+4) != HIGH($+8)
>
> was compiled in asm mode at Mplab. I though that conditional "!="
was a C conditional only.
>
> Why dont you visit Microchips Web Site? There is a Reference
Guide explaining how do this.
>
> Check-out:
>
> http://www.microchip.com/1010/suppdoc/appnote/codxamp/index.htm
>
> or:
>
> http://www.microchip.com/1010/suppdoc/appnote/all/an556/
> Wilson Antonieti
> Engenharia de Desenvolvimento
> Tel.: (11) 4223-5117
> Fax.: (11) 4223-5103
> engenharia3@c...
> Visite nosso site:
> www.contemp.com.br
>
> PRECIS AO SEU ALCANCE!!!
> ----- Original Message -----
> From: jscorse@a...
> To:
> Sent: Tuesday, March 16, 2004 12:57 AM
> Subject: [piclist] MPLAB 6.40 vs MPLAB 5.6x assembler error > This has been bothering me since changing over to MPLAB 6.4x. > The following code snippet works fine on MPLAB 5.6x but will not
> assemble on MPLAB 6.40. The code checks to see if a jump table
> will cross a 256 byte program page boundary on a 14 bit core PIC
> and emits an error message if a page boundary is crossed. > The assembler has a problem with the line:
> if HIGH($+4) != HIGH($+8)
> but not with:
> movlw HIGH($+4) > <Full error message>
> Error[151] C:\SOURCE\XYZZY.ASM 115 : Operand contains
unresolvable labels or is too complex.
>
> <Full code snippet (the first line of code gets the above error)
>
> if HIGH($+4) != HIGH($+8)
> error "PAGING ERROR in jump table"
> endif
> movlw HIGH($+4)
> movwf PCLATH
> movf JUMP_VALUE,W
> andlw 0x03
> addwf PCL,1
> goto DO_SOMETHING_1
> goto DO_SOMETHING_2
> goto DO_SOMETHING_3
> goto DO_SOMETHING_4
>
> Does anyone know how to do a similar range check with the newer
(MPLAB v6.40) assembler?
>
> Jim > to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
>
>
> --------------------------------
----------
> Yahoo! Groups Links
>
> a.. To
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
Yahoo! Groups Links


Reply by March 17, 20042004-03-17
>Phil writes:
>Try this, it also assembles ok (in 6.30):
>if (($+4) & 0xFF00) != (($+8) & 0xFF00)

No luck, same error. It seems that the "if" directive is unable to evaluate the
program counter in v6.40.   Even "if $" or "if SOME_LABEL" gives the 151 error.

I cannot make the "if" directive work if the evaluation contains a program
location (either $ or a label).  It seems to work fine with complex expressions
that contain variables, defines, or literal values

>"Wilson writes:
> I though that conditional "!=" was a C conditional only.

It's a valid conditional.  It's listed in the v6.40 MPASM help file
as "=" but the usage example correctly shows it as "!="

the following also gets the 151 error
if !(high ($+4) == high ($+8))

but the following assembles properly
if (high (0xff55+4) != high (0xff55+8))

Jim



Reply by Phil March 17, 20042004-03-17
look at the expression definitions for mplab assembler. they clearly
used C syntax as the starting point. makes sense to me...

most assemblers I've ever used (somewhere around 10...) have some
sort of high level directive syntax. I think the microchip designers
should be commended for picking C as their model. Though I have to
say they muffed the constants - I still look at movlw a'a' and think
its gibberish for a second.

--- In , "Wilson - Engenharia Contemp"
<engenharia3@c...> wrote:
> Hi Jim,
>
> Well... Let me see...
> First, its my own question: i did not know that the statement:
>
> if HIGH($+4) != HIGH($+8)
>
> was compiled in asm mode at Mplab. I though that conditional "!="
was a C conditional only.
>
> Why dont you visit Microchips Web Site? There is a Reference
Guide explaining how do this.
>
> Check-out:
>
> http://www.microchip.com/1010/suppdoc/appnote/codxamp/index.htm
>
> or:
>
> http://www.microchip.com/1010/suppdoc/appnote/all/an556/
> Wilson Antonieti
> Engenharia de Desenvolvimento
> Tel.: (11) 4223-5117
> Fax.: (11) 4223-5103
> engenharia3@c...
> Visite nosso site:
> www.contemp.com.br
>
> PRECIS AO SEU ALCANCE!!!
> ----- Original Message -----
> From: jscorse@a...
> To:
> Sent: Tuesday, March 16, 2004 12:57 AM
> Subject: [piclist] MPLAB 6.40 vs MPLAB 5.6x assembler error > This has been bothering me since changing over to MPLAB 6.4x. > The following code snippet works fine on MPLAB 5.6x but will not
> assemble on MPLAB 6.40. The code checks to see if a jump table
> will cross a 256 byte program page boundary on a 14 bit core PIC
> and emits an error message if a page boundary is crossed. > The assembler has a problem with the line:
> if HIGH($+4) != HIGH($+8)
> but not with:
> movlw HIGH($+4) > <Full error message>
> Error[151] C:\SOURCE\XYZZY.ASM 115 : Operand contains
unresolvable labels or is too complex.
>
> <Full code snippet (the first line of code gets the above error)
>
> if HIGH($+4) != HIGH($+8)
> error "PAGING ERROR in jump table"
> endif
> movlw HIGH($+4)
> movwf PCLATH
> movf JUMP_VALUE,W
> andlw 0x03
> addwf PCL,1
> goto DO_SOMETHING_1
> goto DO_SOMETHING_2
> goto DO_SOMETHING_3
> goto DO_SOMETHING_4
>
> Does anyone know how to do a similar range check with the newer
(MPLAB v6.40) assembler?
>
> Jim > to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
>
>
> --------------------------------
----------
> Yahoo! Groups Links
>
> a.. To




Reply by Wilson - Engenharia Contemp March 17, 20042004-03-17
Hi Jim,
 
Well... Let me see...
First, its my own question: i did not know that the statement:
 
if HIGH($+4) != HIGH($+8)
 
was compiled in asm mode at Mplab. I though that conditional "!=" was a C conditional only.
 
Why dont you visit Microchips Web Site? There is a Reference Guide explaining how do this.
 
Check-out:
 
http://www.microchip.com/1010/suppdoc/appnote/codxamp/index.htm
 
or:
 
http://www.microchip.com/1010/suppdoc/appnote/all/an556/ 

Engenharia de Desenvolvimento
Tel.: (11) 4223-5117
Fax.: (11) 4223-5103
e...@contemp.com.br
Visite nosso site:
www.contemp.com.br


----- Original Message -----
From: j...@aol.com
To: p...@yahoogroups.com
Sent: Tuesday, March 16, 2004 12:57 AM
Subject: [piclist] MPLAB 6.40 vs MPLAB 5.6x assembler error

This has been bothering me since changing over to MPLAB 6.4x.
 
 
The following code snippet works fine on MPLAB 5.6x but will not
assemble on MPLAB 6.40.  The code checks to see if a jump table
will cross a 256 byte program page boundary on a 14 bit core PIC
and emits an error message if a page boundary is crossed.
 
 
The assembler has a problem with the line:
        if HIGH($+4) != HIGH($+8)
but not with:
       movlw HIGH($+4)
 
 
<Full error message>
Error[151]   C:\SOURCE\XYZZY.ASM 115 : Operand contains unresolvable labels or is too complex.
 
<Full code snippet   (the first line of code gets the above error)>
            if HIGH($+4) != HIGH($+8)
               error "PAGING ERROR in jump table"
            endif 
               movlw    HIGH($+4)
               movwf    PCLATH
               movf     JUMP_VALUE,W
               andlw    0x03
               addwf    PCL,1
               goto     DO_SOMETHING_1
               goto     DO_SOMETHING_2              
               goto     DO_SOMETHING_3
               goto     DO_SOMETHING_4
 
Does anyone know how to do a similar range check with the newer (MPLAB v6.40) assembler?
 
Jim


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions