Jump to content
IGNORED

Disassembling 2600 Games?


DEBRO

Recommended Posts

Hi there,

 

I reverse engineer 2600 games as a past time hobby.

 

Does anyone else do this? The reason for the ask is I'd hate to duplicate efforts.

 

Also, is there anything anyone wants to see? I have a number of to-dos but I was just curious. I kind of stay clear of games produced in the late 80's by GCC as those will probably be found over time. I tend to gravitate to games I've played as a youth. I also mostly do 2K or 4K but I have looked at 8Ks occasionally.

 

I'm about done with Megamania. I'm still trying to get back to it but I've kind of lost interest. I've since moved on to Video Pinball. I don't know why but I picked it up again a couple of weeks ago after abandoning it some 10 years ago.

 

I can't promise I would look at the suggestions or commit to a timeline because I do this as I find time but was just curious. Thanks

  • Like 2
Link to comment
Share on other sites

Very cool Debro, your 4K Pacman is awesome, I'm looking forward to seeing what your version of Video Pinball plays like! :)

 

This is also great fun to do with awesome games for other systems that were never released on the Atari.

 

How woul you describe your approach, do you look at the source code for the game you're reverse engineering or just the game output?

Link to comment
Share on other sites

I'd request a disassembly of Video Olympics..mostly am looking at it to see how they did a nice 2x2 ball in a 2 line kernel that was smooth (I tried to do it by ANDing the scanline by #$FC, and it gets the ball size correct, but the vertical motion is quantized, so even with vertical delay, it still wobbles...) :P

 

-Thom

  • Like 2
Link to comment
Share on other sites

I'm looking forward to seeing what your version of Video Pinball plays like! :)

If done correctly, it should execute exactly the same way as the original binary. The purpose of reverse-engineering is to create a reasonable duplication of the author's original source code. Some things, such as variable names, are impossible to recreate. On the other hand, reverse-engineered files are often commented much more extensively than their originals (when an original exists for comparison)...and built as a single document instead of using smaller program modules.

Link to comment
Share on other sites

Hi there,

 


I did (as you know already). And I have a number of partially disassembled games (and DiStella config files) on my hard disk, mostly done to hack them.

 

But currently I am busy with other stuff.

Yes Thomas! I got started years ago following you on [stella]. I've had or needed some 2600 time which has sparked me revisiting some of my partially disassembled work.

 


I made some headway on Warlords back in 2006. Had most of the RAM usage figured out and 40% of the generic labels given more meaningful names.

I didn't know that. Thanks. I'll take a look.

 


Very cool Debro, your 4K Pacman is awesome, I'm looking forward to seeing what your version of Video Pinball plays like! :)

 

This is also great fun to do with awesome games for other systems that were never released on the Atari.

 

How woul you describe your approach, do you look at the source code for the game you're reverse engineering or just the game output?

All my work is done from original coding. The reverse engineering projects I do are easier than doing a game from scratch and is a way to get lost source from decades ago archived in some way. I also find it interesting how developers got around the limitations of the system. They seem trivial now but they were pioneers of their time.

 


I'd request a disassembly of Video Olympics..mostly am looking at it to see how they did a nice 2x2 ball in a 2 line kernel that was smooth (I tried to do it by ANDing the scanline by #$FC, and it gets the ball size correct, but the vertical motion is quantized, so even with vertical delay, it still wobbles...) :P

 

-Thom

 

That is one of my partially reverse engineered projects. Unfortunately its more partially than anything. I hope this helps.

   txa                        ; 2         move scan line to accumulator
   sec                        ; 2
   sbc ballVertPos            ; 3         subtract ball vertical position
   and #$FC                   ; 2
   php                        ; 3 = @70
   stx WSYNC

Before coming here, they point the stack to ENABL. They then subtract the scan line from the ball's vertical position. The value is then AND'd with #$FC which is the 1's complement of 3. They then push the status of the AND'ing to the stack which enables or disables the ball. So in essence, if the value is between 0 - 3 then the BALL is enabled because the Z status is set.

 

In Video Pinball, the ball height is 4 because of the 2LK. Bob Smith does...

CheckToDrawBall
   lda ballScanline           ; 3         get scanline to enable ball
   sec                        ; 2
   sbc scanline               ; 3         subtract current scanline
   cmp #(H_BALL / 2)          ; 2
   rol                        ; 2         shift carry to D0 (1 if greater than 2)
   asl                        ; 2         shift carry to D1 (i.e. ENABL)
   eor #ENABLE_BM             ; 2
