Menu

strange problem (GCBASIC v0.9.2.0)

2006-10-29
2013-05-30
  • Stefano Delfiore

    I have a strange problem with compliler, my code is:

    #chip 16F84A, 4
    #mem 68
    '
    ind=1
    main:
    ind=ind+1
    goto main

    when I compile the assebler I get this assembler (file COMPILED.ASM):

    ;Program compiled by GCBASIC, which is the best language for PICs, ever!
    ;Something not working? Email me at hconsidine@bigpond.com
    ;GCBASIC Version: 0.9 12/10/2006

    ;********************************************************************************

    ;Set up the assembler options (Chip type, clock source, other bits and pieces)
    LIST p=16F84A, r=DEC
    #include <P16F84A.inc>
    __CONFIG _HS_OSC & _WDT_OFF

    ;********************************************************************************

    ;Set aside memory locations for variables
    IND    equ    12

    ;********************************************************************************

    ;Jump to initialisation code when PIC is reset
        ORG    0
        call    INITSYS
        goto    SystemInitialise

    ;********************************************************************************

    ;Interrupt routine
        ORG    4
    INTERRUPT
    ;Interrupt code will be inserted here in a later version
        retfie   

    ;********************************************************************************

    ;Various initialisation routines, automatically called by GCBASIC
    SystemInitialise

    ;********************************************************************************

    ;Start of the main program
        movlw    1
        movwf    IND
    MAIN       
        incf    IND,F
        goto    MAIN
    BASPROGRAMEND       
        sleep   
        goto    $
           
    ;********************************************************************************
    ;Subroutines included in program
    ;********************************************************************************
           
    InitSys       
        return   
           
    ;********************************************************************************
           
    SysCompEqual       
        clrf    SYSCALCTEMPX
        movf    SYSCALCTEMPA, W
        subwf    SYSCALCTEMPB, W
        btfss    STATUS, Z
        return   
        movlw    255;STARTUP12
        movwf    SYSCALCTEMPX
        return   
           
    ;********************************************************************************

    END

    ----------------------

    The problem are the following last lines that gcbasic put at the end of the code

    SysCompEqual       
        clrf    SYSCALCTEMPX
        movf    SYSCALCTEMPA, W
        subwf    SYSCALCTEMPB, W
        btfss    STATUS, Z
        return   
        movlw    255;STARTUP12
        movwf    SYSCALCTEMPX
        return   

    -----------------------

    The message that I got at is:
    ---------- Capture Output ----------
    > "C:\Programmi\GCBASIC\compile.bat" C:\Programmi\GCBASIC\var01.txt
    Great Cow BASIC (0.9 12/10/2006)

    Compiling COMPILED.TXT ...

    Program compiled successfully!

    Assembling and downloading program ...
    compiled.asm:59:Error [113] Symbol not previously defined (SYSCALCTEMPX).
    compiled.asm:60:Error [113] Symbol not previously defined (SYSCALCTEMPA).
    compiled.asm:61:Error [113] Symbol not previously defined (SYSCALCTEMPB).
    compiled.asm:65:Error [113] Symbol not previously defined (SYSCALCTEMPX).

    > Terminated with exit code 0.

    Moreover if I compile the file COMPILED.ASM using Mplab I got an other error because in the code there is a call to INITSYS (all letter uppercase) but in the code the label is InitSys.

    I made some test, the line with problem is  " ind=ind+1 "
    so with:
    ind=ind+1
    ind= ind+1
    I got the error
    with:
    ind =ind+1
    ind = ind+1
    the code is ok.

    stefano

     
    • Hugh Considine

      Hugh Considine - 2006-10-29

      I've fixed the bug with SysCompEqual - please download the latest update of GCBASIC from http://gcbasic.sourceforge.net/newfiles/New_GCBASIC.zip

      Turning off case sensitivity in MPASM should solve the other bug for now - I'll look into it in a little more detail later on.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.