emeyeraway
Posts: 146
Joined: Tue Mar 24, 2015 7:11 am

Chipmunk BASIC on RasPi?

Wed Apr 15, 2015 10:49 pm

I used to teach elementary school children simple BASIC using a Mac. I'd like to find out if I could use my RasPi to do this. I was able to download Chipmunk BASIC for Linux, and extract the files. But I have no clue how to start using BASIC. I don't know how to tell RasPi to load the BASIC software. Can anyone help?

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Chipmunk BASIC on RasPi?

Wed Apr 15, 2015 11:28 pm

Search around for FUZE BASIC (there's a couple of old MagPi magazine articles about it). That is a fully fledged version.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Chipmunk BASIC on RasPi?

Thu Apr 16, 2015 1:23 am

The Linux version appears to be a limited version for Intel x86 processors only. So it will not work on the RPi.
http://www.nicholson.com/rhn/basic/
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

MikeDX
Posts: 9
Joined: Thu Nov 27, 2014 9:07 am
Location: Secret FUZE HQ
Contact: Website

Re: Chipmunk BASIC on RasPi?

Thu Apr 16, 2015 2:26 pm

FUZE BASIC V3 will be out really soon! :)
Join me in the lair if you dare
http://lair.fuze.co.uk/

hotpaw2
Posts: 6
Joined: Wed Apr 22, 2015 5:19 pm

Re: Chipmunk BASIC on RasPi?

Wed Apr 22, 2015 5:31 pm

klricks wrote:The Linux version appears to be a limited version for Intel x86 processors only. So it will not work on the RPi.
There is now a Raspberry Pi version of Chipmunk Basic interpreter on the Chipmunk Basic web site:
http://www.nicholson.com/rhn/basic/

Built using raspbian Linux raspberrypi 3.12.22+ gcc version 4.6.3.

emeyeraway
Posts: 146
Joined: Tue Mar 24, 2015 7:11 am

Re: Chipmunk BASIC on RasPi?

Fri Apr 24, 2015 11:23 am

Ron Nicholson has just posted a version of Chipmunk Basic for the Raspberry Pi on his website. The link is given in one of the replies to this topic.

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Chipmunk BASIC on RasPi?

Sat Apr 25, 2015 11:05 am

Ron,

Thank you so much! I have Chipmunk BASIC running on my RPi b+ now, will test some tomorrow on my RPi 2B; my b+ is headless so I can't try the graphics yet; pumped about that!

Thanks again... how did you know? I was all set to send off a letter to you asking for a port... and here it already is! wow...

Obviously, what is needed from an educational standpoint is some special blocks of BASIC code to simplify Raspberry PI coding in the area of i2c, spi, and gpio... there are students all over the globe Ron who would benefit with one more way to talk to the RPi !

Thanks again!

PS I have been using Ron's BASIC on my computers (going back to the first MACs) and I am using his codes on all of my gnu/linux boxes (even my 64 bit ones) with great success as both an educational tool, and for personal pleasure (non commercial). This addition to the Raspberry PI is splendid (even brilliant) and a big fat round of applause for Ron! 8-)

PPS @ Ron, I know you've heard this from me before... so here goes one more time... I really think its time to open this up with a GPLv3 license (of equiv) before one or both of us grows old and dies! Maybe even give it to the Raspberry PI foundation for ownership and maintenance (and be immortally brilliant ! ) ... no pressure, just think about it... please?

Kind Regards,
marcus

'73 W0MHH

:geek:
marcus
:ugeek:

hotpaw2
Posts: 6
Joined: Wed Apr 22, 2015 5:19 pm

Re: Chipmunk BASIC on RasPi?

Sat Apr 25, 2015 6:54 pm

Some GPIO access functions are on the todo list to experiment with after I get my Pibrella board. I'll add SPI and I2C to the potential todo list for future Chipmunk Basic support once I get some interesting test peripheral boards/hats that need such.

Please let me know what you use this for, and if you think there are any features you think it might be interesting or useful to add to a simple Basic interpreter for the Pi.

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Chipmunk BASIC on RasPi?

Mon Apr 27, 2015 3:01 am

I was able to test on the RPi 2B today, and ran into a goofy font related message while trying to run the 'graphics 0' command:

can't open font 6x10

... then the interpreter crashes.

Maybe there is an Xresources entry that would help... don't know... thanks!
marcus
:ugeek:

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Chipmunk BASIC on RasPi?

Fri May 15, 2015 4:33 am

MarkHaysHarris777 wrote:I was able to test on the RPi 2B today, and ran into a goofy font related message while trying to run the 'graphics 0' command:
"can't open font 6x10"
hi folks, sorry to take so long in getting back on this (took a while to track down, then I misplaced my note!)... anyway, there are several important font packages missing from the Raspberry PI Raspbian image, which results in the error message for Chipmunk BASIC when running the 'graphics 0' command:

sudo apt-get install xfonts-base
sudo apt-get install xfonts-100dpi
sudo apt-get install xfonts-75dpi
sudo apt-get install xfonts-terminus

The xfonts-base package is the main one (contains the 6x10 fount needed by BASIC). The fonts get installed in:
/usr/share/fonts/X11/

The misc directory contains the xfonts-base set. From LxTerminal start BASIC with the command basic, then enter the graphics 0 command to display the graphics canvas. This is limited X graphics that works very nicely for function graphing and anything pixels.

I will post my sierpinski program source here in a bit...
marcus
:ugeek:

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Chipmunk BASIC on RasPi?

Fri May 15, 2015 5:18 am

Greetings, I am posting my [ sierpinski.bas ] codes here for use with Chipmunk BASIC for the Raspberry PI. This program opens up the graphics canvas and then plots two sets of 77,000 colorful points as sierpinski sieve 'triangles'. Each set of 77,000 points takes about 15 seconds to plot on the RPi 2B and either set may be interrupted with the Q key. The console reports the total number of points plotted before the Q key was pressed, and also how many points of each color were plotted. Its really a demo program illustrating how to use the X graphics canvas in BASIC.

marcus

Code: Select all

