It is currently Mon Oct 16, 2017 3:20 pm

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Jun 21, 2016 3:00 pm 
Offline

Joined: Tue Jun 21, 2016 2:43 pm
Posts: 13
I've been coding a SNES emulator for a few weeks, and ended with some problems related to the Offset-per-Tile mode. The only doc I found that explains how it works was Anomie registers doc. I made a implementation pretty much like it was show on the pseudocode. The first weird thing I noticed is that anomie says on the doc that the Horizontal Offset from BG3 is supposed to replace the Horizontal Offset of the current BG1/2 background, but this way the name "Trigger" on the Chrono Trigger intro gets stuck at the left side of the screen, because the HOfs value from BG3 table is always zero, but it works perfectly if I use the HOfs of the current background.

My biggest doubt through, is related to the in-game menu on Chrono Trigger. This image shows the issue:
Image
On the left image, I have offset per tile enabled, the icons are on the correct positions, but the texts aren't. With offset per tile disabled, what happens is the exact opposite. The icons get messed up, but the texts are on their correct positions. After some investigation, I figured that the game uses HDMA to change the VScroll registers from BG1 and BG3 mid-frame, and this is what places the texts on their correct positions. But at the same time, this also messes up the icons. When the offset-per-tile mode is enabled, the VScroll register on BG1 is ignored, this way the icons remain on their correct position, but the texts are no longer affected by the reg changes on HDMA, and the text is forced to have this one-tile gap.

So what I would like to ask, is that if anyone knows how CT does this effect. It doesn't seem to do any mode changes mid-scanline, so it is probably something related to the offset-per-tile mode, maybe it someway can use the VScroll register even with it enabled.


Top
 Profile  
 
PostPosted: Tue Jun 21, 2016 3:31 pm 
Offline

Joined: Mon Nov 10, 2008 3:09 pm
Posts: 429
gdkchan wrote:
I've been coding a SNES emulator for a few weeks, and ended with some problems related to the Offset-per-Tile mode. The only doc I found that explains how it works was Anomie registers doc. I made a implementation pretty much like it was show on the pseudocode. The first weird thing I noticed is that anomie says on the doc that the Horizontal Offset from BG3 is supposed to replace the Horizontal Offset of the current BG1/2 background, but this way the name "Trigger" on the Chrono Trigger intro gets stuck at the left side of the screen, because the HOfs value from BG3 table is always zero, but it works perfectly if I use the HOfs of the current background.


It sounds like you aren't handling the enable bits correctly. Each entry in the BG3 offset table only applies to BG1 if bit 0x2000 of the entry is set, and only applies to BG2 if bit 0x4000 is set. If the respective bit is zero, then that column in that layer uses the regular scroll register instead.


Top
 Profile  
 
PostPosted: Tue Jun 21, 2016 5:15 pm 
Offline

Joined: Tue Jun 21, 2016 2:43 pm
Posts: 13
AWJ wrote:
gdkchan wrote:
I've been coding a SNES emulator for a few weeks, and ended with some problems related to the Offset-per-Tile mode. The only doc I found that explains how it works was Anomie registers doc. I made a implementation pretty much like it was show on the pseudocode. The first weird thing I noticed is that anomie says on the doc that the Horizontal Offset from BG3 is supposed to replace the Horizontal Offset of the current BG1/2 background, but this way the name "Trigger" on the Chrono Trigger intro gets stuck at the left side of the screen, because the HOfs value from BG3 table is always zero, but it works perfectly if I use the HOfs of the current background.


It sounds like you aren't handling the enable bits correctly. Each entry in the BG3 offset table only applies to BG1 if bit 0x2000 of the entry is set, and only applies to BG2 if bit 0x4000 is set. If the respective bit is zero, then that column in that layer uses the regular scroll register instead.

This was exactly my problem! I was testing the enable bits correctly, but I forgot to reset the value of my Y Position variable with the ScanLine + VScrollReg when the flag was cleared, so it was using the old value again. Fixed that now and the menu looks good!
Image

I'm really thankful to you for poiting me into the right direction. Also this is the first forum that was actually able to help me, so thanks again.

It's ok if I post more questions that I may have on this thread too?


Top
 Profile  
 
PostPosted: Tue Jun 21, 2016 6:53 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
gdkchan wrote:
It's ok if I post more questions that I may have on this thread too?

If they're about offset-per-tile, yes. If not, please open separate threads for separate subjects. I know that might be inconvenient, but the information here is public and beneficial to the dev world. It's very hard to follow a big long thread covering several subjects.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: nocash, Troglodyte and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group