Errors in “10 PRINT CHR$(205.5+RND(1)); : GOTO 10″

April 5th, 2014

I should start this by saying I love the book 10 PRINT; reading it was a great way to start 2014 and inspired some creativity in me that you can read about here.

It was written by ten or so people, a smart bunch it seems. So I was really surprised when I was reading the chapter about the Commodore 64, page 229 in particular, to find several errors. I was even more surprised to find no one discussing these errors online, and the errors remain in the .pdf version available on their website as of this writing. I tried to contact a couple of the authors (Ian Bogost in particular, because I’m a fan and I found him on Twitter easily) but didn’t catch his attention. I realize he’s a busy guy. So I’ll blog about it, in the hopes it’ll be corrected before the paperback version is released.

Error 1: “1,000 characters do fill the entire screen—in what might be considered an illusory consummation of the maze—before the text scrolls upward, leaving two more twenty-five-character rows to fill.”

This should, of course, be “two more forty-character rows to fill”. The Commodore 64 screen is 40 characters wide, and 25 characters tall; 1000 characters in total. When the screen scrolls upward, the bottom two rows are left empty, requiring 80 new characters of maze to be filled in.

Error 2: “While the code for 10 PRINT specifies one of two characters to display on the screen, it says nothing about where on the screen the chosen character should appear. That placement is defined by the VIC-II chip.”

This statement is sufficiently vague that perhaps it’s not in error, but to be clear: the VIC-II chip has no control over where a PRINTed character will appear on the screen in 10 PRINT; it simply provides the 40×25 character screen that BASIC accesses through the PRINT command, which in turn uses the C-64′s KERNAL operating system. Zero page locations $D6 (line number) and $D3 (column number) are used by the KERNAL to calculate where the character will be plotted in memory.

Error 3: “The large border that surrounds the maze is not addressable by the VIC-II; the thirty-two pixel borders on the left and right and thirty-five pixel borders on the top and bottom were created in consideration of the wide variation within cathode ray tube televisions of the era.”

I’m guessing that these numbers were obtained from an emulator screenshot, but they don’t at all represent what the VIC-II does. Depending on the version of the VIC-II, there are between 403 and 411 pixels visible per scanline (as per the famous VIC-II document); subtracting the 320 pixels of the 40 column screen, we’re left with between 83 and 91 border pixels viewable, if your monitor/TV will show them. I don’t know how they’re split between the left and right sides, but as an odd number, it probably isn’t evenly! The top/bottom values are also incorrect; the VIC-II (again, depending on version) produces between 234 and 284 visible scanlines per frame; subtracting the 200 pixels of the 25 row screen leaves between 34 and 84 potentially viewable pixels worth of border.

Error 4: “Running 10 PRINT in a software emulator, of course, eliminates the need for such a border, though the Commodore 64’s KERNAL nevertheless draws it.”

The KERNAL has no part in drawing the border; this is solely an automatic function of the VIC-II chip. Interestingly, through precise and active manipulation of the VIC-II’s registers, the borders can be prevented from appearing, revealing sprites placed behind that area. This has been used in games to display information (such as scores) in otherwise unusable display space.

Error 5: “In addition to wrapping text automatically, the VIC-II also automatically scrolls the contents of the screen when the cursor is on the bottom row and attempts to move down.”

The VIC-II plays no role in scrolling the contents of the screen in _10 PRINT_. That is done by the BASIC and KERNAL software.

I welcome any corrections to my corrections!

10 PRINT CHR$(205.5+RND(1)); : GOTO 10

March 25th, 2014

“10 PRINT CHR$(205.5+RND(1)); : GOTO 10″ is a BASIC program that will run on all Commodore 8-bit computers including, most famously, the Commodore 64.

It’s also the title of a book released in 2012 that can be purchased in hard copy, or downloaded for free from the official website: 10print.org

