User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Searching for BASIC

Mon Jul 01, 2019 2:10 pm

@RichardRussel:
We have went a bit to far off topic with the Filesystem stuff.

So back more on topic I do have still a question:
I am attempting to wrap my head around some of the decisions made with BBC BASIC for SDL (great implementation BTW).

You said that you implement support for the VDU stream because it is used by a very large number of existing BBC BASIC Applications, the VDU stream is a means of making OS calls. Most of what the VDU stream does can be done in BBC BASIC without using it.

You said that you do not implement OS_Byte calls because a program that intends to be portable should not be calling the operating system, and most of those tasks can be done in BBC BASIC without it. Yet OS_Byte is at least as common in existing BBC BASIC programs as is the use of the VDU stream to do things.

It seems these two statements are self contradictory. It would seem that simulating the VDU means of making system calls would imply simulating the OS_Byte means of doing things. Neither one is really needed, as most of what they do can easily be done without them (the exceptions being things very specific to Acorn MOS and RISC OS). As such I am not sure I understand the logic here.

Now if it is just to save work and code in the implementation that I could understand, though that is not what you said.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Searching for BASIC

Mon Jul 01, 2019 2:22 pm

ScriptBasic wrote:
Mon Jul 01, 2019 4:14 am
@DavidS,

If I bring back the BBC extension module as BBV, would you update the library to where Matrix is with it and see if you can get it running on SDL2?

I personally don't have a craving for Acorn Basic V but from what I see on this UK centric forum the language still appeals to some. (the 57 Chevy in the garage)
I do not use SDL, sorry. The closest thing I have ever done to SDL (other than porting other peoples code) is to implement use of the GPU Firmware provided OpenGL interface in bare metal programming.

I do not know what the UK has to do with it. I know more ex-RISC OS users here in the USA than I have ever heard of in the UK. For that matter I know 8 current RISC OS users that live in my immediate area, all of whom are long time RISC OS users (since the early 1990's at least), so there seem to be a lot more over here than over there. Ok we do not have as much of a web presence over here as RISC OS has over there, though I would say it is very much a USA used OS.

Though I must say the same seems to be true about many older systems. You hear more about them in Europe though in the 1990's every Amiga User Group, Atari ST User Group, Commodore 8-bit User Group, RISC OS User Group, and Sinclair User Group in the United States was busting at the seams with attendees. Still today if you can find your local user group for most of those systems you will find that they have fairly good turnout here in the USA.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
scruss
Posts: 3143
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Searching for BASIC

Mon Jul 01, 2019 3:03 pm

ScriptBasic wrote:
Mon Jul 01, 2019 2:10 am
ScriptBasic allows changing FOR variables on the fly.
It's not BASIC, then. The FOR loop values should be set once and once only on entering the loop. Every BASIC interpreter I've tried (apart from the buggy one) complies. FreeBASIC gets it wrong.

References: Oh, and DavidS - our local Commodore user group, TPUG, has growing membership and our show (World of Commodore) gets bigger every year. We are running out of old hardware, though: the local vendor/refurbisher is down to his last few C64 boards that work, but even those need cleaning, tracing and repair. Amigas are like hen's teeth now, as the ones that didn't die from capacitor failure on the main board (or worse, the power supply) have likely had the CMOS battery go kablooie and take out the PCB down to bare glass. Many of us emulate because it's so much less hassle. 1980s video standards are pretty horrible to support these days, too.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

ZXDunny
Posts: 119
Joined: Sun Jul 08, 2012 7:57 pm

Re: Searching for BASIC

Mon Jul 01, 2019 3:06 pm

miab3 wrote:
Mon Jul 01, 2019 1:02 pm
@ZXDunny,

Have you tried to compile your SpecBAS with Lazarus for Raspberry Pi?
https://www.getlazarus.org/setup/?download#linux

Michal
yes indeed, that's what I use to build it on mac and linux. However, the current code base has a lot of changes which will require that I rewrite the OS-specific source file that interfaces between the host OS and SpecBAS. Once that is done, then SpecBAS can be built for whatever platform I want.

But I'm far too busy (with both SpecBAS and IRL work) for that right now.

User avatar
RichardRussell
Posts: 644
Joined: Thu Jun 21, 2012 10:48 am

Re: Searching for BASIC

Mon Jul 01, 2019 3:25 pm

DavidS wrote:
Mon Jul 01, 2019 2:10 pm
the VDU stream is a means of making OS calls.
All BASIC I/O statements and functions are "a means of making OS calls", even INPUT and PRINT! You have to draw the line somewhere and accept that some of them are sufficiently fundamental that they become 'part of' the language. Without that level of cross-platform standardisation you couldn't expect even a 'Hello world' program to run.

My judgement has always been that, in the case of BBC BASIC, VDU qualifies as part of the language in the same way that PRINT does. If not, even things as basic as printing text at arbitrary coordinates, or defining a text/graphics viewport, or resetting the colour palette could not be done in a cross-platform fashion. In practice, every version of BBC BASIC that has ever existed has, I think, implemented the main VDU commands in a largely compatible way.
Yet OS_Byte is at least as common in existing BBC BASIC programs as is the use of the VDU stream to do things.
That can't possibly be true. In the thousands of BBC BASIC programs I've written over the years I've never used SYS "OS_Byte" (because that's RISC OS specific and I've never owned or used a RISC OS machine) and hardly ever used the BBC Micro equivalent of USR(&FFF4), yet I've probably used at least one VDU statement in 90% of those programs.
Neither one is really needed, as most of what they do can easily be done without them
I listed above some important things that can only be done using VDU. Several more BBC BASIC statements are just a proxy for VDU, since they are converted into equivalent VDU commands (OFF, ON, MOVE, DRAW, PLOT, CLG, CLS, COLOUR, GCOL, MODE, CIRCLE, ELLIPSE, FILL, ORIGIN, RECTANGLE).

I asked what sort of things you use OS_Byte for, but you didn't reply. Since I've never needed it, and the hundred or so example programs supplied with BBCSDL work perfectly well without it, it obviously isn't fundamental in the way VDU is.

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

Re: Searching for BASIC

Mon Jul 01, 2019 4:21 pm

It's not BASIC, then. The FOR loop values should be set once and once only on entering the loop. Every BASIC interpreter I've tried (apart from the buggy one) complies. FreeBASIC gets it wrong.
There is no wrong in BASIC.

I wouldn't change anything about how ScriptBasic handles FOR/NEXT. It makes sense and is very flexable. Give me one good reason why FOR variables shouldn't change. Are you also calling SB buggy because it doesn't require a $ after string variables or functions?

Most BASIC languages require using VAL before using a numeric string in an expression. Is that another SB bug?

I could go on for hours how ScriptBasic has improved the syntax of BASIC.

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Searching for BASIC

Mon Jul 01, 2019 6:58 pm

@RichardRussell:
I missed your asking about what OS_Byte is often used for in BBC BASIC (I do not use it, though see it a lot). Well lets see, there is I/O redirection, that is what I see the most of. I have seen other uses as well, though not coming to mind off the top of my head. I generally just replace such things with more correct ways when I come across them in code, though it is difficult to find a BBC BASIC Program that does not use OS_Byte..

I actually agree that it is poor practice. I had not thought about changing the pallet in a long time, ever since we got 16bpp in RISC OS most things have been done in a true color mode, though that is a use for VDU for sure.

Now as to clipping (defining a viewport) is something that is almost always OS specific. And an example of making a non language OS call.

I personally put VDU in the same category as SYS, they are both OS specific. There is nothing wrong with simulating there effect as it would be on RISC OS in an implementation of BBC BASIC for another platform.

I understand that OSBYTE (OS_Byte), OSWORD (OS_Word), and VDU commands have remained largely the same on all systems that implement BBC BASIC. I think that everyone that uses BBC BASIC is aware of that, even here in the USA where there are a lot of RISC OS users though I have never heard of a BBC Micro 8-bit user of any kind (in the USA). Now many of us learned about the BBC Micro on our first Acorn Archimedes, and many of us emulated it, just to learn more about where RISC OS, BBC BASIC, and ARM came from (though that was way back in the late 1980's early 1990's). There was a decent 6502 BBC Micro emulator that came on the disk set with the early Acorn Archimedes computers (at least over here), I can not think of the name of it now.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

ZXDunny
Posts: 119
Joined: Sun Jul 08, 2012 7:57 pm

Re: Searching for BASIC

Mon Jul 01, 2019 7:34 pm

DavidS wrote:
Mon Jul 01, 2019 6:58 pm
Now as to clipping (defining a viewport) is something that is almost always OS specific. And an example of making a non language OS call.
I probably don't understand something fundamental here, but why would clipping be an OS-specific operation? Surely it's just a matter of excluding writes to graphics memory based on whether or not they fall into region?

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

Re: Searching for BASIC

Mon Jul 01, 2019 8:01 pm

Clipping is a fundamental function in SDL. None of my examples would have worked if I didn't enable viewport clipping support.

User avatar
RichardRussell
Posts: 644
Joined: Thu Jun 21, 2012 10:48 am

Re: Searching for BASIC

Mon Jul 01, 2019 8:56 pm

DavidS wrote:
Mon Jul 01, 2019 6:58 pm
it is difficult to find a BBC BASIC Program that does not use OS_Byte..
You keep asserting something which is manifestly untrue. I told you that I had written thousands of BBC BASIC programs, none of which use OS_Byte. None of the BBC BASIC example programs supplied with BBC BASIC for SDL 2.0 use OS_Byte, not least because it isn't available! Sometimes I wonder if when you refer to "BBC BASIC programs" you really mean "RISC OS BBC BASIC programs" which is a very specific subset (and one of which I have no experience whatever).
Now as to clipping (defining a viewport) is something that is almost always OS specific.
I have no idea what you mean by that. Clipping is no more "OS specific" than drawing a line or a triangle or a circle. They are all basic operations supported by any graphics subsystem on any platform.
I understand that OSBYTE (OS_Byte), OSWORD (OS_Word), and VDU commands have remained largely the same on all systems that implement BBC BASIC.
No. VDU commands are common across different BBC BASIC implementations, but not the others. After all, the purpose of SYS is to access the native Operating System (or in the case of BBC BASIC for SDL 2.0 the OS abstraction layer provided by SDL2) and the only OSes that provide OSBYTE and OSWORD APIs are those in Acorn machines. If you do SYS "OsByte" on any of my BBC BASIC implementations it will report 'No such system call'.

ZXDunny
Posts: 119
Joined: Sun Jul 08, 2012 7:57 pm

Re: Searching for BASIC

Mon Jul 01, 2019 9:45 pm

ScriptBasic wrote:
Mon Jul 01, 2019 8:01 pm
Clipping is a fundamental function in SDL. None of my examples would have worked if I didn't enable viewport clipping support.
Hmm. Literally the only thing I use SDL for under Linux is to get a pointer to the window surface which I then draw to by writing to that pointer (with offsets, natch). Clipping is performed by SpecBAS, not SDL. None of the graphics functions are performed by a library, they're all part of the SpecBAS codebase. The same goes for the Windows version - no GDI/OpenGL used aside from presenting the contents of the surface to the user.

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

Re: Searching for BASIC

Mon Jul 01, 2019 10:40 pm

You truly are the artist in that case. Give me a canvas and I'll show you a masterpiece.

User avatar
RichardRussell
Posts: 644
Joined: Thu Jun 21, 2012 10:48 am

Re: Searching for BASIC

Mon Jul 01, 2019 10:48 pm

ZXDunny wrote:
Mon Jul 01, 2019 9:45 pm
Literally the only thing I use SDL for under Linux is to get a pointer to the window surface which I then draw to by writing to that pointer (with offsets, natch). Clipping is performed by SpecBAS, not SDL.
This is SDL 1.2, right? So whether clippng is done by your code or by SDL it's being done by the CPU, and any performance difference comes down to the quality of your code versus theirs. But with SDL 2.0 things are different, clipping is probably accelerated by the GPU so you'll almost certainly be better off letting SDL do it rather than rolling your own. I'm so pleased that I started with SDL2 and have never had to learn 1.2.

ZXDunny
Posts: 119
Joined: Sun Jul 08, 2012 7:57 pm

Re: Searching for BASIC

Mon Jul 01, 2019 10:53 pm

RichardRussell wrote:
Mon Jul 01, 2019 10:48 pm
ZXDunny wrote:
Mon Jul 01, 2019 9:45 pm
Literally the only thing I use SDL for under Linux is to get a pointer to the window surface which I then draw to by writing to that pointer (with offsets, natch). Clipping is performed by SpecBAS, not SDL.
This is SDL 1.2, right? So whether clippng is done by your code or by SDL it's being done by the CPU, and any performance difference comes down to the quality of your code versus theirs. But with SDL 2.0 things are different, clipping is probably accelerated by the GPU so you'll almost certainly be better off letting SDL do it rather than rolling your own. I'm so pleased that I started with SDL2 and have never had to learn 1.2.
I support multiple windows (within the SDL surface, I only use one of those) so clipping has to be done manually - also there's the clipping commands which allow you to set your own custom clipping region.

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Searching for BASIC

Mon Jul 01, 2019 10:54 pm

@Richard Russe;
I respect that. VDU is the one thing that gives a few things that would be difficult to do otherwise.

And the only BBC BASIC users I know are those that use it to write RISC OS programs, so yes I am speaking of BBC BASIC programs for RISC OS (and as your BBC BASIC for SDL is based off of BBC BASIC V syntax, RISC OS BBC BASIC).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

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

Re: Searching for BASIC

Mon Jul 01, 2019 11:07 pm

I'm so pleased that I started with SDL2 and have never had to learn 1.2.
Being late to the party has its rewards.

I told myself no more 32 bit Linux for me a few years back and here I am. I'm about to call this the Microsoft syndrome and curse. Thankfully ScriptBasic isn't affected by this 32/64 bit mess. The biggest problem I run into using 32 bit libraries is they are rapidly becoming as is with no plans for future support.

User avatar
RichardRussell
Posts: 644
Joined: Thu Jun 21, 2012 10:48 am

Re: Searching for BASIC

Tue Jul 02, 2019 12:39 am

ZXDunny wrote:
Mon Jul 01, 2019 10:53 pm
I support multiple windows (within the SDL surface, I only use one of those) so clipping has to be done manually - also there's the clipping commands which allow you to set your own custom clipping region.
I don't see why either of those has any impact on whether SDL does the clipping or you do. In the case of SDL2 I'd expect it to be a case of setting the required clip rectangle (SDL_SetClipRect) before rendering into that 'window'.

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

Re: Searching for BASIC

Tue Jul 02, 2019 1:02 am

I would rather see a clipped image before an out of range error message but that's me.

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Searching for BASIC

Tue Jul 02, 2019 2:31 am

Not sure how clipping works in SDL. Though I do know that clipping is very important for any WIMP environment, as it makes updating visible portions of windows much simpler.

I am not sure how you could get an out of range error from using clipping when drawing, that is a new one on me for any system.

Weather it be SDL, VDU (in RISC OS), or any other form:
Clipping can be supported by hardware, and thus the use of an abstraction to implement clipping is important, as that makes it possible for the OS to use the hardware support to enforce clipping. The VideoCore IV is an example of hardware that has support for clipping.

SDL of course would be using another abstraction provided by other OS libraries, most probably something in OpenGL (maybe a bit different for SDL 1.2). SDL is a form of OS library, no different than VDU, X11, WIMP, Shared Sound, ALSA, and OSBYTE are forms of OS libraries (albeit different methods of calling different examples given). SDL just happens to be an OS library that has been ported to multiple Operating Systems (Including RISC OS, Atari TOS, Amiga OS, BeOS, MS/PC/DR/RX/Free-DOS, Linux, Mac OS/Macintosh System Software, AROS, Haiku OS, Linux, BSD, MINIX, etc).

If it gets BBC BASIC on more platforms none can complain about what libraries are used, so long as do not go too deep in the layers of abstraction. Remember the axiom "In software engineering any problem can be solved by adding another layer of abstraction, except the problem of too many layers of abstraction". Thankfully last I looked at SDL (which was 1.2), it is implemented in a way not to use to many layers of abstraction above the HW, it is reasonable (unlike many others).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

ZXDunny
Posts: 119
Joined: Sun Jul 08, 2012 7:57 pm

Re: Searching for BASIC

Tue Jul 02, 2019 8:22 am

RichardRussell wrote:
Tue Jul 02, 2019 12:39 am
ZXDunny wrote:
Mon Jul 01, 2019 10:53 pm
I support multiple windows (within the SDL surface, I only use one of those) so clipping has to be done manually - also there's the clipping commands which allow you to set your own custom clipping region.
I don't see why either of those has any impact on whether SDL does the clipping or you do. In the case of SDL2 I'd expect it to be a case of setting the required clip rectangle (SDL_SetClipRect) before rendering into that 'window'.
Because windows in SpecBAS are not SDL surfaces and may be hidden - just because you can't see a window doesn't mean you don't want pixel writes to be non-clipped :)

Windows in SpecBAS are literally just regions of memory which are gathered together in the compositor prior to blitting to the SDL surface, nothing more than that.

User avatar
RichardRussell
Posts: 644
Joined: Thu Jun 21, 2012 10:48 am

Re: Searching for BASIC

Tue Jul 02, 2019 9:09 am

ZXDunny wrote:
Tue Jul 02, 2019 8:22 am
Because windows in SpecBAS are not SDL surfaces and may be hidden
Well, OK, to be able to clip writes to a hidden window (whilst allowing concurrent writes to a visible window) you would either have to treat that as a special case (I imagine it's uncommon) or make each window a separate SDL surface (or texture in the case of SDL2) but I don't see why that should be ruled out if there is potentially a big performance benefit.

SDL 1.2 is creaking at the edges (there are already problems on recent versions of MacOS I believe) so you'll have to migrate to SDL2 sooner or later. At that point some fairly radical restructuring is probably going to be needed if you are to take full advantage of GPU acceleration.
Last edited by RichardRussell on Tue Jul 02, 2019 9:13 am, edited 1 time in total.

ZXDunny
Posts: 119
Joined: Sun Jul 08, 2012 7:57 pm

Re: Searching for BASIC

Tue Jul 02, 2019 9:11 am

RichardRussell wrote:
Tue Jul 02, 2019 9:09 am
ZXDunny wrote:
Tue Jul 02, 2019 8:22 am
Because windows in SpecBAS are not SDL surfaces and may be hidden
Well, OK, to be able to clip writes to a hidden window (whilst allowing concurent writes to a visible window) you would either have to treat that as a special case (I imagine it's uncommon) or make each window a separate SDL surface (or texture in the case of SDL2) but I don't see why that should be ruled out if there is potentially a big performance benefit.

SDL 1.2 is creaking at the edges (there are already problems on recent versions of MacOS I believe) so you'll have to migrate to SDL2 sooner or later. At that point some fairly radical restructuring is probably going to be needed if you are to take full advantage of GPU acceleration.
The Mac build already uses SDL2.0 but that's besides the point - why do I want GPU acceleration? Literally the only thing I use OpenGL for is to draw the main window to the SDL surface. Or rather, the other way around :D

User avatar
RichardRussell
Posts: 644
Joined: Thu Jun 21, 2012 10:48 am

Re: Searching for BASIC

Tue Jul 02, 2019 9:16 am

ZXDunny wrote:
Tue Jul 02, 2019 9:11 am
why do I want GPU acceleration?
I assume for the same reason I do in BBC BASIC, to make graphics faster! If you don't care about speed, it's a moot point.

ZXDunny
Posts: 119
Joined: Sun Jul 08, 2012 7:57 pm

Re: Searching for BASIC

Tue Jul 02, 2019 9:28 am

RichardRussell wrote:
Tue Jul 02, 2019 9:16 am
ZXDunny wrote:
Tue Jul 02, 2019 9:11 am
why do I want GPU acceleration?
I assume for the same reason I do in BBC BASIC, to make graphics faster! If you don't care about speed, it's a moot point.
Graphics? You mean things like drawing lines and circles?

User avatar
RichardRussell
Posts: 644
Joined: Thu Jun 21, 2012 10:48 am

Re: Searching for BASIC

Tue Jul 02, 2019 9:32 am

ZXDunny wrote:
Tue Jul 02, 2019 9:28 am
Graphics? You mean things like drawing lines and circles?
Yes, for example, and the rest. The GPU is good at that kind of thing as well as blitting textures. You could compare the speed of SDL_RenderDrawLines or SDL_RenderFillRect when using the GPU compared with software rendering.

Return to “Other programming languages”