The archive. Confetti. Type in programs. Read.

syncmagAs part of putting together a package of materials for Half-Byte Tiny Basic, I came across several gems that either reminded me of my early computing days or are cool enough for me to write about.

One such site is the Internet Archive. (The link takes you to the magazine rack. From there, use the search bar near the top of the page, and search for, say, ‘Byte’. Or computer magazines.)

Now, this site has a treasure trove of material, including the Way-Back machine. The Way-Back machine allows you to enter a URL and then see it in various incarnation through the years. It’s really interesting to see how the Internet and web design have developed. But, that’s not what caught my eye, as cool as that is.

No, it was the site’s collection of magazines, specifically, computer magazines. You can download scanned images of whole magazines, going back to the mid 1970’s.  I remember quite a few and even had many of them. At one point, I had the first ten years of Byte Magazine, THE computer magazine of the 1970’s and ‘80s.

Now, the magazines I was looking for, Dr Dobb’s (another one that I had the first seven years worth, but, no longer) Journal and a bunch of Sinclair ZX related magazines. Unfortunately, CMP has Dr Dobbs, so you won’t find it here, however, you will find Byte and a whole slew of Tandy, Commodore, Atari and, of course, Sinclair related magazines.

The quality of the scans various widely. Some are really nicely done and care taken to line them up correctly, etc. BUT…some were not cared for very well. But, hey, they ARE scanned and there’s no charge to download them, so…all considered, it is a treasure trove that I’ll not complain about.

So, I did find a few things that I was looking for, namely some type-in BASIC programs.  I am putting together a booklet of short type-in programs-games-to use on the Half-Byte Console and Tiny Basic. And, the Sinclair flavour of BASIC is close and the ZX-81 lunarzx81specs are very close to the Half-Byte Console, so the conversion is pretty easy. I will also be writing about such a conversion process. The downside is that there are few examples of Tiny Basic software, or other BASIC for that matter.  Type in software is a thing of the past and pre-dates the Internet. 

I certainly remember the thrill of getting my next issue of Computer Shopper, Compute! or Sync Magazine and anxiously looking at the type in games or utilities and converting them to whatever computer I wanted to use them on.  I had my ZX-81, my TRS-80 Color Computer and, eventually, a Xerox 820 that ran CP/M and several flavors of Basic. Of course, the 32k Extended Microsoft Basic was my favorite, but the Xerox had no graphics, so I spent a lot of time on the ZX or the CoCo. 

Typing in games was great. I got to learn what the program did, hone my typing skills and felt accomplished when I typed that last line, saved and then type RUN.  Inevitably, of course, I would have made a mistake and would have to fix it. Sometimes, I made no mistake-the listing was just wrong. Other times, I made a mistake converting the code and would have to correct it. Sometimes, that took minutes. Other times…DAYS. Oh my. I remember one game that took me hours to type in on my CoCo. I had an original CoCo, which had a crummy key board. UGH.  I hated that thing.  Never replaced it though.  Should have. 

Anyway, I get through typing in this game. Saved it on two different tapes, just to make sure. I type RUN, press RETURN and…nothing.  The damned computer hung.  I had to TURN IT OFF! Now, this meant re-loading the game and trying to figure out why it choked.  Loading anything from a tape was a laborious and risky task.  Will it load? You pray, even if you don’t believe, you pray that the Tape Gods are  favorable to you today and will allow the software to load.  Fortunately, I had not upset the Tape Gods and all was good.  I figured out that I had reversed two numbers that were in some MACHINE CODE that was getting POKED into memory and run.  So, I fix that.  Re-save. On three tapes, this time. I want to be safe.

I type RUN.

Boom! Confetti!

It started. 

I followed the directions and pressed the space bar to start the game.

Boom! No Jimmy Johnson. No Confetti. Only a damned Syntax Error and that stupid multi-colored cursor blink at me.

This problem, a multi-statement line where I left out a bloody colon in the middle of the line. That…took a week to find.  I ended up just retyping the line. Three times! I mistyped that same line two different times. The third time was the charm.  This time, there was confetti. And, it was good.

Ah, those were the days. ‘Free’ and open source software before it was called that. Well, not totally free. You still had to buy the magazine.

So, sit right back my friends, you are sure to get a smile…or a chuckle. Once the console is out of the door, expect to see a few type in games or utilities on these pages from time to time.