I got a copy of the book for Christmas 2013, and thoroughly enjoyed reading it. It’s a terribly close reading of the titular one-line program; that program, when run on the C-64, creates an infinitely scrolling maze pattern. The output seems too involved and interesting to be the product of such a tiny, cryptic program. The book discusses every facet of the program and connecting fields of study, such as mazes and randomness. I found the section on computational randomness in the arts especially inspirational.

So inspirational, that when my online song-writing group decided to collectively write a concept album based upon Shakespeare’s Sonnet 64, and I ended up with line 10, “Or state itself confounded to decay”, I used an old Amiga program called NIALL to generate the lyrics for the song. I dumped Sonnet 64 and some Wikipedia commentary into NIALL, and then NIALL used its simple Markov-chain-like procedure to generate new sentences based on the input I gave it. I edited the output a bit, to make it somewhat more lyrical.

We had an additional constraint in the song-writing process: we had to use the common ii-V-I chord progression for at least some of the song. I spent a couple short sessions working on the music, doing my best to write a more interesting melody than most of songs to date. My eldest daughter and I then recorded the song in my basement home studio, using a slightly modified preset on my Zoom MS-50G pedal (a wah filter driven by a step sequencer) as the main bed track that we built the song on. After several poor attempts at singing the vocals myself, my daughter took over the lead vocal, and did a great job. We added some gradually increasing distortion to the vocals to add to the decay or corruption theme of our key lyric.

The video footage was all filmed with my iPod 5g, recording the 1702 monitor hooked up to my Commodore 64, running a couple 6502 programs I wrote specifically for this purpose. One is a 6502 port of _10 PRINT_ with the addition of smooth scrolling. I wanted the visuals to seem like an infinite maze world passing by under the viewer.

The other program increments every character on the screen, so an ‘A’ will become a ‘B’, and so on. It does so in a pattern determined by a 10-bit LFSR that I wrote in BASIC for this forum 7 years ago, and ported to 6502 for this purpose; it allows the screen to be changed in a seemingly random order, but still guarantees that all 1000 locations on the screen will be changed in linear time. I added a delay loop whose length is controlled by a paddle controller, so I could make the effect run faster or slower while it was running. I also created a “corrupted” version of the same program that would periodically skip incrementing locations, to cause the effect to run less uniformly.

I’m still skimming over many details, but that’s probably sufficiently detailed to satisfy the curiosity of the one person who was interested. So, here’s the video:

In a future blog post, I want to talk about _10 PRINT_ more. Specifically, despite the book’s awesomeness, page 229 has, by my count, five errors. I’ve been looking for any discussion of this online, but surprisingly, have come up with nothing so far, and my feeble attempts to contact some of the book’s authors haven’t got anywhere. So, I should blog about it.

Another year, another post…

October 8th, 2013

I see another year has gone by since I last blogged. What have I done this past year? Let’s see…

My company P1XL Games released another iOS game, called 4NR. It’s a platform game with a classic Game Boy style, with some puzzle/discovery mechanics. I’m pretty proud of it.

One of my bands, Ziklag Offramp, released an album which can be streamed free or purchased (download or real CD) here: ZiklagOfframp.bandcamp.com. We started recording it in early 2012, and we finally wrapped up the whole project and released it in April 2013. I mixed 8 of the 11 tracks, and learned a lot through the process. I co-wrote three of the songs (with my friend Tim Lappala), sang vocals on those three, and played bass on the whole thing. My daughter Rianna plays keyboards on a few tracks too.

I started another band with my daughter, called Bedford Level Experiment. It’s kind of geeky folk rock. Rianna plays drums and keyboards, and I play guitars, bass, and sing. We released a number of songs on Youtube over the last year: Bullet the Blue Sky (U2 Cover), October Breeze (original), Old Man (Neil Young cover), And Your Bird Can Sing (Beatles cover), There’s a World (Neil Young cover), and Barfight With Myself (original).

We also worked with Debs & Errol on a Commodore 64-related song for their soon-to-be-released EP. I’ll blog about that once it’s released.

Work continues on RPG Quest – Minimae II, and we hope it’ll be done by US Thanksgiving this year.

