Jump to content

Recommended Posts

I did a search+replace with a regular expression and it was faster for me that way. Ultimately, the assembler will do the math.

 

I'm sorry I used the wrong ROM. I'll try to check your file to see what's wrong with it.

Seeing different symbols in this disassembly that wasn't in the previous one:

 

MVO R1, G_0324 ; 5B15 0241 0324

baseball2.asm:2270: ERROR - undefined symbol G_0324

 

tacrec, if we're using different ROMs then the disassembly would be different. Ignore my source files since they are obviously from a different baseball game. If you send me a copy of the disassembly as generated by dis1600, I'll try to fix all the symbols. Send it via PM, don't post it here, please.

I compared the two disasm's and I think I got it.

First disasm:

L_5B12:
PULR R4 ; 5B12 02B4
ADDI #$0040, R2 ; 5B13 02FA 0040
MVO R1, $0324 ; 5B15 0241 0324
MVO R2, $0321 ; 5B17 0242 0321
B L_5B29

 

Second disasm:

L_5B12:
PULR R4 ; 5B12 02B4
ADDI #$0040, R2 ; 5B13 02FA 0040
MVO R1, G_0324 ; 5B15 0241 0324
MVO R2, G_0321 ; 5B17 0242 0321
B L_5B29 ; 5B19 0200 000E

So G_ should be changed to $?

I compared the two disasm's and I think I got it.

First disasm:

L_5B12:

PULR R4 ; 5B12 02B4

ADDI #$0040, R2 ; 5B13 02FA 0040

MVO R1, $0324 ; 5B15 0241 0324

MVO R2, $0321 ; 5B17 0242 0321

B L_5B29

 

Second disasm:

L_5B12:

PULR R4 ; 5B12 02B4

ADDI #$0040, R2 ; 5B13 02FA 0040

MVO R1, G_0324 ; 5B15 0241 0324

MVO R2, G_0321 ; 5B17 0242 0321

B L_5B29 ; 5B19 0200 000E

So G_ should be changed to $?

 

 

That looks like you had done the replacement already. Yes, "G_" should be replaced by "$". Actually, the correct way of thinking about it is that G_xxxx (where "xxxx" is any combination of Hexadecimal digits), should be replaced with "$xxxx".

 

I did this with a regular expression:

 

Find: \bG_([\dA-F]+)\b

Replace: \$$1

 

-dZ.

OK, there may be a step you are missing or doing wrong. That's OK, no worries, we'll get this sorted out. I managed to find my copy of World Championship Baseball (did I get the right one this time?). I disassembled it and managed to re-assemble it by substituting all the symbols.

 

The final result is a working ROM that plays the game as expected. So this should be your base code. I'll send it over via PM and you can start making changes to this one. I'll take a first stab at changing the player's colours. :)

 

-dZ.

Good news: I found the score colours! :)

 

There's only one quirk: Since the programmer was already expecting to use Red and Blue, he took a shortcut: he set the left (HOME) score board to Red ($0002), then for the right (VISITOR) score board he just shifted that value one bit to the right ($0002 >> 1), which happens to turn it into the value for Blue ($0001).

 

This means that the score for the visitor team will always be dependent on the color for the home team.

 

However, the biggest problem is that the shift operation is one word long, but a constant assignment is three words long. This means that we cannot inject just a simple value assignment in place and still keep the constant addresses that we replaced when we fixed the symbols.

 

We'll have to patch it! No worries. I'll work on this later today. I'm getting ready for work.

No worries, this is sort of fun. I managed to patch the code, and now you can set up a constant at the top of the source defining the colour scheme for the Home and Visitor teams. This then gets used to set the sprite and score board colours. Still need to set the highlight colour, but it's getting there.

 

-dZ.

Edited by DZ-Jay

Don't know if you can fix this, but when the ball gets thrown back to the pitcher, it goes off the screen and comes back through the other side. The fielders go off screen to return to their positions too. Not a big deal, just kinda weird. You can see it happen by selecting 0 for the players, then it plays itself.

