I thought BBC BASIC 4 SDL ran on Linux. So is there a way to call a kernel SWI (which is what the SYS statement should do in Linux in my opinion)?RichardRussell wrote: ↑Sun Jun 30, 2019 9:12 pmThe interpreters are (at least, BBC BASIC for Windows and the 32-bit x86 editions of BBC BASIC for SDL 2.0 share identical code). The differences lie in areas which would be considered part of the OS on the BBC Micro or in RISC OS, but for reasons of emulation are part of the BB4W and BBCSDL packages.
There has never been a RISC OS build, so the question of SWIs hasn't arisen. SYS can be used to call an OS API of course, but different OSes mean different APIs.(is there a way to call a kernel SWI in SDL BBC BASIC?).
When we load a program, in order to get the dynamically linked libraries going we call kernel SWI's in Linux.
On file I/O, it is most desirable in most cases to call SYS "OS_File" in order to accomplish most file I/O, as it gives more control than the builtin commands (eg filetype?).File I/O is surely compatible (at least if you use BGET#, BPUT# and GET$#). In respect of GUI elements, my understanding is that RISC OS is a cooperative multi-tasking system so compatibility with Windows or SDL would be hard to achieve, at least without some undesirable compromises.I could not use any of my BBC BASIC RISC OS programs in BBC BASIC for SDL simply because the way it interacts with the OS to produce GUI elements, support messaging, do file I/O, implement GPIO routines, and the like.
On gui stuff, it would be possible to use the same system call model to implement it. In RISC OS task switches generally accure on a call to Wimp_Poll or Wimp_PollIdle, in Win32 you have polling calls used to obtain messages, in X11 you have polling calls to obtain any messages, and in most other Window Managers you have the same kind of thing, be they preemptive or cooperative multitasking.