I did a port of Minima Reloaded to the Commodore PET 4032 computer, unofficially called “PETima” and showed it off at the Chicago Commodore computer show, ECCC. I also made a quick utility to load images into a real Commodore REU: REU Image Loader. It’s especially useful for playing otherwise-unplayable Infocom games on the C64 with the very-cool Zeugma.

My side-project game label ROM12 once again took first place in the 2013 Christian Speedgame Competition, with our game SG13.

I always feel disappointed that I don’t get nearly as much finished as I’d like to, but when I sum it all up a year at a time, it doesn’t seem SO bad.

Virtual Move and catching up again

October 10th, 2012

I spent quite a bit of time the last two weeks consolidating my various websites and email servers together so I’ve got a single host and more importantly, a single hosting bill! It was fairly fun to do a bit of database and web work, so I don’t get too rusty at it. And doing that work reminded me I have this blog!

What have I done since early 2011? Not as much as I’d like, but still:

We released P1XL Party and a few updates for it: http://itunes.apple.com/app/p1xl-party-retro-minigames!/id444404696

Helped out on a game for metalcore band Oh, Sleeper: Stand Your Ground: http://itunes.apple.com/app/oh-sleeper-stand-your-ground/id501239707

More updates on Pocket God: Journey To Uranus: http://itunes.apple.com/app/pocket-god-journey-to-uranus/id404405151

Took first place in the 2011 and 2012 Christian game dev compos with my side-project team ROM12 with our games 4NR: http://talk.christiandevs.com/viewtopic.php?f=38&t=3393 and Vanguard: http://blog.christiandevs.com/?p=313

Did a lot of work on Pocket God: The Runs but it’s still not released: http://www.gamezebo.com/games/pocket-god-runs/preview

Also not-quite-finished are RPG Quest: Minimae II, Super Splatform, more P1XL Party updates.

Oh, and I’m a father yet again. His name is Silas! :)

Catching up

January 16th, 2011

Wow – over two years since I’ve blogged! I tried to update last year, but in mid-2010 my blog suddenly broke: only the header and title of my entries would appear, all the body was just blank. So, I finally backed up the blog’s database, upgraded to the latest WordPress, jumped through a few hoops, and it’s back. Wasn’t as painful as I feared.

I’ll attempt to quickly sum up the last couple years of game dev. So, as I mentioned at the end of 2008 I bought a Mac mini and iPod touch and started learning how to program it. By early 2009 my last Nintendo DS game programming contract came to an end, and apart from one short NDS game prototype project I did for 8 weeks, I’ve found no more NDS work. So, I got into iPhone dev at just the right time, it seems.

Sam Washburn and I formed P1XL Games later in 2009, and together built a simple RPG engine for iOS. We adapted my Minigame Competition 2003-winning Commodore 64 game Minima Reloaded to the engine, spruced it up quite a bit with some NES looks and sounds, and released it in November 2009 on iTunes. You can check it out here: RPG Quest – Minimæ.

We then started porting my other successful minigame, Splatform. We still haven’t released it as we want to improve on it more, but it *really* should be coming out early in 2011. We had a couple other false starts on games, and in hindsight, a lack of direction.

By mid-2010 we still didn’t have a second game done, money was getting a bit tight – so we looked for some contract work, and through a friend, ended up helping Bolt Creative out with their first iPad game, Pocket God: Journey to Uranus. Classy name, classy game! It’s been a lot of fun to work on, especially because we were able to make “tribute” minigames to Joust and Tempest in it.

Meanwhile, we’re starting to really move on RPG Quest – Minimæ 2.

I had hoped I’d be releasing games at a faster rate by now, but still seem to be averaging just one a year. Here’s hoping 2011 will be more productive!

Happy New Year

December 31st, 2008

Well, that was a terribly long absence.

Back in March I couldn’t keep up with my Game of Life due to working two jobs at once, and that got me out of my blogging habit too.

