Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:52 03 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Mega65 preorder went live yesterday...

     Page 3 of 3    
Author Message
scruss
Regular Member

Joined: 20/09/2021
Location: Canada
Posts: 91
Posted: 08:36pm 07 Oct 2021
Copy link to clipboard 
Print this post

  Mixtel90 said  Compulsory line numbers did have their place in some ways. The "BASIC Faster And Better" book for the TRS-80 showed how they could work - like using chapters, paragraphs and sentences.


That sounds like a throwback to FOCAL's group numbers, where every line was numbered 01.01, 01.02, ... 02.01, 02.02. etc., and you could run a group as a subroutine with DO 02.00.

But line numbers every line do belong in the past. The Bas Full BASIC interpreter has a handy "unnum" feature for removing unnecessary line numbers.
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 442
Posted: 01:58am 08 Oct 2021
Copy link to clipboard 
Print this post

  scruss said  
  Mixtel90 said  Compulsory line numbers did have their place in some ways. The "BASIC Faster And Better" book for the TRS-80 showed how they could work - like using chapters, paragraphs and sentences.


That sounds like a throwback to FOCAL's group numbers, where every line was numbered 01.01, 01.02, ... 02.01, 02.02. etc., and you could run a group as a subroutine with DO 02.00.

But line numbers every line do belong in the past. The Bas Full BASIC interpreter has a handy "unnum" feature for removing unnecessary line numbers.


Make sure you get the latest version. The link on the webpage gives version 2.5 but there's a 2.6 available at

http://www.moria.de/~michael/bas/bas-2.6.tar.gz
Edited 2021-10-08 12:01 by toml_12953
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 04:15am 08 Oct 2021
Copy link to clipboard 
Print this post

I started programming in Atari Basic on my 800XL back in the 80's - with a super fast 1.6MHz 6502 CPU and 64K of RAM.

I loved line-numbers back then, and vowed I would never use a non-line-number programming language, as it was too complicated.

Crikey, I don't think I would be able to do anything in Atari Basic now, being limited to the line numbers!  

Structured programming languages like MMBASIC are a god-send for more complicated stuff, and provided you indent the code correctly, I think they are even easier to read then line-numbered programs.

Most modern IDE's for BASIC-type languages have line-numbers at the far left that are just not part of the actual code itself.  PICAXE editor does, MMEDIT does, so the line-numbers are still a good idea as a reference for the line of code and where it is, but as to keeping them in the code, I think those days are probably gone.  
Smoke makes things work. When the smoke gets out, it stops!
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 442
Posted: 06:05am 08 Oct 2021
Copy link to clipboard 
Print this post

  Grogster said  I started programming in Atari Basic on my 800XL back in the 80's - with a super fast 1.6MHz 6502 CPU and 64K of RAM.

I loved line-numbers back then, and vowed I would never use a non-line-number programming language, as it was too complicated.

Crikey, I don't think I would be able to do anything in Atari Basic now, being limited to the line numbers!  

Structured programming languages like MMBASIC are a god-send for more complicated stuff, and provided you indent the code correctly, I think they are even easier to read then line-numbered programs.

Most modern IDE's for BASIC-type languages have line-numbers at the far left that are just not part of the actual code itself.  PICAXE editor does, MMEDIT does, so the line-numbers are still a good idea as a reference for the line of code and where it is, but as to keeping them in the code, I think those days are probably gone.  


The ANSI/ISO standard for BASIC makes them mandatory but since BASIC is now a structured language, there's no reason to ever use them for targets of GOTO or GOSUB. Even error trapping is line number free. Instead of ON ERROR GOTO... You use a construct like this:

WHEN EXCEPTION IN
   <code to be tested goes here>
USE
   <code to be executed if error has occurred>
END WHEN
 
diabolus
Newbie

Joined: 25/05/2020
Location: United Kingdom
Posts: 12
Posted: 08:27am 08 Oct 2021
Copy link to clipboard 
Print this post

  Grogster said  I started programming in Atari Basic on my 800XL back in the 80's - with a super fast 1.6MHz 6502 CPU and 64K of RAM.

I loved line-numbers back then, and vowed I would never use a non-line-number programming language, as it was too complicated.

