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

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Dec 03, 2017 1:46 pm 
Offline

Joined: Wed Jun 15, 2016 11:49 am
Posts: 65
Hi all,

I've got another graphical glitch that I can't seem to find the resolution to.

On Kirby's Dreamland, for one frame while loading, before the main intro draws, I get this screen:
Image

Here are the states of relevent registers when the drawing occurs:

LCDC: 231(E7) STAT: 192 SCY: 8 SCX: 0 WY: 144 WX: 160 LY: 0 BGP: 228(E4)

At this point LCDC just got set to E7 from 67, so it just got turned from off to on.
Based on these registers, the drawing definitely seems like it should be occuring, but no other emulator seems to output this frame and I'm not really sure why. Based on the register values, the window is not in the way (even though it's on) and the x/y scrolls are normal except shifted 8 pixels up. Gambatte agrees that the screen gets turned on there, but still doesn't draw anything. What am I missing?

Thanks for any insights as always.


Last edited by Alyosha_TAS on Mon Dec 04, 2017 12:37 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sun Dec 03, 2017 4:15 pm 
Offline

Joined: Sun Jan 26, 2014 9:31 am
Posts: 267
SY shouldn't be 8 for the intro screen. That seems to be the crux of your problem there. It's never set to 8 on my end, at least not when rendering the screen matters. It looks like a bug somewhere outside of your emulated LCD. It could be a CPU bug or a memory bug.

I'd suggest finding out where exactly SY gets 8 written into it, and see if that code is triggered on other emulators. It should be easy enough to edit your memory management code and insert a print statement when the CPU writes 8 to SY; just output the PC and see what code you're running, then compare it with another emulator. If Gambatte or BGB never run that code, or they run it with a different value of SY, you'll know that's the problem (or rather a sign of the underlying problem).

This is probably something that can't be determined by just looking at register states. You'll likely have to do some debugging. Like I said, I recommend starting out where SY = 8 on your emulator and working your way back.


Top
 Profile  
 
PostPosted: Sun Dec 03, 2017 4:47 pm 
Offline

Joined: Sun Jan 26, 2014 9:31 am
Posts: 267
Oops, my bad, didn't read your post thoroughly enough. I thought the screen was permanently stuck like that, not just 1 single frame.

I believe if that's the case, you're not implementing the behavior discussed here -> viewtopic.php?f=20&t=16284

Basically, when you turn on the LCD, there's a 1 frame delay. During that time, nothing gets rendered to the screen (should be blank/white). A lot of games use this extra time to do some final setup before the transition is complete. Definitely investigate this first before debugging anything else.


Top
 Profile  
 
PostPosted: Sun Dec 03, 2017 4:47 pm 
Offline

Joined: Wed Jun 15, 2016 11:49 am
Posts: 65
That screen is from before the intro screen. It pops up a few frames after the boot rom is complete (frame 333 on my emulator.)

Gambatte also has SY getting set to 8 at this time, in 2 seperate places:

Code:
018E:  3E 08     LD   A,#08h         A:e4 B:00 C:00 D:de E:42 F:80 H:ff L:23 LY:91 SP:fffe  Cy:531140
0190:  E0 42     LDH  (#FF42h),A     A:08 B:00 C:00 D:de E:42 F:80 H:ff L:23 LY:91 SP:fffe  Cy:531148

Code:
1E04:  FA 55 D0  LD   A,(#D055h)     A:00 B:00 C:a0 D:00 E:04 F:c0 H:ff L:8c LY:93 SP:ffee  Cy:598444
1E07:  E0 42     LDH  (#FF42h),A     A:08 B:00 C:a0 D:00 E:04 F:c0 H:ff L:8c LY:93 SP:ffee  Cy:598460


So, I don't think that's it.

Here is what code is getting executed:

Code:
1E6D:  CB FF     SET  7,A                A:67 F:80 B:00 C:03 D:01 E:03 H:D3 L:E2 SP:FFFA Cy:25077372 LY:0 ZnhciE
1E6F:  E0 8A     LDH  (#FF8Ah),A         A:E7 F:80 B:00 C:03 D:01 E:03 H:D3 L:E2 SP:FFFA Cy:25077380 LY:0 ZnhciE
1E71:  E0 40     LDH  (#FF40h),A         A:E7 F:80 B:00 C:03 D:01 E:03 H:D3 L:E2 SP:FFFA Cy:25077392 LY:0 ZnhciE


Gambatte also runs this code, it's the first point where the screen turns on, and SY is 8 at this time.

Maybe a better question is, what does your emulator do when this first call $1E71 happens?

I'm currently passing all of Blargg's tests except for OAM Bug and all of Gekkio's tests except for intr_2_mode0_timing_sprites , so if I do have a bug somewhere it's something that none of those tests are picking up.


EDIT: WAH! Ninja'd! Thank you! That information is exactly what I needed!


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: No registered users and 3 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