+  RHDN Forum Archive
|-+  Romhacking
| |-+  General Romhacking
| | |-+  I created a tiny bug
Pages: [1] 2
Author Topic: I created a tiny bug  (Read 1 times)
Kagemusha
Guest
« on: November 27, 2008, 05:32:20 pm »



The game has an eight character limit that I've successfully increased to nine with no problems except for this one tiny issue. If I want to exit out of that screen, this happens.



The ninth character doesn't go away like the rest of the text. I've got a trace file with the whole thing, but I'm not sure what to look for or what exactly is causing this minor inconvenience.

Note- I'm not sure if this information is relevant to the problem.

I might also mention that this text (the team names, Sanfrecce etc.) is also written to $604E so it can be called up again as it has to do with the save function
« Last Edit: November 27, 2008, 05:37:26 pm by Pennywise »
RedComet
Guest
« Reply #1 on: November 27, 2008, 05:48:39 pm »

You're gonna want to find the routine that is responsible for either clearing the string or drawing the Continue string. Some games will clear X number of tiles in the tilemap to account for the max number of characters displayable and THEN draw the new string. Others will draw the new string and then pad the remaining X-N (where X is the max number of tiles and N the lenght of the string) tiles.

My advice would be to start looking into when the tilemap is written for the Continue string and see when that routine is called and if the tilemap is altered any between the time  "Sanfrecce" is on screen and when "Continue" appears.

Hope that helps. Smiley
Kagemusha
Guest
« Reply #2 on: December 15, 2008, 12:20:15 am »

Thank you sir. I was able to fix the problem and now I have run into one more that has me perplexed yet again.



The game won't display more than eight tiles at a time for the title screen. I've been looking over the code and trying to figure out what to do, but I still haven't figured it out yet. The title screen's all set to go too as I've relocated the graphic data and altered two control codes that determine the length and width of the graphic thingy.

Can anyone help me out?

Thanks
KingMike
Guest
« Reply #3 on: December 15, 2008, 12:36:11 am »

