Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Which basic ?

67 views
Skip to first unread message

himself

unread,
Aug 8, 2012, 1:34:01 AM8/8/12
to

Hi All,
I have a book published in 1985 with programs written in basic.
I need to run one to find where I am going wrong converting to Python.
It uses for example, line numbers, def fna(x)...., gosub, goto etc.

I have qbasic45 running in dosbox but the syntax is different.

Is there a more appropriate Basic program? I am running win64 but could
fire up ubuntu.

Just a hobbyist so go easy on me :)

Rog
http:rog.pynguins.com


Auric__

unread,
Aug 8, 2012, 6:10:18 AM8/8/12
to
It sounds like it *might* be GW-BASIC, but things like line numbers, DEF FN,
GOSUB, and GOTO are common across most flavors of BASIC, especially those
available in the 80's. (Offhand, I know that BBC BASIC and PowerBASIC both
support all of those, and they're *very* different languages.)

Post one of the programs here. Pick a fairly small one -- less than, say, 50
lines or so.

--
[hold music: dah dah dah, dum de dum-dum]

ralph

unread,
Aug 8, 2012, 7:43:18 AM8/8/12
to
On Wed, 8 Aug 2012 05:34:01 +0000 (UTC), "himself" <so...@where.com>
wrote:
What's the book?

The book itself should contain a reference somewhere to the flavor of
BASIC it is using.

-ralph

Helmut_Meukel

unread,
Aug 8, 2012, 7:45:22 AM8/8/12
to
Am 08.08.2012 vermutete Auric__:
Doesn't the book say which computer or OS?
There should be some reference to the flavour of the language or the
target machine.
Atari, Commodore, some C/PM machine, even probably HP Basic (later
renamed to HT Basic and ported to the PC).

In my experience: with really similar Basics totally unexpected problems
may be caused by some slight difference. :-(

Helmut.


Auric__

unread,
Aug 8, 2012, 8:47:20 AM8/8/12
to
Helmut_Meukel wrote:

> Am 08.08.2012 vermutete Auric__:
>> himself wrote:
>>
>>> I have a book published in 1985 with programs written in basic.
>>> I need to run one to find where I am going wrong converting to Python.
>>> It uses for example, line numbers, def fna(x)...., gosub, goto etc.
>>>
>>> I have qbasic45 running in dosbox but the syntax is different.
>>>
>>> Is there a more appropriate Basic program? I am running win64 but
>>> could fire up ubuntu.
>>>
>>> Just a hobbyist so go easy on me :)
>>
>> It sounds like it *might* be GW-BASIC, but things like line numbers,
>> DEF FN, GOSUB, and GOTO are common across most flavors of BASIC,
>> especially those available in the 80's. (Offhand, I know that BBC BASIC
>> and PowerBASIC both support all of those, and they're *very* different
>> languages.)
>>
>> Post one of the programs here. Pick a fairly small one -- less than,
>> say, 50 lines or so.
>
> Doesn't the book say which computer or OS?
> There should be some reference to the flavour of the language or the
> target machine.
> Atari, Commodore, some C/PM machine, even probably HP Basic (later
> renamed to HT Basic and ported to the PC).

A lot of books through... let's say the late 80's... did their best to be
"generic" BASIC, which typically meant they were written in Microsoft
BASIC, and would often work without change on any MS BASIC machine -- and
since the popular PCs of the day mostly used MS BASIC (Commodore 64 and
Apple 2 come to mind), they were fairly "universal" to their target
audiences. See, for example, David Ahl's books.

