Commodore Basic as a Scripting Language
github.com
github.com
There's still a few BASIC implementations floating about for modern systems too. FreeBASIC (https://www.freebasic.net/) is one worth checking out.
Personally I still have quite a few of those 80s micro computers and occasionally hook them up to teach my kids programming.
REM Squaring a number using FN
A=4
B=FN_Square(A)
PRINT A;" squared is ";B
END
DEF FN_Square(Num)
=Num^2
(Source: http://www.bbcbasic.co.uk/bbcwin/tutorial/chapter17.html)I'll grant you that even with BBC BASIC the syntax isn't pretty with the = token taking the place of a RETURN statement. BASIC definitely had its quirks.
I think Applesoft BASIC (also a Microsoft BASIC) supported multi-line FN blocks. Can't find anything conclusive online to confirm this though - perhaps someone on here remembers?
The first BASIC I used was Tandy TRS-80 Level II BASIC which shipped on all but the earliest of the TRS-80 Model I's. Microsoft wrote this BASIC also and it didn't support any type of user defined functions. Microsoft created a Level III BASIC for the TRS-80 which was their first consumer product. This did support single line functions and I think but am not absolutely sure that it supported string as well as numeric functions.
It was even worse than Sinclair BASIC due to the lack of drawing commands (yes, I know you could get these as extensions on a cartridge - I didn't have that). The main issues with Sinclair BASIC were limited functions and the fact you had to use key combinations to enter most keywords.
I also remember it as being slow as all hell when compared to other BASICs, although that might just be the opposite of whatever rose-tinted nostalgia is.
I loved the Commodore 64 but its BASIC sucked. Commodore continued to royally eff up with Amiga BASIC which, if memory serves, was also basically[1] by Microsoft. I immediately switched over to AMOS by Francois Lionet, which was great, although with hindsight wish I'd given Blitz a go too.
[1] Pun also intended, even though dreadful.
Apple, Commodore, and the IBM PC all used Microsoft BASIC and were the fastest standard BASICs.
Across the pond the BBC Micro had a faster BASIC, and by the mid-80s there were lots of faster BASICs you could buy from 3rd parties.
Microsoft BASIC was relatively swift compared to most early peers, had decent precision FP, and had limited interoperability between platforms. This made it ideal for small business, education, and magazine listings.
So once again Microsoft won with an inferior product by turning it into a de facto standard :-)
I did like the simplicity of it.
I love it that this ethos has persisted in the ZX Spectrum Next design[1], which also allows for the .. limited .. 8-bit (well, max'ed out actually) machine to access a .. rather large super-computer, by comparison, and by that I mean a raspberry-pi Zero ...
I wonder, if ZX Next is a paradigm which develops further into a viable market (imho, this already exists, elsewhere and otherwise..) then what sort of crazy machines might we be sporting on our wrists and in pockets, soon enough?
I mean, ZX Next ideology, in a PDA ..
[1] - https://www.specnext.com
(I had trouble believing this, but all the info I found online points to this being true)
And for anyone else thinking about this subject, consider this: every year for the last decade now the following systems have had new programs written for them by thriving communities: Amstrad CPC6128, C64, ZXSpectrum, BBC Micro B, Oric Atmos, Jupiter Ace (!), Apple II .. actually, never mind. Lets just try this experiment: dig out the old computer from your attic, dust it off, get your docs together, and go find the .. rather eager, I'm sure .. community of hackers that are keeping these machines alive.
Honestly, I have a ton of iDevices with App Store crap on them. The only releases I get really excited about lately are for the Amstrad CPC6128 and Atmos, though .. its just so fun to see crazy new stuff being made for these 'ancient' machines ..
So yeah, please get to coding. Docs for some of these systems are easier now than ever!
(I'm aware of the TheC64 project, but it seems sold out at the moment, and not easy to get in all parts of the world).
I would... but my dad sold it decades ago, in order to buy me my PC XT clone. It seemed like a good move at the time (and I learned to program with GWBASIC for the PC), but today I want to go back in time and tell my dad to keep the C64!
Of course I've used VICE and other emulators. BMC64 on the Raspberry Pi feels like the real thing, computer-as-appliance. But I really, really want the beige "breadbin" C64 keyboard for the full experience.
I'm looking into buying a used C64 from my local eBay clone (note: I'm not from the US or the UK). But I keep fearing someone will sell me a defective C64 or that I won't be able to plug it into a modern LCD.
Thanks for the encouragement!
https://www.youtube.com/watch?v=rUyebYD5UO0
Written partially in Atari BASIC... I wonder which environment Sid Meier preferred.
What did people do for a development environment on the C64? I remember that it was not fun at all using straight Commodore tools. For example, the disk was unbelievable slow. At the time, I also had Atari 800- it was a much nicer system.
* CBMBASIC implements CHRGET/CHRGOT as self-modifying
* code in the zero page.
I did quite a bit of programming on the C64 but I didn't know that. I always thought that, although there is no technical reason not to, zero page is only used for storing data and not code.However, there's really nothing special about Commodore BASIC 2.0. It was a very basic Microsoft BASIC; not as minimal as Apple Integer BASIC but not as good as something like GW-BASIC on the PC.
The Commodore BASIC 2.0 supported none of the hardware features of the C64 that weren't provided by the Commodore Kernal through PRINT statements. So you can clear the screen and change text color through embedding the appropriate control codes in strings or use ASC function, but accessing the VIC-II or SID had to be done through assembly or PEEKs and POKEs. So honestly making it a general scripting runtime can work easily.
If you want to use a real BASIC as a scripting language you want to check out FreeBASIC. It's an reimplementation of Microsoft's QBASIC with OOP and other extensions.
1) This code was generated by the LLVM C-backend (llvm_cbe), which converts LLVM IR to C code
2) The code contains variables for the 6502 registers.
This suggests it was generated by translating 6502 machine code to LLVM IR, and then converting the LLVM IR to C.
The code also appears to include the Commodore BASIC ROM. (See initialization of llvm_cbe_ROM in cbmbasic.c).
So, it looks like an emulator that was written in some other language then converted to C using the LLVM C backend.
It's a completely different situation than for Amiga ROMs, for some reason.
While the Amiga was actively worked on nobody really cared about the 8-bit stuff. The Commodore name and trademark was not actually included in the IP package, it went to Tulip Computers in the Netherlands. From there it went on to Yeahronimo ventures and then into C= holdings.
The patents and copyrights were always in the big IP package passed around but since there was no real money in dead 8-bit stuff nobody actively enforced the rights on those ROMs. As such I think it would be hard for anybody today to start trying to enforce the IP rights on the 8-bit ROMs, they are so widely spread, distributed and used.
All the IP rights (except the Commodore name and trademark) is now owned and managed by Cloanto. You can buy legal copies of all the ROMs and software from them, they also seem very amenable to make deals with makers of retro computers etc.
IANAL, but while you can lose a trademark through non-enforcement, I don't believe the same applies to copyrights. Turning a blind eye to infringement, even for years on end, doesn't necessarily prevent an attempt to go after it in the future.
> All the IP rights (except the Commodore name and trademark) is now owned and managed by Cloanto. You can buy legal copies of all the ROMs and software from them, they also seem very amenable to make deals with makers of retro computers etc.
I don't know who owns Cloanto. But even if its current owner(s) are nice and friendly people – it could end up being owned by someone else in the future who is more focused on extracting as much money as possible (like what happened to Unix with the SCO saga). Maybe the current owner(s) go bankrupt, pass away, fall on hard times, etc, and the business ends up being sold to someone only interested in maximising their return at any cost.
A couple of years ago I got an software exception request (regulated industry...don't ask) from a developer who wanted permission to use this. No one had any idea what to make of it, so it bubbled up to me. Turns out the developer was British, started out on BBC BASIC, and even though nothing in the app was BASIC, he'd written an amazingly comprehensive testing scaffold in it. I granted the request on the condition that they train at least 2 other devs to maintain it. It was impressive enough I bought my own copy and used it for various scripting tasks on Windows until PowerShell became what the cool kids used.
This is kind of neat, OP what interested you about it to submit it?