I can't find a link option ; the project is hosted on github at https://github.com/paulscottrobson/1k-coding-challenge
I'll upload the basic listing file to files when it is completed.
Attempting to get a workable BASIC interpreter in 1k of 8008 assembler code.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
I can't find a link option ; the project is hosted on github at https://github.com/paulscottrobson/1k-coding-challenge
I'll upload the basic listing file to files when it is completed.
basic.lstAssembly Listinglst - 68.88 kB - 01/06/2017 at 20:30 |
|
|
basic.asmAssembly Sourcex-asm - 29.69 kB - 01/06/2017 at 20:30 |
|
What it says .... it's complete and apparently working okay. Code size is 722 bytes. Currently the source compiles to 725 bytes + some extra code after $400 ; this code allows me to put code in the assembly which is loaded on new - it's quicker than typing it in manually.
The < 768 bytes would actually matter ; ROMs in these days were often 256 x 8 bytes, so it's the difference between 3 and 4 of them.
Well, having sobered up after Christmas, the project is nearly completed. It is currently running at $000-$29C - 668 bytes. 3 of those are a 'hack' put in so I can load code in without typing it in, which wouldn't be in the final build.
Currently implemented commands are FETCH, GOTO, IF, LET, NEW, OUT, PRINT, STOP, VIEW and XECUTE. The reason for the renaming is I decode on the first character only (so I can't have IF and INPUT). So FETCH is INPUT, VIEW is LIST and XECUTE is RUN.
Currently outstanding are GOSUB/RETURN which means the interpreter is likely to come in in under 3 pages.
In places it is horribly wasteful of CPU time and data memory, but then it's designed to minimise code memory.
I appreciate the people who worked on the MCM/70 system - an 8008 APL Laptop from the early 1970s. It's an interesting machine to program for to put it mildly.
The project is about 570 bytes long, which includes : program editing/listing, evaluation, assignment, GOTO, INPUT, PRINT.
Outstanding are GOSUB/RETURN (will actually be CALL/RETURN), a conditional statement, and a command which is a bit like INKEY.
Some things may be improved later if space permits ; the evaluator was written first and is about 110 bytes but needs some better error checking - it doesn't crash, it just accepts bad syntax.
The project is very wasteful of RAM - deliberately to save program memory :)
The simplest way to build it is using NETBEANS 8.2 ; it also requires SDL 2, but nothing else. To build the assembler you need Alfred Arnold's AS Cross Assembler.
Create an account to leave a comment. Already have an account? Log In.
Become a member to follow this project and never miss any updates
By using our website and services, you expressly agree to the placement of our performance, functionality, and advertising cookies. Learn More
This is really awesome! You made really interesting trade-offs (e.g. the tokenization). Chapeau!
The 8008 opcodes are surprisingly compact. I don't think that this could be done with the STM8 architecture - there are too many 2, 3, 4 and even 5 byte opcodes, and there aren't enough general purpose registers.