Advertisements

HALFBYTE Console Tiny BASIC update

XANDER - WIN_20140222_110454 (2)The HalfByte Console is nearly complete. The hardware design is pretty much done and a prototype built. It is a fairly simple ATMega328 based computer with audio and video out, Wii Nunchuck interface (the Wii Classic Controller also works), PS/2 Keyboard support and will run off of battery, wall wart or can be powered via FTDI.  It is pretty small, about the size of an Arduino UNO. It is designed to be easy to use and build. (The console featured in the photo above is the first prototype and is not the final design. The final prototype is not presentable here, this one looks nicer.)

One of the goals of the console is to aid in learning to program.  For now, this can be done in two ways: standard Arduino IDE or on console via Tiny Basic.

Yes, Tiny Basic. 

I have adapted the wonderful little version of Tiny Basic from Mike Field.  I did this for the XGamestation and have done it for the HalfByte Console as well. This version of the language supports graphics, low level hardware access and the Nunchuck. It is standard Tiny Basic in every other aspect: integer variables, single letter variables, line numbers, GOTO, small memory footprint and is easy to learn. It makes the perfect introduction to programming.

Because the 328 is limited, RAM wise AND the video takes up most of that RAM, we are left with only 726 bytes of memory to use for programming. The 52 bytes for variable storage and stack already have RAM dedicated, so you do not need to factor that in.  As such, the big feature I wanted to include, SD Card support, could not be done.  To implement FAT16, you need a 512 byte buffer and we simply do not have that, so, for now, EEPROM is used to store a program. Again, memory issues only allow for ONE saved program.  Since RAM is low anyway, we can fit it in the 1k EEPROM space we have.  And, remember, this is more of a learning tool than a ‘serious’ development platform.  The console can, of course, be programmed for games and other applications outside of Tiny Basic and there are a lot of really clever games that utilize the TV OUT library.

So, what can we do with Tiny Basic? Well, even with these limitations, a lot.  Throw some motors on the console and control them with Tiny Basic.  Add some LED’s and make them blink.  Create small, clever games.  Your imagination is the limit.

I won’t discuss the basics of BASIC, but would like to touch on the hardware specific enhancements, like graphics and controller support.

GRAPHICS

There are five graphics statements and one function.  The five statements are:

  • SET x,y
  • RESET x,y
  • LINE startx,starty,endx,endy,on or off
  • BOX startx,starty,endx,endy,on or off
  • CIRCLE startx,starty,radius,on or off

The function is:

  • <var>=GET(x,y)

GET will return the setting of a pixel at x,y. If the pixel is lit, it returns a TRUE (1) otherwise a FALSE (zero).

For LINE, BOX and CIRCLE, ‘on or off’ means a one for on and a zero for off.  If you BOX a section of the screen with text or other graphics, you can set ‘on or off’ as a 2 and it will invert that section of the screen. This is a good way to highlight text.

HARDWARE ACCESS

There are two statements that can set pins on the 328:

  • AWRITE <pin>,on or off or value (sets the ANALOG pin)
  • DWRITE <pin>,on or off or value (sets the DIGITAL pin)

There are three functions to read values from the hardware:

  • <var>=AREAD(<pin>)
  • <var>=DREAD(<pin>)
  • <var>=IN( 0 )

AWRITE and DWRITE will send a value to the specified pin. A zero sets the pin LOW, a one sets it HIGH, any other value is simply sent to the pin. AREAD and DREAD will return a value from the specified pin. NOTE: the ‘A’ in AREAD and AWRITE specify the ANALOG pins, while the ‘D’ means DIGITAL pin.

IN( 0 ) returns the current value from the RX pin (D0) on the 328p chip. This could be useful to monitor the serial interface for incoming data.

SAMPLE CODE

Since adding support for graphics and the Nunchuck, simple games like Space Invaders or simple shoot them ups are fairly easy.  Nunchuck support is complete, too…you can not only read the buttons and the thumbstick, but also the accelerometer. While the Classic Controller will work, no support for it is included. Maybe a later version.

The first sample I want to show is Kaliedoscope:

