It is currently Fri Dec 15, 2017 12:50 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sun Nov 26, 2017 8:41 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 750
Location: New York, NY
I noticed this issue in several GB emulators, including one that I am attempting to code. The player select screen shakes horizontally and the same thing happens during game play. It seems like every other frame it out of alignment. If anyone has seen this issue before, perhaps you can provide me with a few hints to track this down? Thanks.


Last edited by zeroone on Mon Nov 27, 2017 12:12 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Nov 27, 2017 6:53 am 
Offline

Joined: Sat Aug 28, 2010 9:01 am
Posts: 201
Can you give an example of an emulator (other than yours) which exhibits this behavior?

Looking at the code, from 5AF2 and forward there's some code that seems to be related to camera panning. It later writes to FFAB which in turn is I'm going to go out on a limb and say that your bug is related to how flags are affected by the rr, sra, add or adc instructions.

_________________
Gameboy Genius (Blog) - Gameboy development forum (+wiki and file area)


Top
 Profile  
 
PostPosted: Mon Nov 27, 2017 7:50 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 750
Location: New York, NY
nitro2k01 wrote:
Can you give an example of an emulator (other than yours) which exhibits this behavior?

Looking at the code, from 5AF2 and forward there's some code that seems to be related to camera panning. It later writes to FFAB which in turn is I'm going to go out on a limb and say that your bug is related to how flags are affected by the rr, sra, add or adc instructions.


I saw a similar effect in JavaBoy. It's an old emulator, but it used to be hosted on many web pages. Whatever it is doing wrong, I'm doing the same thing incorrectly.

I reviewed the flags in those instructions and I can't visually see an issue. However, I did notice what appears to be a repeated typo in the Gameboy CPU (LR35902) instruction set table; the carry flag is marked as reset in all the SRA instructions. My emulator is setting the carry flag to the LSB.

If there is a particular test ROM that could vet the instruction flags, I'll gladly run it.

I noticed a similar issue with Street Fighter 2. Both of those are SGB roms. I'm not sure if there is a connection.


Top
 Profile  
 
PostPosted: Mon Nov 27, 2017 8:49 am 
Offline

Joined: Sat May 13, 2017 7:54 pm
Posts: 14
zeroone wrote:
I noticed this issue in several GB emulators, including one that I am attempting to code. The player select screen shakes horizontally and the same thing happens during game play. It seems like every other frame it out of alignment. If anyone has seen this issue before, perhaps you can provide me with a few hints to track this down? Thanks.

What do you mean? There's no player select...


Top
 Profile  
 
PostPosted: Mon Nov 27, 2017 9:13 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 750
Location: New York, NY
SuperWill24 wrote:
What do you mean? There's no player select...


After the title screen, there is a screen where you can select your player (your save game slot). That selection screen shakes horizontally.

In fact, the whole games seems like it is running at half speed. It's almost like it renders the frame correctly and then it re-renders it a second time with the wrong scroll offset.


Top
 Profile  
 
PostPosted: Mon Nov 27, 2017 12:19 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 750
Location: New York, NY
[solved]

The problem was related to LYC. The wiki says that LYC and related registers "can be accessed even during Mode 3, but they have no effect until the end of the current scanline." To postpone the effect of LYC updates, I introduced a cached LYC variable and my buggy code was using the cached value instead of the latest during VBLANK.

On a side note, I suspect that updating LYC actually takes effect immediately since writing to LYC can trigger an LCD STAT interrupt. And, as such, I got rid of the cached version entirely.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 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