But I think I’ll at least catch you all up on the major happenings this year, and then maybe I’ll start a new Game of Life shortly (possibly with less rigid rules).

So, most importantly, kid #6 arrived way back on July 12th, 2008. We named her Stella Joy, and she’s a lot of fun. She gets so intensely happy sometimes that her smile spreads right through her body, causing her to twist up in pretty weird ways. It always makes us laugh :)

I’ve taken leave from that telephone job since her birth and just continued to do video game programming from home since. So it’s been a great (almost) 6 months of being home. I’m working a lot, but I’m able to take breaks whenever needed to help with the kids or whatever.

The Nintendo DS game I started working on back in February was finished in late August and released in stores in November. It was a great learning experience once again… very challenging at times almost to the point of “I don’t think I can do this” but I got through. I finally did some 3d game code, and was most proud of fixing a bug in the game engine. The engine programmers didn’t have time or motivation to fix it, so they gave me a workaround that I thought was just too poor. So I took a weekend and really dug in and fixed the bug myself. Just a couple days before the game was finished, this same bug was discovered in a different part of the game that I wasn’t responsible for. I was able to give the fix to the lead programmer and in minutes it was working 100%.

I’m working on yet another Nintendo DS game now, and there’s talk of more work after this, so we’ll have to see what the new year holds. I’m due to head back to the telephone job in early April, so I’ll have to see how things fit together.

I did a lot of travelling this year. Carla and I went to two homeschool conferences: one in April and one in May. The one in Hamilton meant we took our first flight together – ever, in 12 years of marriage! I really enjoyed both conferences, but was shocked how the Minnesota conference (held in Duluth this year) was so much bigger than the one for all of Ontario. I really enjoyed the vendor areas for both. I always find books and other educational materials interesting, but at these conferences the actual people who produce the materials are present and very willing to talk. Fun!

It was especially cool to meet Steve Demme, the guy who made Math-U-See which is the math curriculum we use with our kids. We had a good talk, and over lunch I showed him the prototype of a MUS game I’ve been working on, and he seemed quite interested. However, I haven’t followed up with him on that… I really should!

I also made it out to the same 3 geek conferences again this year: Milwaukee’s Midwest Gaming Classic in March, Chicago’s ECCC in October, and Toronto’s World of Commodore in December. I made out especially well in Chicago, getting loads of boxed games for a song. And there was the usual great food and conversation with friends.

There was also Ron and Mary Ellen’s long-awaited wedding in October in Scotland. I had a great time on the way, visiting my friend Brian in Oxford, visiting many C.S. Lewis sites, and then took the train up to Edinburgh for the wedding, and a neat trip to Stirling Castle. It was great spending time with the whole wedding party. I’ve got a bunch of pictures to share from the trip, and it deserves its own post later.

More recently I bought myself a Mac mini and an iPod touch and have set about learning to program it. I’m getting somewhere with it now, and am prototyping my first game for it now. I hope to finish a couple games for it in the new year.

Some nice round numbers

March 14th, 2008

I’ve kind of taken this week off from my “game of life”, but I still do need to post about the previous week. Later.

I keep a text editor open all the time on my laptop, and jot little notes down in it whenever I have a thought. Sometimes weeks go by between computer reboots (hooray for WinXP) but when the time comes, I have all these unsaved text documents to look through and decide what to save and what can be tossed.

So, here’s something I figured out a couple weeks ago:

When you’re:
11.41 years old, you are 100,000 hours old.
19.03 years old, you are 10 million minutes old.
19.18 years old, you are 1 thousand weeks old.
27.40 years old, you are 10 thousand days old.
31.71 years old, you are 1 billion seconds old.
83.33 years old, you are 1000 months old.

I chose the biggest nice “round” number that fit in a regular human lifespan. Did I miss any? Fortnights seemed a little silly.

