Retrochallenge 2016/01:
Maze War for Olivetti M10 and NEC PC-8201A

Episode 5: From Mockup to Data

Last time, we learned how to talk to the display low-level and today we'd really want to put our findings to some use. Deplorably, today's time budget doesn't allow for much, but we have to start with the maze-data anyway.

From mockup to data ...

Not exactly Star Wars and not exactly rocket science either … Down-to-earth DATA statements.

How to Be Lazy

Most clever things were invented for laziness — and programming isn't an exception to the rule. Since we've already a mockup of the maze, we won't go through the painstaking process of encoding it again. Rather, we just transform the graphics into something BASIC can read, namely DATA statements.

So, we take some tool at hand, let's say, the web browser already open and the text editor that's always at hands — why not? Here we go:

<!DOCTYPE html>
<script type="text/javascript">

onload = function() {
    var img=document.getElementById('img'),
        ctx, pixels;
    pixels=ctx.getImageData(0,0, w,h).data;
    var data=[];
    for (var i=0; i<h; i++) {
        var d=[], y=w*i*4;
        for (var x=0; x<w; x++) {
            d[x]= (pixels[y+x*4]>128)? 1:0;
        data.push((1000+i)+' DATA '+d.join(','));

    <img id="img" src="maze.gif" />
    <pre id="out"></pre>

Our little script, see it here in action.

And this is what we get:

1000 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1001 DATA 0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
1002 DATA 0,1,0,1,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0
1003 DATA 0,0,0,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0
1004 DATA 0,1,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,0,1,1,1,0,0,0
1005 DATA 0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,1,0,1,1,1,1,1,1,0,0,0,1,1,0,0
1006 DATA 0,1,0,1,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,0,1,1,0
1007 DATA 0,1,0,1,1,1,1,1,1,1,0,1,0,1,0,0,0,1,1,1,1,1,0,0,1,0,0,1,1,0,0,0
1008 DATA 0,1,0,0,0,1,0,0,0,1,1,1,0,1,1,1,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,0
1009 DATA 0,1,1,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,1,1,1,0
1010 DATA 0,0,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0
1011 DATA 0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,0,1,0
1012 DATA 0,1,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,1,0,1,1,0,1,0,1,0,1,0
1013 DATA 0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0
1014 DATA 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
1015 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

WYLIWYG, What You Load Is What You Get. … Yeah, looks like a maze …

And that's really all of it for today, folks — no time for more, sorry.

P.S.: A Small Battery Wonder

The runtime and standby capacities of the Kyocera Siblings are already legendary, so there hasn't to be said much about this, anymore. But, there's something worth mentioning: The Olivetti M10 arrived somewhen in mid to late October and the NEC PC-8201A in (mid?) November. Both of them are still running on the first set of 4 AA batteries! (VARTA High Energy Alkaline AA batteries, PD0113 ED0618.) That's two to three months by now! — Take that, iPhone. ;-)

Fair enough to mention that the Olivetti came with an AC adapter and I had it plugged in most of the time while actually playing around with it, but the NEC is running on batteries alone. Also, as the amount of RAM may tribute to the energy consumption, it may be worth noting that the Olivetti M10 had just 24 K of RAM installed in the beginning and the PC-8201A even less, just 16 K (I upgraded them both to 32 K a few days before Christmas, just some weeks ago).

However, we may want to reconsider our mobile technologies.


Next:   Episode 6: The Round and the Square — Displaying the Maze Map

Previous:   Episode 4: LCD Talk

Back to the index.

— This series is part of Retrochallenge 2016/01. —