Hacker News new | past | comments | ask | show | jobs | submit login

Well... the original BBC Basic was originally hand-written in 6502 assembly for the BBC Micro; it's a 16kB application ROM. Later versions were rewritten for the 65C102. The extra opcodes available freed up some space and they added a few more features, and made it even faster (and BBC Basic was already one of the fastest 8-bit Basics around). I don't believe that any of the 6502-era Acorn sources were ever released, which is a shame, as Acorn's MOS was one of the best 8-bit operating systems around.

Basic V was a complete rewrite for the ARM. In hand-tooled ARM machine code, also by Sophie Wilson. The source for this is available from the CVS archive here: https://www.riscosopen.org/content/downloads/cvs-access But trust me, it won't help. I've debugged my way through it. It's very... hand written.

Oh, yes: there are also ports of BBC Basic IVish to the 8086 and the Z80 by R.T. Russell: http://www.bbcbasic.co.uk/bbcbasic/bbcbasic.html He wasn't associated with Acorn, as far as I know. The 8086 version (for Windows and DOS) is commercial, but the Z80 version (for a variety of CP/M machines) is a free download. Not open source, unfortunately. His version even includes 80186 or Z80 inline assemblers, depending on the version. His Z80 port was licensed for a variety of machines --- Amstrad made a range of Z80 notebooks with his Basic in ROM. I've used all his versions, and they're superb.




Locomotive BASIC - which was shipped on the Amstrad CPC range of micro computers - was heavily influenced by BBC BASIC. It made switching between the CPC 464 and BBC Micro really easy.

The other variation of BASIC I used a lot in the 80s was Microsoft BASIC on the Commodore 64.

dim personalopinion$ = "Frankly I think the C64 was over hyped. Sure it had the popular MOS 6510 rather than the Z80 as used by the BBC Micro and Amstrad CPC range, but the Amstrad CPC had a more vibrant display, built in cassette player and, most importantly to me as a programming kid in the 80s, a far superior port of BASIC than Microsoft BASIC was."


"The source for this is available from the CVS archive here: ... But trust me, it won't help. I've debugged my way through it. It's very... hand written."

First computer ZX80, so I missed the BBCM.

Thx @David, the reason I asked was I was interested to see ^how^ it was written, but probably more to the point, what made it good? Sounds like speed was a loved feature. Was there ever a API or documentation made public?

Reason: want to hack a language together a BASIC-like language (are of use) for graphics.


Well, there's an annotated disassembly here:

http://acorn.huininga.nl/pub/docs/sourcecode/Acorn/BASIC%202...

AFAIK there wasn't anything particular magical about it --- it was just written well, with great care. Programs were stored in tokenised form, where each keyword was reduced to a byte, and line numbers in things like GOTO statements were stored preparsed, but execution happened directly from the tokenised form. Named procedures were faster than GOTOs because the interpreter would cache the address of the line where they were defined, while GOTOs would have to search for the line; variables were stored in a hash table; there were two stacks, one for GOSUBs and one for PROCs (the GOSUB stack was much smaller!); there was a superb 5-byte floating point library...

It's also worth mentioning that Acorn's MOS was in a different ROM, so it didn't have to share space with Basic. The two communicated via a system call interface. I've seen people run BBC Basic on entirely different 6502 machines by reimplementing the system call interface.

I would not recommend writing this style of Basic if you want a simple language these days. Basics are a nightmare of ad-hoc parsing with too many edge cases. Better to write a modern byte-compiled language with a byte interpreter --- you'll end up with something much cleaner and easier to understand. We're not all Sophie Wilson.


"I would not recommend writing this style of Basic if you want a simple language these days. Basics are a nightmare of ad-hoc parsing with too many edge cases. Better to write a modern byte-compiled language with a byte interpreter --- you'll end up with something much cleaner and easier to understand."

thankyou for these suggestions.

"We're not all Sophie Wilson."

agree, very talented individual.


> want to hack a language together a BASIC-like language (are of use) for graphics.

One of the coolest ones was AMOS for the Amiga.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: