[Translation] Crack BASIC to 768 bytes

[Translation] Crack BASIC to 768 bytes



Those lucky enough to write their first program in BASIC in the late eighties, the volume of the interpreter of 16 kilobytes seems quite natural. This was not always the case; interpreters of 8 and 4 kilobytes are known, of course, with a more modest set of functions. But this time, it would seem, the impossible is done - the interpreter is compressed to 722 bytes. This is less than 768, which means that it will turn out to be placed not into four, but into three memory chips of 256 bytes. Yes, there were such!

And 768 bytes is, by the way, 21, (3) times less than 16384.

The interpreter is written for the 8008 processor that is not very popular among retrocomputers. For it, there is already a BASIC interpreter - SCELBAL, but it is 8 kilobytes. The command system 8008 resembles the command system 8080 without half the instructions. Or the Z80 command system without 90% of instructions.

The first version of the interpreter, which already had the words GOTO, INPUT, PRINT, and also provided a standard way of program editing for BASIC interpreters, took 570 bytes. Then the word list was expanded to the following: FETCH, GOTO, IF, LET, NEW, OUT, PRINT, STOP, VIEW and XECUTE.

Some of them seem strange to you. And the thing is that this interpreter recognizes words by the first letter. Therefore, INPUT had to be turned into FETCH, LIST - into VIEW, and RUN - into XECUTE. And GOSUB and RETURN do not provide at all - then you would have to go beyond the planned volume.

The author understands the users of the MCM/70 portable computer, also made on the 8008, equipped with a dual cassette and programmed in the APL language with its one-letter commands.

The project together with the emulator is available here under the MIT license. The author has no real iron for 8008. You can also download assembly source code and compilation result with comments separately.

The easiest way to build an entire project from GitHub is to use NETBEANS 8.2, you also need SDL2. Assembly of the assembler requires AS macro assembler .

Source text: [Translation] Crack BASIC to 768 bytes