×   Main Menu ALL The 8BS News Manuals (New menu) Links Worth a Look Tools Disc and Basic Webring Site Map 8BS Guestbook Old Guest Book Me The Barnsley Rovers   
8-Bit Software

The BBC and Master Computer Public Domain Library

BBC BASIC Emulation

From Sebastian Mennicke

Back to 8BS

Sebastian has sent me the following info and this file containing the source code so far

I'll attach the C++-Sources I have written so far. They should be compilable (at least the ones specified in the Makefile), but they are in an *absolutely unfinished* state! I think so far it's pure ANSI C++, nothing specific to Linux. So if you have a C++-Compiler you can try to build it. And you can have a look at the sources of course.

Unfortunately I haven't written documentation yet. The basic way it works is the following:

A program in form of a text file is loaded into memory as a list of lines. The lines are split into tokens by the Lexical Analyzer. (These tokens don't correspond to the built-in token values of BBC BASIC!) So far, I don't use line numbers at all. A line can contain several statements, separated by colons. A statement can be a REMark, an assignment or a statement keyword followed by its arguments. For each keyword, there is a handler which is responsible for parsing the arguments and executing the command.

I've implemented only few keywords so far. Currently I'm trying to implement the core structure, like loops, procedures, arrays etc.

The BBC BASIC version I am used to is BASIC V. I've worked with it on an Acorn Archimedes and RiscPC with an ARM CPU. I think since version V there are many new structures, like WHILE...ENDWHILE and multi-line IF...THEN...ELSE...ENDIF. And these are a bit tricky to implement. If the condition after WHILE is FALSE, you have to search for the next ENDWHILE keyword, but you have to skip nested WHILE loops, I think.

So if you could find out how these things are handled in the BASIC ROM, that could be of help for me. Also it would be interesting to know how the stack is organized.

I don't plan to include an 6502 assembler in the interpreter, as it wouldn't make sense to generate 6502 code on a different architecture. And an assembler is probably easier to realize than an interpreter. The core functionality could be written in a system independent way. But for things like graphics, sound and special I/O stuff the code would be OS specific.

It would also be possible to make the language easily extensible. New statements and functions could be added by just copying a DLL to a certain directory and loading it dynamically.

So, I can't say "have fun with it" because the code doesn't do very much right now, but let me know what you think and if you want to discuss further!


Back to 8BS