26 January 2015

Happy Little Ataris... []

So I've been working with my Atari 800XL computer more as of late.  I recently acquired a device called an sio2pc-usb which, in conjunction with a program called AspeQt, allows me to use my computer as a disk drive (several, simultaneously, actually), and thus allows me to use files between the two computers. It even works in conjunction with my Atari 1050 disk drive, so long as I make sure the drive numbers don't conflict.

This has given me the opportunity to make more use of a cartridge-based program I acquired shortly after the 800XL itself, AtariArtist. It's a basic paint program that uses the bundled-in Atari TouchTablet to create images at a dazzling 320 x 192 resolution and maximum four colors from the built-in palette. Works much better than it sounds. The tablet is responsive, although no match for a modern one like my Wacom Intuos4, and although it doesn't have an undo or erase feature it's still fairly easy to use.

So I've been doing some artwork.  The program I use to convert the images from the native Atari format to PNG is called RECOIL. I've posted these on my almost-never-used Tumblr account, but here they are, and there will probably be more to follow. Just because. It's retro fun and an interesting challenge, with its limitations.


P.S. I have plans to re-restart the blog, maybe just doing posts discussing a particular game each. Stay retro, my friends... []

12 November 2014

Lemme just # this out for a moment...[]

Those of you who read this blog (which, I know, I need to update more) are probably aware that I do most of my activity on Twitter. It's fast, simple, and I like the challenge of compressing it all into 140 characters or less. Additionally, it's fairly straightforward to get your message out there simply by adding one or more relevant hashtags to help people find you (and ping the retweet-bots).

One of the hashtags I've been seeing a lot lately has to do with a scandal. I am not going to name the scandal (for reasons I'll elaborate), but it follows the post-Nixon tradition of suffixing all such phenomena with "-gate." I'm seeing it in a good third of my Twitter feed these days, so I assume it's fairly relevant to the public consciousness (or at least to those who share a subset of my interests).  Makes sense that I should find out what it is, right?

I've tried. I've looked up articles, read opinion pieces galore, and seen enough commentary on it to make me thoroughly, completely...confused.

That's really what it is. I'm confused about what, exactly, this thing is that everyone's discussing. Here's what I've been able to gather:

(1) It has something to do with a female game developer who was accused of having relationships with journalists for a good review (which was later proven untrue), which led to a horrid campaign of harassment against her from the vast online horde of the -chans, the release of personal information,  death/assault threats, etc. The same happened to a number of other women who publicly supported her. Naturally, this led to cries of sexism.

(2) But she's the perpetrator, not the victim? Or something? I can't get a clear picture of what happened here.

(3) Then people (journalists?  bloggers?) in the industry started calling all gamers bigots and other less savory terms, using various categories of group identity rhetoric for some purpose? This is where the story seems most disjointed. Apparently there was a series of articles aimed at what they've termed "gamer culture," saying that the so-called "hardcore" gamers are all a bunch of misogynists, racists, and other -ists. How did the discussion get from an isolated case to this seemingly unrelated topic? Someone please help me find the missing link here.

(3b) The movement later responded with another hashtag, showing that it is comprised of a diverse group of people, not just the "white male" crowd.

(4) More in line with (1) and (2), because it came out that some journalists were contributing to certain game developers' fundraising campaigns, several news sites made public statements of their policies, making it clear that (at least from here on in) their contributors should not be contributing to those they're reviewing (which makes sense, to dispel any notion of bias), or if they did they need to be transparent about it.

(5) So then a groundswell of outcries against -- something? The news sites, I guess -- started using this hashtag to generate a movement. The proponents of it say that it's about "ethics in journalism." The opponents say it's about bigotry and misogyny.

But there's a problem here: both of those attempts to define what this thing is "about" are just vaguely defined concepts. A reactionary movement is not about "ethics in journalism." It is not about "bigotry and misogyny." It is about a specific event or series of events that had a specific meaning and effect. So far, the only specifics I can find show that (a) a game developer was falsely accused, then subjected to the full force of the Internet's army of faceless yrch. (b) the backlash against this assault was reacted to by outcries of sexism and by identifying it (and the contention is that the identification is incorrect) with the "gamer" culture, and (c) the counter-backlash claims that they're really interested about journalistic ethics.

