Stepping Through Ultima 1's Code

Kingspud left a comment a few days ago announcing the onset of a very interesting project at the website of his project, Ultima 1 Revisited:

Well, it’s been a while but I finally started posting the tutorial on my Ultima 1 Revisited blog. This tutorial will take the World Map program and detail each subroutine LINE-BY-LINE, explaining how each line works, how it affects the program, and what the program is doing because of the partiular code line.

I will be updating the tutorial as soon as I have each subroutine marked up and made available.

Enjoy.

He has already posted five separate tutorials/code walkthroughs to the project site:

  1. The tile graphics and world map movement.
  2. The main program for the game.
  3. The PGM “clear screen” subroutine.
  4. The routine that initializes all program variables at launch.
  5. A routine that resets some variables during gameplay.

Here’s a taste, from the most recent tutorial:

111 CLRSET LDA #$00

Line 111 is used to “[L]oa[D] the [A]ccumulator” or register A with the value equal to zero! So, you are setting the value of A to equal the HEX value of $00, which equals decimal value of 0. Also, line 85 has a header titled CLRSET, which allows it to be called from a separate statement as a subroutine. In this case it is used to initialize all the variables with a zero, a HEX value, a DECIMAL value, or a CONSTANT.

Kingspud does a good job of breaking down each command into something that a layperson non-coder could reasonably hope to understand. Do give each article a read, Dragons and Dragonettes; they offer nothing less than a glimpse into the mind and early technical genius of a young Richard Garriott!

Oh, and on a congratulatory note: The reason it has “been a while” since we have heard from Kingspud and his project is the addition of a “new Avatar” to the family:

Well the reason I haven’t had a chance to update the blog for some time is because I recently added a new member to the family.

A new baby boy Kyle!

Do join me all in offering a big round of congratulations, applause, and all such merry things to Kingspud, his wife, and young Master Kyle!

6 Responses

  1. Sanctimonia says:

    Big congratulations on the little one, and to your work on bringing Ultima to life in a way it truly deserves.

    After I heard the news that the original incarnation of Ultima’s source code was available and after hosting it from my home server, I was quite a bit perturbed that no one seemed to give a damn and that WtF out of respect for the current IP holders wouldn’t post it himself. Even the (now decrepit) /. didn’t seem to give a crap, which is slightly less disturbing than the general response here.

    Fortunately I have the files and am willing to distribute them to those who care.

    @WtF, you might want to remove my direct link in a post to my hosted archive. Linking is infringing these days. I think I’m going to create a torrent on tpb just to see how many people continually seed, though. My mention could be considered an indirect link. 🙂

  2. Sanctimonia says:

    I just created and am seeding a torrent on the most common and well-known site.

  3. kingspud says:

    Hello all,
    Kudos to Sanctimonia and Ultimaaiera for make this information available!
    Thank guys!
    I have to agree that its amazing how little response there is from people to the availability of Ultima 1 Basic code. I myself was taken aback when I was informed just how easy it was to look at the basic code for Ultima 1. Now don’t get me wrong, taking a look at the basic code doesn’t mean you will be able to re-write the Ultima 1 program. When I looked through the disk and the code that was on it “which is pretty intense” I found that there are still binary file that use some assembly code, which are not available. These binary files are for the dungeons, towns, castles, etc… More research needs to go into the entire Ultima 1 program disk to decipher all that can be removed and used for a revamp of the program. I took the approach that since I only have certain parts of the code it would be easier, “well it seemed easier” to just rewrite the Ultima 1 program from scratch. This approach would also give me the ability to make all the code available since I’m not duplicating EA’s work or infringing on EA’s copyrights. This is my “interpretation of the game” and in the end could be turned into any “Ultima” style game with tile graphics.
    That being said, this is going to be a massive undertaking and I hope to do the program justice. I also hope that others with more assembly experience then I will start to participate and help in creating subroutines that will bring the entire project to the Ultima 1 fan base. Once I have all the tutorials posted for the World Map tile-graphics movement part of the program, I hope I will received a large number of request for the apple program .dsk images so others can play with and tweak the code to their liking. Please feel free to ask any questions you might have and I will try to answer them.
    Ultima_revisited@yahoo.com
    Sincerely,
    Joe “kingspud”

  4. kingspud says:

    Hi Wtfdragon,

    Thanks for write up. Also, you might want to correct a mistake I made in your example of code line 111.

    111 CLRSET LDA #$00

    Line 111 is used to “[L]oa[D] the [A]ccumulator” or register A with the value equal to zero! So, you are setting the value of A to equal the HEX value of $00, which equals decimal value of 0. Also, line 85 has a header titled CLRSET, which allows it to be called from a separate statement as a subroutine. In this case it is used to initialize all the variables with a zero, a HEX value, a DECIMAL value, or a CONSTANT.

    Actually where it shows “line 85” in the example, it should actually say line 111! If you could fix this in your example display that would be great. I already fixed it in the blog and wanted to thank you for making this available.

    Unfortunately there is no spell checker for code writing. LOL!

    Joe

  5. kingspud says:

    Hello Sanctimonia,
    Could you please give a link to the site where you have all the info and codes for Ultima 1.
    Thanks
    Joe

  6. Sanctimonia says:

    I just used some win32 app under Wine to dump the source code from the data files and manually removed the file extensions that it added automatically for win machines. I included the boot disk and vanilla player disk images (not the one with the character name entry) and created a brief README with redacted names for legal reasons.

    A certain web site for those who like the say “Arrrr, matey” deleted the original torrent because my tracker was incorrectly configured and subsequent attempts to re-upload result in an error ascribed by the site GUI to Captcha failure. So fuck the Bay, I’m just hosting it from my domain for the time being. If someone wants to upload the file to a search engine with its own trackers, feel free. The more trackers the better, as a single DMCA takedown could knock my ass offline.