.doneCheckToDrawBall
   rts                        ; 6

Here he compares the subtraction of the the scan line and the ball's scan line with half of the height of the ball (i.e. 2). He then shifts the carry flag to D1 and flips the value to enable or disable the ball. So if the subtraction value is greater than 1, then the ball is disabled. If the subtraction value is less than 2 then the ball is enabled.

 


If done correctly, it should execute exactly the same way as the original binary. The purpose of reverse-engineering is to create a reasonable duplication of the author's original source code. Some things, such as variable names, are impossible to recreate. On the other hand, reverse-engineered files are often commented much more extensively than their originals (when an original exists for comparison)...and built as a single document instead of using smaller program modules.

 

Kurt is correct. Generally the original source wouldn't have as many comments as I add. Carla Meninsky was noted as not having any comments in her code.

  • Like 2
Link to comment
Share on other sites

Yup, I've used the combat stack trick to enable the ball at the right scanline, but when moving vertically, I would see it change by what looked like 4 scanline increments...

 

(apologies, I'm still learning... I've been a professional software developer for close to 30 years, and VCS dev (especially kernels) is the hardest thing I have EVER done... I had been following homebrew VCS development since the Stella list in the late 90s, and after all this time, I finally have a game idea that I'm trying to put together.) :P :)

 

-Thom

Link to comment
Share on other sites

Hi there,

 

I reverse engineer 2600 games as a past time hobby.

 

Does anyone else do this? The reason for the ask is I'd hate to duplicate efforts.

I used to do a lot of disassemblies. I think I've done ~ between 120-150 rough disassemblies. Most were to the extent where a lot of the pointer data was mapped to labels. I did a lot of them for fun or to help people, other times it was for controller conversions, hacks, etc...

 

For 100% complete reversals I think I've only done 2. StoneAge and the 208 in 1 Game Select Menu.

Link to comment
Share on other sites

 

All my work is done from original coding. The reverse engineering projects I do are easier than doing a game from scratch and is a way to get lost source from decades ago archived in some way. I also find it interesting how developers got around the limitations of the system. They seem trivial now but they were pioneers of their time.

 

 

 

Very cool, so your Pacman has Todd Frye's source code in it? I'm surprised because it looks and plays more like the arcade, though I am a big fan of the original as well.

 

 

If done correctly, it should execute exactly the same way as the original binary. The purpose of reverse-engineering is to create a reasonable duplication of the author's original source code. Some things, such as variable names, are impossible to recreate. On the other hand, reverse-engineered files are often commented much more extensively than their originals (when an original exists for comparison)...and built as a single document instead of using smaller program modules.

 

I think working through the original codebase has alot in common with typing in game listings from Magazines bitd, it's a lot of fun and the best way to learn.

 

I don't consider it reverse engineering though, more like an awesome hack if it has much of the original source.

 

I'm used to reverse engineering projects where only the inputs and outputs are available and none of the source code; my Atari games only reuse the Battle Zone positioning routine and an optimized division routine. For me, writing all the code from scratch helped immensely in learning the TIA architecture.

Link to comment
Share on other sites

 

All my work is done from original coding. The reverse engineering projects I do are easier than doing a game from scratch and is a way to get lost source from decades ago archived in some way. I also find it interesting how developers got around the limitations of the system. They seem trivial now but they were pioneers of their time.

 

 

Holy ham and cheese batman! Not that it matters but you've earned my admiration forever! Thank you for doing what you do, man!

Link to comment
Share on other sites

Hi there,

 

 

Very cool, so your Pacman has Todd Frye's source code in it? I'm surprised because it looks and plays more like the arcade, though I am a big fan of the original as well.

 

You misunderstood. All of my games are original conceptions.

 

I do admit that we all learn from the pioneers before us. Using Pacman4K as an example...Dodge'em was the first dot eating game by Atari. Pac-man, though no reused code, would have built from this in some manner. Ebivision did a Pac-man which became Pesco. I studied their work too. The code wasn't reused but I did learn from what they did.

  • Like 1
Link to comment
Share on other sites

Hi there,

 

 

You misunderstood. All of my games are original conceptions.

 

I do admit that we all learn from the pioneers before us. Using Pacman4K as an example...Dodge'em was the first dot eating game by Atari. Pac-man, though no reused code, would have built from this in some manner. Ebivision did a Pac-man which became Pesco. I studied their work too. The code wasn't reused but I did learn from what they did.

 

Gotcha. Your code is all original, but you examine the source code as well as the output screens of the games that influence you.

 

The source code will influence your own design to varying degrees depending upon how much and how long you study the other codebases. Making a detailed dissembly will probably have a big influence on your design.

 

I think that could sometimes be an advantage and sometimes a disadvantage but it's definitely fun to see the old code documented with comments and labels (I won't look at a machine dissembly without comments).