Oh, and check out the comment I recently received. Jeff, thanks for taking the time to share your well-worded thoughts. For what it’s worth, my wife did spend some money at that store to support ma-and-pa. My words may have been unfairly cynical, but surely the store owners did name the store in an attempt to “tap into” (a less cynical way of putting it?) the “Little House” tourists, even before the museum was established? I don’t think they’re “con artists” or “preying” on anyone. Thanks for the feedback. I’ll probably reword the old post after my reader(s) have a chance to weigh in.

Seventh Week

March 6th, 2008

94/100.

I got exercise in 5.5 of the days. I find it easy on the days I’m working at that telephone place: I’m quite eager to take my break, and since I’m sitting around, stuck to the phone the whole time, I really feel like moving and go for a walk. When I’m at home for the whole day, it seems a lot tougher to get a chance, and it’s usually dark outside by the time I get a chance. VRT has become a bit boring, and so I’ve been reading a book about something similar by John E. Peterson (a guy who’s in amazing shape in his mid or late 50s) but boy it seems like more work than what I’ve been doing.

I’ve continued practicing some songs on guitar: Low, and Country Feedback by R.E.M., and a few of my own. I also played a few songs with KK since we were together.

I did some more sorting in my room, tried to fix a broken DVD player and just got a puff of smoke for my efforts (literally!). I beta tested Loadstar issue #249 which was good fun. It had a neat game called “4 Duko” which is just a fun 4×4 Sudoku puzzle. My kids liked it quite a bit too. I ran the church business meeting, and it went a lot smoother than I expected, and I was thankful. I sorted through my C-64 collection of car battling games, comparing it to the list I’ve compiled over the last few years of all known games in the genre. I was then able to go through the long list of games from a fellow in Norway who is selling off his large C-64 software collection, and make intelligent, non-duplicitous choices.

The kids and I kept up the pace on playing Super Luigi Galaxy (81 stars as of today) and watched some more eps of the Super Mario Bros. Super Show. Also, I took Rianna to the music festival where she once again placed second. Like always. Ask her about it sometime.

I finished reading Exodus and read the first 18 chapters of Leviticus. Nearly done On The Edge (the book about Commodore) now. I think I’m going to keep alternating with fiction and non-fiction, so it’s fiction next. I’m thinking either Flatland or The Postman is next. They keep leering at me from my bookshelf when I walk by.

Carla and I finished watching season one of Battlestar Galactica. Boy, was it good. We need to borrow season two from my good friend Tim shortly. Otherwise, we’ll end up watching Stargate SG-1.

Tim and I went and saw “No Country For Old Men” at the extra-cheap theatre. I really liked it. It took several plot twists that I wasn’t expecting, and being set in 1980 was a bonus. Lots of cool 70s vehicles, including a 1977 Mercury Monarch that I identified immediately. My first vehicle was a ’76 Monarch. The fiery fate of the car was sad, but the car got a lot of screen time and attention, so I was very pleased.

I got quite a bit of work in on some C-64 projects. I helped a bit with the “4 Doku” game for Loadstar, and also helped a friend with a Spy Hunter-like game for the C-64 that will be a pretty big deal if it gets finished. I owe both of them more help, but I’ve been rushing to meet a milestone on the paid game work this week, so that’s had to wait. Today was a good day of work on the game though; things I’d been fighting with for a few days finally worked, and just in time. I’m feeling pretty good about my co-workers too. And I got paid for my first month’s work, plus the bit owing on the previous project.

I’m almost certainly buying myself a new laptop tomorrow; just waiting for the new prices from Dell Friday morning.

Sixth Week

February 25th, 2008

77/100. Oh well.

I got off to a good start with exercise the first 4 days, but a bunch of midnight shifts allowed the cold I had been dodging for more than a week to finally get me, and I just didn’t have the energy after that. I’m mostly over the cold now; feeling pretty good today.

I’ve been trying to learn a few new songs on guitar this week. I played along with some MJ Hibbett (“A Million Ukeleles” and “She Tastes Like Sugar”) more Midnight Oil (“Real Thing” which is actually a cover) and R.E.M. (“Low” – what a great song). I also worked on my scales. It was just KK and I doing the music at church this week; we both played acoustic guitar (usually I play bass) and took turns with one leading the rhythm and the other doing something “interesting” like arpeggios.

