64 bit graphical hand held

I read a post on Hackaday about a ‘64 bit graphics’ hand held game system powered by the atmel 328…an Arduino Uno like handheld.  Well, the headline was a bit deceptive, the 64 bit part was correct, as there is an 8×8 LED matrix being use for the ‘screen’. 

WP_20160702_03_18_57_Pro (2)This is actually something I had toyed with building for quite a while now.  I had seen several (Super Pixel Brothers being the first) and, after seeing this particular build, I thought…why not?  I have a lot of those matrices lying about, so I took my last unbuilt matrix (it was a ‘kit’) and used it as the basis of my console.

I used my previous handheld build as the basis for this one, which was also very similar to the Hackaday build.  I guess there aren’t many different to do this.

My build has four buttons: Reset, left, right and action.  I deviated from the article’s build and used a battery pack that has three AA batteries.  The unit ran nearly 24 hours on those three batteries.

While I have the hardware complete, I am working on software. The article’s build has six games: space invaders, pong, racing and three others.

So, I now have a piece of nice hardware and nothing running on it.  I’m thinking about adapting the Super Pixel Brothers to the handheld or doing a Space Invaders type game.  Not sure yet. Heck, I WP_20160630_21_10_14_Promay just put several pre-programmed messages and use the buttons to select them. 

What would you do?  Thoughts on software/games?  Leave them in the comments below.

 

Link to the Hackaday article: http://hackaday.com/2016/06/25/this-arduino-console-has-64-bit-graphics/

Retro-computing: old school programming

In my last post, I spoke about the TRS-80 Model 100 Portable Computer and how I wrote up a crude little game that sort of resembles Space Invaders. Well, if you take away all of the invaders except for one of them, neuter their ability to return fire and take away the sound, that is. Anyway, I thought I would post the code from an enhanced version of that one hour exercise. I found an emulator that let me take screen shots and test the code before hand keying it on the real thing.  The code is posted twice: once as you would actually enter it into the Model 100 and once formatted and commented.

Type it into the Model EXACTLY as you see here (you do not need to enter blank lines between each line of code):

10 CLS

20 LINE(0,38)-(66,48),1,B

100 SC=0:BP=20

105 PRINT @201,”Score: 0″;

110 H=669:L=75:X=0

115 B$=CHR$(230)+CHR$(239)+CHR$(229):B=(40*7)+19

116 C$=CHR$(144):C1$=CHR$(145):L$=CHR$(152)

117 ALIEN$=C$:D=LEN(ALIEN$)

120 PRINT @X, ALIEN$;

121 PRINT @B, B$;

122 IF X/2 = INT(X/2) THEN ALIEN$=C1$ ELSE ALIEN$=C$

130 PRINT @X, ” “;

140 X=X+D

200 K$=INKEY$

210 IF K$=”q” THEN END

215 IF K$=”,” THEN BP=BP-1:BM=-1

216 IF K$=”.” THEN BP=BP+1:BM=-1

217 IF BP<13 THEN BP=13 ELSE IF BP>27 THEN BP=27

220 IF K$=” ” THEN F=6:SHOOT=1

221 IF BM=-1 THEN PRINT @B,”   “;:B=(40*7)+BP:PRINT @B,B$;

230 IF SHOOT=1 THEN PRINT @(40*F)+BP+1, L$;

231 F1=F

232 IF SHOOT=1 THEN F=F-1:IF F=0 THEN SHOOT=2

233 MP=(F*40)+BP+1

234 IF SHOOT=2 AND X=MP THEN FOR Z=1 TO 4: PRINT @X,”*”;: FOR YY=1 TO

100:NEXT YY:PRINT @X,”+”;: FOR YY=1 TO 100:NEXT YY:NEXT Z:PRINT @X,” “;

235 IF SHOOT=2 AND X=MP THEN PRINT @140,”HIT!”;:SOUND H,L:FOR DL=1 TO

