Jim giordano - 2013-05-28

This is a redo/update of my previous thread with more specific information.

I spent some time doing more tests on this array problem.  It turns out that arrays are not functioning for any chip belonging to family 15  (Family=15 in the chipdata file).

The problem is when trying to set several elements of an array with a single line of code, as show in the GCBasic help file, the correct asm code is not generated.

To verify this, I took the 12f1822 chipdata file, and changed the family to 14 and later to 16 just for a test, and  code to actually set the values was generated in both cases, so it's something in GCBasic itself that isn't being done correctly for arrays for family 15.

This is the complete code of the test program I used-

#chip 16f1822, 4
Dim TestVar(5)
TestVar = 1, 2, 3, 4
tst2 = TestVar(2)

As stated previously, this results in an asm file containing

;Start of the main program
;Dim TestVar(5)
;TestVar = 1, 2, 3, 4
    movlw   low TESTVAR
    movwf   FSR0L
    movlw   high TESTVAR
    movwf   FSR0H
;tst2 = TestVar(2)
    movlw   low(TESTVAR+2)
    movwf   AFSR0
    movlw   high(TESTVAR+2)
    movwf   AFSR0_H
    movf    INDF0,W
    movwf   TST2

the code to actually set the values is missing.  It should look something similar to this from a Family=14 chip

;TestVar = 1, 2, 3, 4
    movlw   low TESTVAR
    movwf   FSR
    movlw   4
    movwf   INDF
    incf    FSR,F
    movlw   1
    movwf   INDF
    incf    FSR,F
    movlw   2
    movwf   INDF
    incf    FSR,F
    movlw   3
    movwf   INDF
    incf    FSR,F
    movlw   4
    movwf   INDF
;tst2 = TestVar(2)
    movlw   low(TESTVAR+2)
    movwf   FSR
    movf    INDF,W
    movwf   TST2

Looking at the latest source code in update.zip, I suspect it is the code around line 11578, but there are many place that have tests for families 12,14,and 16 but the code for 15 is missing.  I just don't know enough about the program to tell what's going on.