All BASIC

BASIC Developer & Support Resources => Interpreters => Topic started by: John on August 06, 2013, 07:22:20 PM

Title: RTB - Return to BASIC
Post by: John on August 06, 2013, 07:22:20 PM
RTB is a modern BASIC it has while/until looping constructs and named functions and procedures which can have local variables and be called recursively. It has  simplified colour scheme (or you can use all 24-bits if you like), and the usual point, line and shape drawing primitives as well as some nice turtle graphics commands.

Missing features that ScriptBasic includes.


Ubuntu 12.04 64 bit
(http://files.allbasic.info/RTB/rtb.png)

jrs@laptop:~/rtb$ ./rtb
Screen/Keyboard initialisation:
  Standard font selected
  Screen resolution of 640 x 480 selected.
  Screen Bits Per Pixel set to: 32

(http://files.allbasic.info/RTB/rtb_mandel.png)

FYI: That's seconds to complete the Mandelbrot rendering.

(http://files.allbasic.info/RTB/rtb_circles.png)


Language Reference Manual (http://project-downloads.drogon.net/rtb/rtb.pdf) (PDF)

Download and install info (https://projects.drogon.net/return-to-basic/rtb-download-and-install/)

This is a more feature rich version of an interactive BASIC than MY-BASIC is. I'm looking at porting it to Android.
Title: Re: RTB - Return to BASIC - Android / SDL
Post by: John on August 14, 2013, 11:54:27 AM
I have made some progress with porting RTB (Return to BASIC) to Android native with SDL support. There are still unicode issues which SDL (1.2) for Android doesn't support. For example I can't type in a quote character and keyboard entry seems a little slow. It's cool just to see it running even though it it isn't ready for prime time. I would like to thank Роман (C4droid author) for his help getting the project to this point.

(http://files.allbasic.info/RTB/rtb_android.png)


The Kdb graphic toggles the keyboard.
The arrow key in the upper right corner I'm thinking is a like the Android back key in the standard toolbar.
The circle with arrows seems to be a mouse pad and the center being a return/right mouse button.

These background keys are controlled via the apps SDL preference menu which is a nice codeless feature users will like.

(http://files.allbasic.info/RTB/c4droid_sdl.png)

It's nice to see a native C application interacting with the Android Java VM.

Title: Re: RTB - Return to BASIC - RTB Mandelbrot - Android SDL
Post by: John on August 14, 2013, 03:26:11 PM
I cheated and added a SDL (button one) to do the double quote for me so I could load one of the demo files. (Mandelbrot Set)

(http://files.allbasic.info/RTB/mandel_android.png)

Note: The background SDL user interface controls can be toggled off with the application preference menu option.
Title: Re: RTB - Return to BASIC
Post by: John on August 14, 2013, 04:06:58 PM
C4droid generates a rtb.apk when exporting a SDL based application. As soon as I get the unicode / keyboard codes worked out, I'll post the rtb.apk for others with Android devices to help test it out.

Title: Re: RTB - Return to BASIC - Snowflake
Post by: John on August 14, 2013, 10:32:16 PM
(http://files.allbasic.info/RTB/snowflake.png)

Code: [Select]
HGR
RAD
DIM AnglePattern(3100), TempPattern(3100)
Angle = 0
c = 1
r = 1
NumSides = 3
AnglePattern(0) = -30
AnglePattern(1) = 120
AnglePattern(2) = 120
StartX = gwidth / 2
StartY = gheight / 4
SideLength = 300
//CONST PI = 3.141592654#
CYCLE
  c = 1
  X = StartX
  Y = StartY
  Angle = AnglePattern(0)
  WAIT (1)
  CYCLE
    NewX = X + SIN (Angle * PI / 180) * SideLength
    NewY = Y + COS (Angle * PI / 180) * SideLength
    Angle = Angle + AnglePattern(c)
    //LINE (X, Y)-(NewX, NewY), r
    COLOUR = r
    LINE (X, Y, NewX, NewY)
    IF (c = (NumSides - 1)) THEN c = 0
    c = c + 1
    X = NewX
    Y = NewY
    UPDATE
  REPEAT UNTIL (INT (X) = INT (StartX)) AND (INT (Y) = INT (StartY))
  r = r + 2
  FOR b = 0 TO NumSides - 1 CYCLE
    TempPattern(b) = AnglePattern(b)
  REPEAT
  IF NumSides * 4 > 4000 THEN END
  FOR b = 0 TO NumSides - 1 CYCLE
    AnglePattern(b * 4) = TempPattern(b)
    AnglePattern((b * 4) + 1) = -60
    AnglePattern((b * 4) + 2) = 120
    AnglePattern((b * 4) + 3) = -60
  REPEAT
  NumSides = NumSides * 4
  SideLength = SideLength / 3
  UPDATE
REPEAT
Title: Re: RTB - Return to BASIC
Post by: John on August 16, 2013, 11:48:11 AM
I was able to create a RTB (Return to BASIC) APK installable Android application. I'll post it after the keyboard issues are resolved. What is interesting and the reason for this post is RTB is a .so (shared object / dynamic link library) when in this form. My understanding at this point is the SDL plug-in is a JNI gateway and your native Linux code is wrapped in a shared object.

This is more in line of what I was hoping for. I could use SDL as my IDE/UI and embedded ScriptBasic which already plays well as an embeddable runtime scripting engine.

My goal at this point is to get the RTB keyboard working and maybe if it's not too difficult add a way to define the starting screen size based on device full screen size. (depending on portrait or landscape orientation)
Title: Re: RTB - Return to BASIC
Post by: John on September 02, 2013, 07:56:53 AM
Hope your new tablet arrives today.  :o

The author of C4droid has the latest SDL 2 and native console app APK generation enhancements released on Play.

I also hope that the BASIC developers that are members of the All Basic developers forum chime in and share each others talents making each BASIC a little bit better.



Title: RTB - Return to BASIC - Android & Ubuntu 64 bit Betas
Post by: John on January 13, 2014, 11:44:48 PM
I was able to get RTB (Return to BASIC) working with the same (almost) fix I made for the Brandy BASIC V Android version. I would be interested in which interactive BASIC you like more and if someone wants to do some benchmarking, all the better. The Ubuntu 64 bit version of RTB is also attached.

Quote
Sprites are (usually) small rectangular or square bitmap images which you can move round the screen under program control. You can create them using one of the many graphical image creation packages available. The file-form at is 24 bits per pixel BMP, and a colour of 254,254,254 is transparent.

LoadSprite (filename$)

This loads a sprite from the supplied fine into memory and returns a handle to the internal sprite data. You need to use the number returned in all future sprite handling functions/procedures.

PlotSprite (sprite, x, y)

This plots the given sprite at the suppled x, y coordinates. The coordinates specify the bottom-left corner of the bounding rect-angle of the sprite.

DelSprite

This removes a sprite from the screen. You do not have to erase a sprite from the screen when you move it, just call PlotSprite with the new coordinates.

Sprites is a big advantage over Brandy BASIC V.
Title: Re: RTB - Return to BASIC
Post by: scruss on August 16, 2016, 07:29:58 PM
Hi - do you still have the source archive for RTB, please? There were a couple of versions that were GPL V3, but Gordon's withdrawn the source of later versions. Unfortunately, your Doxygen archive isn't useful for building the project.
Title: Re: RTB - Return to BASIC
Post by: John on August 16, 2016, 08:26:36 PM
Hope this helps.

Title: Re: RTB - Return to BASIC
Post by: scruss on August 17, 2016, 06:04:36 AM
Thank you!

Archived at scruss/rtb: Gordon Henderson's “Return to Basic” interpreter — GPL 3 version of 2013-01-27 (https://github.com/scruss/rtb)
Title: Re: RTB - Return to BASIC
Post by: John on August 17, 2016, 01:42:18 PM
Thanks Stewart for your contribution creating the RTB archive.
Title: Re: RTB - Return to BASIC
Post by: drogon on September 28, 2018, 11:16:16 PM
Hello,

After an automated email suggesting my account here hadn't been used for some time, I had a look-in and found a thread about RTB - Yay  :)

Yes, there is no current source - I may re-publish at some point. Many reasons but note there is a commercial version called FUZE that started as a simple "re-branding" which turned into the FUZE people buying a source code license and taking development further. I have done my own further development on it though, so maybe some time in the future I'll release an update.

A few points from Johns post some 5 years back - it will never (well my released versions will never!) have class support because that's just not my thing. Embeddable? Well, later versions can be run using the "shebang" method and chmod +x the file. OS calls are there via system(), popenIn() popenOut() - although I'd need to check what version they came in at. Sockets - no. Really not sure how to make them work in the RTB environment - although a simple blocking socket might work - I did sketch plans to put in enough to make a single-threaded web server though.

(There is built-in sockets transparent to the user to talk to a Raspberry Pi Minecraft server though)

Anyway, thanks for noticing it - I'm actually using it with some clients to produce graphical front-ends to various remote sensors, running on a Raspberry Pi - mostly because it's quick and easy and talks to the Pi's GPIO, etc. via my wiringPi library - an experiment I did a while back was to boot a Pi directly into RTB - which it can do in under 5 seconds. Not quite the instant on of the Apple II, etc. but that's progress for you.

An example of a more recent bit of code I wrote for it is here: https://unicorn.drogon.net/wumpus.rtb

Not sure where I'm taking it - currently looking at a retro 8-bit micro system with the challenge to make it work there, but who knows.

Cheers,

-Gordon
Title: Re: RTB - Return to BASIC
Post by: John on September 29, 2018, 09:58:05 AM
Great to hear from you again Gordon!

It wasn't an automated e-mail but more of a roll call for All BASIC members forgetting about the resource.

Are you still driving and programming?
Title: Re: RTB - Return to BASIC
Post by: drogon on September 29, 2018, 10:17:44 AM
Presume you meant diving (scuba) there :)

Sadly, no. After 20 years of it, Illness and some family issues took their toll. Programming - yes, but also running a small home-based microbakery. Long story. It does feature a Pi controlled oven though...  https://projects.drogon.net/raspberry-pi-controlled-oven/

I should make an effort to release a new version of RTB - I've changed a lot sinec back then and it's about 30% faster. it seems to run OK under 64-bit Linuxes as well as 32-bit ones. Soon... (or, as we say in Devon, direc'ly - which is like manjana without the sense of urgency)

-Gordon
Title: Re: RTB - Return to BASIC
Post by: John on September 29, 2018, 10:27:54 AM
I thought you were driving a truck commercially for a living. and you had an app for drivers.

Am I confused and have you mixed up with someone else?
Title: Re: RTB - Return to BASIC
Post by: drogon on September 29, 2018, 10:35:41 AM
Obviously confused :)

-Gordon
Title: Re: RTB - Return to BASIC
Post by: John on September 29, 2018, 10:37:30 AM
Sorry!
Title: Re: RTB - Return to BASIC
Post by: drogon on September 29, 2018, 10:45:06 AM
No worries...

I did write some scuba diving decompression software once upon a time though - diving app, driving app... ah well!

-Gordon

Title: Re: RTB - Return to BASIC
Post by: John on September 29, 2018, 10:58:39 AM
Peter Verhas (Script BASIC author) is an avid scuba diver. Not sure he is still active with all the Java books he has released lately.
Title: Re: RTB - Return to BASIC
Post by: John on September 29, 2018, 04:07:09 PM
I checked out your site and now remember your other obsession, baking. My new distraction is furnature refinishing.

BTW: I now remember who had the truck drivers app. It was written in B4A for Android devices.
Title: Re: RTB - Return to BASIC
Post by: neilld on October 01, 2018, 02:36:39 AM
Hi, Stumbled onto this thread following the "reminder" email.  Was using RTB for some domestic "hobby" stuff until development/support dried up. Now using FUZE Basic which is OK for my needs.
Jus installed your RTB apk for android to a geriatric tablet and it seems to work.  Do you have any guidance notes anywhere (I seeem to have six squares and an arrow key symbol on my screen - not sure what they do?

thanks & regards

DFN
Title: Re: RTB - Return to BASIC
Post by: drogon on October 01, 2018, 02:53:31 AM
Hi, Stumbled onto this thread following the "reminder" email.  Was using RTB for some domestic "hobby" stuff until development/support dried up. Now using FUZE Basic which is OK for my needs.

There was never really any support for RTB - as a hobby project it just ticked along, as it does now. Maybe let me know what's missing in RTB and I'll put it on the board for another release?

-Gordon
Title: Re: RTB - Return to BASIC
Post by: John on October 01, 2018, 10:21:54 AM
I think that was my attempt to compile RTB on Android native. I use C4Droid which creates the app container you see. The background graphics are arrow keys and a return. You can also define hot keys with the container. It's pretty old and was just an experiment.

Have Fun!
Title: Re: RTB - Return to BASIC
Post by: neilld on October 03, 2018, 08:34:09 AM


There was never really any support for RTB - as a hobby project it just ticked along, as it does now. Maybe let me know what's missing in RTB and I'll put it on the board for another release?

-Gordon
[/quote]
Hi,
My needs are fairly simple, access to GPIO, Analogue inputs via external a/d converter and serial comms via USB.
The latest version of FUZE Basic has a nice softPWM feature which gives the option of PWM output from any GPIO pin (think the Raspberry Pi has only one GPIO pin which can be configured as PWM).  This is useful for speed controlling motors etc.

regds.

DFN
Title: Re: RTB - Return to BASIC
Post by: drogon on October 03, 2018, 09:28:18 AM


There was never really any support for RTB - as a hobby project it just ticked along, as it does now. Maybe let me know what's missing in RTB and I'll put it on the board for another release?

-Gordon
Hi,
My needs are fairly simple, access to GPIO, Analogue inputs via external a/d converter and serial comms via USB.
The latest version of FUZE Basic has a nice softPWM feature which gives the option of PWM output from any GPIO pin (think the Raspberry Pi has only one GPIO pin which can be configured as PWM).  This is useful for speed controlling motors etc.

regds.

DFN
[/quote]

Those features should be in the current release, (as it's the same version that the fuze people initially got), but I'll check.

The working version uses my wiringPi extensions library, so to add in (say) and mcp3004 ADC, then you'd execute

  wpiExtension ("mcp3004:0:200)

then you have

  analogRead (200)

200 through 207, etc.

sOpen() and other serial functions ought to be there too - check the manual at https://unicorn.drogon.net/rtb.pdf you just need to path to the serial device - /dev/ttyACM0 or /dev/ttyUSB0 or whatevre your usb serial gives.

However I've got some time early next week so will go through it all. Currently I make a Pi release and Linux x32 and x64 releases. There is a network extension that lets you control Pi GPIO pins from another Pi or generic  Linux box too.

Cheers,

-Gordon
Title: Re: RTB - Return to BASIC
Post by: John on October 03, 2018, 02:04:29 PM
DFN,

Was your Android questions about RTB curiosity or a platform of intetest?
Title: Re: RTB - Return to BASIC
Post by: neilld on October 06, 2018, 01:40:48 PM
Gordon,
Thanks for info.  I think the last time we communicated (by email) the ADC feature was not available  but would like to revisit.  The FUZE version only talks to an 8 bit ADC which is a bit limiting.

John,
I currently focus on Raspberry Pi for various "home" projects (security, data logging etc.)
My interest in the Android version was more to see if I could get it to work and to see what (if anything) I could do with it.

thanks

DFN
Title: Re: RTB - Return to BASIC
Post by: neilld on October 08, 2018, 09:04:25 AM


-Gordon
[/quote]
Hi,
My needs are fairly simple, access to GPIO, Analogue inputs via external a/d converter and serial comms via USB.
The latest version of FUZE Basic has a nice softPWM feature which gives the option of PWM output from any GPIO pin (think the Raspberry Pi has only one GPIO pin which can be configured as PWM).  This is useful for speed controlling motors etc.

regds.

DFN
[/quote]

Those features should be in the current release, (as it's the same version that the fuze people initially got), but I'll check.

The working version uses my wiringPi extensions library, so to add in (say) and mcp3004 ADC, then you'd execute

  wpiExtension ("mcp3004:0:200)

then you have

  analogRead (200)

200 through 207, etc.

sOpen() and other serial functions ought to be there too - check the manual at https://unicorn.drogon.net/rtb.pdf you just need to path to the serial device - /dev/ttyACM0 or /dev/ttyUSB0 or whatevre your usb serial gives.

However I've got some time early next week so will go through it all. Currently I make a Pi release and Linux x32 and x64 releases. There is a network extension that lets you control Pi GPIO pins from another Pi or generic  Linux box too.

Cheers,

-Gordon
[/quote]

Gordon,
Checked back through my notes.  The last version of RTB that I used was 2.20 (September 2015)  but there was a version "in the works"  (2.22) which I think was to include the features mentioned above (ADC,softPWM etc.)
Is this the version now available on your site?

thanks

DFN
Title: Re: RTB - Return to BASIC
Post by: drogon on October 09, 2018, 01:06:45 PM
Just to update - I've been going through some of the code today, running all my tests on it after some recent changes, so I hope to post new versions soon. They will be Pi .deb's as well as Debian/Devuan .debs (x86 and x86_64) as well as a .tgz that might work on other Linuxes. I don't have the resources to build for other platforms.

Things added since the last release include a new way to add wiringPi extensions as well as direct I2C access code - in as much as you can handle bytes in RTB (all numbers are 64-bit doubles internally) There are some tweaks to the associative array code too (not that I've found anyone who uses it though).

-Gordon
Title: Re: RTB - Return to BASIC
Post by: John on October 09, 2018, 02:08:47 PM
Outstanding Gordon!

I'm looking forward to another round with your BASIC.

The All BASIC wiki is an available resource if documenting RTB and promoting its features are of interest.
Title: Re: RTB - Return to BASIC
Post by: neilld on October 11, 2018, 07:31:51 AM
Gordon,
Just revisited this & find that although the version listed for download on your site suggests that it is v2.20, in fact the version installed is 2.24 and the features mentioned previously (softPWM, ADC, etc) are all there.

thanks

DFN