100 ' ********************************************************* 
110 ' ********************************************************* 
120 '   Mark H. Harris      4-24-2010 
130 '       graphics canvas is x:690 y:640 numbered from 0 
140 '           origin (0,0):upper left corner 
150 '             (689,639):lower right corner 
160 '       Change History           
170 '       Color Version  10-08-2013
180 '       ( cym rgb    ) 10-12-2013
190 '
200 ' *********************************************************
210 ' *********************************************************
220 ' GRAPHICS ON and CLEAR   INITIALIZATION 
230 ' *********************************************************
235    input "Resize or Move Console ?";k$
240    graphics 0
245    graphics window 20,70,690,640
250    graphics cls : cls
260    dim k(4,2)
270    dim c(3,3)
280    dim cc$(3)
290    dim set$(2)
300    dim cpts(3)
310 ' *********************************************************
320 ' MAIN    print two sets of sierpinski color triangles 
330 ' *********************************************************
340    for n = 1 to 2 step 1
350 '     initialize arrays from DATA statements
360       gosub 6000
370 '     plot sierpinski points and statistics
380       gosub 5000
390       next n
400 ' *********************************************************
410 '  TERMINATE PROGRAM with BREAK   
420 ' *********************************************************
430    print
440    stop
1000 ' ========================================================
1005 '                  ROUTINES FUNCTIONS DATA
1010 ' ========================================================
5000 ' ********************************************************
5010 ' PLOT 77 THOUSAND RANDOM POINTS to SIERPINSKI CANVAS 
5020 ' ********************************************************
5030 '      PLOT COLOR SIERPINSKI TRIANGLE to CANVAS
5035        i = 0
5040    while i < 77000
5050        p = rnd(3)+1
5060        cpts(p) = cpts(p)+1
5065        i = i+1
5070        gosub 7000
5080        if inkey$ = "q" then exit while
5090        wend
5100 '      DISPLAY STATISTICS to CONSOLE OUTPUT 
5110    print
5120    print "(";set$(1);": ";i;")"
5130    print "(";cc$(3);": ";cpts(3);")"
5140    print "(";cc$(2);": ";cpts(2);")"
5150    print "(";cc$(1);": ";cpts(1);")"
5160    return
6000 ' ********************************************************
6010 ' Load ARRAYS from DATA STATEMENTS
6020 ' ********************************************************
6030 '        LOAD POINT DATA PAIRS INITIALIZING SIER CORNERS
6040    read set$(1)
6050    for i = 1 to 4 step 1
6060      for j = 1 to 2 step 1
6070        read k(i,j)
6080      next j
6090    next i
6100 '        LOAD COLOR DATA PAIRS INITIALIZING CORNER COLOR
6110    for i = 1 to 3 step 1
6120      cpts(i) = 0
6130      read cc$(i)
6140      for j = 1 to 3 step 1
6150        read c(i,j)
6160      next j
6170    next i
6180    return
7000 ' ********************************************************
7010 '        DETERMINE NEW POINT and PLOT WITH CORNER COLOR
7020 ' ********************************************************
7030 '        COMPUTE NEW POINT k(4,1|2), based on p index
7040    graphics color c(p,1),c(p,2),c(p,3)
7050    k(4,1) = (k(p,1)+k(4,1))/2
7060    k(4,2) = (k(p,2)+k(4,2))/2
7070 '        PLOT POINT P TO GRAPHICS CANVAS
7080    graphics pset k(4,1),k(4,2)
7090    return
9000 ' ********************************************************
9010 '        PROGRAM DATA STATEMENTS
9020 ' ********************************************************
9030 '    pSet(1)  FOUR POINT PAIRS       k(x,y) 
9040 data " pSet(1)",50,600,650,600,350,50,50,600
9050 '             THREE COLOR TRIPLETS   (r,g,b)
9060 data "    blue",0,0,90,"   green",0,70,0,"     red",90,0,0
9070 '    pSet(2)  FOUR POINT PAIRS       k(x,y) 
9080 data " pSet(2)",50,50,650,50,350,600,50,50
9090 '             THREE COLOR TRIPLETS   (c,y,m)
9100 data "    cyan",0,90,90,"  yellow",100,100,0," magenta",90,0,90

marcus
:ugeek:

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Chipmunk BASIC on RasPi?

Fri May 15, 2015 7:15 am

hi, since getting the font problem straightened out on my PI(b+) also, I decided to run sierpinski.bas on both PI(b+) and PI(2B) for a comparison because sierpinski ties up one core, and also ties up the gpu: each machine is plotting 77,000 random points to the BASIC X graphics canvas:

PI(b+) : 73 seconds

PI(2B) : 15 seconds


YMMV :shock:



.
marcus
:ugeek:

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Chipmunk BASIC on RasPi?

Fri May 15, 2015 3:10 pm

hotpaw2 wrote:Please let me know what you use this for, and if you think there are any features you think it might be interesting or useful to add to a simple Basic interpreter for the Pi.
hi Ron, for many years I have used Chipmunk BASIC as an educational tool in the same spirit of the original authors (Kemeny and Kurtz, Dartmouth College) http://en.wikipedia.org/wiki/Dartmouth_BASIC

There is a fine nuance between "programming" and "software engineering". BASIC is a wonderful language for teaching "programming" to kids (and other lay-people) who just want to 'talk' to their computer yet have no desire to become software engineers. On the other hand, BASIC is a horrible language for teaching software engineering; in fact some have joked that BASIC causes brain damage. :shock:

