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

Author Topic: HDMA Fun!  (Read 3990 times)

justin3009

  • Hero Member
  • *****
  • Posts: 1611
  • Welp
    • View Profile
HDMA Fun!
« on: February 06, 2013, 09:33:27 pm »
I'm actually thinking that this may not even be possible to do unless I do some funky stuff, but here's the dilemma.

- I'm attempting to make the menu look like this.  (Obviously with the proper shading, cut that out for simplicity sake).  The boxes are EASILY setup, no issue at all there.

Now the issue is the HDMA with the spacing between each word.

Tales of Phantasia has a nifty little thing where if you set part of the HDMA value to 01, it'll load a black bar across the screen so you can SEE where it's putting the data.  But then I realized, it loads ALL across the screen.  Meaning, every single thing gets affected where it's at which thus screws up every little part of that menu layout.  Is there ANYWAY to prevent it from borking up everything?
« Last Edit: February 06, 2013, 09:47:56 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.'

furrykef

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: HDMA Fun!
« Reply #1 on: February 06, 2013, 09:56:35 pm »
I'm a little confused as to what the problem you're having actually is...

justin3009

  • Hero Member
  • *****
  • Posts: 1611
  • Welp
    • View Profile
Re: HDMA Fun!
« Reply #2 on: February 06, 2013, 10:29:52 pm »
- Forgot to post this.

The HDMA is basically setup on the left but then the outcome on the right... yeah.  Since it covers a part of the whole screen, it screws up text that SHOULDN'T have it.  I'm not sure it there's anyway to get around that.
'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: 906
    • View Profile
    • au-ro-ra.net
