Jump to content

Photo

Disassembling 2600 Games?


99 replies to this topic

#1 DEBRO OFFLINE  

DEBRO

    Stargunner

  • 1,957 posts
  • Location:Atlanta, GA

Posted Sat Aug 20, 2016 10:31 AM

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



#2 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

  • 24,030 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany, Europe, Earth

Posted Sat Aug 20, 2016 11:46 AM

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.



#3 SpiceWare ONLINE  

SpiceWare

    Draconian

  • 12,748 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Sat Aug 20, 2016 2:40 PM

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.



#4 Mr SQL ONLINE  

Mr SQL

    River Patroller

  • 2,098 posts

Posted Sat Aug 20, 2016 3:27 PM

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?



#5 tschak909 OFFLINE  

tschak909

    River Patroller

  • 3,220 posts
  • Location:USA

Posted Sat Aug 20, 2016 4:01 PM

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



#6 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 21,924 posts
  • Location:The land of Gorch

Posted Sat Aug 20, 2016 5:20 PM

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.



#7 DEBRO OFFLINE  

DEBRO

    Stargunner

  • Topic Starter
  • 1,957 posts
  • Location:Atlanta, GA

Posted Sat Aug 20, 2016 9:17 PM

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.



#8 tschak909 OFFLINE  

tschak909

    River Patroller

  • 3,220 posts
  • Location:USA

Posted Sat Aug 20, 2016 9:57 PM

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 



#9 Omegamatrix OFFLINE  

Omegamatrix

    Quadrunner

  • 6,239 posts
  • Location:Canada

Posted Sat Aug 20, 2016 11:51 PM

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.



#10 tschak909 OFFLINE  

tschak909

    River Patroller

  • 3,220 posts
  • Location:USA

Posted Sun Aug 21, 2016 1:00 AM

Yeah, some of them wound up on the minidig time capsule, which still exists.

 

http://www.qotile.ne...idig/index.html

 

I keep looking at all of these, in the hopes that if I dissect them well enough, that all that awesome VCS knowledge will seep into my brain, and I can actually #@(%#@(%# write kernels. :P :)

 

-Thom



#11 Nathan Strum OFFLINE  

Nathan Strum

    Quadrunner

  • 8,398 posts
  • Enjoying a sandwich
  • Location:Newhall, CA

Posted Sun Aug 21, 2016 2:12 AM

When I read the topic title, my suggestion was going to be "use an adhesive solvent to remove the label first", but now I kind of think that was missing the point. ;)



#12 alex_79 OFFLINE  

alex_79

    Stargunner

  • 1,199 posts
  • Location:Italy

Posted Sun Aug 21, 2016 9:13 AM

I disassembled the Magicard, which is not a big achievement, as the manual describes the function of every subroutine as well as ram usage...
 



#13 Mr SQL ONLINE  

Mr SQL

    River Patroller

  • 2,098 posts

Posted Sun Aug 21, 2016 1:58 PM

 

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.



#14 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,328 posts

Posted Sun Aug 21, 2016 2:26 PM

 

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!



#15 DEBRO OFFLINE  

DEBRO

    Stargunner

  • Topic Starter
  • 1,957 posts
  • Location:Atlanta, GA

Posted Sun Aug 21, 2016 6:31 PM

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.



#16 Mr SQL ONLINE  

Mr SQL

    River Patroller

  • 2,098 posts

Posted Sun Aug 21, 2016 10:20 PM

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



#17 DanOliver OFFLINE  

DanOliver

    Moonsweeper

  • 333 posts
  • Location:Phoenix AZ

Posted Tue Aug 23, 2016 7:48 AM

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.



#18 Mr SQL ONLINE  

Mr SQL

    River Patroller

  • 2,098 posts

Posted Tue Aug 23, 2016 8:44 AM

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.

 



#19 DanOliver OFFLINE  

DanOliver

    Moonsweeper

  • 333 posts
  • Location:Phoenix AZ

Posted Tue Aug 23, 2016 9:42 AM

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.



#20 SpiceWare ONLINE  

SpiceWare

    Draconian

  • 12,748 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Tue Aug 23, 2016 9:44 AM

I assume there are tools already, but I like writing my own.


Yep - DiStella



#21 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

  • 24,030 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany, Europe, Earth

Posted Tue Aug 23, 2016 11:00 AM

The Shaman sure looks like Demon Attack.

Actually its a hack of Assault/Fire Birds/Sky Alien.

#22 Mr SQL ONLINE  

Mr SQL

    River Patroller

  • 2,098 posts

Posted Tue Aug 23, 2016 11:09 AM

Actually its a hack of Assault/Fire Birds/Sky Alien.

 

How do you figure this? I know the programmer, his games too from bitd and they are all original.



#23 DanOliver OFFLINE  

DanOliver

    Moonsweeper

  • 333 posts
  • Location:Phoenix AZ

Posted Tue Aug 23, 2016 12:02 PM

Actually its a hack of Assault/Fire Birds/Sky Alien.

And these also look like Demon Attack to me from screen shots.



#24 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

  • 24,030 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany, Europe, Earth

Posted Tue Aug 23, 2016 12:06 PM

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, Tue Aug 23, 2016 12:19 PM.


#25 Mr SQL ONLINE  

Mr SQL

    River Patroller

  • 2,098 posts

Posted Tue Aug 23, 2016 2:41 PM

Greg wrote tons of fantastic games in the 80's as well as operating systems and all kinds of cool things, that's actually a great thread to read! :) And the last analysis with that program was disproven, how's it different now?






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users