Program corrupted by comments!

jikmar

New Member
Here is a strange one...

I have a prog on 40X1 that takes over 4000 bytes. It has been a long project and after getting it all working to my satisfaction I wanted to tidy up the comments in it.

After getting the comments all nice and tidy I did a syntax check to make sure I hadn't inadvertently made a mess of anything. The reality was worse than my fears.

I got an Error: Unknown symbol message when I did the syntax check. I tried replacing the symbol with a number and then it checked past this point and trips up at a later 'Unknown Symbol'. I knew that all I had changed in the program was the comments and the order in which the symbols are declared. Hence I removed some comments from the program until the syntax check ran without error. Sounds good. Unfortunately then I noticed that the syntax check reports the program size as 5 bytes (and no, I didn't have to remove 3995 bytes of the program to get it to compile, only comments;)).

Does anyone else think this is really weird?

I have scoured the forum for anything on this. The most relevant thing I found was a thread entitled: "Syntax error, but code is old". After reading this I cut & pasted the text into each of Notepad, Wordpad and MS Word then pasted back into Progeditor. In each case the program remains corrupt.

Upgrading from Progeditor 5.2.0 to 5.2.2 didn't help.

Any Ideas?

I thought of posting the code, but it is large and would need cut into about 5 bits to post it. Also, I think there is nothing visually wrong with it.

PS: I have attached it (change extension to .bas). It doesn't compile. Remove lines 1270-1287, THEN remove lines 303-352. Now it compile but reports size as 5 bytes!

View attachment TESTRIG-FUNCTIONAL_R122_temp.txt
 

westaust55

Moderator
For starters,

where you have a rem block like this:
Code:
#rem#############################################################################################################
#################################################################################################################
#####																		#####
#####		DECLARE VARIABLES														#####
#####																		#####
#################################################################################################################
###########################################################################################################endrem
move the #endrem to a new line. Then a lot of the seemingly missing aliases will magically appear :)

and missing labels like " lcdisplay" will also become valid :)


Brought about by trying to make the presentation too tidy.


EDIT:
I will however say that at a first glance, the code is reasonably well documented and good use of indenting for the formating to make reading easier.
 
Last edited:

Dippy

Moderator
On the first run through I get the same error reported as Westy i.e. an undelcared variable. Line 354, which may explain some of your findings...

There seem to be many more like that, but you really need to get all that sorted before you go any further.
 

jikmar

New Member
@ Westaust55

move the #endrem to a new line. Then a lot of the seemingly missing aliases will magically appear
Brilliant! How did you know that?

That would have taken me FOREVER to find. All sorted now, half an hour after posting the problem - thank you so much. This forum is AWESOME!
 

westaust55

Moderator
#REM and #ENDREM are PE directives.

After a remark "flag" be it #REM, ' or ; anything can follow immediately without a space between the remark "flag" and the comments.

But for the PE syntax checker to find the #ENDREM it needs to be identified
if needs to be on a new line. even a string of ###### with just a space before #ENDREM will not work.

As soon as I spotted that the seemingly missing alias words were in fact present, I looked for what was preventing the SYMBOL statements being seen, then lo and behold . . .
 

jikmar

New Member
I get your drift.

Strange don't you think, that PE knows (if used in colour mode) to change the text colour back from green? It had obviously seen the #endrem. If it had made the whole text green then I would have spotted the problem immediately.


BTW: why do programmers often confuse Christmas and Halloween? Because OCT 31 = DEC 25.
 

BCJKiwi

Senior Member
Interesting use of
#rem
...
#endrem

Since these headers are not alternate code sections not being used for now, I use a
' or ;
as the the first char in these header lines rather than
#rem
..
#endrem
Then the issue never arises.
 

Dippy

Moderator
But it is handy to know and note for the future I would have thought.

I prefer * rather than # - unlike Bob Marley.

Other compilers I have use { and } instead of rem and endrem and also select a block and comment in a single click.
All very handy ways. I have no preferences, just a memory.

Anyway, no need to go on, just make a note in the cerebral notebook.
 

westaust55

Moderator
#REM and #ENDREM

Seems there is something more (or is that less) happening within the PE.

With a simple short block of program as:

Code:
[PLAIN]#rem#############################################################################################################
#################################################################################################################
#####																		#####
#####		DECLARE VARIABLES														#####
#####																		#####
#################################################################################################################
###########################################################################################################endrem
SYMBOL white = b9

For white = 0 to 255
debug
next white
[/PLAIN]
The PE V5.2.2 does not present a syntax error.
But the code will not simulate. Try to simulate and it terminates immediately.

But move the #ENDREM to a new line and all is well.
You can have spaces in front of the #ENDREM directive but no other characters

So seems the requirement is certainly to put the #ENDREM command on a new line
 

Technical

Technical Support
Staff member
All directives should be on a separate new line.

Also every directive, command, variable etc is identified as a 'unique word' which must have whitespace around it, so '####endrem' is not the same as '#endrem' in the same way that 'hhhhhigh' is not the same as 'high'.
 
Top