+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  NES DTE Code Etc.
Pages: [1] 2
Author Topic: NES DTE Code Etc.  (Read 1207 times)
Kagemusha
Guest
« on: September 23, 2007, 06:45:07 pm »

Edit: Meh, I've gotten the code to load the two characters, but the text goes a little crazy. I'm doing some side tests to possibly find the problem. I've put in some code to change a character when it's used to another character.

Original Code goes here
CMP #$04
BNE $02
LDA #$10
RTS

While it doesn't break the game, it doesn't do what's intended to do which is a simple character replacement. A trace dump tells me that the game is not recognizing the A5 10 when the $04 is loaded and skipping it like it was told to do. Any reason as to why it would do that?
« Last Edit: September 23, 2007, 08:43:42 pm by Pennywise »
RedComet
Guest
« Reply #1 on: September 23, 2007, 08:59:16 pm »

Care to post a trace? I don't understand what you're saying.
Kagemusha
Guest
« Reply #2 on: September 23, 2007, 09:17:11 pm »

What I was trying to say was check to see if the character $04 is loaded then replace it with the character $10 if it's loaded. If it's not loaded then skip the next two bytes. Anyway here's the trace when I tried to implement it.

LDY $0182 = #$00
LDA ($02),Y @ $BCE3 = #$54
CMP #$04               
BNE $FF93
RTS

The game skips that instruction even though the character $04 was loaded.
RedComet
Guest
« Reply #3 on: September 23, 2007, 09:45:51 pm »

Could you post it with the addresses? BNE $FF93 doesn't tell me much if I don't know where $FF93 is. Tongue
Kagemusha
Guest
« Reply #4 on: September 23, 2007, 09:55:00 pm »

If you mean the ROM Bank offset sure.

$FF88:AC 82 01  LDY $0182 = #$00
$FF8B:B1 02     LDA ($02),Y @ $BCE3 = #$54
$FF8D:C9 04     CMP #$04
$FF8F:D0 02     BNE $FF93
$FF93:60          RTS

