Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:43 14 Mar 2026 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 : QuickBasic has COMMON, is it a usual feature ?

Author Message
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 662
Posted: 11:58pm 19 Dec 2025
Copy link to clipboard 
Print this post

To my surprise (being a bit ignorant of BASICs) I see QuickBasic
had a COMMON statement.  
Is that a usual feature of BASICs in general or is it
a special addition ?
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3348
Posted: 02:20am 20 Dec 2025
Copy link to clipboard 
Print this post

COMMON defines a series of variables that are shared with a new program run using the CHAIN command.

I think that COMMON came from Fortran and it was also in GW BASIC which MMBasic imitated.  But it never made it into MMBasic.  This was mostly because the early versions of MMBasic (for the Maximite) shared all variables with the chained program.  Peter's ports of MMBasic followed this practice so COMMON has not been needed.

Geoff
Edited 2025-12-20 12:22 by Geoffg
Geoff Graham - http://geoffg.net
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 570
Posted: 02:20am 20 Dec 2025
Copy link to clipboard 
Print this post

  zeitfest said  To my surprise (being a bit ignorant of BASICs) I see QuickBasic
had a COMMON statement.  
Is that a usual feature of BASICs in general or is it
a special addition ?


It's uncommon for BASIC. Fortran uses it but BASIC, not so much.
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1788
Posted: 08:13am 20 Dec 2025
Copy link to clipboard 
Print this post

I found a really cool use for it; My DOS app needed to run certain things without interruption. I reprogrammed the timer interrupt from 55mS to 1mS (compensated to preserve time/date) and hijacked the vector. This was mainly handling I/O in the background. I even had it in a QLB so that, even when I paused or single-stepped the QB code in the IDE, the ISR continued to run.

COMMON: I used this to establish shared variables with the ISR routine. All QB needed to do was read/write the shared variables. Who says "DOS can't do real-time"  

QB was one heck of a product.  
 
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 662
Posted: 06:34am 24 Dec 2025
Copy link to clipboard 
Print this post

Thanks  

Quite a uh, non-trivial thing to add to an interpreter.

I wonder if can I do it ?
But it is calling me...  maybe as a xmas indulgence to myself,
to have a go anyway  
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 570
Posted: 12:04pm 24 Dec 2025
Copy link to clipboard 
Print this post

  PhenixRising said  I found a really cool use for it; My DOS app needed to run certain things without interruption. I reprogrammed the timer interrupt from 55mS to 1mS (compensated to preserve time/date) and hijacked the vector. This was mainly handling I/O in the background. I even had it in a QLB so that, even when I paused or single-stepped the QB code in the IDE, the ISR continued to run.

COMMON: I used this to establish shared variables with the ISR routine. All QB needed to do was read/write the shared variables. Who says "DOS can't do real-time"  

QB was one heck of a product.  


GW-BASIC and MBASIC (and most other Microsoft interpreted BASICs) can run a program from another preserving all variables and keeping files open without having to declare the variables in a COMMON statement.
 
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 268
Posted: 01:07pm 26 Dec 2025
Copy link to clipboard 
Print this post

Here's a COMMON block example from one of my FORTRAN programs. The source code of the COMMON block named 'e2m1.inc' is included in a typical subroutine with the FORTRAN include command. 'e2m1.inc' is a simple text file specifying the information to be shared.

     subroutine findsoi(ri, vi, rhelio, vhelio)

c     determine time and conditions at Earth SOI

c     ************************************

     implicit double precision (a-h, o-z)

     external geo_eqm, rmobj

     include 'e2m1.inc'


     common /e2m1/ rtd, dtr, aunit, emu, xj2, tetol, rtol,
    &              xmmu, smu, xmu(10), xmu_mars, req, rsoi(9),
    &              xjdate0, xjdtip, xjdsoi, xjdca,
    &              direct, revmax, dv1(3), dv2(3),
    &              rito(3), vito(3), rfto(3), vfto(3),
    &              tiwrk, tisaved, yi(6),
    &              yfinal(6), ysaved(6), tradius, eq2000(3, 3),
    &              rmca, xinct, rhsoi(3), vhsoi(3),
    &              rfinal(3), vfinal(3), rmmme(3), vmmme(3),
    &              ip1, ip2, isun, imoon, ij2, itype, isn
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8667
Posted: 01:23pm 26 Dec 2025
Copy link to clipboard 
Print this post

It's not MMFortran (or MMC or MMPascal or MMLisp or whatever) though. Thank goodness. :)

Your mission, should you choose to accept it, is to find a way to do what you want in MMBasic. As always, should you or any of your IM Force be caught or killed, the Secretary will disavow any knowledge of your actions. This tape/disc will self-destruct in five/ten seconds. Good luck.  :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 662
Posted: 06:10pm 30 Dec 2025
Copy link to clipboard 
Print this post

Well I can see a way of adding named COMMON blocks to my interpreter,
it already has the COMMON blank block useable. But tt may be better to just
try to implement modules instead, which were from a later version (f95 ?)
Needs more thought..

  Quote  Your mission, should you choose to accept it, is to find a way to do what you want in MMBasic


    Well, maybe if Hollywood calls I could get onto the Mission Impossible
set, then get Tom Cruise to ask his scientology contacts to send MMBasic to the
Mother Ship...when it arrives of course ... I'd like to see that..    
 
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 2026