News: 11 March 2016 - Forum Rules, Mobile Version
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia

Author Topic: Metal Slader text refuses to jump *SOLVED*  (Read 446 times)

Her-Saki

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
Metal Slader text refuses to jump *SOLVED*
« on: October 05, 2017, 03:58:22 pm »
As the title says, this game (Metal Slader Glory) can't get a forced jump without display garbage, get sick of bad opcodes or enter in a loop of jumps forever. I have tried almost every possible jump routine for another custom overflow routine but none seems to work.
The problem is to jump. I have set a counter for help to detect overflow text, set the condition's math, and is proved to do it well (example, set 2B to 00 as result of condition make text to reset on X axis without display halved MTE). That two parts doesn't affect rest of the game at all. The "better" result is interrupting read of index $0029 for $0012 and make a JSR to the condition then set result to jump again to "jump" routine. However after 2 or 3 lines the game start to display garbage text.



Code: [Select]
A:80 X:00 Y:00 S:5B P:nvUbdiZc     $91CE:20 C0 9F  JSR $9FC0 ; jump to custom routine
A:80 X:00 Y:00 S:59 P:nvUbdiZc       $9FC0:A9 1B     LDA #$1B ; checks
A:1B X:00 Y:00 S:59 P:nvUbdizc       $9FC2:E5 2B     SBC $002B = #$1A
A:00 X:00 Y:00 S:59 P:nvUbdiZC       $9FC4:E5 9A     SBC $009A = #$06
A:FA X:00 Y:00 S:59 P:NvUbdizc       $9FC6:30 05     BMI $9FCD ;branch to "jump" routine
A:FA X:00 Y:00 S:59 P:NvUbdizc       $9FCD:20 62 92  JSR $9262
A:FA X:00 Y:00 S:57 P:NvUbdizc         $9262:20 2C 95  JSR $952C
A:FA X:00 Y:00 S:55 P:NvUbdizc           $952C:A9 00     LDA #$00
A:00 X:00 Y:00 S:55 P:nvUbdiZc           $952E:85 2D     STA $002D = #$00
A:00 X:00 Y:00 S:55 P:nvUbdiZc           $9530:A5 30     LDA $0030 = #$06
A:06 X:00 Y:00 S:55 P:nvUbdizc           $9532:85 2B     STA $002B = #$1A
A:06 X:00 Y:00 S:55 P:nvUbdizc           $9534:E6 33     INC $0033 = #$02 ;in fact trying to increase $0033 alone make
A:06 X:00 Y:00 S:55 P:nvUbdizc           $9536:A5 33     LDA $0033 = #$03  text jump... without palette and stopping at
A:03 X:00 Y:00 S:55 P:nvUbdizc           $9538:C5 26     CMP $0026 = #$04  4th line. That's another weird aspect, #0033
A:03 X:00 Y:00 S:55 P:NvUbdizc           $953A:D0 20     BNE $955C         reachs 03 then stop and there seems to be no
A:03 X:00 Y:00 S:55 P:NvUbdizc           $955C:A5 38     LDA $0038 = #$00  byte that regulates Y axis whatsoever.
A:00 X:00 Y:00 S:55 P:nvUbdiZc           $955E:D0 08     BNE $9568
A:00 X:00 Y:00 S:55 P:nvUbdiZc           $9560:20 71 95  JSR $9571

Even setting it directly to read a 02 from real text makes an infinite loop of jumps. Where could be the proper jump? Hoping save another 3 days thinking in the problem, thanks in advance.
« Last Edit: October 08, 2017, 04:31:58 pm by Her-Saki »
"Ask me about ROMs and your suffering will be legendary"

Pennywise

  • Hero Member
  • *****
  • Posts: 2162
  • I'm curious
    • View Profile
    • Yojimbo's Translations
Re: Metal Slader text refuses to jump
« Reply #1 on: October 05, 2017, 07:41:04 pm »
This game requires no code hacks for where the text is stored. It uses 24-byte pointers, which determines both the offset and bank in which the is located. Just expand the ROM and relocate text as needed.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6258
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Metal Slader text refuses to jump
« Reply #2 on: October 05, 2017, 11:01:50 pm »
You don't say what your RAM addresses do, so your code is hard to follow.
But why are you doing two SBCs (with no SEC. You usually need a SEC to get a proper subtraction.) and then a BMI.
I have trouble remember which one is used for which but aren't usually BCC and BCS better for branching checks?
Quote
Sir Howard Stringer, chief executive of Sony, on Christmas sales of the PS3:
"It's a little fortuitous that the Wii is running out of hardware."

Her-Saki

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
Re: Metal Slader text refuses to jump
« Reply #3 on: October 05, 2017, 11:30:33 pm »
About address I think I can make a list of the most importants:
9FC0 is the custom overflow routine: checks everytime game read text searching overflow
009A is the counter for MTE extension
9262 is a jump routine already in the game
0033 increases Y axis, but stops at 03 position then magically continue going down

About SECs I found it late, it was fixed but again, condition is OK, the problem is the result.
And BMI was chosen for math operation; if negative, goto custom routine.

After digging a bit more I see that problem is not jump anymore (at least with this jump option implemented), but 0029 index reading at weird order due to some accumulator reset made to 0013 when reachs 03 position at text...

This is growing more and more troublesome, i'm afraid that this doesn't apply to a simple option to jump what I thought at beggining but a way to stops the problems it brings. Probably Pennywise it's right but game is already at maximum size. Can be mappers expanded beyond it's capacity?

October 08, 2017, 04:25:42 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
... woah, now it works. It took 12 days but it works. After studying a little more I found that mapper just doesn't have a maximum but the PRG or CHR rom itself, so added to the overflow code PRG was expanded without compromising any routine.
Well, altough this was solved there's still a lot of work todo, so back to work again. [Edited 'cause I just pressed Enter unintentionally].
« Last Edit: October 08, 2017, 04:31:17 pm by Her-Saki »
"Ask me about ROMs and your suffering will be legendary"