LOL! I just saw that. (By the way, I didn't know you could have the game play itself. Shows you how much I played that game.)

 

It is weird, but I'm afraid that's a bigger change. It seems the game calculates the trajectory based on the direction the fielder is facing. For some reason, it decides that it is closer to throw the ball "around the world" (and wrap around the other side of the screen), than sending it "as the crow flies" directly to the pitcher.

 

Oh, it happens also with the running fielders: they will run up and "around the world" instead of just turning around and walking a few steps back to their positions. It sure looks weird! :lol:

 

-dZ.

I think that's a result of disasm/reasm. That doesn't happen in the real game. Oh well.

 

Oh, really? I didn't know. Hmm... In that case, we'll have to hunt it down and fix it. Sorry about that.

Some. I fixed the weird behaviour. It was caused by some errors in the disassembly; there was a bug in dis1600. I'm working on adding "HOME" and "VSTR" to the scoreboard.

 

I will post an update soon.

 

-dZ.

Edited by DZ-Jay

OK, I just realised that there is not enough space to put "HOME" or "VSTR" on the scoreboard. The score is devised to take up to three digits. I tried moving it in towards the center, but then it gets in the way of the "status area," where it displays "STRIKE" and other status messages. You need at least 10 characters to account for the message "FOUL BALL!," which leaves us with only two characters on each side for the team name.

 

This is what I get when after I moved things around. Notice that the HOME score (left) is left-padded and the VSTR score (right) is right-padded. The two padding spaces overwrote the team names.

 

post-27318-0-38328700-1404728073_thumb.gif

 

The good news is that I found where to tap the code during the initialisation routine. I will post my modified code soon. I think you should be able to take over.

Hi, Dan,

 

Attached find a copy of the updated source file. I performed some clean-up in this source, so you may use it as reference. It not only has all symbols corrected, I also fixed the four bad instructions mangled by the disassembler. It also includes some symbols for the score and the team colours. Just look right below the default symbol table at the top of the file. You'll find something like this:

; ------------------------------------------
; CONFIGURATIONS:
; ------------------------------------------
COLOR_Black         EQU     $0
COLOR_Blue          EQU     $1
COLOR_Red           EQU     $2
COLOR_Tan           EQU     $3                  ; Dirt background colour, so don't use it for teams
COLOR_DarkGreen     EQU     $4                  ; Field background colour, so don't use it for teams
COLOR_Green         EQU     $5
COLOR_Yellow        EQU     $6
COLOR_White         EQU     $7                  ; Chalk background colour, avoid using it for teams

                    ; Colors:
C_TEAM_HOME         EQU     COLOR_Red
C_TEAM_VSTR         EQU     COLOR_Blue

                    ; Score positions
P_SCORE_HOME        QEQU    (.BTAB + $00)       ; Home scoreboard: left
P_SCORE_VSTR        QEQU    (.BTAB + $11)       ; Vstr scoreboard: right

; ------------------------------------------
; INTERESTING SYMBOLS
; ------------------------------------------
SCORE_HOME          EQU     $0165
SCORE_VSTR          EQU     $0166
; ------------------------------------------

At the bottom of the file there's a large block of unused locations, all filled with zeros. That's where I'm adding all the patches. As I mentioned before, you can't just inject code willy-nilly; if the new operations are of a different size than the ones you are replacing, you'll have to patch and pad accordingly. What I've done is I've taken a sub-routine call ("JSR R5, XYZ"), and replaced it with a jump to a patch. At the end of the patch, I make sure to call the original sub-routine and jump back to the original spot.

 

For instance, the following code:

        SDBD                                    ; 5107   0001
        MVII    #$502C, R1                      ; 5108   02B9 002C 0050

        JSR     R5,     X_TIMER_START           ; 510B   0004 0118 0044

L_510E:
        J       L_58B6                          ; 510E   0004 0358 00B6

I replaced it with the following:

        SDBD                                    ; 5107   0001
        MVII    #$502C, R1                      ; 5108   02B9 002C 0050

        ; We're going to tap here to proceed
        ; with our initialisation.
        ; --------------------------------------
        ; JSR     R5,     X_TIMER_START           ; 510B   0004 0118 0044
        JSR     R5,     INIT_PATCH              ; 510B   0004 01DC 01E6

INIT_PATCH.Return:
        ; --------------------------------------

L_510E:
        J       L_58B6                          ; 510E   0004 0358 00B6

At the bottom of the file, I have the following code for INIT_PATCH:

INIT_PATCH  PROC
            PSHR    R5                              ; DDE6   0275
            PSHR    R4                              ; DDE7   0274

            ; Initialise away...!
            ; --------------------------------------

            CALL    PRINT_HUD                       ; DDE8   0004 01DC 01F2

            ; --------------------------------------

            PULR    R4                              ; DDEB   02B4
            PULR    R5                              ; DDEC   02B5

            ; Continue with instruction from
            ; patch point:
            ; --------------------------------------
            JSR     R5,     X_TIMER_START           ; DDED   0004 0118 0044

            B       INIT_PATCH.Return               ; DDF0   0220 8CE3
            ENDP

Anyway, I think you have enough here for you to continue with your ideas. If you have any questions, just ask--and have fun! :)

 

Cheers!

-dZ.

 

wc-bball.asm

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