I use Chipmunk BASIC personally *primarily* as a graphing programmable calculator, the same way I would use my TI-84 or TI-89 graphing calc. BASIC is a very easy venue for cartesian and parametric graphing. The syntax is easy and the graphics are fast.

Your improvements to Chipmunk to allow Classes has been brilliant and welcome; also, the fact that my graphing functions can be moved between my machines (gnu/linux, mac, and now raspberry PI) is really appreciated.

What is wanted now for Chipmunk on the Raspberry PI is a simple BASIC interface to the GPIO block. Easy i2c and SPI would be nice, but also just the bare bones gpio control (maybe first), and maybe with the Gertboard in mind. There is "still" a BASIC need out here-- thanks for your work!
marcus
:ugeek:

hotpaw2
Posts: 6
Joined: Wed Apr 22, 2015 5:19 pm

Re: Chipmunk BASIC on RasPi?

Fri May 15, 2015 8:58 pm

If you want to try simple GPIO with the current build of Chipmunk Basic for the Raspberry Pi, you can use the Chipmunk Basic sys() command and system$() function in conjunction with the wiringPI gpio shell command.

For example:

Code: Select all

100 rem blink0.bas for Chipmunk BASIC 367b6.05
110 rem blink Pibrella yellow LED on pin 0
120 rem
200 gpio$ = "/usr/local/bin/gpio "
210 cmd1$ = gpio$ + "mode 0 output"
220 print "setup pin 0 for output", sys(cmd1$)
230 n = 0
300 while(1)
310   cmd2$ = gpio$ + "write 0 1"
320   print "LED on", sys(cmd2$),
330   fn sleep(0.5)
340   cmd3$ = gpio$ + "write 0 0"
350   print "LED off", sys(cmd3$)
360   fn sleep(0.5)
370   if len(inkey$) > 0 then exit while
380   n = n + 1
390 wend
400 print n; " times"
420 cmd4$ = gpio$ + "mode 0 input"
430 print "done", sys(cmd4$)
980 bye
990 end

hotpaw2
Posts: 6
Joined: Wed Apr 22, 2015 5:19 pm

Re: Chipmunk BASIC on RasPi?

Fri May 15, 2015 9:20 pm

MarkHaysHarris777 wrote: hi Ron, for many years I have used Chipmunk BASIC as an educational tool in the same spirit of the original authors (Kemeny and Kurtz, Dartmouth College) http://en.wikipedia.org/wiki/Dartmouth_BASIC

There is a fine nuance between "programming" and "software engineering". BASIC is a wonderful language for teaching "programming" to kids (and other lay-people) who just want to 'talk' to their computer yet have no desire to become software engineers.
I happen to strongly agree with this. Not every kid will become a software engineer (developing correct, maintainable, well documented applications, etc.). But it still might be good for lots and lots of kids to learn a little about programming and have fun making their computer do silly but interesting stuff. (Sort of like the difference between taking chem 101 and having a blast making a mess in the yard with mentos and diet coke.) Plus, I think there is a reason that a large number of great programmers started out playing with an 8-bit personal computer with only BASIC built-in. Those computers made programming extremely accessible.

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: Chipmunk BASIC on RasPi?

Sat Apr 09, 2016 6:51 am

hi folks,

I have recently purchased two PI 3B boards from MCM Element14 with the noobs card included, one with each unit. I then installed Raspbian from there on both units. I was surprised to find (on the first unit) that Chipmunk BASIC with full graphics ran great, and I didn´t have to install the fonts packages that are typically missing from Raspbian--- whoohoo I thought it was fixed; but, alas, on the second unit the fonts were still missing.

So, again, not all noobs cards are the same, probably do to storage on the distributors shelf. On the second machine I installed the missing fonts packages (see above in this thread) and all is good.

xfonts-base is the one needed for Chipmunk BASIC to work properly (graphics won´t start without it).

Cheers
marcus
:ugeek:

Return to “Beginners”