BASIC Developer & Support Resources > Interpreters

RTB - Return to BASIC

(1/7) > >>

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
[*]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.

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.

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.

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.


--- Code: ---HGR
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#
  c = 1
  X = StartX
  Y = StartY
  Angle = AnglePattern(0)
  WAIT (1)
    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
  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)
  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
  NumSides = NumSides * 4
  SideLength = SideLength / 3

--- End code ---


[0] Message Index

[#] Next page

Go to full version