300:NEXT:PRINT @140,”     “;

238 IF SHOOT=2 AND X=MP THEN SC=SC+10:X=0:D=LEN(ALIEN$): PRINT

@201,”Score:”+STR$(SC);
239 IF SHOOT=2 THEN F=6

240 IF SHOOT=-1 THEN PRINT @(F1*40)+BP+1, ” “;

245 IF SHOOT<>-1 THEN PRINT @(F1*40)+BP+1,” “;

390 IF X<40-LEN(ALIEN$) THEN D=+D ELSE D=-D

395 IF X<0 THEN X=1: D=LEN(ALIEN$)

400 GOTO 120

And here is the formatted, commented code:

10 CLS                ‘Clear the screen
20 LINE(0,38)-(66,48),1,B    ‘Draw the score box
100 SC=0:BP=20            ‘Set score and base position
105 PRINT @201,”Score: 0″;    ‘Write our score label
110 H=669:
    L=75:
    X=0            ‘Set the pitch and length for our sound
                 and set the initial alien position to zero
115 B$=CHR$(230)+CHR$(239)+CHR$(229):
    B=(40*7)+19        ‘Create the base and set the position
116 C$=CHR$(144):
    C1$=CHR$(145):
    L$=CHR$(152)        ‘Create the alien and missile character
117 ALIEN$=C$:
    D=LEN(ALIEN$)        ‘D holds the direction for the alien
120 PRINT @X, ALIEN$;        ‘Draw the alien
121 PRINT @B, B$;        ‘Draw the missile
122 IF X/2 = INT(X/2) THEN
        ALIEN$=C1$
    ELSE
        ALIEN$=C$    ‘Animate the alien
130 PRINT @X, ” “;        ‘Erase alien from previous position
140 X=X+D            ‘Calculate the new position for the alien
200 K$=INKEY$            ‘poll the keyboard
210 IF K$=”q” THEN END    ‘Q will quit
215 IF K$=”,” THEN
    BP=BP-1:
    BM=-1            ‘comma (<) moves base left
216 IF K$=”.” THEN
    BP=BP+1:
    BM=-1            ‘period  (>) moves base right
217 IF BP<13 THEN
        BP=13
    ELSE
        IF BP>27 THEN
            BP=27    ‘determine the boundary for the base
220 IF K$=” ” THEN
    F=6:
    SHOOT=1        ‘space bar fires your missile
221 IF BM=-1 THEN
    PRINT @B,”   “;:B=(40*7)+BP:
    PRINT @B,B$;        ‘Move the base
230 IF SHOOT=1 THEN
    PRINT @(40*F)+BP+1, L$; ‘Show Missile
231 F1=F            ‘Remember the missile’s previous position
232 IF SHOOT=1 THEN
    F=F-1:
    IF F=0 THEN
        SHOOT=2    ‘Row calculation
233 MP=(F*40)+BP+1        ‘Calculate the new missile position
234 IF SHOOT=2 AND X=MP THEN
    FOR Z=1 TO 4:
        PRINT @X,”*”;:
        FOR YY=1 TO  100:
        NEXT YY:
        PRINT @X,”+”;:
        FOR YY=1 TO 100:
        NEXT YY:
    NEXT Z:
    PRINT @X,” “;        ‘If the alien was hit, show an explosion
235 IF SHOOT=2 AND X=MP THEN
    PRINT @140,”HIT!”;:
    SOUND H,L:
    FOR DL=1 TO  300:
    NEXT:
    PRINT @140,”     “;    ‘If alien was hit, show ‘hit!’ on screen and play sound
238 IF SHOOT=2 AND X=MP THEN
    SC=SC+10:
    X=0:
    D=LEN(ALIEN$):
    PRINT  @201,”Score:”+STR$(SC); ‘If alien was hit, update score and reset alien position and direction
239 IF SHOOT=2 THEN
    F=6            ‘Reset the missile row after destruction of alien
