Apple ][ Assembly Language Programming

Posted on

The past few weeks I have been diving into the world of assembly language programming on the Apple ][ computer. My interest in the topic stems from the recent book release of a compilation of articles on assembly language programming called Assembly Lines: The Complete Book. The articles were written by Roger Wagner and originally published in Softalk magazine back in the early eighties. This edition was edited by Chris Torrence and is available for download and purchase from a number of locations.

Now, I am pretty familiar with Applesoft Basic programming, but I was always in awe of commercially released software on the Apple ][ that ran so fast, had fancy hi-res graphics and used sounds other than the system beep. What was the secret of these mythical programs that required you to type “BRUN” in order to get them to load? The secret was machine language.

This image shows you just how intuitive and user-friendly machine code is. It’s almost like it was written by the Terminator himself (just after he finished cutting out his eyeball with an Xacto knife). Despite the seeming impenetrability of machine code, in the past I made a few attempts to learn it. I would get a few chapters into Apple Machine Language and then the endless diversions into binary math would addle my art-school trained brain. It never really clicked for me.

What I didn’t know is that there was this thing called “assembly language” which is a human-readable method of creating machine code. It still is pretty brutal compared with Basic or JavaScript, but for the first time I think I am starting to understand machine language and, more generally, just how the Apple ][ works. Cryptic hex numbers and even the aforementioned binary math are still a part of assembly, but it uses three letter abbreviations for various functions and allows for comments and labels. The assembler will translate the letters into their numeric machine language equivalents and assemble the source code into a BRUN-able program. Woo-hoo!

The first hundred pages or so of Assembly Lines has been very informative and I have dutifully typed in many of the example programs. At one point I had a pretty nice “ah ha!” moment when I was messing around with creating tones. I created a small program that generated an annoying high pitch noise and decided I would further enhance the interactivity by outputting a stream of numbers to the screen showing the paddle positions. Before I got very far beyond just reading the paddles I noticed that I could use the joystick to change the pitch of the sound. I had no idea why this would change the pitch so I decided to look at the machine code in the built-in paddle routine. To my surprise, I was able to see that it got the paddle value by using a count down loop. The longer the count down, the lower the tone. I couldn’t really say why this was the case, but at least I was starting to be able to decipher that wall of hex values.

Now, back in the late eighties I got my hands on an issue of Compute! magazine. Kids nowadays with their fancy iWatches and download services may not believe this, but in the olden days there would be program listings in computer magazines. Readers could carefully type in the program and, “Voila!”, you had new software to use. This issue contained a listing for a game called Space Dodger, with a separate listing for just about every machine available at the time. Most were written in basic, but the one for Apple ][ was pure machine code. I had no idea what any of it meant, but I dutifully typed every line into my Apple’s monitor. The result was a pretty slick little arcade game:

You moved your ship to avoid the space junk which flew by from right to left at varying speeds. However, playing the game in emulation, I noticed a slight problem: the ship movement was mapped to the wrong joystick axis.

And now we get to my second assembly language “Ah ha!” moment. I now know the memory address where the paddles are read. I just needed to search the code listing for 00 1E FB and it would just be a matter of changing the 00 to 01. I found the values at $706B, made my edit and, magically, the joystick now worked correctly!

I still have no clue as to what the other 99% of the code does, but this was a breakthrough. Assembly language… I think I can do this. In the meantime, download Space Dodger and play it in your favorite emulator.

2010 Best of the Year

Posted on

Well it’s the first day of the New Year. This day means different things to different people. For my wife it means washing off the post-New-Year’s-Eve-bash Sharpie moustache that she woke up with this morning. For me it means it’s time to assess what I thought was the best of the media I consumed this past year.

Movies

Like last year, there really wasn’t anything that truly amazed me this year. My best rated films were Moon and The Maltese Falcon. I watched more T.V. than I have in recent years, so I suppose I could add LostV or The Walking Dead as honorable mentions.

Books

Towards the second half of the year I started reading a bit more than usual and found several books truly grabbed me in ways that no movie or show did this year. If I had to pick a favorite from this year it would be George R. R. Martin’s A Game of Thrones, especially if considered along side the three other books in the series that I also read and loved. At a near-tie for the number one spot is Patrick Rothfuss’s The Name of the Wind, which started my on my current fantasy lit kick. Finally, rounding out the top was Motherless Brooklyn by Jonathan Lethem. Honorable mentions would go to Mistborn books 1 & 2Devil Born Without Horns and Racing the Beam.

Video Games

House of the Dead: Overkill Box Art

I played a ton of games this year. My highest rated game was House of the Dead: Overkill for the Wii. It was stupid, crude, violent and hilarious… loved it. My runners-up would be Mass Effect and Legend of Zelda: Twilight PrincessMass Effect further proves that the best science fiction is in video games these days, and Zelda is Zelda… ’nuff said. I am still mid-game in GTA IV and Metroid Prime Trilogy but I suspect those two titles would have made this year’s list too had I completed them in time. I also played a few casual games I liked such as Puzzle Quest and Plants vs. Zombies.

Steam just finished their massive annual game sale and I stocked up so there should be no shortage of gaming for me in the next year and beyond.

2009 Best of the Year

Posted on

It’s the end of another year and I think it would be a good time for me to recap my personal best of lists for 2009. In case you haven’t noticed, much of this site is devoted to keeping track of all the media I digest. I review and rate just about every moviegame or book I finish. I also keep track of the music I listen to, but I don’t really buy much music anymore, so that section doesn’t really give a good overview of the new music I have heard lately. So, anyhow, here it is. The Pages of Fun Best of 2009!

Best Book

  • Flying Colours by C. S. Forester – I’d ran out of Aubry/Maturin Napoleonic era novels so I guess Hornblower had to suffice for this year. This series has its highs and lows, and never quite matches O’Brian, but this book in particular was very good.
  • Honorable Mention: Twisty Little Passages – An Approach to Interactive Fiction by Nick Montfort – This one is probably a bit too nerdy for the average reader, but I really enjoyed this academic analysis of text adventures.

Best Movies

I guess it was a pretty lame film year for me. I have a pretty big back list of films yet-to-see, so hopefully 2010 will fare better.

Best Video Games

  • Braid was my highest ranked game this year.  A wonderfully inventive platform game.
  • I also have a couple of honorable mentions in this category as well: Fallout 3 and Mirror’s Edge were both incredible games.

All of these games were bought using Valve’s Steam download service, and all were very cheap! PC rules!

My Media Consumption Journal

Posted on

2007

Music List 2007

  • My God is Alive! Sorry About Yours. by The Knights of the New Crusade
  • The Austerity Program…?
  • A Challenge to the Cowards of Christendom by The Knights of the New Crusade
  • On a Tight Budget by Budget Girls
  • The Giallos Flame by The Giallos Flame
    • Rating: 7/10
  • L’Uccello Dalle Piume di Cristallo by Ennio Morricone
    • Rating: 10/10

Game List 2007

  • The Last Battle
    • Rating 3/10
    • Impossible platform brawler for the Sega Genesis.
  • The Orange Box
  • Prince of Persia: The Sands of Time
    • Rating: 7/10
    • The jumping puzzles are more fun than the combat.
  • Legend of Zelda: The Ocarina of Time
    • Rating: 9/10
    • Wonderfully done video game. Simple mechanics and a good story.
  • Super Mario Land 2: 6 Golden Coins
    • Rating: 8/10
    • Nothing new here. Just a great mario game.
  • Return to Castle Wolfenstein
    • Rating: 5/10
    • Took me forever to finish because it’s pretty boring. Tries to tell a story and fails.

2006

Game List 2006

  • Half-Life 2
    • Rating: 9/10
    • Very good, but starts to drag in the 3rd act
  • Heretic II
    • Rating: 6/10
    • Bad voice acting, decent gameplay, but suffers from early FPS monotony.
  • Day of Defeat: Source
    • Rating 10/10
    • Great multiplayer FPS

Music List 2006

  • Hello Young Lovers by Sparks
    • Rating: 10/10
    • A masterpiece of epic, symphonic goofiness and left-of-center pop structuring. Sparks best since Kimono my House.
  • Fear Box Set by Ennio Morricone
    • Rating: 10/10

2005

Game List 2005

  • Max Payne 2: The Fall of Max Payne
    • Rating: 10/10
    • Excellent plot, really fun game play, and excellent voice acting. Who cares if it was a bit short. This is a perfect video game is ever there was one.
  • Neverwinter Nights
    • Rating: 6/10
    • Great graphics and enjoyable story, but the gameplay is monotonous and lacks and sort of serious skill or strategy element.
  • Serious Sam the Second Encounter
    • Rating: 6/10
  • Farcry
    • Rating: 8/10