> In my experience: with really similar Basics totally unexpected problems
> may be caused by some slight difference. :-(

Agreed.

--
- Mmm. Angry mob and soldiers.
- This is unlikely to end well.

himself

unread,
Aug 8, 2012, 9:07:20 AM8/8/12
to
It is an RSGB publication, Amateur Radio Software, he does mention that
it will be generic Basic that may need adapting.
I have adapted the code in qbasic and have a result as such using
online calculators.
It calculates distance and bearing.
Will type out the original and post. Thanks for the feedback.
Rog

ralph

unread,
Aug 8, 2012, 9:50:57 AM8/8/12
to
On Wed, 8 Aug 2012 13:07:20 +0000 (UTC), "himself" <so...@where.com>
wrote:


>
>
>It is an RSGB publication, Amateur Radio Software, he does mention that
>it will be generic Basic that may need adapting.
>I have adapted the code in qbasic and have a result as such using
>online calculators.
>It calculates distance and bearing.
>Will type out the original and post. Thanks for the feedback.
>Rog

I have several old Astronomy cook books like that. All the code using
a "generic" BASIC which does seem to ever have actually existed
anywhere. <g>

In this case I suggest you simply adopt a BASIC you would like to use
and then convert/port the code. If you run across any particular
construct that is a problem, then post it here, and I'm sure one of
the extremely knowledgeable people will be able to provide a
conversion. But you need to pick a BASIC.

One thing I will mention, in case you are not aware, is that floating
point math and thus accuracy can vary dramatically, and is likely to
be your major problem. For example, an algorithm typed in BASIC and
then compared with a seemingly identical algorithm typed out on a
handheld calculator often produces surprises.

There are many excellent resources, but this seems to be the most
readable. <g> Worth a look if you are not aware of fp issues.
http://floating-point-gui.de/

-ralph

himself

unread,
Aug 8, 2012, 9:56:24 AM8/8/12
to
Auric__ wrote:

>> himself wrote:
>>
>> >> I have a book published in 1985 with programs written in basic.
>> >> I need to run one to find where I am going wrong converting to
>> >> Python. It uses for example, line numbers, def fna(x)....,
gosub,
>> >> goto etc.
>> >>
>> >> I have qbasic45 running in dosbox but the syntax is different.
>> >>
>> >> Is there a more appropriate Basic program? I am running win64 but
>> >> could fire up ubuntu.
>> >>
>> >> Just a hobbyist so go easy on me :)
>>
>> It sounds like it might be GW-BASIC, but things like line numbers,
>> DEF FN, GOSUB, and GOTO are common across most flavors of BASIC,
>> especially those available in the 80's. (Offhand, I know that BBC
>> BASIC and PowerBASIC both support all of those, and they're very
>> different languages.)
>>
>> Post one of the programs here. Pick a fairly small one -- less than,
>> say, 50 lines or so.
>>
>> --
>> [hold music: dah dah dah, dum de dum-dum]

A sample:

10 pi = 3.14159265: dr= pi/180
20 def fna(x) = int(x * 10 + .5) / 10

840 if left$(t$, 1) = "s" then n = -n

220 print "DX=";fna(dx), "AZ=";fna(az/dr)

gosubs reference a line number which finish with a return.

will type out the whole program if required when I have time.

Rog

Auric__

unread,
Aug 8, 2012, 4:28:32 PM8/8/12
to
himself wrote:

> Auric__ wrote:
>
>>> himself wrote:
>>>
>>> >> I have a book published in 1985 with programs written in basic.
>>> >> I need to run one to find where I am going wrong converting to
>>> >> Python. It uses for example, line numbers, def fna(x)...., gosub,
>>> >> goto etc.
>>> >>
>>> >> I have qbasic45 running in dosbox but the syntax is different.
>>> >>
>>> >> Is there a more appropriate Basic program? I am running win64 but
>>> >> could fire up ubuntu.
>>> >>
>>> >> Just a hobbyist so go easy on me :)
>>>
>>> It sounds like it might be GW-BASIC, but things like line numbers,
>>> DEF FN, GOSUB, and GOTO are common across most flavors of BASIC,
>>> especially those available in the 80's. (Offhand, I know that BBC
>>> BASIC and PowerBASIC both support all of those, and they're very
>>> different languages.)
>>>
>>> Post one of the programs here. Pick a fairly small one -- less than,
>>> say, 50 lines or so.
>
> A sample:
>
> 10 pi = 3.14159265: dr= pi/180
> 20 def fna(x) = int(x * 10 + .5) / 10
>
> 840 if left$(t$, 1) = "s" then n = -n
>
> 220 print "DX=";fna(dx), "AZ=";fna(az/dr)
>
> gosubs reference a line number which finish with a return.
>
> will type out the whole program if required when I have time.

Looks to be fairly generic MS BASIC. If you add a line that assigns
appropriate values to the variables, this works in GW-BASIC, QBasic, and
VB-DOS -- and therefore *probably* any BASIC compatible with one of the
above (FreeBASIC, QB64, BCET, etc).

