Getting BASIC programs compiled in Puppy?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

HOW TO GET BASIC-LANGUAGE SOFTWARE WORKING NATIVELY IN PUPPY

#21 Post by Puppyt »

HOW TO GET BASIC-LANGUAGE SOFTWARE WORKING NATIVELY IN PUPPY (??)

Over a year has passed since my OP, and with a range of life issues taking over I haven't come back to a solution to my original problem since very recently. (Still in the tragic camp - e.g., https://en.wikipedia.org/wiki/BASIC#Nostalgia). With a bit more research, the options for resurrecting old BASIC code (line-numbered, unstructured) either natively or with suitable correction - as 6502coder pointed out with my ATARI-dialect "Werewolf" example earlier in the thread. And I'll be trying to steer clear of vbasic, QBAS64 and QBasic given the overheads discussed frequently by others wiser than I on a lot of fora (including Murga's)

There are a range of possibilities (current dribblings before I get sucked back into the real world for another year):
1. BaCon GUI + HUG
BarryK's example here (http://bkhome.org/archive/bacon/my-1st- ... index.html) has got me dreaming of converting ye olde BASIC games into neat little C + GTK applications - provided the line numbers/calls are appropriately updated to structured Basic format. However, while at the time of writing Bacon 3.7.3 is available from PPM, the Bacon GUI doesn't appear in the menu. I've dumped the "Werewolves and Wanderer" text in and there are label issues from the get-go. Looks hopeful, will have to pour through the documentation... [http://www.basic-converter.org/] and to what others have achieved under gatordog's inspiration (e.gs., BaCon Bits; BaCon, HUG & Thanks for the fishes.)

2. FreeBASIC plus Geany
FreeBASIC apparently can cope with unstructured BASIC with the old line numbers - but modern flow controls are preferred (and I have to get my head around those). I have spent a *little* time with geany 1.29, but how to save dumped code as an executable *.bac file is something I will have to look into.

3. SDL_basic: SDL-based Basic interpreter
THIS IS WHAT I WAS LOOKING FOR :) Only just found it! Already has Wumpus, Star Trek and a load of other line-numbered programs. In Dpup Stretch 7.5 the 1.0.2 pet from 2009 works OOTB. Menu entry issues at present, but hopeful that *.bas files can be sorted out (there was a post from somebody specifically on this issue). From muggins' readme:
This is an implementation of the language BASIC I made to expose my kids to programming...
So - I'm not the only one :)

4. Gambas3
No line numbers, as far as I can tell. Will have to be translated first into structured BASIC..

5. Online compilers
{INCOMPLETE NOTES example given earlier, other sites found that interpret and/or compile in the browser}

6. Translation (e.g., JSBasic-(GW-Basic dialect required))
{the ideal way I think to link the history with modern flow commands, languages eg javascript, lua, python maybe...}