Link to comment
Share on other sites

I'm pretty dense...trying to understand, is it like what Mr SQL described? You look at how a game plays, and you look at the disassembled code, and then re-create the same game using your own code? So the result looks very similar to the original but slightly different.

 

How do you not end up with an almost identical kernel? I mean do you purposely find another way?

 

That's basically how I got started, and I suspect how many people did even if they don't admit it. When I did it my game couldn't look like the original and we couldn't lift any code for fear of being sued. Looking at Wikipedia I guess this would be more like Reverse Code Engineering. I forget what we called it back in 1982, probably just "disassembly". I wonder how it would have changed me as a programmer if I'd been able to disassemble Demon Attack for Space Cavern. Apollo couldn't get their hands on a copy so I disassembled a few other games to learn how to program a game. Only recently did I learn how Demon Attack was done and I was amazed. Never would have occurred to me I think. If I'd learned that before Space Cavern I think it probably would have looked like a rip off, so glad I didn't.

 

I also did kind of the same thing on the ST, created a Mac looking UI for a rip off of Andy Hertzfeld's Switcher, and other Mac UI elements. No matter how hard I tried I couldn't come up with a better UI. Seems like I have to design from scratch to make an improvement. Trying to tweak an existing doesn't get me anywhere.

 

I have to disassemble Laser Gates before starting another game just to remember where my head was. Hopefully it will make sense. Although could be funny if I keep seeing poorly written code, or better ways.

 

I'm writing a tool to disassemble. I assume there are tools already, but I like writing my own. Be interesting to start a thread on creating such tools if there isn't one already.

  • Like 1
Link to comment
Share on other sites

I have similar thoughts; if I looked at the PACMAN, KC, Defender or StarGate sourcecode before coding KCMD and STARBLITZ, I would have for sure been influenced by their codebases and ended up with similar routines.

 

Ditto had I looked at the codebase to BoulderDash before creating a tile mapping engine with a large virtual world, or looked at the source code to the batari BASIC runtime and compiler, before creating a Virtual World BASIC runtime and compiler.

 

From my conversations with Fred, Tom and particularly Andrew, I'm amazed at the very different ways they went about their approach. Computers are limitless in possibility and there are so many unique things we can do we might very well miss innovative ideas we could have come up with, Dan is right on. How do you guys keep from ending up with a similar kernel and routines?

 

Dan, regarding Space Cavern checkout the screenshots for The Shaman, a similar genre game coded recently by awesome 80's programmer Greg Zumwalt with all original source. There were silly claims (since debunked) on Atariage that he had copied the source; he didn't, but like us he could have been influenced to write similar style routines if he saw it, or maybe even just from looking at the outputs.

 

Professionally we are no longer allowed to look at just the outputs and reverse engineer the source code even without having ever seen it; I finished my last such project before the DCMCA went into effect some 15 years ago; I think the DCMCA isn't fair to programmers because it means you can copyright an idea and then no one else can use that idea.

 

Link to comment
Share on other sites

The Shaman sure looks like Demon Attack. For learning it's a very interesting idea to recreate a game. A way to really judge skill since you can compare side by side. I once saw painters in front of the Mona Lisa in the Louvre painting a copy. Puzzled the hell out of me, seemed dishonest but they were right there for everyone to see. Asked them and they said it was part of learning. Made sense. I assume they do something to their painting to make it clear it's a copy.

 

I don't see how DMCA allows copyrighting an idea. That always had to be done via a patent. But, none of that really matters, only how many lawyers you have.

  • Like 1
Link to comment
Share on other sites

Yes, but those are originals, the code is created from scratch.

BTW: Initially I also thought The Shaman would be a hack of Demon Attack. icon_smile.gif When the ROM was released I ran it through CloneSpy which clearly shows the origin. The code is identical between 88 and 92%.

Edited by Thomas Jentzsch
  • Like 1
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.
Note: Your post will require moderator approval before it will be visible.

Guest
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.

Loading...
  • Recently Browsing   0 members

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