The “sort/fix” category has further expanded to include things that I’m doing solely for the benefit of others. That included helping to cut Ben’s hair (he really needed it, and there’s no way he’ll sit still for a stranger to cut his hair) and a church business meeting. More enjoyable activities included sorting through my music CD collection, and testing/sorting some of my latest thrift store purchases, including a Spider-Man plug & play gamestick that was a lot more enjoyable than I expected. $3!

The kids and I continued watch the Super Mario Bros. Super Show DVDs, and have now rescued Peach for the first time with Luigi in Super Mario Galaxy. We’re up to 64 stars now, though we’re playing less frequently as I think the kids are finally starting to get a bit bored of it. But I think we’ll push through to finish the game with Luigi as I hear there’s a couple extra bonuses as a reward.

Reading-wise, I read Exodus chapters 18-38, and continued with “On the Edge”. I’m into the chapter about the Commodore 128 now.

Carla and I watched some more episodes of Battlestar Galactica (nearly done season one now). I also watched Mats Sundin’s not-last home game with Toronto with friends and had some good over-coffee talking afterwards.

I finished my current assignment for the paid game work. I had a good time making a little demo to show it off; with some google image searching and a bunch of Paint Shop Pro massaging I made some NDS-ready graphics that followed a written description of an example cut-scene in the game design document, and put it all together. The producer seemed to like it.

I didn’t really get any work done on my own projects, but I did come up with a new idea that I really like, and I’ve taken a bit of time tonight to start researching it. It’s Autoduel meets Strategic Commander, and it had me reading through my old Graph Theory text book from university.

Fifth Week

February 19th, 2008

88/100. Getting back there!

I exercised every day this week, except was really slack one of the days, so I lost a point there. Mostly VRT, and got some walking in 3 days.

All week I practiced the same 3 Midnight Oil songs: River Runs Red, Arctic World, and Sometimes. Then on Sunday night I played them at a coffee house in Richard’s church basement, accompanied by Richard. It was fun taking the lead vocals again. I was a bit nervous, but it’s a very forgiving and familiar audience, and once again some friends were quite encouraging about how it went; they’re the type to tell it like it is too.

I did less fixing/sorting/helping than in past weeks. I put new strings on my acoustic guitar for the first time in way too long, I fixed a badly clogged sink (yuck), attempted to help a friend with a VB.Net/SQL Server problem (and mostly didn’t succeed in the short time I had) and helped set up the (my) sound system for the coffee house. Alex: no, I didn’t find any new magazines last week, but you’ve got first dibs if I do!

I played more Super Luigi Galaxy with the kids; we’ve got 50 stars now, so just 10 short of rescuing Peach for the 3rd time. We also watched another 4 Super Mario Bros. Super Show episodes. And I brought my two oldest girls along to the coffee house, so Mr. Lappala could teach them a new word.

I finished Genesis and the first 18 chapters of Exodus this week, and continued plowing through On the Edge; I’m about 2/3rds done now.

Carla and I had a good night out on Valentine’s Day. Food at Montana’s, and wandering around Staples/Future Shop/Winners/Chapters after.

I’m looking to get a new laptop, but it seems I’m going to have to get it from Dell. I want a Core 2 Duo T7500 processor (it’s the cheapest one with a 4MB cache) but it appears to be too high-end still to make it into most consumer laptops. Also, for professional reasons I need Windows XP on the computer, and that’s getting difficult to find. It’d be a waste of money to pay for Vista then erase it, plus you never know if there will be some hardware in the computer that doesn’t have a WinXP driver.

I did do a little bit of work for my math game idea; we received some more math books in the mail and I read through some of them looking for ideas, and got a few more good ones. I got quite a bit of work done on the paid game work; I’m making a scripting language for the story/cut-scene parts of the game. It’s something I’ve never done before, so it’s pretty fun, and I’m learning a bit of Lua at the same time.