Jump to content

Crystal Castles Source Code

Recommended Posts


I recently ran across a bunch of Atari arcade source code that was added to the Historical Source Github site, including source for one of my favorite games, Crystal Castles.




I thought it would be cool to be able to re-assemble this back into the original ROMs. I started by trying to find an existing assembler that could do this, but the assembler used for this source had a lot of syntactical differences and features I couldn't find in any other 6502 assembler. I assume Atari used a VAX based assembler and I did even find documentation for a VAX assembler with similar features, but still not an exact match. 


I then thought about manually modifying the source to work with an existing assembler. I quickly realized that this wasn't feasible due to some of the odd syntax in this assembler. For example the Atari assembler has an different syntax for addressing modes. You can write Zero Page X like this: "LDA ZX,$PSTSL", you couldn't fix this with a simple search and replace. This would also have to be done for every game I wanted to re-assemble. 


So I decided the best option was to build my own assembler that could handle these files with little changes to the original source. The assembler I build is now able to reassemble the main source from the historical source repository and reproduce the MAME ccastles1 ROM set. 


I have setup a GitHub repository to hold the C# source code for my assembler as well as tool to split the output into separate ROMs and handle the checksum process. There is also a folder there with the files and instructions needed to rebuild the source. There are some small changes needed to the source which I have documented in the instructions, and there was one file missing from the Historical Source archive which I re-created from the original ROMs. 



Edited by DanBoris
  • Like 3
Link to comment
Share on other sites

Posted (edited)

While digging through the source code I noticed a reference to a game state called "flashy display". It looks like this is activated if you have a high enough score at the end of the game. It fills the display with random cubes. I am not sure exactly what the score is, I modified the code so it always showed up. I played this game a lot in the arcades and don't know if I ever saw this.



Edited by DanBoris
  • Like 3
Link to comment
Share on other sites

  • 4 months later...

I have been writing some blog posts about the Crystal Castles source code. First post is here:




In this post: 




I discuss the high level language macros that the code uses. This is a pretty cool macro library that lets you do run time nested if/then statements. 


I have figured out enough of the assembler to reproduce the binary ROMs, but there is some odd syntax in these macros that relate to the listing output. I wrote a post about this and would be interested if anyone has an ideas on this. 




  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...