100 CLS
110 X=RND(40)
120 Y=RND(20)
130 P=RND(40)
140 Q=RND(20)
150 SET X,Y
160 SET 80-X,Y
170 SET 80-X,40-Y
180 SET X,40-Y
200 RESET P,Q
210 RESET 80-P,40-Q
220 RESET 80-P,Q
230 RESET P,40-Q
240 IF INKEY(0)=27 STOP
250 IF RND(100)<95 GOTO 290
260 BOX 0,0,79,39,0
270 FOR I=1 TO 500
280 NEXT I
290 GOTO 110

This little gem will display random pixels that are mirrored in four quadrants on the screen.  Randomly, the screen will invert. It can be quite mesmerizing.

Here’s a Nunchuck example:

100 X=1: Y=1 #INITIALIZE OUR START
110 SET(X,Y)
120 P=PAD(0) #GET THE X VALUE
130 Q=PAD(1) #GET THE Y VALUE
140 IF P>200 X=X+1 #IF VALUE IS MORE THAN 200, GO RIGHT
150 IF P<100 X=X-1 #IF VALUE IS LESS THAN 100, GO LEFT
160 IF Q>200 Y=Y+1
170 IF Q<100 Y=Y-1
180 SET(X,Y) #LIGHT UP THE PIXEL
190 IF PAD(3) STOP #IF Z BUTTON IS PRESSED, STOP
200 IF PAD(2) RUN #IF C BUTTON IS PRESSED, RESTART
210 GOTO 120 #DO IT AGAIN

This bit of code is akin to an etch-a-sketch. PAD is the function which reads the controller. The parameter passed tells Tiny Basic which part of the controller to return a value: the x and y axis for the stick, the C and Z buttons and the accelerometer.  the modes are:

PAD number

Return value

0

Thumbstick x

1

Thumbstick y

2

‘C’ button

3

‘Z’button

4

Accelerometer x

5

Accelerometer y

6

Accelerometer z

BLINKY

This example will blink the PIN 13 LED:

100 FOR K=1 TO 50
110 DWRITE 13,1 #TURN ON LED ON PIN 13
120 FOR I=1 TO 500 #DELAY
130 NEXT I
140 DWRITE 13,0 #TURN OFF THE LED
150 FOR I=1 TO 500
160 NEXT I
170 NEXT K

Looking at the code, you see that line 110 turns on the LED and 140 turns it off.  120 and 150 create a delay so you can actually see the LED turn on and off.  We could add a line between 120 and 140 to test for the status of pin 13:

115 IF DREAD(13)=1 PRINT “LED IS ON.”

165 IF DREAD(13)=0 PRINT”LED IS OFF.”

Now, these lines are rather pointless in the example, because we know they SHOULD be set accordingly, you can see the utility of them. 

As you can see, there is a nice foundation here for something that can be quite useful in not only teaching a child how to program (or, anyone) but it is also useful for scripting hardware functions as well.  This version of Tiny Basic should run, as is, on an Arduino Mega2560. On that board, you will have more RAM to work with and create some really nice, useful or fun code.  You could also modify the interpreter for a slightly high resolution.

I have prototyped using a second 328 strictly for video generation. This gave me an effective resolution of 128 x 96 graphics and 22 by 12 text.  However, communication between the two is serial and I did not fully implement graphics. Once the console is complete, I will return to this side project and fully develop it. Perhaps HB Console II will feature two 328 chips.

Developing this Tiny Basic has been fun and brought up many memories of when I was a wee lad, experimenting with this new thing called a home computer with my Dad.  I hope this can create similar memories for parents and children going forward and, along the way, spark an interest in these nifty little computers.

NOTE: I am currently stumped with the PIC16 version of TINY BASIC.  I have the interpreter working very nicely with low res color graphics, sound and hardware support. BUT…I’ve been stumped with a big bug in the SAVE-LOAD code.  We utilize the SD Card (FAT16) library and can read and write and get the directory listing. If you are familiar with the PIC and know C and would like to help, PLEASE drop me a note.  I can’t reward you with a financial reward, but you will have my eternal thanks and recognition both here and in the Tiny Basic code.

EDIT: since publishing this post, I have been able to squeeze 200 more bytes into RAM by moving the keyword scan tables into PROGRAM MEMORY. More optimization may be possible. Who knows, maybe I can get a whole 1k of RAM. That’s what the original ZX-81 had.

Pioneers: Ralph Baer and Odyssey

270px-Magnavox-Odyssey-Console-SetDuring the gift giving season known as Christmas, video games will be one of the most given gifts.  Today’s game console, such as the Nintendo Wii and Microsoft XBOX 360, owe their existence not to Atari or Nolan Bushnell, but to Ralph Baer and something called the Brown Box.

