DanBoris Posted March 5, 2022 Share Posted March 5, 2022 (edited) 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. https://github.com/historicalsource/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. https://github.com/danlb2000/AT6502 Edited March 5, 2022 by DanBoris 5 Quote Link to comment Share on other sites More sharing options...
DanBoris Posted March 12, 2022 Author Share Posted March 12, 2022 (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 March 12, 2022 by DanBoris 4 Quote Link to comment Share on other sites More sharing options...
DanBoris Posted August 11, 2022 Author Share Posted August 11, 2022 I have been writing some blog posts about the Crystal Castles source code. First post is here: https://dansdigitalarchaeology.blogspot.com/2022/03/crystal-castles-source-code.html In this post: https://dansdigitalarchaeology.blogspot.com/2022/08/hll65fmac.html 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. https://dansdigitalarchaeology.blogspot.com/2022/08/hll65f-indenunden.html 3 1 Quote Link to comment Share on other sites More sharing options...
Max_Chatsworth Posted August 31, 2022 Share Posted August 31, 2022 On 3/4/2022 at 6:18 PM, DanBoris said: 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. https://github.com/historicalsource/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. https://github.com/danlb2000/AT6502 You couldn't find an assembler so you wrote your own?!?! Hardcore man.... 1 Quote Link to comment Share on other sites More sharing options...
fultonbot Posted September 9, 2022 Share Posted September 9, 2022 On 8/11/2022 at 1:25 PM, DanBoris said: I have been writing some blog posts about the Crystal Castles source code. First post is here: https://dansdigitalarchaeology.blogspot.com/2022/03/crystal-castles-source-code.html In this post: https://dansdigitalarchaeology.blogspot.com/2022/08/hll65fmac.html 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. https://dansdigitalarchaeology.blogspot.com/2022/08/hll65f-indenunden.html Dan, Can the ROM you produced run in an emulator? I'm looking through the Asteroids Deluxe code right now and to try to understand the sound Macros, and I'd like to test out some changes. 1 Quote Link to comment Share on other sites More sharing options...
DanBoris Posted September 11, 2022 Author Share Posted September 11, 2022 On 9/9/2022 at 10:00 AM, fultonbot said: Dan, Can the ROM you produced run in an emulator? I'm looking through the Asteroids Deluxe code right now and to try to understand the sound Macros, and I'd like to test out some changes. Yes, I have built the tools necessary to re-create the ROMS that will run in an emulator. I haven't tried Asteroids Deluxe yet but I took a quick look at the source and it looks like it will work with this assembler. Quote Link to comment Share on other sites More sharing options...
Keatah Posted September 11, 2022 Share Posted September 11, 2022 This is like engine-building school, 'cept for the digital age. 1 Quote Link to comment Share on other sites More sharing options...
fultonbot Posted September 11, 2022 Share Posted September 11, 2022 5 hours ago, DanBoris said: Yes, I have built the tools necessary to re-create the ROMS that will run in an emulator. I haven't tried Asteroids Deluxe yet but I took a quick look at the source and it looks like it will work with this assembler. From your example, do I just find all the code files and string them to together as a parameter to the assembler? Is there any order to it? Quote Link to comment Share on other sites More sharing options...
DanBoris Posted September 12, 2022 Author Share Posted September 12, 2022 39 minutes ago, fultonbot said: From your example, do I just find all the code files and string them to together as a parameter to the assembler? Is there any order to it? In Crystal Castles there was a single root source file that included all the others so you only need to point the assembler at one file. I downloaded the Asteroids Deluxe code and I think DSTRD0.MAC is the root file. I tried assembling from that file but there was a pseudo op that isn't implemented in my assembler. If I have some time I may dig into this and make the changes to the assembler to be able to assembler this code. 1 Quote Link to comment Share on other sites More sharing options...
fultonbot Posted September 12, 2022 Share Posted September 12, 2022 19 hours ago, DanBoris said: In Crystal Castles there was a single root source file that included all the others so you only need to point the assembler at one file. I downloaded the Asteroids Deluxe code and I think DSTRD0.MAC is the root file. I tried assembling from that file but there was a pseudo op that isn't implemented in my assembler. If I have some time I may dig into this and make the changes to the assembler to be able to assembler this code. Wow, cool, thanks! Quote Link to comment Share on other sites More sharing options...
DanBoris Posted September 20, 2022 Author Share Posted September 20, 2022 I started to dig into this and have run across a number of features in the assembler that Crystal Castles doesn't use. 1 Quote Link to comment Share on other sites More sharing options...
negative1 Posted December 17, 2022 Share Posted December 17, 2022 very cool. someday, hopefully someone will make a frontend, and maybe a level viewer, or editor. later -1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.