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:

#16 Post by Puppyt »

Cheers 6502coder - no that's all good with the debugs of course - just illustrating how quickly I get derailed even when things are working :)

Anyone have ideas on how to get BAS files automatically executable via vintbas, from within ROX-filer?
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
8Geee
Posts: 2181
Joined: Mon 12 May 2008, 11:29
Location: N.E. USA

#17 Post by 8Geee »

A few words about AtariBASIC.
Its rather close to C64 BASIC and its a precursor to IBM/Sinclair BASIC used in the mid 80's.

IIRC SinclairQL BASIC also introduced String-slicing using the "TO" command within the Range i.e. A$ = B$(1 TO 4) Optionallly the 1 or the 4 could be omitted indicating, respectively, start or end of B$. This deprecated the use of MID$, LEFT$ and RIGHT$ commands.

Regards
8Geee
Linux user #498913 "Some people need to reimagine their thinking."
"Zuckerberg: a large city inhabited by mentally challenged people."

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

#18 Post by 6502coder »

8Geee wrote:A few words about AtariBASIC.
Its rather close to C64 BASIC and its a precursor to IBM/Sinclair BASIC used in the mid 80's.
I'd be interested in your source for this.

Atari BASIC was developed by Shephardson Microsystems in 1978-9 specifically for Atari. This BASIC had a number of idiosyncracies that distinguished it from other BASICs of that era, and as far as I know it was never used on any platform other than Atari.

The Wikipedia entry for Sinclair BASIC says it was developed by Nine Tiles in 1979, with nothing to suggest that the Nine Tiles product was in any way a derivative of Shephardson's work. Moreover, the Sinclair was a Z80 machine and the Atari was a 6502 machine, making such a borrowing seem rather unlikely, as the two CPUs had radically different architectures especially with regard to the use of registers and page zero memory.

As for "IBM" BASIC, this was simply Microsoft BASIC under license from Microsoft. Microsoft BASIC's progenitor was Altair BASIC, which is perhaps what you are confusing with Atari BASIC.

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

#19 Post by 6502coder »

Puppyt wrote:Anyone have ideas on how to get BAS files automatically executable via vintbas, from within ROX-filer?
I'm no ROX expert but I believe that in order to set a run action for .BAS files you'd first have to create a new MIME type corresponding to .BAS files:
http://puppylinux.org/wikka/AssociateFiles
I've never tried creating a new MIME type but based on the dire warnings in the Wikka and some vague recollections of there being some gnashing of teeth on the forum about this not really working correctly, I'd certainly wait for guidance from a ROX expert!

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

#20 Post by Puppyt »

Funny how old habits die hard - if at all... had too much time on my hands recently and thought to assist my son with a high school assignment in javascript, found myself recalling my old and sketchy history with BASIC. Back here over a year later. Should update this thread with something that others may find useful:

1. vovchik recommends BaCon for optimal BASIC-like functions
BaCon - Bash-based Basic-to-C converter/compiler (and there are other statements he makes elsewhere outlining its superiority over QBasic and similar resource-heavy compilers. vovchik I have found everywhere (it seems!) on other fora and sites with applications - that is good enough for me :)
UPDATE: http://bkhome.org/archive/bacon/ (talk about missing the wood from the trees :oops: )

2. I missed mentioning other native forms of BASIC in or available for Puppy - [EDIT wxbasicscipt]/PuppyBasic (e.g.,wxBasic (Gtk2) - interpreter for grafical wxBasic apps, PuppyBasic 2.6 (updated august, 06, 2008); GTKBasic (e.g., GtkBasic 003e - small Basic interpreter/IDE - 3300 functions

3. Recent updates on the wider BASIC environment, including links to sites/applications that can (?) convert unstructured (line numbered) BASIC code into structured javascript. Coupled with BaCon, a few avenues for updating old BASIC code and understanding into modern language/functionality?
Puppyt wrote:<snip>
Well - the son had a Yahtzee javascript assignment for school to knock off later this week, and I volunteered to put my head in the noose and help him out using only first principles I had from my (our??) high-school epoch of BASIC, Pascal, Fortran, etc. It's a recent addition to the curriculum, and the teachers are learning as they go - even I am able to spot errors in the coding they have been providing the kids (missing semicolons, etc etc).

I caught a recent post of yours reminiscing of the good ol' days with BASIC - and I've hassled the Puppy forums in the past for help with interpreters, use of Bacon etc etc. When Usborne first open-sourced their series of '80's books of BASIC games (https://usborne.com/misc/news/coding-books/) I was in on a series of Facebook posts with mates from Blizzard, former programmers from Auran (Brisbane) etc who stated how important their background in (early, line-numbered) BASIC was in providing error-checking discipline and structuring ideas for software. And lo - Usborne have picked up on that in their recent promotional material!

So I was looking for a way to motivate my children to write their own software/games, and built up a large library of code from GWBasic, QBasic, and line-numbered BASIC dialect sources including code from the Usborne PDF books. No dice :(
So then yesterday after some wins on the Javascript assignment I was looking for a solution to 'pipe' the BASIC into Javascript - and thereby kill all birds with one stone toolset. I found JSBasic - and while it will be a struggle for me to get it working in Puppy natively, I mucked around with the online converter and it looks promising as a possibility.

And while there are loads of javascipt Yahtzee tutorials online on youtube etc which my son has been working through, I am always(?) hopeful of inspiring him to actively create - rather than exist as a passive consumer of products. I thought a BASIC foundation would be ideal. GAMBAS could have been useful, in that regard.
Cheers :)

===================
some references from a historical hunt:
http://x11-basic.sourceforge.net/
http://tab.thinbasic.com/
http://www.hoist-point.com/applesoft_basic_tutorial.htm
http://www.purebasic.com/index.php
http://games.freebasic.net/dumpbyid.php?input=113
http://basic.mindteq.com/index.php?i=popular
freeBASIC notes to self - http://www.murga-linux.com/puppy/viewtopic.php?t=21650; http://www.murga-linux.com/puppy/viewtopic.php?t=37614; https://www.freebasic-portal.de/downloads/: smallBASIC http://smallbasic.github.io/pages/download.html
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...

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

Post Reply