The humble beginnings of the home video game market actually go further back than Baer, but for our purposes, we will ignore Higginbotham’s ‘Tennis for Two’ as it was just a computer demo, on an oscilloscope and never commercialized. As Baer was actually able to see his creation hit the market, his will be considered the first home video game console.

Shot in 1968, Baer and associate are playing with the Brown Box.

Baer, an engineer for Sanders Associates, came up with the idea for a video game device in the mid 1960’s and built several prototypes beginning in 1966.  Sanders was a defense electronics company and had no interest in manufacturing the game, but allowed Baer to continue working on the device with the hopes of licensing the technology to a proper consumer company. 

Many companies were pitched the idea and Magnavox had the foresight to take out a license and actually market the device.

The Brown Box, the codename for the prototype, was primitive by today’s standards.  It consisted of discreet parts, no microprocessors (none were available at the time of the prototype development) so it was built of transistor technology. It employed several ‘spot’ generators which created two ‘players’, a ball and vertical or horizontal lines. The controllers allowed for vertical, horizontal and ‘english’, which applied a curve to the path the ‘ball’ would take. It had a ‘fire’ button as well. The prototypes were capable of color and sound, but the final product was monochrome and sound was absent. Baer proposed adding sound a year later, but the idea was rejected.

The game cards were really jumper boards that configured which spots were to appear and where.  There were twelve initial cards that could be used to play hockey, baseball, football, roulette, etc.  The ‘graphics’ for each game were really just plastic overlays in two sizes for the most common television screen sizes. They clung to the CRT screens via static electricity. It was a clever, but cheesy solution.  Packed in the console were playing cards, chips, the game cards, and various other accessories that were needed to play the game. In effect, the package was more traditional board game play with the television aspect thrown in.  The only game to actually resemble what it was, was the ‘ping pong’ game on card 1. 

Higginbotham’s Tennis for Two demo

Baer’s services  were called upon time and again to fix issues with Odyssey, Magnavox’s product name for the device.  Since Magnavox was a licensee, it was in Sander’s best interest to guard the patents and make sure that no one used the ideas without paying.  Unfortunately, other companies would try.  The most notable, at least early on, was Atari.

The story goes that Nolan Bushnell had attended a demo of the Odyssey and signed the guestbook.  When Atari introduced its Pong home console in 1974, they were sued. Baer trotted out his notes, patents and, most importantly, that guest book with Bushnell’s signature.  Atari settled out of court and got one of the most lucrative deals: perpetual rights to the home console for little money.  More important, for Sanders, was the precedent: they never lost a case.  I suppose one could argue that consoles like the Fairchild Channel F and the Atari VCS did not violate the patent since they were microprocessor based.  I don’t believe anyone did, though.

Baer went on to serve as consultant for Magnavox on the follow up Odyssey II, which was microprocessor based. In between, there were numerous ‘Odyssey’ labeled devices, but they were all variations on Pong and used a generic chip that was popular at the time.  Baer also invented the popular Simon game and other handheld games, but his contribution to video games is what he is best known for and deservedly so. 

Nolan Bushnell tends to get the credit for the home video game and not Baer.  Bushnell’s contributions were, no doubt, important-arguably there would be no market without him, but it was Baer who started it.

Odyssey was never a huge seller for Magnavox, though it was not a failure either. Magnavox sold the console only through its dealers, who knew nothing about how to market the device and Magnavox further muddied the waters by only demoing the console on Magnavox televisions, giving the image that one needed to own a Magnavox television in order to use the device.  And the accessory gun and games were almost never displayed along with the console, so they did not sell well at all.

I was lucky enough to own the console and the rifle.  It provided hours of fun back in the late 1970’s and led to an Odyssey 2 a few years later. I was a huge Magnavox fan and was delighted to find out, years later, that my Odyssey was a piece of history. Unfortunately, it did not survive one of my moves and has long since disappeared. (I did manage to score an Odyssey 2 last year via eBay.)

There were many pioneers who got the home video game market going, like Baer, Bushnell, Al Alcorn and others.  (And, no, again, Willy Higginbotham does not count.) Each one made significant contributions but it was Baer who got his ideas turned into an actual product for the home and, thus, the home video game came of age.

Digg This