7. PuppyBASIC/wxBasicScript
{MU's project, stalled but still functional? wxBasicscript is around somewhere, but from what I can see wxBasic (wxWidgets) looks like doing the same job as BaCon+HUG - unless I am much mistaken}
Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

User avatar
6502coder
Posts: 677
Joined: Mon 23 Mar 2009, 18:07
Location: Western United States

#22 Post by 6502coder »

@Puppyt: Speaking of nostalgia...

Intrigued by sdlBasic, I started browsing through the documentation, and in the section on "Graphic and Sound" I ran across this:
"sdlBasic syntax follows the Amos/darkBasic philosophy."
Talk about a blast from the past! I remember AMOS from the Commodore Amiga. It was a version of BASIC with much better sound and graphics support than the native AmigaBASIC. I used AMOS to write a program which was published in an Amiga fanzine--and even got paid for it! And of course the Amiga was the true successor to the Atari 400/800, as Jay Miner was the hardware genius behind both.

Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

#23 Post by Puppyt »

Kudos, 6502coder!
You caught me before I was able to update my last summary with your VintageBasic reference... thanks again.
With regard to your programming history I had a cultural disconnect by comparison - dunno if it was a trend here in Australia but we seemed to jump from the Vic20/C64 era, to Apple IIe and the x386 and x486 PCs - skipping the full effect of the Atari/Amiga console revolutions? (Though my family travelled in the C/PM waters for a while with the Osbourne 1 and Kaypro 10 - while the very first computer rooms at high school were filled with MicroBees). BASIC of some description always seemed to be there (PET Basic, MBasic, SBasic) - but I missed AMOS and darkBASIC,

I posted that 'nostalgia' link as I was feeling a bit like a BASIC Troglodyte beforehand - and then found that there is a bit of an Underground for the learning foundations I recalled. As echoed in muggins' rationale for his sdl_BASIC pet. And pretty much simultaneously but most recently with greater impetus - M$ Small Basic (not to be confused with SmallBasic).

It seems a shame that muggins' efforts went largely unnoticed by the Puppy community. From what I can see, PuppyBasic from MU and David Cuny (wxBasic - and another link with SDL_basic) also went largely by the wayside. PuppyBasic was dropped from the devx of the Puppy 1 and 2 series, and then FreeBasic was included and dropped also from later devx's. BaCon wasn't in the devx for the Dpup Stretch 7.5 I'm writing from, had to install it via PPM but it's missing menu inclusions etc that prolly needs repackaging as a pet to correct, with MIME associations for bac files etc. I'm trying to get familiar with Geany meantimes - would be so naff to get FreeBasic+Geany properly set up to open, edit and execute *.bas files.

I haven't really betrayed that I feel more or less still stuck in the unstructured BASIC era - but willing to hobble as a hobbyist towards unstructured and object-oriented applications. The goal is then to be more acquainted (by proxy?) with other languages - while dragging the old gaming classics along for the ride.
big_bass wrote: <snip> ... so much code so little time ...<snip>
Source: BaCon Bits thread
Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#24 Post by rockedge »

would be so naff to get FreeBasic+Geany properly set up to open, edit and execute *.bas files
I am currently working on just that. Just to see.

I learned BASIC on a PDP-11/70 running RSTS/E operating system...using the most advanced BASIC of its time (1975-80), Digital Basic from the Digital Computer Corp. went on later to QuickBasic 4.5 which I used a lot in it's day on DOS machines. So playing around with QuickBasic 4.5 on DosBox running on a Xenial64 or Tahr64 or the various 32 bit machines around here lately I got to wonder....what if......so I am experimenting with FreeBasic and Geany as the IDE/GUI......

ran once or twice TinyBasic loaded from a paper tape roll through a Teletype 33 with a paper tape reader connected to an Altair 680B home built by our High School computer club networked with the school's PDP-11/70. Good times.....

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#25 Post by rockedge »

the PDP-11/70 had 2 hard disk drives.....both the size of washing machines

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

#26 Post by RetroTechGuy »

I wonder if a Basic to Python converter exists? Both a scripting languages, and might be quite conductive to simply conversion... ;-)
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

#27 Post by Puppyt »


Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

User avatar
6502coder
Posts: 677
Joined: Mon 23 Mar 2009, 18:07
Location: Western United States

#28 Post by 6502coder »

After an evening of research, experimentation, and a lot of trial and error, I was able to set things up so that I can now click on a Vintage BASIC file in a ROX window, and have the program run in a terminal session. Here's how I did it on my Tahr 6.0.6 system. (MIME experts: once you stop laughing, please feel free to post corrections!)

To be clear about what we're trying to achieve, the normal way of running a Vintage BASIC program is to open a terminal and type

Code: Select all

vintbas  myprogram
where "vintbas" happens to be the name of the Vintage BASIC interpreter, and "myprogram" is a BASIC program written in Vintage BASIC. Instead, we want to be able to click on the icon for "myprogram" in a ROX window, and have the program run by the "vintbas" interpreter. I'm using Vintage BASIC but the same procedure should work for any other flavor of BASIC that can be run from the command line in the same way.


WARNING: Step 9 calls for rebooting your system, so be prepared for this.


Step 1. Choose a filename extension for your BASIC programs.

Since I am using Vintage BASIC, I chose the extension ".vbas".

I do NOT recommend using ".bas" because all BASICs are not alike, so it is better to use an extension that is unique to the particular flavor of BASIC you are using.

