6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 10:03 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Bug or Feature?
PostPosted: Sat Mar 10, 2018 1:28 am 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
I have noticed that line beginning with a ':' are ignored by EhBASIC. Was this intentional or just a fortunate bug?

It allows a way to comment code sections in program files without incurring the overhead of REM statements.

For instance, when the following is sent to EhBASIC:
Code:
: The convention for variables and constants in this code is as follows:
:      A, AA and aA = variables/constants in main body
:      Aa =  global variables/constants
:      aa = variables/constants in subroutines
:
: It makes it easier for quick changes if global constants are defined one per line.
:
: Initialize global constants and variables here
:
10 Ix = 10
: constant - initial x index

20 Iy = 39
: constant - initial y index

30 Mx = 189
: constant - maximum x value for screen locations

.
.
.
. (etc...)


All those lines beginning with a colon are ignored.

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug or Feature?
PostPosted: Sat Mar 10, 2018 10:08 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
Good observation. It is a usefull but unintentional and undocumented feature. It only works that way in direct mode and allows comments in the source text while these comments will not be loaded to program memory. So a LIST in EhBASIC will not show them.

I wouldn't call it a bug as you are expected to enter a valid statement or line number in direct mode. The colon can be used as usual to separate further statements on the same line.

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug or Feature?
PostPosted: Sun Mar 11, 2018 6:00 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
As you say, still useful.

Especially for me as I always keep my source open in Notepad++ and do all my changes there rather than directly on the target. The only thing I might od on the target is change the initial value of a variable or the value of a constant. Since I always define these one to a line to make that very job easier. Once the program is fully developed and sufficiently debugged you can always pack them many per line to save a bit of space if required. However, the biggest space saving comes from being able to comment the source without taking up space on the target.

Perhaps you could update your awesome version of the documentation with a note that outlines the 'feature'.

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug or Feature?
PostPosted: Tue Mar 13, 2018 9:00 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
I use a similar but more obvious technique to achieve the same thing. All REM lines in my programs have no line number. On load they will be executed as direct statements (do nothing) and will not be loaded to program memory.

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: