Shop OBEX P1 Docs P2 Docs Learn Events
Explanation of Compiler Error Message? — Parallax Forums

Explanation of Compiler Error Message?

John CoutureJohn Couture Posts: 370
edited 2006-08-01 18:03 in General Discussion
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

Comments

  • BeanBean Posts: 8,129
    edited 2006-08-01 11:50
    John,
    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
  • John CoutureJohn Couture Posts: 370
    edited 2006-08-01 15:34
    Thanks Bean, (grin) I didn't want to "presume" it was a bug which is why I used that subject line.· In my classes, I'm always cautioning students about presuming the "the compiler has an error" vs. "it's your source code".·

    Thanks again.·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College
  • BeanBean Posts: 8,129
    edited 2006-08-01 18:03
    John,
    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
    ·
Sign In or Register to comment.