With very little change this specific code also works in PowerBASIC for
DOS, Brandy BASIC (open source BBC BASIC), BCX, and TrueBASIC. (The
necessary changes are different for each language, and for the most part
still results in valid MS BASIC -- but that's just chance.)

--
She died and we did nothing.

Todd Vargo

unread,
Aug 8, 2012, 7:57:29 PM8/8/12
to
Most likely it should run in qbasic unmodified. Type it verbatim into a
text editor, save and try to run it with out modifications. You will
receive a message if it uses any commands that were omitted from qbasic.

See help in qbasic, Contents on the Version Differences page and at the
bottom of the page, Unsupported Keywords.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

nospam

unread,
Aug 9, 2012, 3:36:18 PM8/9/12
to
Rog, you mention the RSGB. Well I can't recognise one version of BASIC
from another but I do know that around the 2000's the RSGB were
actively encouraging people to use BBC Basic of the various competing
flavours not least because it was home grown and had a long history
here in the UK with many amateur radio programs previously written on
the BBC B computer with BBC BASIC.
73's

Helmut_Meukel

unread,
Aug 9, 2012, 4:48:25 PM8/9/12
to
Auric__ wrote:
> Helmut_Meukel wrote:
>
>> Doesn't the book say which computer or OS?
>> There should be some reference to the flavour of the language or the
>> target machine.
>> Atari, Commodore, some C/PM machine, even probably HP Basic (later
>> renamed to HT Basic and ported to the PC).
>
> A lot of books through... let's say the late 80's... did their best to be
> "generic" BASIC, which typically meant they were written in Microsoft
> BASIC, and would often work without change on any MS BASIC machine -- and
> since the popular PCs of the day mostly used MS BASIC (Commodore 64 and
> Apple 2 come to mind), they were fairly "universal" to their target
> audiences. See, for example, David Ahl's books.
>

I started programming with an HP 9815 S, and looked into a TRS 80/II for
private use. So I purchased the Basic manual for this machine, but
was unhappy with the restriction to 2 characters for variables and some
other shortcomings. So I never buyed the TRS 80.
Later I came to FORTRAN 66 on a HP 1000 realtime machine and got
distracted from Basic for some years.
While still programming 2 HP 1000 systems now in Fortran77, I looked
into programming PCs in dBase II and TurboPascal, but finally came to
QB4, QB4.5, then Basic PDS 7.1. That was in the late 80's and early 90's.
I also programmed a HP 86B in HP-Basic, and about '93 I switched to
VB-DOS on PCs.
I never read independent books about programming, only the manuals that
came with the programming languages, except in one case: a book about
Fortran which was a waste of time. The Manuals that came with the
HP1000's FORTRAN 6X and Fortran 7X compilers were way better.
I learned database programming from the manual that came with HP's
Image1000/II database subsystem.
The HP 1000 set the standards for me in performance and multitasking/
multiuser capabilities and until about '99/2000 I still compared the
PCs to the long gone HP 1000.
My first home computer was a PC with an I386SX processor, my christmas
'89 present for me. ;-)

Helmut.


himself

unread,
Aug 9, 2012, 7:49:46 PM8/9/12
to
I have let my callsign go idle, g0fno, but still have my equipment, now
retired should boot it up again.
I have the programming bug at the moment, just finished the program
with Just Basic, the first one done with qb45 gave me the values to
correct the Python version.
zx81, Spectrum, BBC, 386sx, 486dx and so on is the path I have taken :)
I have a son doing computer science who has lit the fire for
programming again.
Rog



ne...@rtrussell.co.uk

unread,
Aug 10, 2012, 12:12:17 PM8/10/12
to
On Aug 10, 12:49 am, "himself" <s...@where.com> wrote:
> nospam wrote:
> >> I do know that around the 2000's the RSGB were
> >> actively encouraging people to use BBC Basic

Indeed.

> I have the programming bug at the moment, just finished the program
> with Just Basic

If you use 'LB Booster' (LBB) you can kill two birds with one stone -
program in Just BASIC (or Liberty BASIC), but know you are actually
running them in BBC BASIC!

http://lbbooster.com/

> I have a son doing computer science who has lit the fire for
> programming again.

Schools are keen on BBC BASIC too, because it's one of the languages
recommended by OCR (The Oxford, Cambridge and RSA examination board).

Richard, G4BAU.

Auric__

unread,
Aug 10, 2012, 8:12:16 PM8/10/12
to
ne...@rtrussell.co.uk wrote:

> Schools are keen on BBC BASIC too, because it's one of the languages
> recommended by OCR (The Oxford, Cambridge and RSA examination board).

That's interesting. Is it BBC BASIC in general, or specifically BB4W?

--
The difference between theory & practice
is larger in practice than in theory.

ne...@rtrussell.co.uk

unread,
Aug 12, 2012, 7:48:12 AM8/12/12
to
On Aug 11, 1:12 am, "Auric__" <not.my.r...@email.address> wrote:
> That's interesting. Is it BBC BASIC in general, or specifically BB4W?

Both! For example here:

http://social.ocr.org.uk/files/ocr/GCSE_Computing_J275_Centre_Crib_Sheet_180112.doc

It says: "Any programming environment can be used but Unit A451 may
contain questions in a generic pseudocode that looks a lot like BBC
BASIC, eg BBC BASIC for WINDOWS, or PASCAL" and later "all tasks have
been tested in VB.net and BBC BASIC for Windows to make sure they are
suitable".

As one would expect, OCR are careful not to make their examinations
language-specific, and acknowledge several as being suitable, but I
have received considerably more orders from schools than usual.

Richard.
http://www.rtrussell.co.uk/

Auric__

unread,
Aug 12, 2012, 4:07:38 PM8/12/12
to
Just goes to show the popularity of BBC BASIC on that side of the pond, I
supppose.

Interstingly, that doc is the first mention I can recall seeing (ouside of
Microsoft itself) of MS Small Basic:
The tasks can generally be completed in a console programming mode but many
centres are choosing to use Visual Basic in one of its versions, from VB6
through SMALL BASIC, VBA to VB.net.

--
I kept everything inside, and even though I tried, it all fell apart.
0 new messages