J-LEAGUE appears to be stored as sprites, thus the NES hardware is limiting it to 8 tiles wide.
So, you'd otherwise have to move it to the background layer, and be forced to one of the BG palettes.
(the alternate is a flickering logo, but that would probably be even more work for a not-very-pretty result.
Kagemusha
Guest
« Reply #4 on: December 15, 2008, 12:44:00 pm »

Geh, I don't know how to do that and this game probably isn't worth the effort I'm putting into it. The quick solution for me is just to put J. League with the game 8X16 font in there now.
RedComet
Guest
« Reply #5 on: December 15, 2008, 01:41:55 pm »

I'd get someone creative to throw together a nice 8 tile wide "J-League" using the current palette for you. Smiley
Kagemusha
Guest
« Reply #6 on: December 15, 2008, 02:29:09 pm »

I took care of it. I used that same 8X16 font, but now it's blue.
Black_Phantom
Guest
« Reply #7 on: December 15, 2008, 02:31:03 pm »



^A blue background like that?
Kagemusha
Guest
« Reply #8 on: January 05, 2009, 04:25:14 pm »

I've got a few issues with J. League again and they're pointer related, I guess.

This game has got a multitude of pointer systems. It has normal pointers and it has non-standard pointer systems (At least for me). I'm having a bit of trouble with the non-standard. Some of the text pointers aren't stored in RAM at all. Instead they use an LDA $?Huh and all the strings for this stuff is fixed length. The problem is that the original string length was 8, but I changed it to 9 and the game reads every new string at 8 (I hope that sounds right). I've figured it out with another part of the game as it used a table of sorts to determine where the new strings start, but it appears to me that's not the case here. I'm kind of stumped at the moment.

Here's some slightly commented code that might or might not reveal something.

Code:
;I guess the Y coordinate for the string
A463:A9 2B     LDA #$2B
A465:8D 06 20  STA $2006 = #$22
;The X one
A468:A9 22     LDA #$22
A46A:8D 06 20  STA $2006 = #$22
A46D:A0 00     LDY #$00
;It's loading that string
A46F:BD E0 F9  LDA $F9E0,X @ $F9E0 = #$21
A472:8D 07 20  STA $2007 = #$00
A475:E8        INX
A476:C8        INY
;this is the one determines how many characters are read or something. I don't know the technical term for it. Maybe loop.
A477:C0 09     CPY #$09
A479:D0 F4     BNE $A46F
A47B:AD 13 00  LDA $0013 = #$0A
A47E:0A        ASL
A47F:0A        ASL
A480:0A        ASL
A481:AA        TAX
;The Y for the second one
A482:A9 2B     LDA #$2B
A484:8D 06 20  STA $2006 = #$22
;The X
A487:A9 36     LDA #$36
A489:8D 06 20  STA $2006 = #$22
A48C:A0 00     LDY #$00
A48E:BD E0 F9  LDA $F9E0,X @ $F9E0 = #$21
A491:8D 07 20  STA $2007 = #$00
A494:E8        INX
A495:C8        INY
A496:C0 09     CPY #$09
A498:D0 F4     BNE $A48E
A49A:60        RTS

Basically the game loads two strings from the relative place (Two different ones, just same group) on the screen at the same time.

Any help would be appreciated. Thanks
RedComet
Guest
« Reply #9 on: January 05, 2009, 04:30:20 pm »

I'll look at this more later when I get a chance, but right now there's one thing that stands out at me:

Code:
;I guess the Y coordinate for the string
A463:A9 2B     LDA #$2B
A465:8D 06 20  STA $2006 = #$22
;The X one
A468:A9 22     LDA #$22
A46A:8D 06 20  STA $2006 = #$22

I think you're misunderstanding how $2006 works. It simply specifies where in the PPU to stick the data written to $2007 at. In other words, these 4 instructions are just specifying where in the tilemap to begin drawing the string at.

EDIT: Did the game originally store strings as 8 one byte characters plus 1 one byte end control code, or were strings just stored one after the other with no control codes between them? Also, create a trace log of this chunk of code in FCEUXD. It looks like you just copied the above from the debugger window and it's throwing the values of certain variables  (like register X at $A48E) off.
Kagemusha
Guest
« Reply #10 on: January 05, 2009, 04:39:59 pm »

Quote
I think you're misunderstanding how $2006 works. It simply specifies where in the PPU to stick the data written to $2007 at. In other words, these 4 instructions are just specifying where in the tilemap to begin drawing the string at.

I suppose I don't completely understand what all this stuff does, but I know enough to do what I want to do. In this case I just wanted to reposition the strings on screen and I did that.

I believe it stores all the text in the game one after the other with no control codes.

Ah, yes I copied that from debugger, I was just too lazy to get a trace log, but I'll do so in a minute.
Disch
Guest
« Reply #11 on: January 05, 2009, 04:48:13 pm »

Code:
A47B:AD 13 00  LDA $0013 = #$0A
A47E:0A        ASL
A47F:0A        ASL
A480:0A        ASL
A481:AA        TAX

$0013 is the index to the string it's loading.  ASL multiplies that by 2, so 3 ASLs means it's being multiplied by 8.  In effect, string*8 is being put in X, which is later used to index the string data.  This implies 8 characters between starting points in the string.

To correct this you need to multiply by 9, which you can do by doing 8+1:

Code:
LDA $13  ; get index
ASL A    ; x2
ASL A    ; x4
ASL A    ; x8
ADC $13  ; x8 + 1
TAX


EDIT:

err... wait... crap...  am I even close to addressing your problem?  For whatever reason I didn't actually read what your problem was, I just assumed it was that and responded.  *reads your post again*

EDIT 2:

yeah... yeah... I think I got it right...  yeah...    :laugh:
Kagemusha
Guest
« Reply #12 on: January 05, 2009, 11:10:01 pm »

Thanks, I think that should do it. I'll try it out tomorrow. I've still got a few hacks left and some issues that I haven't figured out yet. So I'll be back once I try out a few things.
KingMike
Guest
« Reply #13 on: January 05, 2009, 11:41:12 pm »

Quote from: Pennywise on January 05, 2009, 04:39:59 pm
Quote
I think you're misunderstanding how $2006 works. It simply specifies where in the PPU to stick the data written to $2007 at. In other words, these 4 instructions are just specifying where in the tilemap to begin drawing the string at.

I suppose I don't completely understand what all this stuff does, but I know enough to do what I want to do. In this case I just wanted to reposition the strings on screen and I did that.

I believe it stores all the text in the game one after the other with no control codes.

Ah, yes I copied that from debugger, I was just too lazy to get a trace log, but I'll do so in a minute.

Writing to $2006 sets the tilemap address. You have to write twice because the address is 14 bits, but the NES can only write 8 bits at a time. The first write sets the high 6 bits (AFAIK, the highest 2 bits of this write do nothing), the second write sets the low 8 bits.

(a step beyond this, but $2005 is also factored into this. $2005 is the scroll register, also 2 writes. One for horizontal and one for vertical (I don't recall which order). I believe game routines usually read $2002 (PPU status) once to clear the register, and usually update $2005 afterwards to avoid screen jerking)
Kagemusha
Guest
« Reply #14 on: January 17, 2009, 02:37:55 pm »

This is something that has stumped me. What I did was increase the character limit from 8 to 9 and 2 rows to 1. Now it highlights anything in the ninth character and I'm not sure why.



This is a trace dump of relevant code. Come to think of it, I don't think I ever looked it over completely.

Code:
$8E34:A9 00     LDA #$00               
$8E36:8D 19 00  STA $0019 = #$06     
$8E39:AE 19 00  LDX $0019 = #$00           
$8E3C:BD 97 60  LDA $6097,X @ $6097 = #$00
$8E3F:0A        ASL                       
$8E40:AA        TAX           
;Pointer table stuff           
$8E41:BD F7 8E  LDA $8EF7,X @ $8EF7 = #$0F
$8E44:8D 34 60  STA $6034 = #$89           
$8E47:BD F8 8E  LDA $8EF8,X @ $8EF8 = #8F
$8E4A:8D 35 60  STA $6035 = #$98           
$8E4D:AD 19 00  LDA $0019 = #$00         
$8E50:0A        ASL                       
$8E51:AA        TAX 
;This one has to do with text positioning or something                     
$8E52:BD DF 8E  LDA $8EDF,X @ $8EDF = #$84
$8E55:8D 32 60  STA $6032 = #$6F           
$8E58:BD E0 8E  LDA $8EE0,X @ $8EE0 = #$20
$8E5B:8D 33 60  STA $6033 = #$20           
[b]$8E5E:A9 01     LDA #$01[/b]                   
$8E60:8D 2F 60  STA $602F = #$00         
[b]$8E63:A9 09     LDA #$09[/b]                   
$8E65:8D 30 60  STA $6030 = #$10           
$8E68:A9 00     LDA #$00                   
$8E6A:8D 31 60  STA $6031 = #$07           
$8E6D:A9 01     LDA #$01                   
$8E6F:8D 2E 60  STA $602E = #$00           
$8E72:20 EA A8  JSR $A8EA 
;Seems like it's just LDA'ing that stuff above and writing it to RAM                
$A8EA:AD 34 60  LDA $6034 = #$0F           
$A8ED:8D 22 00  STA $0022 = #$25         
$A8F0:AD 35 60  LDA $6035 = #$8F         
$A8F3:8D 23 00  STA $0023 = #$91           
$A8F6:AD 33 60  LDA $6033 = #$20           
$A8F9:8D 06 20  STA $2006 = #$71         
$A8FC:AD 32 60  LDA $6032 = #$84           
$A8FF:8D 06 20  STA $2006 = #$71           
$A902:AE 31 60  LDX $6031 = #$00         
$A905:AD 30 60  LDA $6030 = #$09           
$A908:C9 08     CMP #$08                   
$A90A:F0 0A     BEQ $A916                 
$A90C:C9 10     CMP #$10                   
$A90E:F0 0C     BEQ $A91C                 
$A910:BD 2A AA  LDA $AA2A,X @ $AA2A = #$00
$A913:4C 1F A9  JMP $A91F                 
$A91F:A8        TAY                     
$A920:AE 30 60  LDX $6030 = #$09           
$A923:B1 22     LDA ($22),Y @ $8F0F = #$01
$A925:8D 07 20  STA $2007 = #$00           
$A928:C8        INY                       
$A929:CA        DEX                       
$A92A:D0 F7     BNE $A923                 
$A923:B1 22     LDA ($22),Y @ $8F10 = #$28
$A925:8D 07 20  STA $2007 = #$00           
$A928:C8        INY                       
$A929:CA        DEX                       
$A92A:D0 F7     BNE $A923       

I bolded the code I touched. One of things I've noticed about this game is that most of the character limits are written to $6030.
« Last Edit: January 18, 2009, 05:55:34 pm by Pennywise »
Pages: [1] 2  


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