Re: HDMA Fun!
« Reply #3 on: February 07, 2013, 12:15:19 am »
Unless you're able to move either the text on the left or on the right to another background layer I'm afraid no. HDMA is made to be applied to whole vertical rows (because it's triggered each horizontal blanking period).

justin3009

  • Hero Member
  • *****
  • Posts: 1611
  • Welp
    • View Profile
Re: HDMA Fun!
« Reply #4 on: February 07, 2013, 12:21:53 am »
I have no clue why I didn't even think of that.  Moving the text to another background layer is extremely simple on this.  Welp, time to get cracking!

Edit: Can HDMA affect more than one layer?  It seems the Status screen has separate HDMA or something of the sort going on for Layers 1 and Layer 3.
« Last Edit: February 08, 2013, 07:55:28 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.'

LostTemplar

  • Hero Member
  • *****
  • Posts: 906
    • View Profile
    • au-ro-ra.net
Re: HDMA Fun!
« Reply #5 on: February 09, 2013, 07:02:25 am »
HDMA isn't applied in terms of layers, but in terms of registers. If I recall correctly, depending on the settings in $43x0 it either writes to a single register (e.g. $2111) or to two/four neighboring registers. The size of the write (one byte or two bytes) also depends on $43x0. You should probably read up on it.

Anyway, this means that it is possible that one HDMA channel affects more than one background layer. Two or more channels are obviously able to do this, too. If you have Geiger's Snes9x debugger you can turn on HDMA tracing and get quite a good understanding of what the game uses HDMA for.

justin3009

  • Hero Member
  • *****
  • Posts: 1611
  • Welp
    • View Profile
Re: HDMA Fun!
« Reply #6 on: February 09, 2013, 12:07:46 pm »
That's how I figured out where the HDMA was coming from and modified it was from that HDMA trace.  I wasn't sure if it was just limited to a certain thing or not, which could open up a world of possibilites again for the main menu.

Edit: Found an easier way on the main menu but it doesn't work so well on the others.. I had it drawing the boxes on Layer 1 and then clearing everything, worked out perfectly fine.  But every other menu seems to.. well.. just kinda blow up and NOT draw the boxes at all and I can't for the life of me figure out why.

Edit 2: The boxes end up being drawn with a horribly wrong palette and location for god knows what reason.  Quite strange and interesting.  Looks like I may have to re-do my routine completely to see if I can make it draw on layer 1 again.
« Last Edit: February 10, 2013, 01:07:48 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.'

Bregalad

  • Hero Member
  • *****
  • Posts: 2636
    • View Profile
Re: HDMA Fun!
« Reply #7 on: February 10, 2013, 02:23:20 pm »
Tales of Phantasia uses mode 0 for it's menu, which means each of the 4 BGs have a separate palette.

Palettes 0-7 (colours 0-31) are used for BG1
Palettes 8-15 (colours 32-63) are used for BG2
Palettes 16-23 (colours 64-95) are used for BG3
Palettes 24-31 (colours 96-127) are used for BG4

justin3009

  • Hero Member
  • *****
  • Posts: 1611
  • Welp
    • View Profile
Re: HDMA Fun!
« Reply #8 on: February 10, 2013, 07:46:51 pm »
 They actually have a working palette for the menu on each section,  tested and it does work.  Just something with the code I had was horrifically screwing up somewhere.

 It's kinda sloppy anyhow so I may just try to redo it.

Edit: I've reverted back slightly and I still have this issue.  I have no idea what the heck would cause this nor why.  It seems like it's just pushing it suddenly for no reason.

- This is how it should appear and does usually.

Enter status menu, skills menu and go to your skill selection, etc..

- This occurs.  It's position will flop anywhere depending on where Layer 1 was previously in the original screen (But the coordinates are not even near the same).  Anything on Layer 3 gets completely ignored by that and doesn't screw up.  Just Layer 1/2 do.

Edit: Well, I went to look at the GBA one and there is another method I could do even though it's a bit whacked out.  The GBA's menu text are SPRITES.  Using Sprites for the text would actually make it much easier to customize and put anywhere with whatever color, and that would eliminate the need for any kind of HDMA on screen which would allow me to put all the text back onto Layer 3 without any issues A LONG with the boxes properly working.
« Last Edit: February 11, 2013, 02:35:58 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.'

Bregalad

  • Hero Member
  • *****
  • Posts: 2636
    • View Profile
Re: HDMA Fun!
« Reply #9 on: February 11, 2013, 04:51:50 pm »
It appears to be just a wrong scroll value. Do you use HDMA to set the scroll value of this particular BG in the skills menu ?
If so, then it change the value of the scroll, and when you return it's not set to 0 again...

Ideally scrolling should be reseted at the end of each VBlank but I don't know how TOP handles this.

The SNES have much less sprites than the GBA. Both have 128 sprites, but the SNES is limited to square sizes (8x8, 16x16, 32x32 or 64x64) and to 32 sprites and 34 "tiles" (which is a bigger sprite converted to a 8x8 sprite) per line.
If you had each letter a different sprite you'd run out of sprites quickly.

justin3009

  • Hero Member
  • *****
  • Posts: 1611
  • Welp
    • View Profile
Re: HDMA Fun!
« Reply #10 on: February 11, 2013, 06:03:49 pm »
For Layer 1, no, not at all.  Layer's 1 and 2 don't use HDMA at all in the main menu.  It's used in the Status Screen/Skills menu though for Cless listing his skills, not sure why it'd screw up the menu AFTERWARDS though.

I'm not entirely sure where the value is coming from.  It seems like it just.. stays there.

If I went the GBA method, I'd have to have the sprites be words per sprite.  TOP Handles it with 16x16 being it's default '1x1' data.  You can expand that however needed.

Edit:
Code: [Select]
$C2/89D9 A9 B8       LDA #$B8                A:0101 X:0AA0 Y:2550 P:envMxdizC
$C2/89DB 8D F3 12    STA $12F3  [$00:12F3]   A:01B8 X:0AA0 Y:2550 P:eNvMxdizC
$C2/89DE A9 20       LDA #$20                A:01B8 X:0AA0 Y:2550 P:eNvMxdizC
$C2/89E0 8D F9 12    STA $12F9  [$00:12F9]   A:0120 X:0AA0 Y:2550 P:envMxdizC

Went through some of the Status Menu data.  Not exactly sure what this is for, but NOP'd it and no more issues in the main menu and nothing is wrong with the status menu.  I'm assuming it was a left over from the 'Skill' box that was for Cless in status menu before I removed it.  But Layer 1/2 now both work without any awkward scrolling.

Edit: Easier method.  Just stored 00 to 8D F3 12 and 8D F9 12 on each new menu load.  Doesn't cause any issues, fixes the scrolling bugs too.
« Last Edit: February 11, 2013, 07:33:07 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.'