RichardRussell wrote: ↑Sun Apr 14, 2019 11:34 am(Cross-posted from the new Raspberry BASIC forum)
BBC BASIC is the programming language originally specified and adopted by the British Broadcasting Corporation for its groundbreaking Computer Literacy Project of the early 1980s. It has since been extended and ported onto at least seven CPUs and more than thirty different platforms. Today BBC BASIC is a modern, structured, language capable of most programming tasks.
The Raspbian edition of BBC BASIC is free and open-source. It is highly compatible with the Windows, MacOS, Linux, Android and iOS editions, and generally BASIC programs will run on all these platforms with no modification, even if they use 2D or 3D graphics, sound, joystick input, file or network access etc. More than 100 example programs are supplied with BBC BASIC to demonstrate its capabilities.
Raspbian BBC BASIC needs at least an RPi 2; an RPi 3 or later is recommended for best performance. It may be downloaded as a precompiled binary in the form of a Zip file or the source code, libraries and examples may be obtained from GitHub. There is a makefile in the bin/raspi directory (the SDL2 development libraries must first be installed from the Raspbian repository).
Here are some YouTube videos which illustrate things that BBC BASIC can achieve on the Raspberry Pi:
Music and 3D animation
I'm never too sure about that; I'm happy to take advice. Some forums behave 'strangely' if you edit the subject line (for example to reference a new version) so starting a new thread can be cleaner. Also, if it attracts followups it can be confusing if multiple releases all get discussed in the same place. But equally I can see that having isolated posts in separate threads, on effectively the same subject, could be considered wasteful.fruitoftheloom wrote:Plus a new post for each release, would be better to just have all in one post ????
In a “People keep asking for it, but there's no demand” kind of a way?
FTFY. BASIC is in the same league as Comic Sans.
Dijkstra wrote: It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.
Fortunately BASIC has progressed a long way since then, it was after all the BBC (way back in 1980) who insisted that a fully structured BASIC - not needing GOTOs - was a requirement for their Micro. BBC BASIC is still popular for teaching programming in schools, and for some time was recommended by the Oxford, Cambridge and RSA examining board, so clearly they didn't share Dijkstra's opinion.
And BBC BASIC is probably the only BASIC that includes an assembler in the run-time engine (with the exception of the iOS edition, admittedly). Assembling code on-the-fly at run-time, allowing 'variables' to be expressed as 'constants' in the assembler source code, can even outperform conventional assembled-and-linked code.
Sounds great, but it must be a real maintenance nightmareRichardRussell wrote: ↑Sun Apr 14, 2019 2:10 pmAnd BBC BASIC is probably the only BASIC that includes an assembler in the run-time engine (with the exception of the iOS edition, admittedly). Assembling code on-the-fly at run-time, allowing 'variables' to be expressed as 'constants' in the assembler source code, can even outperform conventional assembled-and-linked code.
All very true: it doesn't make for easy cross-platform programming! But when BASIC isn't fast enough it makes things possible that simply wouldn't be otherwise, except by 'shelling out' to some external app.
I note that you live in the UK, and are of an age to have used BBC BASIC at its peak of popularity, so that's not surprising. In parts of the world where the BBC Micro had little impact (particularly the US, where it bombed - too expensive and too incompatible with the UK model) people have often never heard of it!
The C source code of my 'generic' BBC BASIC interpreter (i.e. with the SDL2 I/O stuff omitted) is reasonably portable, although it does depend on some GCC/clang extensions (for example that sizeof(void) is 1) and intrinsics. However, and this could be a killer with some RISC architectures, it does assume that unaligned stores and loads are allowed (the -munaligned-access compiler switch is specified). If RISC V can load and store only at aligned addresses, as with the original ARMs, porting would be a major hassle.
Potentially a misaligned access will cause a trap and the access performed slowly by a trap handler.For best performance, the effective address for all loads and stores should be naturally aligned for each data type (i.e., on a four-byte boundary for 32-bit accesses, and a two-byte boundary for16-bit accesses). The base ISA supports misaligned accesses, but these might run extremely slowly depending on the implementation.
Yup. Started with the ZX-80, then ZX-81, ZX Spectrum, Sharp MZ-80K, BBC Micro and so on. Spent a couple of years as Technical Manager for CommunITel writing Viewdata software for BBC Micro, Acorn Archimedes, RM Nimbus and IBM PC (The latter using versions of your BASIC).RichardRussell wrote: ↑Sun Apr 14, 2019 4:29 pmI note that you live in the UK, and are of an age to have used BBC BASIC at its peak of popularity, so that's not surprising. In parts of the world where the BBC Micro had little impact (particularly the US, where it bombed - too expensive and too incompatible with the UK model) people have often never heard of it!
By all means contact me privately if you want to attempt a port. All my versions of BBC BASIC (back to the 1982 Z80 version) have had a clear delineation between the generic 'language' modules and the platform-dependent 'input-output' modules, so in principle you shouldn't need to make any changes to the core interpreter. I can give you details of the bare minimum I/O support you would need to provide to get something running.
The option has a different name for RISC-V
Code: Select all
-mstrict-align -mno-strict-align Do not or do generate unaligned memory accesses. The default is set depending on whether the processor we are optimizing for supports fast unaligned access or not.
I'm using Brandy's SDL BBC BASIC graphic library module with ScriptBasic which seems to work okay.In that event Brandy BASIC (or Matrix Brandy), which are also 'BBC BASIC' and open-source, but without many of the 'modern' extensions of mine (e.g. structures, 64-bit integers etc.) might be a better choice. I'm pretty sure they don't depend on unaligned accesses.