Author: scruss

  • 2D Star Dodge flies again!

    There’s rather more nostalgia in this post than I’d want to deal with. If you want to just play the game, go here here and skip this blurb.

    Update: the Java emulator doesn’t work in the browser any more, so here’s Arnold playing the BASIC version: http://scruss.com/cpc/6128s.html?stardoj.dsk/run%22stardoj2

    About 25 years ago, I was a smallish computer nerd obsessed with programming his Amstrad CPC464. I had got a BCPL rom-based compiler for cheap and was looking for things to do with it. “Why not write a game?” I asked myself.

    There were two minor hurdles. I had no imagination, and I certainly wasn’t focused enough to write anything big. Fortunately, it was still the 80s, so we knew how to rip stuff off without being called out for it. I merrily copied a game my friend Alan Cook had written for the Dragon 32, and called it 2D Star Dodge.

    2D Star Dodge was the perfect rip off. Not merely had I ripped off the idea from Alan, but he had ripped off the idea in turn from a BBC Basic one-liner game called (as verified by Graeme Smith) “One Line” Asterisk Tracker. The name 2D Star Dodge was an, um, homage to Realtime Games’ 3D Starstrike, which itself was “strongly influenced” by the Star Wars arcade game. Originality? Pfft.

    So I wrote the game. Well, okay, I wrote a mockup in Locomotive BASIC, which ran a bit slowly, but gave me something to work from. Here it is, if you want to play it in you (Java-enabled) browser: 2D Star Dodge – BASIC. I then meticulously translated it into BCPL, and ended up with something that looked liked this:

    (if you click on that image, you can play the BCPL version in your browser.)

    this is actuall screen three, hope no-one notices ...

     

    The gameplay — press a key to go up, stop pressing a key to go down — is a bit like SFCave (obligatory Java version: Lab6 SFCave) or even my current favourite Tiny Wings.

    Once I’d finished the BCPL version, I had bought the MAXAM assembler ROM, and got learning the Z80 opcodes. Soon, a third port was complete, now needing hardcoded delays to be playable as it would kill you off in about one screen refresh without them.

    So, now I had three versions of the same game. There was only a limited number of local folks I could give it to, so I decided to send all three versions to Amstrad Computer User magazine to print as a type-in. Thankfully, it arrived on the desk of the freshly minted (yet still beardy) assistant editor Jeff Walker, who had founded the jam econo CPC magazine/club WACCI. Jeff had the idea for me to turn the simple game into a comparison of programming in three languages.

    Thanks to the CPCWiki forum, you can now read the articles I wrote in Amstrad Computer User in 1988 that went with the code. Writing style best described as “typing”:

    To play the game in an astonishing JavaScript emulator:

    1. Download this disc image file: stardoj
    2. Unzip it
    3. Go to CPCBox
    4. “Choose configuration …” of Boot CPC464 (or 664, or 6128)
    5. Select your downloaded stardoj.dsk as Drive A:
    6. Annoyingly, it seems to be stuck with an AZERTY keymap, so to catalogue the disc (cat) you have to type cqt
    7. To run the BASIC version, type run"stardoj2 (on my American keyboard, that becomes run@stqrdoj2; quotes are Shift+2). Hitting Escape twice will quit back to the prompt.
    8. To run the BCPL version, type run"2dstardo. The only way to quit is to reset the emulator.

    The BASIC version is based on the published type-in. The BCPL version I found as a disk image (2dstardo.dsk) on a download site — it’s exactly as I submitted it to the magazine, dubious copyright message and all. I’m not sure how it got out there; I suspect either my network of, ahem, software protection experts I knew through Colin Harris of Nemesis, or it went via my CPC-owning French penpal (Hi Benoit Hébert, formerly of Le Havre).

    I had to modify the BCPL binary to run on modern emulators, as the real Amstrad CPC did a thing with its keymapping that is really hard to get right on modern systems. Originally, the game used the Shift key, but I modified it to use Space, which is easier to emulate as it’s a printing character. Can I just say that I remembered how to read and modify Z80 binaries after a quarter century? Old school, literally. I used iDsk‘s disassembler/hex dumper and emacs’s hexl mode to do the deed.

    I recently discovered that someone created a Flash game based on my type-in: Star Dodger. Mind = Blown.

    Update, 2018: Lawks! Someone wrote a PureScript version! It doesn’t exactly work for me on Firefox, but it does on Chromium.

  • Artisanal rarebit

    Artisanal rarebit

    Instagram filter used: Lo-fi

    View in Instagram ⇒

  • Amstrad CPC INKEY codes

     

    Ganked from the CPC 6128 manual. You’re welcome …

    Note that non-printing keys (like SHIFT) are really hard to emulate on modern machines. The CPC scanned them as if they were any printing key, but modern machines handle them like key modifiers.

  • Pibow; it’s official – normal USB cables don’t fit

    I’d noted previously that a standard USB micro-b power plug doesn’t fit into a Pibow. I’ve measured the opening in the case at 10.4 mm. This is what the USB.org spec says for the Micro-B plug:

    A conforming cable can be up to 0.2mm larger than would fit into the Pibow. The rather weak excuse given by the designer is:

    My Micro-USB cable doesn’t fit!

    The Pibow supports a wide range of svelte, stylish micro USB cables, we recommend on [sic] of these. We may be able to slightly widen the aperture to include more cable. We don’t intend to support cables with large sleeves though, they just look naff 🙁

    While I had the vernier calipers out, I measured all the USB connectors I could find. Not one was under 11 mm, way out of spec, and completely unlikely to fit in the Pibow.

  • Lookout Trail

    Lookout Trail

    Instagram filter used: Lo-fi

    Photo taken at: Lookout Trail

    View in Instagram ⇒

  • Algonquining

    Algonquining

    Instagram filter used: Lord Kelvin

    View in Instagram ⇒

  • Has it really come to us needing a “fresh remote” bag?

    Has it really come to us needing a “fresh remote” bag?

    Instagram filter used: Lord Kelvin

    Photo taken at: Best Western North Bay

    View in Instagram ⇒

  • the russian peasants are multiplying!

    Via this post, I found out about Russian Peasant Multiplication, a rather clever method of multiplication that only requires, doubling, halving and adding. So I wrote some code to display it:

    #!/usr/bin/python
    # -*- coding: utf-8 -*-
    
    import sys
    results=[]
    indicator=' '
    
    left=int(sys.argv[1])
    right=int(sys.argv[2])
    
    while right >= 1:
        indicator='X'
        if right % 2:
            indicator=' '              # right number is odd,
            results.append(left)       #  so add left number to results
        print (" %s %16d \t %16d %s") % (indicator, left, right, indicator)
        left *= 2
        right /= 2
    
    print("%s × %s = %s = %d")%(sys.argv[1], sys.argv[2],
                                ' + '.join(map(str,results)), sum(results))

    So to multiply 571 × 293:

    $ ./rpmult.py 571 293
                    571                   293  
     X             1142                   146 X
                   2284                    73  
     X             4568                    36 X
     X             9136                    18 X
                  18272                     9  
     X            36544                     4 X
     X            73088                     2 X
                 146176                     1  
    571 × 293 = 571 + 2284 + 18272 + 146176 = 167303

    Python’s still got some weirdness compared to Perl; where I’d join the list of sum terms in Perl with join(' + ', @results), in Python you have to convert the integer values to strings, then call the join method of the separator string: ' + '.join(map(str,results)). Still, I’ll give Python props for having a built-in list sum() function, which Perl lacks.

  • A gently snoozing porcupine

    A gently snoozing porcupine

    Instagram filter used: Earlybird

    Photo taken at: Science North

    View in Instagram ⇒

  • The view over to Porridge Lake

    The view over to Porridge Lake

    Instagram filter used: Lo-fi

    Photo taken at: Fire Lookout Tower

    View in Instagram ⇒

  • Roots

    Roots

    Instagram filter used: Lo-fi

    View in Instagram ⇒

  • The view across Horne Lake

    The view across Horne Lake

    Instagram filter used: X-Pro II

    Photo taken at: Horne Lake

    View in Instagram ⇒

  • The dinner view …

    The dinner view …

    Instagram filter used: Lo-fi

    Photo taken at: Dunlop Lake Lodge

    View in Instagram ⇒

  • Moth Squadron

    Moth Squadron

    Instagram filter used: Lo-fi

    Photo taken at: Hampton Inn by Hilton

    View in Instagram ⇒