240 IF SHOOT=-1 THEN
    PRINT @(F1*40)+BP+1, ” “;     ‘Erase the Missile
245 IF SHOOT<>-1 THEN
    PRINT @(F1*40)+BP+1,” “;    ‘Erase the Missile (added to fix a bug)
390 IF X<40-LEN(ALIEN$) THEN
        D=+D
    ELSE
        D=-D        ‘ Update the alien direction
395 IF X<0 THEN
    X=1:
    D=LEN(ALIEN$)
400 GOTO 120            ‘Loop back for more

Yeah, the code is crap, but it was fun to go back in time and mess around with such an ancient language on an ancient computer (that still works and works well.) 

The Gameinvader

Objective: Shoot the alien until you are bored of doing so.

Controls:

, {comma} Move base to the left
. {period} Move base to the right
  {space bar} Fire missile
Digg This

Retro-Computing: the TRS-80 Model 100 and old school coding

TRS-80 Model 100 Portable ComputerSometime in late 2010, I purchased a TRS-80 Model 100 Portable Computer. The computer, one of the first true notebook computers, was a marvel of its time: integrated keyboard and LCD screen, built in MODEM, up to 32K (yes, K…that’s THOUSANDS of bytes) of RAM and a host of software.  The computer ran off of AA batteries and was fully self contained. It had Microsoft Basic (THE standard of the day) along with personal information management software. It was a very popular computer and you can still see them in use today.

Recently, I dusted the computer off and took it for a spin.  I wanted to show my son just how a geek in my day had ‘fun’.  I sat there, while he played Call of Duty on the Xbox and wrote a crude space invader style game. Right there, on the device. NO development environment to speak of, just the line oriented editor.  Oh, and LINE NUMBERS.  Remember them?

100 Print”Hello, World”

Wow. I have not used line numbers in years…decades, even.  I don’t know, there’s something quaint about them…having to figure out a decent increment because, you know, you will, at some point, have to insert a line or two of code because you left something out or, more likely, figured out you needed to add or move something to fix something somewhere else.  Ah, the joys of spaghetti code.  Nothing like it.

So, in that hours time, I managed something that sorta kinda resembles a one invader space invaders game. My little invader, which was sorta animated, would go back and forth on the top line of the 7 line screen. My base was centered on the bottom of the screen and touching the space bar would ‘fire’ the missile at the invader.  Only a direct hit would score your ten points. The game continued until you press Q.  This version does not have the alien invader retaliating, only moving back and forth.  With only about thirty lines of code, there isn’t much there.  But, hey, not bad for such a crude little machine and hours worth of time. 

This little exercise reminded me that sometimes we don’t always need the most recent, hottest or best of anything to have a good time.  I was having a ball playing with the computer, figuring out how to do things without reading the manual (which I have.)  And, for this developer, using that old flavor of Microsoft Basic was a blast.  Line numbers, PRINT @, and the ever so enthralling ‘SOUND’, which makes high pitched beeps. Good stuff.  Makes me appreciate .Net even more.

If I can transcribe (I.E. feel like retyping) the code, I’ll post it here, if there is any interest.

One note about the computer: while the LCD screen is terrible, the rest of the computer, ergonomically, is superb.  The keyboard has a nice feel and the whole thing is surprisingly light.  The fact that it uses AA batteries is awesome. No cumbersome recharger, expensive batteries or funky adaptors. Just AA batts. Oh and the menu screen is easy to use, but, for some odd reason, you have to actually go into BASIC and issue a command to delete a file.  Weird.  Hey, it was the 1980’s. Hell, it’s easier to use than some newer devices today…like Pandigital’s e-Reader and the Kindle.

Update:

Here is a wonderful site full of TRS-80 information and nostalgia. Also, there is an emulator for the Model 100.  I won’t put a direct link here since the emulator contains copyrighted material, just use Bing or that other search engine.  Search for VirtualT.

Digg This