User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Sun May 19, 2019 7:41 pm

Or a BASIC that can be used from a terminal, like the good old days!
Most commercial users of ScriptBasic use a browser interface to the BASIC.

Control Solutions - ScriptBasic

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Sun May 19, 2019 7:48 pm

Interesting the dedicated Python board post count don't extend beyond one page. The ScriptBasic thread just exceeded the 600 post threshold.

It looks to me that ScriptBasic deserves it's own board. Of course this would mean moderators would need to stop shaking their ugly stick at me when some whiner gets upset.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Sun May 19, 2019 8:07 pm

ScriptBasic,
Most commercial users of ScriptBasic use a browser interface to the BASIC.
That is cool.

Not quite what I had in mind. I'd like to have a stand alone system. Just talk to it's command line over a serial link from minicom or putty or whatever terminal.
Interesting the dedicated Python board post count don't extend beyond one page. The ScriptBasic thread just exceeded the 600 post threshold.
What on Earth are you counting there?

The Python section here has nearly 400 pages of posts, 9380 Topics, 55750 posts.
It looks to me that ScriptBasic deserves it's own board.
Dream on.

Over the years an own board has been suggested for many languages that have orders of magnitude more users than ScriptBasic. Or all BASICs combined I imagine.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Sun May 19, 2019 8:11 pm

I was referring to the first page of threads on the Python board. Other than the sticky thread, none exceed one page.

I think a poll should be created as a way to get community approval.

At this point the https://RaspberryBASIC.org forum is the only representation BASIC gets.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Sun May 19, 2019 8:29 pm

Heater wrote: Not quite what I had in mind. I'd like to have a stand alone system. Just talk to it's command line over a serial link from minicom or putty or whatever terminal.
The sbhttpd application server is what is used under the covers for the browser interface.

ScriptBasic supports a socket connection native as another option if ssh won't work for you. Opening a serial port connection is also doable.
Dream on.
Dreams are unacomplished reality.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Sun May 19, 2019 8:35 pm

Thing is I'm aiming to have my RISC V creation running on small FPGA boards. Currently it's on a Terrasic DE0-Nano. I want to use it on 20 dollar Lattice devices. Think of it like an Arduino but with a 32 bit RISC V processor and perhaps 32MB of SDRAM space. The only way to get a socket connection would be to add a ESPxx device or some such to the mix.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Sun May 19, 2019 8:58 pm

I would try your serial port connection idea.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Sun May 19, 2019 9:05 pm

But the question is, is it easy to get ScriptBasic to run on a processor with no operating system under it?

I can always tweak it to talk to the UART but if it requires a file system or pthreads or whatever that would be too much.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Sun May 19, 2019 9:30 pm

The commercial users use POSIX OS.

I'm lost to help you if you are trying to run on a device with no OS.

hippy
Posts: 5373
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Sun May 19, 2019 10:00 pm

Is there any up to date reference for writing ScriptBasic extensions ?

In particular what argument characters and RETURN wording is used for 'int32', 'uint32', 'int64', 'uint64', 'float', 'double', and 'char*' types ?

besARGUMENTS("...")
besRETURN_...(value);

And what does one do if a parameter is parsed but the value it has isn't valid for the function ? I suppose I'm asking how one throws an error from within a ScriptBasic extension.

I looked, but the difficulty of finding anything current and relevent about ScriptBasic remains a major problem.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Sun May 19, 2019 11:24 pm

The SciptBasic repo (sandbox) there is an extensions project. I would recommend looking at the extensions that go with the core build as well.

Have you looked at the GPIO extension module as an example? That extension is just a wrapper to the code you already know.

Post your code and I'll help you make a ScriptBasic extension out of it. The shat extension returns all its multi-variable results via arguments passed undef.

ScriptBasic uses Variadic functions and allows optional argument passing. You can return values (including arrays) via the argument variables. (IUP INFO is a good example)

The API uses macros / defines extensively to hide all the object pointer magic.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11859
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: ScriptBasic

Mon May 20, 2019 12:16 am

ScriptBasic wrote:
Sun May 19, 2019 8:11 pm
I think a poll should be created as a way to get community approval.
polls on this forum are seen as undesirable, and only used in rare cases, in fact I know of none that is currently running..
They are seen as childish attention seeking mechanisms, and are generally deleted if one pops up, and a complaint is made about it.

although I am a big fan of (BBC) BASIC myself, I don't see such enthusiasm around me much, unfortunately.

the length of a thread is more an indication that BASIC is a disputed subject than anything else, and it seems script BASIC isn't one of the more popular implementations of the language I fear, and being zealous about it seems to hurt, not help the acceptance of it.

For some strange reason people think BASIC is an archaic language, perhaps because only microsoft tried to push a modern implementation, and they seem to have given up on it.

These days its role seems to have been taken over by Python, which has many of BASIC's strengths, such as its immediacy, it runs your code directly without visible compiling. it just has a few unfortunate traits, such as two competing versions, and its use of whitespace.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon May 20, 2019 12:20 am

BASIC is like hanging out all day in your PJ's while still getting stuff done.

When a topic like "Why avoid BASIC on the RPi" goes almost 100 pages, I don't think you're alone.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon May 20, 2019 12:36 am

polls on this forum are seen as undesirable, 
Voting has taken a hit with brexit, US elections, ... and trying to be heard seems pointless.

I rarely use moderation on the forums I facilitate. It just creates members with unquestionable attitudes

Moderation (forum management) to me is an invisible task. Someone spams the forum or acts like a jerk, they're gone no questions asked..

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon May 20, 2019 1:10 am

ScriptBasic is seriously late to the RPi party and trying to tell a story that SB isn't your grandfather's BASIC. Its major use is an embedded scripting language in BACnet controllers. ScriptBasic is really an API that I'm 'selling' as pre-assembled goods.

My theory is once someone tries ScriptBasic it's up to the language to keep the interest flowing. No one wants to be the first to try it. I think key members of this forum have testified it doesn't bite.

Can I file a complaint that there needs to be a dedicated BASIC board? Complaints rather then suggestions seem to have more pull.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon May 20, 2019 3:57 am

ScriptBasic,
Its major use is an embedded scripting language in BACnet controllers.
I'm confused.

I know nothing of BACnet controllers but I see here https://www.ccontrols.com/tech/bacnet.htm they are industrial strength controller boxes. That is to say rugged embedded-system computers with suitable interface for building control and the like. Sweet.

All this talk of ScriptBasic being used in embedded systems is why I thought it might be useful on my FPGA SoC projects which are typical of many embedded systems I have worked on: limited RAM, no operating system.

Yet you say it needs a POSIX operating system API to sit on top of.

Are all those BACnet controllers running Linux or VxWorks or some other RTOS?

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon May 20, 2019 4:09 am

Look at the line of BACnet controllers from Control Soutions or Banner Engineering controllers that use ScriptBasic. These are ARM based controllers running POSIX OS standards.

The last project I did for a Control Soulutions dealer was connect their BACnet system to a solar power converter at a remote resort in New Zealand.

http://info.bannerengineering.com/cs/gr ... 191745.pdf

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon May 20, 2019 6:06 am

They sound like the ARM based embedded systems I worked on for a long while that used Wind Rivers VxWorks operating system.

Problem was they never worked. Never did get Wind River to fix the bugs in their OSPF routing and the GCC compiler they shipped for it was always ancient and crashed here and there when trying to compile our code.

I and others in the company campaigned to switch to Linux. Which was a bit radical and controversial at the time. Eventually we got our way. I was glad to see, nearly two decades later, there are man of those boxes still doing their job.

Anyway... I have no Linux for my RISC V. It has no support for virtual memory and memory protection, no "supervisor" instruction set extension, so it will never run Linux. I have considered getting some open source embedded RTOS running on there but really I'm not enthused by the prospect. I have no idea if any of them is POSIX compliant anyway.

So I guess ScriptBasic is not suitable for a bare metal embedded system.

Most likely I will go with Javascript using Esprunino or JerryScript run times. Nice an simple.

hippy
Posts: 5373
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Mon May 20, 2019 1:28 pm

ScriptBasic wrote:
Sun May 19, 2019 11:24 pm
The SciptBasic repo (sandbox) there is an extensions project. I would recommend looking at the extensions that go with the core build as well.

Have you looked at the GPIO extension module as an example? That extension is just a wrapper to the code you already know.
I had a browse through the repo but what I looked at seemed to be doing things differently to how the GPIO module does things.
ScriptBasic wrote:
Sun May 19, 2019 11:24 pm
Post your code and I'll help you make a ScriptBasic extension out of it.
Thanks; attached. I split the native C out from the interface with ScriptBasic , so it's mostly "interface.c" which I need to resolve -

sbtest.def - My definition file for auto-generating the extension
sbtest.bas - The Scriptbasic Module definition
interface.c - The interface between ScriptBasic and native C
sbtest.c - The native C itself
sbtest.h - The native C definitions

That reflects how non-Monolithic Python extensions would be. I haven't tried compiling it or integrating with ScriptBasic yet.
ScriptBasic wrote:
Mon May 20, 2019 1:10 am
Can I file a complaint that there needs to be a dedicated BASIC board? Complaints rather then suggestions seem to have more pull.
I wouldn't bet on it. There are other languages ahead of ScriptBasic, or any Basic, which can be argued to be more deserving of their own forum section. What we currently have seems appropriate to me. Gaining an 'own forum section' would rest on demonstrable need and there doesn't even seem to be any demand for that at present.
ScriptBasic wrote:
Sun May 19, 2019 8:11 pm
At this point the https://RaspberryBASIC.org forum is the only representation BASIC gets.
Not really true. There are posts and mentions of Bas 2.5, BBC BASIC, blasic, Chipmunk BASIC, FreeBasic, FUZE BASIC, Gambas, Liberty Basic, Matrix Brandy BASIC, MMBASIC, RTB Basic, SpecBas, Tiny Basic, Visual Basic, X11-basic, Xojo (realBASIC), and yabasic, on the forum.

I've probably missed a few, and it's true that some don't get a lot of mention. But it does seems Basic gets a far bit of representation here. The RPF even publicly celebrated the 50th anniversary of BASIC -

https://www.raspberrypi.org/blog/celebr ... s-of-basic

How well anything gets represented or how often mentioned in the forum, really comes down to how many are using that, how useful it is. One can't artificially create interest for something when that isn't there.

It doesn't seem to me that ScriptBasic and other Basics are more 'hard done by' than Go, Rust, or Lua, or any number of other languages.
Attachments
sbtest.zip
(2.82 KiB) Downloaded 12 times

hippy
Posts: 5373
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Mon May 20, 2019 1:53 pm

Heater wrote:
Mon May 20, 2019 6:06 am
So I guess ScriptBasic is not suitable for a bare metal embedded system.

Most likely I will go with Javascript using Esprunino or JerryScript run times. Nice an simple.
I have not tried it but I don't see how ScriptBasic is any less suitable than any other language for embedding in a bare metal system.

Some may be more easily modifiable to have the underlying OS pulled-out from under them and those with some sort of REPL or command line interface have an advantage to start from, but there's usually some effort involved if there's any interaction with hardware or the outside world.

One can pretty much get any self-contained program running bare metal; it's breaking through being self-contained which is the issue, and probably as much an issue no matter what's chosen.

MicroPython, Lua, or some scripting engine with a REPL intended for bare-metal embedding is where I would start. Those should be fairly easy to get going by just adding GetCh() and PutCh() routines for a UART.

If I understood how Ultibo did things I'd probably take a deeper look at that.

BareBox, though not intended as such, is currently looking like a promising lightweight OS option for a Pi which any scripting language or interpreter could be crowbarred into. That seems to offer support for RISC-V.

I would perhaps suggest that rather than go through the blood, sweat and tears, of getting something to run on your RISC-V chip as it is, it would be better investing that effort into adding what your RISC-V chip needs to run what's already available.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon May 20, 2019 3:00 pm

hippy,
I have not tried it but I don't see how ScriptBasic is any less suitable than any other language for embedding in a bare metal system...
I have not looked it to the ScriptBasic sources yet so I have no idea.

Pretty much anything can be ported to anything with enough effort. If only required some means of character I/O and say a timer interrupt and GPIO and the like it would be trivial to provide and API for it. Which is basically where my RISC V firmware and test programs are at now. If a program requires a file system, sockets, pthreads, X Windows (or any graphics) and the like that becomes a lot of work and it better to have a system that can support an OS that provides all that.
...those with some sort of REPL or command line interface have an advantage to start from,...
Indeed. I was thinking of using the Espruino Javascript engine. Espruino works stand alone on tiny ARM micro controllers and the ESP8266. It looks pretty easy to cross compile it and tweak it for a RISC V. Now I find I young guy in Brazil has done exactly that so using Espruino seems even more likely.

MicoPython might be an option but I'm not really a Python head.

Aren't there any good old BASICs out there that provide a REPL, program edidting one line at a time using those line numbers? Like the good old days. Requing nothing but a console port.
I would perhaps suggest that rather than go through the blood, sweat and tears, of getting something to run on your RISC-V chip as it is, it would be better investing that effort into adding what your RISC-V chip needs to run what's already available.
I'm not quite sure what you are suggesting there. If it requires major additions to my RISC V there are couple of issues. If I ever actually get the thing running it will be pretty minimal because:

a) This is all an adventure in getting familiar with FPGA, Verilog, SpinalHDL and CPU design. Given my lack of knowledge, skill, time I don't plan on anything ambitious. So no pipelining, no cache memory, no virtual memory, no supervisor mode. Ergo, no Linux or such.

b) What I really want is to make it smaller not bigger. I want it to fit in those super cheap Lattice 4K parts.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon May 20, 2019 3:41 pm

Thanks; attached. I split the native C out from the interface with ScriptBasic , so it's mostly "interface.c" which I need to resolve
Thanks @hippy. I'll have a look and get back to you.

After looking at the code, can I assume your target is Linux 64 bit?
Last edited by ScriptBasic on Mon May 20, 2019 5:02 pm, edited 1 time in total.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon May 20, 2019 4:51 pm

Turns out that there is an RTOS for micro-controllers that provides a POSIX API. NuttX: https://nuttx.org/

NuttX is small enough to support JerryScript on STM32 F4 with only a couple hundred K of RAM. There is a NuttX port to RISC V.

ScriptBasic could indeed make it onto small RISC V machines ontop of NuttX.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon May 20, 2019 4:55 pm

Heater wrote: ScriptBasic could indeed make it onto small RISC V machines ontop of NuttX.
That is great news!

Let me know if I can be of any assistance.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon May 20, 2019 5:26 pm

@hippy,

Here are the ScriptBasic extension module RETRUN macros.

besRETURN_STRING(x)
besRETURN_MEM(x,y)
besRETURN_POINTER(x)
besRETURN_LONG(X)
besRETURN_DOUBLE(X)

If returning a VOID, don't use besRETURN_??? at all.

The ARGUMENT macro takes "i" = long, "r" = double, "z" = null terminated string, The "[i]" indicates an optional argument passed.

Example of passing two longs and a string. "iiz"

The MySQL and cURL extension modules are good resources to understand error reporting.

There are two methods of extracting arguments. The macro method and 'old school' method. If returning values back via the argument, the old school method is the only way to do it. You will see both methods used in existing extension modules.

Return to “Other programming languages”