Step 2. Create a MIME type for your BASIC programs.

Using your favorite text editor, create an XML file similar to this one, which I have named "vintagebasic.xml"

Code: Select all

<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="application/vintagebasic">
    <comment>Vintage BASIC program</comment>
    <glob pattern="*.vbas"/>
  </mime-type>
</mime-info>
Again, you should modify this appropriately to suit the flavor of BASIC you are using.

Step 3. Place the XML file in the /usr/share/mime/packages directory.
Then, in a terminal, give the command

Code: Select all

update-mime-database  /usr/share/mime
Step 4. Using your favorite text editor, create a desktop file for your BASIC interpreter.

Mine is called "vintagebasic.desktop" and it looks like this:

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Vintage BASIC Interpreter
Exec=vintbas
MimeType=application/vintagebasic
Comment=Vintage BASIC Interpreter
NoDisplay=true
Terminal=true
Modify this to suit your flavor of BASIC. Note that in the "Exec=" line, "vintbas" is the name of my Vintage BASIC interpreter program. Substitute the name of your BASIC's executable here.
Also note that the MimeType here must match the mime-type in the XML file.

Step 5. Place your desktop file in the /usr/share/applications directory.

Step 6. Put a copy of your BASIC's executable somewhere in your PATH. I chose to put a copy of "vintbas" in ~/my-applications/bin which is as good a place as any. Make sure the "executable" file in fact has execute permissions!

Step 7. Using your favorite text editor, create an application file. Mine is called "application_vintagebasic" and looks like this:

Code: Select all

exec urxvt -hold -e bash -c "vintbas $1  &&  bash"
Replace "vintbas" with the name of your BASIC interpreter program. Note that the filename must match the MimeType: my MimeType was "application/vintagebasic", so my filename has to be "application_vintagebasic" where the slash changes to an underscore.

Step 8. Put the application file in the ~/Choices/MIME-types directory, and make sure your application file has execute permissions!

Step 9. REBOOT.

Step 10. Create a trivial BASIC test program file and give it your chosen extension. For example, mine was "foo.vbas" and looks like this:

Code: Select all

10 PRINT "Hello, world!"
Step 11. Open a ROX window in the folder ~/Choices/MIME-types.
In another ROX window, right-click on your BASIC program, choose "Set Run Action", and drag your application file (in my case, "application_vintagebasic") from the first window and drop it in the Set Run Action dialogue where indicated.

Step 12. If everything went well, you should now be able to run your test program by clicking on its icon.

NOTE: The run action command I gave in Step 7 will run your BASIC program and leave the terminal window open after the program finishes. This is so that you have a chance to read anything that might be printed by the program. You then have to close the terminal window manually. However, if you'd rather have the terminal window close as soon as the program finishes, delete the "&& bash" from the end of the command.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#29 Post by musher0 »

Hi.

This post basically to get my big toe in the water of this thread -- to keep
abreast of the interesting discussion.

I used to be able to code in Atari Basic (~ 1989) and later in the "super" one
that you had to install. (I can't remember the real name of that BASIC
variant right now, sorry.)

About PuppyT's quote concerning "coding without a plan" -- the following is
just my 2 cents. I know it helps me to outline, beforehand, what i want the
program or script to do, in words, in a kind of "story". (I read somwhere
that doing this is called "writing pseudo-code"?)

Probably it's because of my background, but I find that computer languages
have structures that mimic human languages: if's, but's, negations, capacity
for listing and sorting, definitions, etc. When I have my "story" rather
logically organized, it's time I start coding. As I said, this is just my 2 cents!

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

#30 Post by Puppyt »

Of course your input (toe) is welcome, musher0! (You washed it first?) I reckon you are quite correct on both counts - computer languages [EDIT: are more practical] with meaningful operators, as opposed to more esoteric codings (e.g., C or assembly language), and, having your story straight before coding. I think that is the attraction with BASIC and all its derivatives. Pseudocoding wasn't anything we were taught much back in the day - but it features pretty heavily in my son's current javascript assignment as something really required as part of coding.

Cheers 6502coder for your HOW-TO for getting bas (*.vbas - excellent point) files running de novo in a Puppy environment. I'm going to see about making a Vintagebasic pet for 32-bit Puppy versions - they only have 64-bit debs available (I think), and I'll get back to that and your instuctructible later. Gotta cut down on my waffle :)
Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#31 Post by musher0 »

@PuppyT: I take a relaxing foot bath every day! :lol:
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

#32 Post by Puppyt »

Well - so long as you don't expect a Basic foot massage here - your toe is always welcome :)
Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#33 Post by rockedge »

I surprised myself and successfully compiled a BASIC program with FreeBasic
using Geany as the IDE...for some reason it all worked and made a binary that actually works...it doesn't do much but baby steps are called for here!

Just that I was able to use Geany and it's features with freebasic is a good start.

Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

#34 Post by Puppyt »

Thanks for the update rockedge - meant to respond earlier but got caught up with real-life issues. I was thinking that the Geany+FreeBASIC route is potentially the best for Puppy Linux, given FreeBASIC's QuickBASIC slant with a very similar syntax, and allows for features that are otherwise either impossible of hard to achieve in QB (32bit, high-res graphics modes). FreeBASIC apparently also works perfectly with FreeDOS having also compatibility with many DJGPP libraries - so ideal I guess for people with toes in many waters?
Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

ozsouth
Posts: 858
Joined: Fri 01 Jan 2010, 22:08
Location: S.E Australia

#35 Post by ozsouth »

I use Chipmunk Basic interpreter - minimal but interesting.
Attachments
cbasic365.tar.gz
(109.06 KiB) Downloaded 134 times

Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

#36 Post by Puppyt »

Hi ozsouth,
nice catch with Chipmunk Basic. I can only get the 'cbasic' executive working from within terminal despite making the file executable - but no biggie (Dpup Stretch 7.5 rc3). I was having trouble loading *.bas files, using the Chipmunk manual, but just now found that enclosing the filename in quotes as pictured below, does the deed nicely. Using Geany to correct typos from the "Werewolves and Wanderers" example text from earlier in this thread. Cheers :)
Attachments
chipmunkbas.png
(132.34 KiB) Downloaded 253 times
Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

ozsouth
Posts: 858
Joined: Fri 01 Jan 2010, 22:08
Location: S.E Australia

#37 Post by ozsouth »

@Puppyt - I run (in a terminal, in folder where .bas file is):
cbasic progname.bas

User avatar
puppy_apprentice
Posts: 299
Joined: Tue 07 Feb 2012, 20:32

#38 Post by puppy_apprentice »

More BASIC interpreters from my own .pet archive (hope that will work on another Puppies).

These two are to big to store on forum:

bas-2.4.pet
http://s000.tinyupload.com/index.php?fi ... 7266674771

bwbasic-3.20.pet
http://s000.tinyupload.com/index.php?fi ... 7317291174

Bon Appetit!
Attachments
cbmbasic-2.0.pet
(43.12 KiB) Downloaded 128 times
bas55-1.10.pet
(115.87 KiB) Downloaded 115 times

User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

#39 Post by nosystemdthanks »

RetroTechGuy wrote:I wonder if a Basic to Python converter exists?
i actually worked on converting qb64 to output python instead of c++, but i got bored with it because no one cared about it. its very tedious to edit qb64 to do this (i got as far as for loops, but it had some trouble nesting them.)

so that was the only basic to python converter i know of. and it didnt get far enough to bother linking to it. the source code was huge, the feature list was tiny.

what i was interested in was creating a new language that converted to python-- and it was heavily influenced by basic.

spoiler: i found it easier to translate most of my own basic programs to this language, but its not going to understand traditional basic programs.

one thing i wanted was to try to make the language easier than basic.

right, easier than basic. thats like saying easier than scribbling in crayon (i used basic for > 20 years.)

what i ended up with was a language partly inspired by logo, heavily inspired by qbasic, with some of the nicest features of python.

qbasic:
screen 12
x = 5
y = 10 : pset (x, y), 14

fig:
x = 5
y = 10 : pset(x, y), 14

whats different?

like puppybasic did, fig runs in a term window. it has a shell command like qbasic did. it also has arrshell, which dumps command-line output into an array.

