Jump to content
IGNORED

Any 2K games disassembled with comments?


Recommended Posts

I know there were a few commented disassemblies floating around a while back. Does anyone remember what they were of if they're still out there in the ether somewhere.

 

Do they exist for something simple like Stampede! or Laser Blast?

 

I wanna jump back into this after 2 years away.

 

Essentially start over.

 

Are people still using DASM? I should probably update that since it's so out of date. Assuming it was updated in that time.

Link to comment
Share on other sites

MiniDig has a number of commented disassemblies and other useful info.

 

For the past couple of weeks I've been developing Collect, a 2K game, for a presentation. Since its for a presentation, I've been going overboard with the comments.

 

Still using DASM.

 

http://dasm-dillon.sourceforge.net

Edited by SpiceWare
  • Like 2
Link to comment
Share on other sites

So here's another question, I'm poking around in Stampede! and I see that lives are stored in ram_BE but looking at the code I don't see that "defined" anywhere (if that's the right term)

 

How does that value of "3" initially get set when you hit reset.

 

I see where it gets INC and DEC when you gain or lose lives but not that

 

I might have missed it since my eyes are starting to glaze over.

 

Gotta say, it weirdly makes more sense this time.

 

Gonna see if I can dig up some old code examples I got to compile 2 years ago and if I can make heads or tails of them again

 

Fun stuff!

Edited by godzillajoe
Link to comment
Share on other sites

By ram_BE I gather you're looking at in via Stella's debugger?

 

Use the trapwrite command to have Stella stop execution when a specific memory location is updated.

post-3056-0-37803700-1404775190_thumb.png

 

The steps to get to that point are:

  • hit ` to enter Stella's debugger
  • click on the Prompt
  • type in 'trapwrite ram_BE' (circled in purple)
  • hit ` to exit Stella's debugger
  • hit F2 to RESET the game

The purple arrow points to the green box which is the next command that will run, so the one above it (STA ram_BD,X) is what updated ram_BE. The green circle shows the state of the registers. X = 1 so ram_BD + 1 = ram_BE.

 

The command above STA ram_BD,x is LDA LF798,X. Using the fact that X=1 we know data came from address F799, which contains the 3.

post-3056-0-29194800-1404774915_thumb.png

Link to comment
Share on other sites

I know there were a few commented disassemblies floating around a while back. Does anyone remember what they were of if they're still out there in the ether somewhere.

 

Do they exist for something simple like Stampede! or Laser Blast?

 

I wanna jump back into this after 2 years away.

 

Essentially start over.

 

Are people still using DASM? I should probably update that since it's so out of date. Assuming it was updated in that time.

 

I've got a collection of commented disassembles on my site as well. No stampede or laser blast, but I do have kaboom. :) It's www.bjars.com.

Link to comment
Share on other sites

 

I've got a collection of commented disassembles on my site as well. No stampede or laser blast, but I do have kaboom. :) It's www.bjars.com.

 

Thanks AMax, I looked at a couple last night. That will be a good resource.

 

Maybe go back through the Newbies programming tutorial if I can find my hard copy.

 

Let's see what trouble I can get into today!

Edited by godzillajoe
Link to comment
Share on other sites

 

The purple arrow points to the green box which is the next command that will run, so the one above it (STA ram_BD,X) is what updated ram_BE. The green circle shows the state of the registers. X = 1 so ram_BD + 1 = ram_BE.

 

The command above STA ram_BD,x is LDA LF798,X. Using the fact that X=1 we know data came from address F799, which contains the 3.

attachicon.gifScreen Shot 2014-07-07 at 6.13.26 PM.png

 

So I get what it's doing but why wouldn't you just do

 

STA ram_BE

 

instead of STA ram_BD,X

 

Why bother with X and doing the "add"

Link to comment
Share on other sites

That command is part of a loop which initializes 12 RAM variables. Starting at F1FD:

 

        ldx #$0C        ; LoaD X with 12
LF1FF:  lda LF798,x     ; LoaD A with contents of address F798+X
        sta ram_BD,x    ; STore A into address ram_BD + X
        sta ram_CB,x    ; STore A into address ram_CB + X
        sty ram_99,x    ; STore Y into address ram_99 + X
        sty ram_A5,x    ; STore Y into address ram_A5 + X
        sty ram_B1,x    ; STore Y into address ram_B1 + X
        dex             ; DEcrease X
        bne LF1FF       ; Branch (if X) is Not Equal to zero

The BNE works on the command most recently done that updates the Z flag, which is the DEX command. All the ,x commands are process when X contains the values of 12, 11, ..., 2, 1

 

Not shown in that code is that Y = 0 (see the screenshot with the green oval). That means the three STY commands are zeroing out a range of RAM. Don't know for sure, but I suspect the zeroed out RAM holds the onscreen obstacle information - the positions of the cattle formations, blank angus & skull.

 

It takes a lot less ROM to use a loop than to use

        lda LF799
        sta ram_BE
        lda LF79a
        sta ram_BF
        ...
        lda LF7A4
        sta ram_C9
Edited by SpiceWare
Link to comment
Share on other sites

That command is part of a loop which initializes 12 RAM variables.

I should probably rephrase that:

 

That command, as part of a loop, initializes 12 RAM variables. The loop as a whole initializes 60 RAM variables (5 STore commands * 12 times thru loop)

Link to comment
Share on other sites

 

So I get what it's doing but why wouldn't you just do

 

STA ram_BE

 

instead of STA ram_BD,X

 

Why bother with X and doing the "add"

Because X is being used as it was intended for, as an index register. Often times when coding you'll have a table of data, say that data is stored at a given location... memory location 10, and there's 10 elements. Say the 4th element in represents the number of lives left, and your initializing the game, so you want to store a 3 in the 4th element of a table that starts at memory location 10, so you really want to access memory location 14. Instead of remembering all these different locations and what those locations represent, you can equate a label to a value, for example, the table begins at location 10, so we'll equate the number 10 with BEGTAB which stands for beginning of the table, and let's equate 4 to LIFLFT, with lives representing the 4th item into the table, which needs to hold the number of lives left. Also we'll equate NUMLIV to the initial number of lives to store in our table.

 

EQU BEGTAB 10

EQU LIVES 4

EQU NUMLIV 3

LDX BEGTAB <--- this line will load the X index register with 10, the beginning location of our table.

LDA NUMLIV <--- this will load A with the initial value of 3 to store in our table

STA LIVES,X <--- this is where the magic happens, this line says store A in the memory location referenced by X (10) plus the offset of LIVES (4), which equals 14, so A gets stored to memory location 14, but you as a coder didn't need to know it was memory location 14, you just need to remember BEGTAB is the begining of the table, and that LIVES is the offset to where we store the remaining lives, and NUMLIV is the start up value for number of lives in the game.

 

In the above example, he's doing the same sort of thing just that he's using the offset as the base and is decremented X instead. This sort of thing is used alot to move a chunk of data from one spot to another. Something that's not really done much in Atari coding after initialization as there are no sprites to move around a frame buffer for example, It's called indirect addressing and its useful for dynamically defining pointers on the fly. You can be 1000 lines into code and equate an offset, then use it. Generally that's not done though, typically you usually see all the equates at the beginning or more often, end of a program.

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