Can somebody please explain to me what's really going on? How did this become a thing?

On the one hand, I believe firmly that the contention about "gamer" culture (which by they way they failed to define adequately) is horrendously out of line. What they really should have said was "can we please try to starve the torogrim? These aren't just Bill, Tom, and Bert anymore, and just exposing them to the light won't make them stop arguing." And yeah, it would make me feel a little better if I knew news sites that employed journalists to review games didn't allow them to make personal contributions to the people they reviewed. And yeah, I've believed for years now that game reviews are mostly a mutual handshake deal. That should change.

But then I just read every other thing about the proponents of this thing. It seems to have been founded in gleeful hate attacks and continued by much the same method. The voices crying "it's about ethics" seem to me to be latecomers trying to pretty-up and repurpose what they perceived to be a useful groundswell. I'm not sure that's the right tactic.

You know what?

Maybe it's just because I'm out of touch with "gamer" culture. I haven't bought a new-release game in over two years, and even then I wasn't really looking at the latest releases. I was mostly just a fighting gamer (who nonetheless played the snot out of ModNation Racers), so I didn't even I really read gaming news sites.  Especially now that I'm a retrogamer, the only time I ever visit sites like Kotaku, et al. is when I'm linked to an article that seems interesting. So maybe it's just because I'm sorta disinterested in the whole arena. Maybe. So many people I follow are talking about it that it makes me feel I should try to take a side, though.

But is anybody altogether on my side?

I dunno; I suppose. I love the #retrogaming community. We all share a passion, and we pretty much get along. Maybe one of the reasons I escaped into the retro community was just to get away from the modern morass that is current-gen video games. Just couldn't stand it anymore.

So yeah...I still can't really figure out what this whole thing is all about, and I theorize that half the people who use the now several hashtags associated with it don't really either, or they'd be able to put forward a more coherent purpose statement. If you want me to give my opinion,  it's this:

I do believe in journalistic ethics, not just in video games but in all news media. I also believe that it is indefensible to attack people's lives and livelihood because you disagree with them, or because you heard a nasty rumor.  And it is above all irresponsible and reprehensible to toss such fuel into the pits of the internet yrch and trolls who only get a sense of fulfillment in life when they are rending, tearing, gnawing, biting, hacking, burning burarum...*ahem* and otherwise causing misery for others.

Do not ask me to support either side of this "movement." I won't even reference it by name in this article or in the article's tags, because that would just put it in the same lists of search terms. Until you figure out what the sides actually are, I'll just state what I believe and leave it at that.


21 September 2014

Today, in "Retro Frustration"... []

I present the 72-pin connector for a Nintendo Entertainment System (front-loader style)...

