News: 11 March 2016 - Forum Rules

Author Topic: Extremely Confused on VRAM Issue  (Read 4518 times)

justin3009

  • Hero Member
  • *****
  • Posts: 1666
  • Welp
    • View Profile
Extremely Confused on VRAM Issue
« on: August 17, 2013, 02:51:25 am »
I went back to X3 and noticed that with the recent Z-Sabre 'Fix', there's an issue that causes a graphical bug due to VRAM being overwritten.  So I took notice of that, moved the Z-Sabre graphics in VRAM from C600 (6300) up to 0B00 and they get stored there, perfectly.

Now the fun issue comes around.  The game still reads from 6300 for whatever reason.  I took a look in BSNES and decided to see if there's a breakpoint somewhere that reads from 6300.. nope.  There's NOTHING reading from there yet the graphics are loading from there.  I'd say it's the Sprite Assembly but that doesn't make sense considering one of the graphics used is tile #35 (Which is reading from 6300..)  So even editing the Sprite Assembly wouldn't fix it.

I've traced the code forwards and backwards and thought maybe there's a single value that's being used to dictate which selection of VRAM to use, much like the Main Menu does, but nope.  I haven't come across anything like that.

What the heck would cause this?  This is the LAST thing I need before I can fully mess around with VRAM however I want but it's proving next to impossible to fix!
« Last Edit: August 17, 2013, 01:28:01 pm by justin3009 »
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

assassin

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • My Barren Webpage
Re: Extremely Confused on VRAM Issue
« Reply #1 on: August 17, 2013, 11:11:05 am »
does BSNES catch DMA transfers in its breakpoints?  i've never used its debugger (or any version beyond some ancient one, as my computers are too slow).

MathOnNapkins

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 650
  • Who ya gonna call
    • View Profile
    • Arc-Nova - Rohmackin' and Chiptunin'
Re: Extremely Confused on VRAM Issue
« Reply #2 on: August 17, 2013, 01:51:14 pm »
It does not log DMA transfers the way that Geiger's does, for example. However, you can set read / write breakpoints on vram in BSNES at which point it will break in the middle of the DMA transfer (continuing to "step into" I believe will remain in the dma transfer until all bytes have been written or read, then the S-CPU will resume stepping). Keep in mind I use a relatively old version of the BSNES debugger (v0.67 so the available features and dynamics might have changed).

justin3009

  • Hero Member
  • *****
  • Posts: 1666
  • Welp
    • View Profile
Re: Extremely Confused on VRAM Issue
« Reply #3 on: August 17, 2013, 07:03:52 pm »
 It's exactly what I used.  I've tried both but it seems it's forcefully loading 6300  yet it can't be read nor is it written to anymore when the Z-Sabre  is used,  which is what confuses me.
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

LostTemplar

  • Hero Member
  • *****
  • Posts: 910
    • View Profile
    • au-ro-ra.net
Re: Extremely Confused on VRAM Issue
« Reply #4 on: August 18, 2013, 04:01:15 am »
I can't say for certain but it's probably the case that no breakpoints are triggered if the PPU itself reads from that address. However, if it displays the wrong tiles there has to be an error in the OAM - there's nothing else that influences what tiles are displayed as sprites (well there's the base address for the sprite tiles).

Though I'm not sure I understand your problem correctly - you mean you moved the graphics to another place but it's still displaying from the old location? You say you now use 0x0b00 - how did you change the tile numbers in the OAM to reflect this? If the sprite base is set up at 0x6000 you have to change that one, too. Or is it actually not displayed as a sprite?

justin3009

  • Hero Member
  • *****
  • Posts: 1666
  • Welp
    • View Profile
Re: Extremely Confused on VRAM Issue
« Reply #5 on: August 18, 2013, 11:18:13 am »
 It's displayed as a sprite but if I'm remembering correctly, it only lets you use 0-FF  as sprite tile values. Since  the graphics are at 0B00 now instead of 6300,  can't really reflect that.  It's a strange issue
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7414
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Extremely Confused on VRAM Issue
« Reply #6 on: August 19, 2013, 10:01:51 am »
Isn't one of the PPU registers used to set which PPU bank (8KB) is used for sprite tiles, just as for the tiles for each of the BG layers?
"My watch says 30 chickens" Google, 2018

justin3009

  • Hero Member
  • *****
  • Posts: 1666
  • Welp
    • View Profile
Re: Extremely Confused on VRAM Issue
« Reply #7 on: August 19, 2013, 12:10:55 pm »
 It's possible though I'm not 100% sure. I know there's something in the menu that can let you load/store graphics anywhere in VRAM with a single byte and something to dictate which RAM area to use.  It's just in-game I'm really unsure how it fully handles it since I can't seem to trace everything down.

Edit: I figured it out.. sort of.  I went through some other code and decided to test that 'single byte' VRAM indicator bit.  Strangely enough, setting data to store at $18 would tell in VRAM where to write the graphics.  Though this is REALLY weird considering there's already code to do so, but this $18 value seems to write graphics/read them from the correct location.  Not.. really sure why.  But I took a test, modified some code and have it storing a value of 20 to $18.  It stores the Z-Sabre graphics JUST above the PC life icons and such.  Fixes the graphics bug and such.  But the issue with this is that it's FORCED to stick between 6300 and about and around 6450.  I can't make it read beyond or before these two areas.  It's REALLY frustrating.
« Last Edit: August 19, 2013, 03:12:08 pm by justin3009 »
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'