BBCSDL icon indicating copy to clipboard operation
BBCSDL copied to clipboard

ForthLib not working on BBCSDL?

Open forthuser opened this issue 1 year ago • 8 comments

Hi, great project!

ForthLib not working on BBCSDL? Testing on Linux32 (Puppy Xenial) http://www.bbcbasic.co.uk/wiki/doku.php?id=libraries

P.S. And Is not downloading Box2D.
Game SubZap II on http://www.proggies.uk/bbcsdl/index.html working and other no in Linux32 (on Wine Windows - ok) Some examples BBCSDL won't load.

? and BB4wForth not testing in Linux or Windows BBCSDL? https://github.com/ForthHub/BB4Wforth

forthuser avatar Jul 31 '23 06:07 forthuser

ForthLib not working on BBCSDL? Testing on Linux32

FORTHLIB contains some Windows-specific code, for example:

        call "LoadLibrary"
...
        call "FreeLibrary"
...
        call "GetProcAddress"

You could try simply deleting the incompatible code, but it might need more work. Since FORTHLIB is 32-bit x86 only, and most x86 Linux systems are now 64-bits, there has not been much incentive to try to port it.

Some examples BBCSDL won't load.

Which examples? They all work here in 32-bit Ubuntu, including the Box2D examples and SubZapII.

This is using the pre-built binaries in bbclinux32.zip of course, not built from source.

rtrussell avatar Jul 31 '23 09:07 rtrussell

Here Small Portable Forth JonesForth and for x64, arm, c64, Dos, Amiga

P.S. nasmjf Forth Possible embeded Forth in kernel BBCSDL? My favorite Forth Systems SPF4, nncron, Win32Forth, VFX Forth, amForth, Mecrisp ... and other.

forthuser avatar Jul 31 '23 09:07 forthuser

Here Small Portable Forth JonesForth and for x64, arm, c64, Dos, Amiga

I'm not suggesting that it would be terribly difficult to convert the 32-bit x86 code in FORTHLIB to 64-bits, but somebody would have to do it, and it's not going to be me! It would still be 'platform specific' which is rather against the philosophy of BBC BASIC for SDL 2.0.

If you want a challenge, write a Forth interpreter in shader (GPU) code, that would make it fast and cross-platform!

rtrussell avatar Jul 31 '23 11:07 rtrussell

If you want a challenge, write a Forth interpreter in shader (GPU) code, that would make it fast and cross-platform!

Like vectorforth, SF or implement GIPS ?

forthuser avatar Jul 31 '23 14:07 forthuser

Here Small Portable Forth JonesForth and for x64, arm, c64, Dos, Amiga

P.S. nasmjf Forth Possible embeded Forth in kernel BBCSDL? My favorite Forth Systems SPF4, nncron, Win32Forth, VFX Forth, amForth, Mecrisp ... and other.

BB4WFORTH was based on Jones Forth. As such what would need to be rewritten by a third party as I see it would be the assembly language portion. (I've seen ports of Jonesforth to (ARM 26bit and ARM 32 bit.). I am with other comments here that it would be better to write a FORTHLIB that ran in the shader, which is portable, versus having to have platform modules.

afarlie avatar Aug 14 '23 08:08 afarlie

BB4WFORTH was based on Jones Forth.

Based on, yes, but there were significant changes because (back then, anyway) Jones Forth was rather non-standard and failed one of the test suites. I modified it to adhere to what was then considered to be the correct behaviour.

A GPU-based Forth library for BBCSDL would be great! However the Shader Forth you linked to appears (not surprisingly) to be a Forth-like graphics language rather than a general-purpose Forth, and because of the inherently-parallel nature of shader computations I'm not sure how practical it would be to make one.

rtrussell avatar Aug 14 '23 11:08 rtrussell

Pforth is written in C, designed to be very portable, and is public domain. I don't know about its performance relative to Jonesforth, I guess that needs testing. (I haven't coded anything which needs high performance for years, but it's not slow at anything I do use it for.)

I've built it in 32 & 64 bit Intel Linuxes, in an old version of OpenBSD on 32-bit PPC, in Android ARM64 devices using Termux, and even with a cobbled-together toolchain of mixed MINGW distributions for 64-bit Windows. It was never any trouble. Even adapting the Unix makefile for Windows/MINGW didn't need much work.

Code: https://github.com/philburk/pforth

Docs: http://www.softsynth.com/pforth/

Questions & discussion: http://groups.google.com/group/pforthdev

eekee avatar Jan 20 '24 23:01 eekee

Fth is also written in C, but I can't say much about it. It has features such as array hash & string which you might not want alongside the BBC BASIC features. The core on which it's based might be more suitable; Ficl, "Forth-inspired command language". Ficl was designed to be embedded into other applications. I nearly mentioned Ficl in my previous comment, but didn't because it hasn't been updated since 2010. Whether that matters for BBCSDL, I don't know.

Fth https://fth.sourceforge.net/

Ficl https://ficl.sourceforge.net/

eekee avatar Jan 20 '24 23:01 eekee

Nobody has volunteered to port ForthLib to BBCSDL so I am closing this issue now.

rtrussell avatar Apr 07 '24 17:04 rtrussell