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 !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
dirportc.0_out
And, remind me. What version of the compiler are you using? I WILL need you to test this if we do this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
#CHIP18f27k42DimsMyStringAsStringsMyString="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"HSerPrintsMyString
This gens in the asm:
;MakeintoacommenttousetheAVRchipset;DimsMyStringAsString;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"....lotsofcodeStringTable1db185,111,110,101,32,116,119,111,32,116,104,114,101,101,32,102,111,117,114,32,102,105db118,101,32,115,105,120,32,115,101,118,101,110,32,101,105,103,104,116,32,110,105,110db101,32,116,101,110,32,101,108,101,118,101,110,32,116,119,101,108,118,101,32,116,104db105,114,116,101,101,110,32,102,111,117,114,116,101,101,110,32,102,105,102,116db101,101,110,32,115,105,120,116,101,101,110,32,115,101,118,101,110,116,101,101db110,32,101,105,103,104,116,101,101,110,32,110,105,110,101,116,101,101,110,32db116,119,101,110,116,121,32,116,119,101,110,116,121,79,110,101,32,116,119,101db110,116,121,84,119,111,32,116,119,101,110,116,121,84,104,114,101,101,32,116,119,101db110,116,121,70,111,117,114,32,116,119,101,110,116,121,70,105,118,101
OK?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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 ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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 ?
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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'.... :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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 ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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).
:-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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 !
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.
And, remind me. What version of the compiler are you using? I WILL need you to test this if we do this.
I was just preparing RC36. So,, added this.
This gens in the asm:
OK?
and, see https://github.com/Anobium/Great-Cow-BASIC-Help/wiki/line_continuation
:-)
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 ...
I have uploaded RC36 with this supported.
You should also be aware that this also works:
This is very useful for large blocks of commented code.
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
Hopefully, a result for you today!
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 ?
That is not the compiler. That is the pre-processor. Let me sort.
Put this new AWK file in you GCB@Syn\g+stools folder..
Test.
You program now clears the preprocess check.
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
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'.... :-)
Trouble occurs if I select Mega8515, too ; but the error is detected if I choose Mega162. Very strange ...
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:
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.
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
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.
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 ...
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).
:-)
Thanks in advance ... And, please include the modified preprocessor configuration file.
@RC37 - Lots done since Sunday!!
Published https://sourceforge.net/projects/gcbasic/files/Release%20Candidates/GCB_Installer-v0.98.07%20RC37.exe/download
Enjoy
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.
Got example code?
Line 522