Crikey, I don't think I would be able to do anything in Atari Basic now, being limited to the line numbers!  

Structured programming languages like MMBASIC are a god-send for more complicated stuff, and provided you indent the code correctly, I think they are even easier to read then line-numbered programs.

Most modern IDE's for BASIC-type languages have line-numbers at the far left that are just not part of the actual code itself.  PICAXE editor does, MMEDIT does, so the line-numbers are still a good idea as a reference for the line of code and where it is, but as to keeping them in the code, I think those days are probably gone.  


...you've got to try Fast Basic by DMSC on your Atari...or in an emulator.No line numbers, built-in DLI and PMG, and up to 30x as fast.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 12:26am 09 Oct 2021
Copy link to clipboard 
Print this post

@ Tom_12953: Agreed.  I remember back in those days, I used to GOTO all over the place.  I don't use GOTO at all in MMBASIC unless I find some obscure reason where I HAVE to use it.  99.9% of the time, standard DO/LOOP and IF/THEN/ELSE or SELECT CASE commands can deal with just about everything.  I guess in the days of ATBASIC, it was not really anywhere as advanced as something modern like MMBASIC is, so you could get away with random jumping around in the code with GOTO more, and with a line-based BASIC, you really can't do it any other way with the exception of GOSUB routines.

@ diabolus: I do recall a few other offerings including PASCAL for Atari, but most people - myself included - just used the built-in BASIC on the XL series and above.  I agree about the speed.  ATBASIC was quite slow even compared to other BASIC-like languages of the time.  I do remember reading about that way back when.

Still, without my old 800XL and ATBASIC of the time, I quite possibly would never have got involved in MMBASIC at all, so I am glad for the early exposure.
Smoke makes things work. When the smoke gets out, it stops!
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 07:46am 09 Oct 2021
Copy link to clipboard 
Print this post

I agree on the GOTO debate but I don't dismiss it entirely (it is often condemned on a "snobbery" basis... a bit like the 8bit/16bit argument for stuff where it really makes no difference (been there back in the 80s and had a "bit-off" with BP [and won] for some oil-pressure sensing on a high speed engine of theirs).

I almost never use GoTo and agree it's use should be avoided whenever possible, but it shouldn't be dismissed because we've got nice structures now. It is a good way of jumping out of a bit of code where a common possibility affects following related sections:

One that really made sense for me was with some ESP8266 code I wrote. It is possible to get timeouts anywhere in the LAN code (because you are reliant on a foreign system responding) and if a T/O occurs, the only way to stop the subsequent bits of your program from trying to do their thing on a dead connection would be to set a flag and then you have ANOTHER test to jump around moot code, which then goes to the next bit which does the same test... and so on, just to maintain the structured program snobbery. It would be slow and convoluted - a simple GoTo TOHandler at any point avoids all that fluff and time wasting.

That said, I am certain I don't have a monopoly on wise/elegant code-structure so a re-write might come at the problem a different way.

So yes I *always* use structured programming... except when I don't

houses are still made from bricks, wheels are still round. Just because it is old doesn't mean it is useless

On the subject of BASIC speeds, it was often down to some thoughtful design and insight into how the language is used. For example the guys who wrote BBC Basic all recognised that most programs use simple integer variables a lot, for counters etc... so they had 26 integer size lumps of RAM set aside for such. Combined with the tokenization, when you used A%, B% etc., there was no look-up to find the variable, the firmware instantly went to the memory associated at CPU speed. That alone was an amazing speed boost and all because the writers/designers actually put some thought into how BASIC was used and optimized common stuff like FOR N%=1 TO 10. There were others too but this is the simplest and most drastic speed increase - possibly.
.
Edited 2021-10-10 00:40 by CaptainBoing
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7939
Posted: 08:01am 09 Oct 2021
Copy link to clipboard 
Print this post

I'm quite happy to use GOTO <label> in some situations. It can actually be the more elegant solution sometimes, less confusing than SELECT/CASE in some instances. I'm not as happy using GOTO <line_number>. It's fun to use GOTO <line_number> when you have POKEd <line_number> to get self-modifying code. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
     Page 3 of 3    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025