Many people take part in annual 10 liner contests where they write BASIC programs that are no more than 10 lines long. Most of these, if not all, are games. I thought it would be interesting to see if the same could be done for some productivity software. I chose to build database software. It may not be elegent or efficient, but that is not the point. The point is making something functional using only 10 lines of BASIC code!
I’ve been working on this on and off for a couple of years. I chose to implement it on the Atari 8 bit. To make it especially challenging I chose Atari BASIC (revision C) as the dialect. I didn’t set out to make it challenging, it just turned out that way. Other BASIC’s such as Turbo BASIC, BASIC XL, and Microsoft BASIC (to name a few) are much more powerful.
There are several challenges with Atari BASIC. The most significant is the lack of in ELSE clause for IF constructs. This means conditional logic constructs need more lines of code than conventionally necessary – and thats a problem when you only have 10 lines to work with.
So far, I’m on my fourth version of the software, and FINALLY, it is showing results. Each version I looked at different implementation techniques for data storage.
Currently, there is a preset number of fields (5), present length (25 characters), and a maximum of 255 records. This means each record is 125 bytes. 125 bytes times 255 records is 31875 bytes (right at 32K).
Here are some screenshots of the software in action. The first is of a new database being created, a record being added, the records being listed, and the database being saved at exit:
The next shows the database being loaded, the records being listed, and the database being saved at exit:
The last shows the hex dump of the database file on disk:
Now I just need to figure out the delete with just 1 line. I’ll post the source once I finish, or maybe after I enter the next contest.