or the actual offset in the rom it's 1FF98 
Bongo`
Guest
« Reply #5 on: September 23, 2007, 10:14:36 pm »

Quote from: Pennywise on September 23, 2007, 09:55:00 pm
If you mean the ROM Bank offset sure.

$FF88:AC 82 01  LDY $0182 = #$00
$FF8B:B1 02     LDA ($02),Y @ $BCE3 = #$54
$FF8D:C9 04     CMP #$04
$FF8F:D0 02     BNE $FF93
$FF93:60          RTS

or the actual offset in the rom it's 1FF98 

What are the two bytes at $FF91 and $FF92? I was justwondering since you didn't place the code in the trace data...  :beer:
Disch
Guest
« Reply #6 on: September 24, 2007, 12:52:34 pm »

I'm assuming those 2 bytes would be the LDA #$10 from his original post.

From this tracelog -- it looks as though A is not $04 -- it's $54:

Code:
$FF8B:B1 02     LDA ($02),Y @ $BCE3 = [u][b]#$54[/b][/u]

so that's why your branch is failing.  (Or rather, succeeding)
Kagemusha
Guest
« Reply #7 on: September 24, 2007, 02:16:28 pm »

I suppose I should clear up a few things. Remember last when I was having trouble jumping out to some free space in a ROM bank? Well I found a game that would let me do that with no problems. So I'm in some free space with the original code I overwrote and plus the new code that's supposed to change a Hiragana to something else every time it's loaded, but it's not exactly doing that. I'm trying to get え($04) replaced with に($16), but it doesn't change it to that only to something else. I've actually been playing around with it a bit by typing in the desired hiragana hex value and I've managed to change it to a few other things like a few hiragana and a blank space, but they weren't what I asked for.

Anyway that $54 is the first hirgana loaded for the particular string. The $04 is the next one. I don't think that would make a difference, but then again what do I know.
Disch
Guest
« Reply #8 on: September 24, 2007, 02:57:10 pm »

errr... if you want to change to $16 .. then why are you LDAing #$10 ?

From the code you pasted, you'll be replacing $04 with $10 (assuming A really is the character being loaded).
Kagemusha
Guest
« Reply #9 on: September 24, 2007, 06:52:06 pm »

Quote from: Disch on September 24, 2007, 02:57:10 pm
errr... if you want to change to $16 .. then why are you LDAing #$10 ?

I was messing around with different values. The idea's the same though.

Anyway would anyone be willing to take a look at my DTE hack to see why it's not working properly? My guess is that it's either conflicting with some other code or there's something wrong with my fundamentals or hack. Like I said before I can get the DTE value to load and the script even continues, but there's a bunch of line breaks and a repeating character that are causing problems. At least the text isn't completely broken, just a little crazy.
Disch
Guest
« Reply #10 on: September 24, 2007, 07:08:32 pm »

I'll take a peek -- sure.  Just gimmie a link.
Kagemusha
Guest
« Reply #11 on: September 24, 2007, 07:31:46 pm »

Thanks.

I've uploaded a patch, table, and some locations. The name of the game is Ganbare Goemon 2. It might be possible that this being a Konami game might have something to do with the problems. Also there's an extreme lack of space, but I was able to just find a little space to accomadate the code and table. If more code needs to be added in, the ROM will have to be expanded. I know NES ROM exspansions aren't the easiest thing, but how difficult would it be to expand this game? I'm not sure, but I think that varies depending on the mapper or some such.

Link: I'll ask the big guy over on MIJET to do me a favor

If I forgot anything, let me know. For the most part I just adapted someone else's source code to fit the game. Although I understood most of what was going on, there were a few things I didn't understand.

Edit: I've been messing with the intro text.
« Last Edit: September 24, 2007, 07:55:50 pm by Pennywise »
Disch
Guest
« Reply #12 on: September 24, 2007, 07:42:28 pm »

ack... rapidshare

[quore]
You have reached the download-limit for free-users. Want to download more?
Get your own Premium-account now! Instant download-access! (Or wait 203 minutes)
[/quote]

Can you throw it up on a geoshitties or googlepages account or something?

Quote from: Pennywise on September 24, 2007, 07:31:46 pm
I know NES ROM exspansions aren't the easiest thing, but how difficult would it be to expand this game? I'm not sure, but I think that varies depending on the mapper or some such.

The difficulty of NES ROM expansion is often over-exaggerated.  Konami mappers are actually quite easy to work with... although the early ones have moderately low caps (VRC2 is capped at 256K PRG)

It does take basic understanding of 6502 and NES addressing space -- but if you're comfortable with those things, expanding really isn't all that hard.

** looks to see what mapper this game uses**

023 -- so it's either VRC2 or VRC4 (that mapper includes both  >_<).  It's only got 128K of PRG though -- so you'll be able to expand it to 256K in either case.
KingMike
Guest
« Reply #13 on: September 24, 2007, 08:29:05 pm »

Quote from: Disch on September 24, 2007, 07:42:28 pm

023 -- so it's either VRC2 or VRC4 (that mapper includes both  >_<).  It's only got 128K of PRG though -- so you'll be able to expand it to 256K in either case.

So, I'm confused in that doc. If it's VRC2, I can only have a 4-bit bank number, but if it's VRC4, I can have 5 bits?
Working on a DIFFERENT mapper 23 game. The game seemed to run only when I added 128KB to the beginning of PRG. Checking later, it seems the game writes values $10+ to the PRG-swap registers, even though it has 16 banks (00-0F).
(although in my case, I had enough free space to add DTE+dictionary compression instead of expansion)
Disch
Guest
« Reply #14 on: September 24, 2007, 08:36:42 pm »

Quote from: KingMike on September 24, 2007, 08:29:05 pm
So, I'm confused in that doc. If it's VRC2, I can only have a 4-bit bank number, but if it's VRC4, I can have 5 bits?

Yes.  Although most emus just treat it like it's always VRC4 (always give you 5 bits).  Though I would discourage practice that takes advantage of that.

With mapper 23 the only way to tell the difference would be to look at the regs it writes to.  If it's writing to $x000, $x001, $x002, $x003, then it's VRC2.  If it's writing to $x000, $x004, $x008, $x00C, it's VRC4

Quote
Working on a DIFFERENT mapper 23 game. The game seemed to run only when I added 128KB to the beginning of PRG. Checking later, it seems the game writes values $10+ to the PRG-swap registers, even though it has 16 banks (00-0F).

Can't explain the logic behind that one.  Some games seem to fill the unused or unnecessary bits with garbage in some games.
Pages: [1] 2  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC