Menu

Another proposal from the "troublemaker"

2021-01-03
2021-01-08
1 2 > >> (Page 1 of 2)
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-03

    It would perhaps be fine in a future version to add the same feature which exists in Microsoft's VB(A), the possibility of splitting one "logical" line on several "physical" lines, using the underscore character ... Unfortunately I use some very long identifier names !

     
  • Anobium

    Anobium - 2021-01-03

    Dear Troublemaker,

    Should be doable. Like this?


    Line continuation

    A single _ (underscore) character at the end of a line of code tells the compiler that the line continues in the next line. This allows a single statement (line of code) to be spread across multiple lines in the input file, which can provide nice formatting.

    Be careful when adding the _ line continuation character right behind an identifier or keyword. It should be separated with at least one space character, otherwise it would be treated as part of the identifier or keyword.

    dir portc.0 _
    out
    

    And, remind me. What version of the compiler are you using? I WILL need you to test this if we do this.

     
  • Anobium

    Anobium - 2021-01-03

    I was just preparing RC36. So,, added this.

    #CHIP 18f27k42
    
    Dim sMyString As String
        sMyString ="one _
                   two _
                   three _
                   four _
                   five _
                   six _
                   seven _
                   eight _
                   nine _
                   ten _
                   eleven _
                   twelve _
                   thirteen _
                   fourteen _
                   fifteen _
                   sixteen _
                   seventeen _
                   eighteen _
                   nineteen _
                   twenty _
                   twentyOne _
                   twentyTwo _
                   twentyThree _
                   twentyFour _
                   twentyFive"
    
    HSerPrint sMyString
    

    This gens in the asm:

    ;Make into a comment to use the AVR chipset
    ;Dim sMyString As String
    ;sMyString ="one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twentyOne twentyTwo twentyThree twentyFour twentyFive"
    
    ....
    lots of code
    
    
    StringTable1
        db  185,111,110,101,32,116,119,111,32,116,104,114,101,101,32,102,111,117,114,32,102,105
        db  118,101,32,115,105,120,32,115,101,118,101,110,32,101,105,103,104,116,32,110,105,110
        db  101,32,116,101,110,32,101,108,101,118,101,110,32,116,119,101,108,118,101,32,116,104
        db  105,114,116,101,101,110,32,102,111,117,114,116,101,101,110,32,102,105,102,116
        db  101,101,110,32,115,105,120,116,101,101,110,32,115,101,118,101,110,116,101,101
        db  110,32,101,105,103,104,116,101,101,110,32,110,105,110,101,116,101,101,110,32
        db  116,119,101,110,116,121,32,116,119,101,110,116,121,79,110,101,32,116,119,101
        db  110,116,121,84,119,111,32,116,119,101,110,116,121,84,104,114,101,101,32,116,119,101
        db  110,116,121,70,111,117,114,32,116,119,101,110,116,121,70,105,118,101
    

    OK?

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-03

    Thanks Anobium, Your post concerning the underscore is exactly what I wanted to suggest ... Long lines are displayed as one line on the screen, but from the beginning of next line when printing ; this is "ugly" with indenting or headers of Sub's ...

     
  • Anobium

    Anobium - 2021-01-03

    I have uploaded RC36 with this supported.

    You should also be aware that this also works:

    /*
    line of comments
    line of comments
    line of comments
    line of comments
    line of comments
    line of comments
    */
    

    This is very useful for large blocks of commented code.

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-03

    Thanks, I will install it immediately ...
    About comments : I use only ' ----- between subroutines and ' Comment after the header.

     

    Last edit: Bertrand BAROTH 2021-01-03
    • Anobium

      Anobium - 2021-01-03

      Hopefully, a result for you today!

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-03

    It doesn't work (see attachment) ; and I saw another issue : GoTo non-existing labels doesn't cause an error message : what is in the compiled code in this case ?

     
    • Anobium

      Anobium - 2021-01-03

      That is not the compiler. That is the pre-processor. Let me sort.

       
  • Anobium

    Anobium - 2021-01-03

    Put this new AWK file in you GCB@Syn\g+stools folder..

    Test.

    You program now clears the preprocess check.

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-03

    Thanks, the issue with the parentheses is solved, You need only to modify the installer program to use the new preprocessor ... But if You replace line 502 with "GoTo Debut_manuel" (i.e. a jump to a non existing label), the system compiles without error ! I noticed this because I had such a label before, and erased the corresponding lines. But, what does it compile in fact ?

     

    Last edit: Bertrand BAROTH 2021-01-03
    • Anobium

      Anobium - 2021-01-03

      Thank you for testing. I will put in the next release.


      Re the GOTO. I have looked and I do not know what is causing this. I think this will rjmp to some random memory location. I will asked Hugh to have a look as I do not why this is failing on your chip but not on other AVRs.

      So, do not use 'goto'.... :-)

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-03

    Trouble occurs if I select Mega8515, too ; but the error is detected if I choose Mega162. Very strange ...

     
    • Anobium

      Anobium - 2021-01-03

      Yes. Most odd.


      Try this IF YOU have ATMEL studio installed. If not... do not try ... or, install it.

      You can validate the generated ASM source. All you have to do it edit one file. This will show the error condition as shown below:

      20:40:45    G+Stool started with parameter 'hex'   ->   processing   d:\GCB@Syn36\G+Stools\makeHEX.bat
      Source-File  =  C:\Users\admin\Downloads\Controle_test.gcb
      >>>  WARNINGs / ERRORs reported by Great Cow BASIC  (if Syntax Error, doubleclick on the errormessage below)  <<<
      C:\Users\admin\Downloads\Controle_test.asm(554): error: Undefined symbol: DEBUT_MANUEL
      
      Assembly failed, 1 errors, 14 warnings
      
      Duration:   1.3  Seconds.
      

      Locate the file D:\GCB@Syn36\G+Stools*makehex.bat*

      At the top locate the REM on the line REM set ATMELStudio=C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR Assembler\Native\2.1.1175\avrassembler\

      The location MUST be the ATMEL studio location in your folder that has the file avrasm2.exe

      Once you have edited makehex.batsave, And, makehex. You will see the error.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-03

    Unfortunately ... I DON'T use Atmel Studio ; in my eyes it is a "gaseous plant". The only work I did with assembler in my life was with the good old 6502 (I think that for ASM language it was the best processor ever created) !
    I tested the issue with RC35, it was the same ... But, to minimize risks related with "wild" jumping I can, at least until the error is corrected, perform a "test compilation" if I define the processor as Mega162 (so the compiler would notify the error of wrong or missing label) and finally modify the processor type back to 8515 in the configuration section. Not very elegant, but working until You discover the origin of the bug.

     

    Last edit: Bertrand BAROTH 2021-01-03
    • Anobium

      Anobium - 2021-01-03

      The compiler component is the piece that is required at 20mb, or, adapt makehex.bat and use WINAVR toolchain. Either of these toolchains will provide another level of validation of your source.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-06

    In fact, I made several tests, defining various processors (even 90S4434). It seems that a non-existing label is not detected if the processor has a maximum of 8K Flash. With processors with 16 K or more the error is detected. And I looked at the xxxx.lst file : with the 90S8515 the "dummy" label doesn't appear in the list ; hope this helps ...

     
    • Anobium

      Anobium - 2021-01-06

      Your analysis is correct.

      Hugh found this one easy with the hints that it only affects larger chips.

      Relative jumps have a bit of extra code in the assembler to calculate the offset to jump by, and that code was silently failing if a location couldn't be resolved. Absolute jumps don't use any special code, so the standard value checking code in the assembler picks those up already. Smaller chips only use relative jumps, hence the error message not showing.

      I will issue a new RC release today with this fix (and, a few more for PICs).

      :-)

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-06

    Thanks in advance ... And, please include the modified preprocessor configuration file.

     
  • Anobium

    Anobium - 2021-01-06

    @RC37 - Lots done since Sunday!!

    918   Fix     Prep        Improved handling for braces within block comments. Preprocessor.awk updated[1168].
    919   Nex     DAT         All DAT files reissued with new entries as follows:
                              New CHIPDATA entry to support ChipSubFamily and MemoryLock register, updated system.h with required constants. Required to support 18FxxQxx chip family[1166]
                              A rewrite of NVMADR_EPWrite/EPread to better support 18fxxQxx chips/NVMADRU register moving to ChipSubFamily.
                              ChipFamily18FxxQ10 = 16100
                              ChipFamily18FxxQ43 = 16101
                              ChipFamily18FxxQ41 = 16102
                              ChipFamily18FxxK42 = 16103
                              ChipFamily18FxxK40 = 16104
                              All other PICS are assigned = ChipFamily*1000.
                              ChipSubFamily data is held in chipdata.csv file.
    920   Fix     Compiler    Small compiler fix: generate error if relative jump on AVR jumps to a non-existent location[1165]
    921   Fix     EEPROM      Improved Write and Read support using ChipSubFamily[1167]
    922   Fix     PWM         Improved handling of CCP/PWM for ChipSubFamily = ChipFamily18FxxQ41. [1167]
    923   Fix     PICINFO     Reordered TABs and UI improvements.
    
     
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-07

    Thanks, now it works ... Another question : why does GCB accept "Delay_ms" ? It is compiled to ... nothing ; I made the mistake once using it instead of Wait ... ms, because in the past I programmed in Pascal.

     
    • Anobium

      Anobium - 2021-01-07

      Got example code?

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2021-01-07

    Line 522

     
1 2 > >> (Page 1 of 2)

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.