These things are what cause so much rage, given that when they wear out, you have to load cartridges in just so to avoid the blinking screen of death (console continually resetting because the anti-bootleg chip didn't get the signal) or garbled graphics because something isn't lined up right...no amount of isopropyl alcohol and q-tips can save you when this goes bad.

This right here is actually a replacement one I got off eBay...lasted all of a month. So much for quality.

It's a real pain to have to replace these things too: you need to remove five screws to take off the top, seven screws to take off the metal shield over the cartridge slot, then six more to take off the Zero Insertion Force (ZIF) loader (the springy thing which, despite the name, actually does require a nonzero amount of force). Then you must pull up the motherboard to slide off the pin connector, then slide the new one on, then re-screw all the screws. And if you re-tighten them too tight, the loader will no longer function. 

Also, new 72-pin connectors have a ridiculously tight fit for the first week or so. Takes a firm shove to get the cartridge in and then a jaws-of-life grip to pull it out until you break it in a bit. And then the thing breaks.

Oh, the pain of the retro collector who prefers the original NES over the top-loader.  

EDIT: I should note that it is actually possible to repair these things, so long as they're not actually completely broken. But it's still a pain to take them out, do so, and replace them.


P.S. If you're interested in some awesome Top 5-style videos that also feature more Nintendo than I usually cover, check out 2MooglesGaming on their blog and YouTube.

11 September 2014

Cool Thing of the Day: Business Card Math...[]

Okay, hear me out on this one, because I know the title isn't all that exciting. But I promise that, so long as you're the right kind of geek, it's at least something that will pique you're interest and maybe occupy you for a few minutes, or hours possibly.

Warning! Incoming Math content from a former English major!

If you're offended by mathematics or by a Creative Writing major doing mathematics, feel free to skip this post.

So I work in an office. I'm not ashamed to admit it; it pays the bills and keeps me productively busy. But I get bored sometimes (especially after an eyes-bleedingly long day staring at Excel spreadsheets), so occasionally I will reach for something to recharge my brain. Often, I grab a spare sticky-note pad and sketch something (like Batman, or ninjas, or whatever), or maybe I'll grab a piece of paper and pretend I'm good at origami. Among the things handy to snatch for compulsive paper folding are business cards:

They're small, somewhat sturdy (and so stand up to repeated re-folding), and common enough that I don't feel like I'm wasting anything (plus I have a stash of my own blank ones that I made into a glue-bound notepad a while ago). So naturally, they're a common target.

I noticed something a while ago, though, which really caught the side of me that likes to mess around with math (though another side always reminds me that I never want to do math for a living): it's really easy to fold these things into equilateral triangles.

Check this out: the standard business card in the US is 2" tall by 3.5" wide. It just so turns out that this ratio is nearly perfect* for folding into 60° angles, which create equilateral triangles, and thus also for dividing into thirds.

* The ratio isn't exact. It would need to be 3.5" × ~2.02726" or ~3.464102" × 2" to be perfect, but it's certainly close enough. 

Folding Instructions

Step 1: Obtain an ordinary 2" × 3.5" business card. [/obvious] 

Step 2: Fold one corner over to the corner diagonally opposite (e.g. bottom left to top right) so that the corners touch. Try to get this as accurate as you can.

At this point, you've just made the crucial fold. If you unfold it, you'll see that the diagonal crease intersects the long edges so that the crease is ⅓ away from either end. So now you get to pick your own adventure:

If you want to fold it into thirds, go to Step 3.
If you want to make equilateral triangles, go to Step 5.

Step 3: Stick your thumbnail on one of the spots where the crease intersects a long edge and fold over at that point so that the edge meets itself (i.e. so it's not folded over at an angle).

Step 4: Now flip it all over and fold the other edge so the short edge meets the crease you made in the previous step. You may have to finagle it a bit so that it lines up (since the ratio's not completely exact).

Step 4 (alternate): Repeat Step 2 from the other side, so that there is now an X-shaped crease in the center. Then repeat Step 3 from that side. Again, also depending on how accurately you did the folds, you may have to finagle it a bit.

You're done!

Step 5: After you've done Step 3 and folded one corner over to the other, fold over the "wings" on either side, using the "top" point, which is where the two corners meet each other and one of the "bottom" points, which is where that side hits the crease, as your end points. When it folds over, the short edge of the card should go vertically down the middle and the other edge should be flush with the crease from Step 2. Repeat this step on the other side.

You're done!

Math Content

So here's what's behind this: equilateral triangles (i.e. those with all three sides the same length) have all their internal angles at 60°. When you make that first fold, you make a rough approximation of a 60° angle with the long side of the card.

More detail: You'll notice that when you finish up Step 5, the two end flaps are right triangles (meaning one angle is a 90° corner) half the size of the big ones. In fact, they're a rough approximation of a special type of right triangle, the 30-60-90 triangle. Click that link, read the Wikipedia page, then come back, if you're not familiar.

If you're like me, you've already drawn a diagram and mapped out how the different lengths relate to each other. If you're further like me, you set up some worksheet formulas (Excel or LibreOffice) to calculate side lengths for future triangles. But that's a bit beside the point.

The main math thing that has to be true for this to work is for the ratio of the long edge to the short edge of the card being 3:√3̅, or ~1.732051. So if you do the math, you'll see that the business card dimensions aren't exact, but they're pretty close.

Anyway, hope this was at least somewhat entertaining for you. I tried to add photos of me doing the folds, but my cell phone's camera refused to focus [/badexcuse].


05 September 2014

That certain kind of morning... []

My favorite kind of morning happens in late summer, when the sun is still rising early due to daylight saving time and the sun hasn't yet had its coffee. It's cool but not cold, still full of summer, and everything feels like it's just rained even if it hasn't.

There's a certain smell about it that reminds me of going to camp with my grandpa as a kid. I'd wake up in the cabin, next to which the camper had been parked, push open the door, and walk out towards where the fire had been.

It's the deep and enveloping smell of dirt and dew and gravel parting under my tennis shoes. It's the heavy blanket of mist and dampness held close about the earth: the world waking up after a long nap still hot and sticky with sweat under the bedsheets.

That smell, that perfluence of aromas and gathering of old memories, always makes me expect to see that same salamander, bright and orange, that I found underneath the camper that one morning.

Above all, it's quiet. I mean the kind of quiet that you get in the suburbs, with the shush of cars along the pavement in the distance and the neighbor's dog barking. But it still feels quiet and close and personal.

It's the kind of morning where I just want to take in as many slow, lazy breaths as I can as I swim through the thick atmosphere and feel the occasional whispering breeze sliding through my shirt sleeves, up one arm and down the other.

Just a pity those mornings only last for such a short space of time, before the world turns cold once again.


20 August 2014

The 7 Atari 2600 Games You Should Own First...[]

Hi all,

Sorry for the dearth of recent posts. I have a few that are currently in writing limbo; that you all need not wait longer, here's an entirely different post.

This may not be news to those of you who read this blog, but I recommend that everyone interested in video games acquire an Atari 2600 console. It's still my favorite system, and the one for which I've collected the most games.

The first difficult question, of course, is where to get the system. One can usually find an Atari 2600 in decent shape on sites like eBay for a decent price (considerably less than a new PS4, at least). You may also be able to find one at a flea market or garage sale for an even better price (largely because shipping costs are not involved, but also because the seller is less likely to be a retro game vendor and hence may not want as much for it). Whatever you do, I hereby challenge everyone who sees this to find and purchase an Atari 2600 (or 7800, since it's backward-compatible with the 2600).

The next question, then, concerns games. No use having the system without them, after all. Fortunately, you'll often find consoles bundled with a stack of games, typically loose carts but occasionally games with their boxes (in various states of repair).

Even so, the beginning Atari collector (especially one who, like me, was born after the golden Atari age) may be at a loss as to which games to obtain first. Here then, are my recommendations for the seven games that absolutely must be in your collection, and which you should look to obtain first.

7. Asteroids and Space Invaders

Okay, I'm cheating a bit on the first one, but these two really go hand in hand. They're the ones you expect to see, and for good reason. These are the ones that come to mind first when the Atari is mentioned. Fortunately, these are the two games you're most likely to get along with a system, even if you weren't expecting them. They seem to accumulate as if by spontaneous generation sometimes, and if you're not cautious you'll end up with a stack of each. Keep at least one of each around, though, because for all their simplicity, these games never get old.

Another thing to mention about Space Invaders in particular is its incredible amount of game variations. Most Atari games, if they have variations at all, only have around 10 or so. Space Invaders has 112; in fact, it's often labeled as "112 Tele-Games," or some variation thereof. If you just get a loose cartridge, be sure to look up the manual online to check out all the different ways you can switch-up the gameplay in this iconic classic. 

6. Joust

This is another one that never gets old, even if it does look a bit prettier on other consoles. This game is especially fun if you've got a second player to compete against (although it's 2-player in the style of Super Mario Bros., not direct versus as in Street Fighter or Combat). Take up your lance, mount your battle ostrich, and flap your way to victory! It's also fairly easy to find and hence won't cost you a lot. 

5. Centipede

This one practically defines addictive gameplay. If you happen upon an Atari Trak-Ball controller, definitely make sure this game is in your collection (along with Missile Command, but I'm already cheating on the 7 games here from the first entry). It's simple but challenging: fire away at the incoming centipede, watching out for its friends (like that irritating spider who appears every couple seconds). If you've ever played this in the arcades (lucky you), you'll know this game has incredible replay value as you try to get your high score just a bit higher (or at least to the next extra life).

4. Berzerk

Here's another one that'll have you going for hours, to the point where your hand may start to reshape itself around the joystick controller. Make your way through an endless maze, shooting robots and avoiding their shots. You'll soon get used to the controls, where you fire in the direction you're walking (diagonals take some practice).

Tip: Unless you're an absolute newbie, always play at least on Game 2, which features the menacing Evil Otto, who bounces on screen to chase you down should you take too long in a single room. Nothing adds challenge quite like a smiling time limit. He's always smiling, even as he's plotting your demise. The last thing you'll see is his smiling face...body...going through walls as if they weren't there. The fewer robots on screen, the faster he travels. Just gotta keep going.

3. Yars' Revenge

This one's another unquestioned classic, one I've mentioned at least once before on this blog. You take control of the bug-like Yar and go up against the ruthless Qotile. This one really gets challenging in the later stages, when the missile that follows you around starts to speed up, meaning you can't stay in one place for too long. It might only have two distinct stages, but the challenge is more than enough. It's also pretty common, so it shouldn't be too difficult to find or too expensive.

2. Seaquest

Finally, an Activision game on this list! Really, there are so many titles from Activision I could talk about, like Pitfall, Stampede, Kaboom!, Ice Hockey...

...but I'm limited here, and I'm trying to put in a nice variety. Seaquest is probably one of my favorite games for the Atari 2600, as anyone who's read this blog will know.

Short version: you control a yellow submarine (Beatles reference!) and must save six hapless divers per round, while avoiding sharks and enemy subs (who start to travel in twos and threes in later rounds), as well as a really annoying ship that travels along the surface to keep you from coming back up to recharge your oxygen.

So if you can only get one Activision game, get this one. If you can get two, get Pitfall....actually...can I rename this entry to Seaquest AND Pitfall?

2. Seaquest AND Pitfall!

Hey, this is my blog; I can cheat if I want.

Really, this is another expected one. If you've never heard of Pitfall, I'm sure you've seen it, or references to it. Jump across barrels and crocodiles, swing across lakes and pits, collect loot. Get this game; it's practically a requirement anyway. Tell anyone you have an Atari 2600, and they'll probably ask if you have Pitfall. Make sure you can tell them all "Yes."

1. Galaxian

Is that man playing Galaga? Nope; it's Galaxian, the game that started the whole series. This is one of the best games for the Atari 2600, without a doubt. It takes the basic formula of Space Invaders and adds the challenge of targets that fly directly at you. Remember that you can only have one bullet on screen at a time, so aim your shots well. Also, remember that you get more points for hitting an incoming enemy than one that's just keeping formation.

And whatever you do, don't get trapped in the corner. Bad idea. Keep moving, and watch for your openings to avoid getting trapped. Also remember that you can score big points by picking off the two red ships and then the white leader ship. If the challenge is too paltry, try using the Game Select switch to change your starting level. I usually start at level 9 (the highest) for the extra challenge.

So there you go...step number one is to get yourself an Atari 2600 console. Step number two is to get the games on this list. Have fun!


P.S. If you're the type who likes to watch YouTube videos and also a lot of Top 5 lists, you should totally check out my friends 2MooglesGaming. They're awesome. 

All images from AtariAge.com...they're a great resource, so I also advise checking them out regularly.

08 August 2014

...And That's BASICally It....[]

Those of you who follow me on Twitter will know that I've recently been working on some programming on my Atari 800XL computer (well, both of them, since I have two). That means using BASIC, and specifically Atari BASIC.

While I learned some BASIC as a young ninja, it's been a bit of a journey so far on the Atari, for a couple of reasons. Firstly, it's been a while, and I had forgotten a lot. Secondly, I never really learned all that much to begin with, being only around 10 years old at the time. And thirdly, Atari BASIC is a distinctly different flavor of BASIC from what I learned.

In any case, I recently managed to spit out a short program, which I also shared on Twitter. What I wanted was something that would spit out a specified lines of random letters/symbols either to the screen or to a printer.

Why would I want such a thing? Because reasons...Reasons I say!

Okay, I just wanted something that would (a) be a good test for my Atari 1025 dot matrix printer and (b) look cryptic to an observer, as if it were some secret code. *

So anyway...I figured I'd talk a bit about this program, my thought processes while writing it, etc. It'll be an educational column for some, especially in the area of how little I know, and I hope it'll at least be somewhat entertaining.

Disclaimer: Please do not mistake me for an expert (or even a mildly proficient) in programming. This is mostly just me playing around with forces I cannot possibly hope to comprehend.

Here's the full program:
1 ? "}":POKE 752,1
2 DIM Q$(1)
  INPUT Q$:? "}":GOTO 5
10 FOR W=1 TO 500:NEXT W:PRINT "}"
11 DIM Y$(80)
20 DIM X$(1)
25 FOR S=1 TO R
26 IF Q$="N" THEN GOTO 30
27 FOR I=1 TO 80:GOTO 40
30 FOR I=1 TO 36
40 X$=CHR$(INT(59*RND(1))+64)
50 Y$(I)=X$
70 ? Y$
90 POKE 752,0
100 END

I'm positive that this program has been written before, and better, but this is what I done wrote, and I'm sort of proud of it. By the way, wherever you see a "}" character, replace it in your mind with the "clear screen" symbol from Atari BASIC, which looks a bit like "↰."

If you're not familiar with BASIC, each line begins with a number which determines its order. Common practice is to begin with line 10 and enter new lines in multiples of 10 (or sometimes start with 100 and go in multiples of 100) so that, as needed, lines can be inserted in between others without re-numbering. That should give you a bit of an idea of the order in which some lines were added here (actually, I did re-do line 10 at least once, but you get the picture).

For those to whom this still looks like ancient Sanskrit, here's the overview: the program asks for a number of lines, and whether or not the output should go to a printer. Then it generates a line of random characters, then another, and so on until it has output the number of lines specified.  

So let's just take it line by line to see how it works:

1 ? "}":POKE 752,1 

First thing to note about this line is that "?" is a shortcut for the PRINT command, which tells the computer to print a text string. So this line first tells the computer to print a "clear screen" character, which blanks out anything on-screen at the time. The second part of the line (two commands can be on the same line if separated by a colon) is a command that directly changes a memory location — specifically, it turns off the cursor, which makes things look a bit neater.

2 DIM Q$(1)

This second line is here because of a peculiarity of Atari BASIC. While in some versions of BASIC you can just use string variables (contrasted with number variables) at will, in Atari BASIC you must first DIMension them, telling the program how many characters to allot the variable. So this line declares a string variable called Q$ which has a maximum length of 1.


These two lines are the two big questions asked at the start. First, the (invisible) cursor is moved to column 10, row 3. Then the prompt "# ROWS" is printed, followed by an input for a number variable called R (the number of rows to print).

Then it moves two lines down, to column 10, row 5 and asks the second question, whether or not to print the output to a printer. Here is where we use the string variable Q$ which we DIMensioned a couple lines ago.

Also note another peculiarity of Atari BASIC: PRINT commands must be separate from INPUT commands. On a Commodore 64, for example, I could input instead 3 POSITION 10,3 : INPUT "# ROWS";R, but not so on the Atari.

  POSITION 10,7:INPUT Q$:? "}":GOTO 5

These next few lines are partially feedback to the user and partially error handling in regards to the INPUT command on line 4. Since the user may have entered any character at the prompt, it needs to weed out anything but "Y" or "N."

First, it handles the case where the user entered "N." It moves down to row 6, tells the user that the output will not be printed, and then moves to line 10 for further instructions.

The next line is there because ATARI basic only follows an IF/THEN model for conditionals, not an IF/THEN/ELSE model. If the IF condition is true, the THEN is executed, and if not it just goes to the next line. So now the program weeds out anything that isn't a response of "Y," since any "N" responses were caught by the previous line. For all of these responses, it prints an error message, allows the user to re-input for Q$, then moves back to the first conditional statement.

If anything made it through lines 5 and 6 without triggering one of the THEN clauses, it's because the user entered "Y." So the next two lines (there was a line 7 at one point) just offer feedback and remind the user that the printer needs to be turned on.

10 FOR W=1 TO 500:NEXT W:PRINT "}"
11 DIM Y$(80)
20 DIM X$(1)

Okay, now we really get into the operations of the program. First, line 10 uses a FOR/NEXT loop, which will be talked about in a couple lines. Basically what it does is tell the computer to execute a set of commands a given number of times. In this case, though, the loop is empty, so the computer does nothing 500 times (the 1 to 500 part). This is a sort of messy way (which depends on running in Atari BASIC on an 800XL) of causing a delay, which in this case is long enough for the user to read feedback messages before the second half of the line clears the screen again. A professional would use a more precise clock, but I'm not a professional.

Lines 11 and 20 DIMension two more string variables, which are the ones that are really going to be used in the program. Y$ has a maximum length of 80, and X$ has a maximum length of 1.

25 FOR S=1 TO R
26 IF Q$="N" THEN GOTO 30
27 FOR I=1 TO 80:GOTO 40
30 FOR I=1 TO 36

Line 25 starts another FOR/NEXT loop, using the variabl R that was entered in line 3. So for R times, the program will repeat whatever comes between this statement and a line that says "NEXT S."

The next two lines toggle between two different line lengths. Atari BASIC in the standard text mode can only display 40 characters across, while a printer can do 80 characters to a line. So if the user entered "N" for Q$, the program goes to line 30, which starts a FOR/NEXT loop that repeats 36 times (because the line starts a couple of characters in) and otherwise goes to the next line down, which starts a different loop that goes to 80. The second part of line 27 skips it past line 30.

So the loop started by either line 27 or line 30 will do the same thing (for R times, because it's nested within the S loop from line 25).

40 X$=CHR$(INT(59*RND(1))+64)
50 Y$(I)=X$

Here's the real mechanism. These two lines are the repeated steps that churn out the text.

Line 40 sets the X$ string variable equal to a random character. It does this by making use of the CHR$() function, which outputs the Atari ASCII (also known as ATASCII) character with a given numeric value. It also uses the built in RND() function, which outputs a random number between 0 and 1.

Between 0 and 1? Yes, that's right. The RND() function will give you some decimal value between 0 and 1 (and never 0 or 1). So to get it to give you a range of values, you have to get tricky. I want it to give me the range starting with character 64 ("A") and character 122 ("z"). This will also include a number of symbol characters (punctuation, etc.), which was an unintended side-effect. **

So at the heart of the expression in line 40, it takes a random number (the 1 in parentheses doesn't really have any effect) and multiplies it by 59, which is 123-64 (the random number never equals 1, so I have to go one beyond my target range). Then it uses the INT() function to strip out decimals and just use the closest integer. Then it adds 64. So now it will output random numbers from 64-122.

Line 50 is where I had to get creative. There's unfortunately no string concatenation function in Atari BASIC, so I couldn't just build up a line by going X$+X$+X$, and so on. However, it is possible to specify a character position within a string variable. Y$(1) means the first character of the Y$ string variable, and so on. So this line uses the step number of I (which is incremented by 1 each time the FOR/NEXT loop churns) as the position indicator on Y$ and copies over the randomly generated character of X$ onto it.

Line 60 completes the loop begun in line 27/30, which eventually builds up a line of the required length.

70 ? Y$

The next couple lines are the output end of the program. Depending on the value of Q$, the program will either use the LPRINT command to print the value of Y$ to the printer (and then go to line 80) or print it to the screen. Line 80 completes the loop begun in line 25 and causes the next line to be generated, until the required number of lines are generated.

90 POKE 752,0
100 END

Okay, here we are at the wrap-up. After everything's printed out, the cursor is turned back on and the program terminates (until the users types "RUN" again).

So yeah. Took me a bit of noodling to get this one to work, but there it is. Actually, there are a number of improvements I should make to it. For one thing, I should make the user hit a key at line 9 before it moves on, to be sure it doesn't execute before the user has a chance to turn on the printer. For another thing, it might be a good idea to add a line counter, especially when the user's printing a large number of lines to a printed page, as a bit of a progress meter. I have an idea of how I'd do it, but since I currently have no way of saving programs (gotta get an external floppy drive at some point), that's just gonna wait for now.

As I said, I am 100% positive this has been done before and better. But this is what I wrote...BASICally....


* Fun thing to do if you're using laptop running Linux in a public space: either open a new terminal emulator window or go to a virtual console and run either (a) sudo apt-get update or (b) cmatrix. People walking by will think you're either a hacker or a spy. Totally. 

** It wouldn't be straightforward to filter out the range of values for the punctuation characters the way I did it here. I could have just generated the text based on a string variable containing all the alphanumeric characters, but hey, that's hindsight for you.