but heres a closer look at the syntax:

x = 5
y = 10 : pset(x, y), 14

suppose youre niklaus wirth, and you want his style of assignment:

x := 5
y := 10 : pset(x, y), 14

there, that works too. but unlike python, "explicit isnt always better than implicit":

x 5
y 10 : pset(x, y), 14

this also works.

maybe you like how turtle graphics in logo doesnt have so much punctuation (it didnt, in some implementations)

x 5
y 10 : pset x y 14

this works. so does this:

x 5
y 10 pset x, y, 14

the variable on the left is the one that gets worked with throughout the line:

x 5
y = x times 10 : print

in basic that would be:

x = 5
y = x * 10 : print y

change the * to times and remove y:

x = 5
y = x times 10 : print

and you have fig code.

only "quotes for strings" and # hashes for comments are required. other syntax is optional.

it has a fixed parameter count per command:

p "hello" left 2

left always has 1 parameter.

it covers variables (including nice array features), input, output (including very basic graphics), basic math (including a few trig functions) and loops, conditionals and functions.

in fewer than 100 commands.

ive used it to remaster puppy, debian, devuan, void linux.

pet package: http://murga-linux.com/puppy/viewtopic. ... h&id=99110

google drive folder: https://drive.google.com/drive/folders/ ... TdXRnpIakU

this thing: https://imgur.com/oZ0zc1M

but it wont translate basic to python.

its the thing i worked on instead of translating to basic to python, because it was more useful to me and translating basic directly wasnt.

i was tired of basic and wanted something inspired by it instead.

i still use basic commands in it like print, int, mid, left, right, pset, cls, line, locate, lineinput...

it does colour changes (i let someone name it colortext, sorry) and locate in the term using ansi escape codes. you dont have to know the codes, it does that for you.

p = arropen "file.txt"
forin each, p
now each print
next

load file.txt into an array named p.

p = arrcurl "http://murga-linux.com/puppy"
forin each, p
now each print
next

i designed it for teaching programming. i wanted a language as easy as basic or easier, that address the features of python that made teaching it harder for beginners.

i realise that python is good for teaching. it was inspired by abc, a similar educational language the python author worked on.

some people have trouble with python. personally, i find fig easier and faster to write in for quite a few tasks.

i still use python when fig isnt enough. so does fig:

now = "inline python:" ; print
python
if 10 == 3 + 7: print ['hey this is inline python'][0]
fig
now "fig code" print
[color=green]The freedom to NOT run the software, to be free to avoid vendor lock-in through appropriate modularization/encapsulation and minimized dependencies; meaning any free software can be replaced with a user’s preferred alternatives.[/color]

Puppyt
Posts: 907
Joined: Fri 09 May 2008, 23:37
Location: Moorooka, Queensland
Contact:

#40 Post by Puppyt »

Thanks for keeping the thread ticking over guys - life has been getting in the way at my end but I'm keeping tabs, hoping to provide a comprehensive 'how to' in due course. (So I can retrace my steps later on, mostly...)

@puppy_apprentice thanks for those pets - much appreciated. bwbasic - is that the version stock-standard with the FreeDOS1.2 release? Will download all to verify...

@nosystemdthanks, thankyou for taking the time to post here - I was reading your earlier posts regarding void earlier today, and skimmed through your [EDIT]"end the distro war" manifesto [in your signature! Missed it second time around] - very interesting read. A position I have applied for asks for (desirable) experience with Python and tensorflow - will have to put my programming abilities (???!) on skates... Appreciate your point about BASIC being supplanted by something like Python, btw.

UPDATE: On re-reading I see you have a lot in common with the ideals of the late contributer to the forum, learnhow2code. I mean that with the best intentions - I was never up-to-speed with some of the debates he was involved with. Please keep it up :)
Search engines for Puppy
[url]http://puppylinux.us/psearch.html[/url]; [url=https://cse.google.com/cse?cx=015995643981050743583%3Aabvzbibgzxo&q=#gsc.tab=0]Google Custom Search[/url]; [url]http://wellminded.net63.net/[/url] others TBA...

Post Reply