Explanation of Compiler Error Message?
Ref:· IDE 3.2, SASM DLL 1.51.07, SXB 1.51
In the attached program, LCDSize is a a member of an array that is supposed to be equal to 80 once the calculation is done.·
My intent was to initialize that variable in the LCDInit subroutine, however for some reason it doesn't get set???
The gist of it seems to be in this statement (see line 475)
LCDSize = LCDWidth * LCDLines
When the FIRST parameter is·a constant, LCDSize ends up being equal to zero???
' set in the constants section
·· LCDLines· con 4
·· LCDWidth con 20
·
' down in LCDInit subroutine
·· x1 = LCDWidth················· ' x1 is a VAR, LCDWidth is a constant
·· x2 = LCDLines················· ' x2 is a VAR, LCDLines is a constant·
·· LCDSize = LCDWidth * LCDLines· ' yields a Zero
·
'
' Test Results
'
This is the result of testing (without making any other changes in the program):
LCDSize = LCDWidth * LCDLines···· ' yields a Zero
LCDSize = LCDWidth * x2········· ·' yields a Zero
LCDSize = LCDLines ·* x1······· · ' yields a Zero
LCDSize = x1········ ·* LCDLines· ' Works, yields an 80
LCDSize = x2········· * LCDWidth· ' Works, yields an 80
LCDSize = x1 * x2·················' Works, yields an 80
·
A couple of times when I had two·similar statements close together,·I did get the following warnings:
- Warning·48 Pass 2, File register not in current bank
- Warning 37 Pass 2, Literal truncated to 8 bits
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
In the attached program, LCDSize is a a member of an array that is supposed to be equal to 80 once the calculation is done.·
My intent was to initialize that variable in the LCDInit subroutine, however for some reason it doesn't get set???
The gist of it seems to be in this statement (see line 475)
LCDSize = LCDWidth * LCDLines
When the FIRST parameter is·a constant, LCDSize ends up being equal to zero???
' set in the constants section
·· LCDLines· con 4
·· LCDWidth con 20
·
' down in LCDInit subroutine
·· x1 = LCDWidth················· ' x1 is a VAR, LCDWidth is a constant
·· x2 = LCDLines················· ' x2 is a VAR, LCDLines is a constant·
·· LCDSize = LCDWidth * LCDLines· ' yields a Zero
·
'
' Test Results
'
This is the result of testing (without making any other changes in the program):
LCDSize = LCDWidth * LCDLines···· ' yields a Zero
LCDSize = LCDWidth * x2········· ·' yields a Zero
LCDSize = LCDLines ·* x1······· · ' yields a Zero
LCDSize = x1········ ·* LCDLines· ' Works, yields an 80
LCDSize = x2········· * LCDWidth· ' Works, yields an 80
LCDSize = x1 * x2·················' Works, yields an 80
·
A couple of times when I had two·similar statements close together,·I did get the following warnings:
- Warning·48 Pass 2, File register not in current bank
- Warning 37 Pass 2, Literal truncated to 8 bits
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
SXB

22K
Comments
It looks like you have found a bug.
The compiler is generating: "MOV LCDSize,#(LCDWidth * LCDLines) " which would be fine if LCDSize was a non-array variable.
The compiler should generate:
· MOV FSR,#LCDSize
· MOV IND,#(LCDWidth * LCDLines)
I will fix this in the next release.
For your particular code your do this as a work-around:
· x1 = LCDWidth * LCDLines
· LCDSize = x1
· x1 = LCDWidth
· x2 = LCDLines
Thanks for posting it. That's how bugs get fixed.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
Post Edited (Bean (Hitt Consulting)) : 8/1/2006 11:56:33 AM GMT
Thanks again.·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
Usually that is good advise, but when something just isn't making sense please post it. I'd rather debunk 100 false "bugs" than have one go unfixed.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·