Author Topic: RTB - Return to BASIC  (Read 30730 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
RTB - Return to BASIC
« 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.

  • Socket support
  • OS (SYSTEM) calls
  • External library access
  • Non-embeddable
  • Module (class) scope

Ubuntu 12.04 64 bit


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



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




Language Reference Manual (PDF)

Download and install info

This is a more feature rich version of an interactive BASIC than MY-BASIC is. I'm looking at porting it to Android.
« Last Edit: August 06, 2013, 11:56:59 PM by JRS »

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RTB - Return to BASIC - Android / SDL
« Reply #1 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.




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.



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

« Last Edit: August 15, 2013, 01:21:48 PM by JRS »

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RTB - Return to BASIC - RTB Mandelbrot - Android SDL
« Reply #2 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)



Note: The background SDL user interface controls can be toggled off with the application preference menu option.

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RTB - Return to BASIC
« Reply #3 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.


Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RTB - Return to BASIC - Snowflake
« Reply #4 on: August 14, 2013, 10:32:16 PM »


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

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RTB - Return to BASIC
« Reply #5 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)
« Last Edit: August 16, 2013, 11:55:09 AM by JRS »

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RTB - Return to BASIC
« Reply #6 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.




Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
RTB - Return to BASIC - Android & Ubuntu 64 bit Betas
« Reply #7 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.
« Last Edit: January 14, 2014, 12:28:55 AM by John »

Offline scruss

  • Contributor
  • Posts: 6
    • We saw a Chicken ...
Re: RTB - Return to BASIC
« Reply #8 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.

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RTB - Return to BASIC
« Reply #9 on: August 16, 2016, 08:26:36 PM »
Hope this helps.


Offline scruss

  • Contributor
  • Posts: 6
    • We saw a Chicken ...
« Last Edit: August 21, 2016, 02:41:11 PM by scruss »

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RTB - Return to BASIC
« Reply #11 on: August 17, 2016, 01:42:18 PM »
Thanks Stewart for your contribution creating the RTB archive.
« Last Edit: August 17, 2016, 07:10:44 PM by John »

Offline drogon

  • BASIC Developer
  • Posts: 11
    • Drogon Projects
Re: RTB - Return to BASIC
« Reply #12 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

Offline John

  • Forum Support / SB Dev
  • Posts: 3510
    • ScriptBasic Open Source Project
Re: RTB - Return to BASIC
« Reply #13 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?

Offline drogon

  • BASIC Developer
  • Posts: 11
    • Drogon Projects
Re: RTB - Return to BASIC
« Reply #14 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