r/programminghelp • u/Glenny5 • Jun 22 '15
Screen glitch bug in my java gameboy emulator
I have written a gameboy emulator in java after reading the pandocs for many weeks, and I understand the architecture of the console very well. Regardless of this, my final product has a screen glitch bug which distorts what is on the screen. (See: http://imgur.com/VWeFBQil.png)
The image in the link is my backup ROM of tetris for the DMG playing. The text in the middle is the Nintendo logo I believe, as when the emulator starts it scrolls down from the top. The header glitch above this is what I believe is the tetris game start screen background. There is no sound, joypad interrupts, or sprites implemented as I have spent all my time trying to get the background to display properly. Once that is done I will easily be able to shift over and work on those components of the system.
What I am asking is for anyone to attempt to help me find the issue with this project? I have spent 2 weeks attempting to fix this bug, to no avail. I have wasted too much time trying to find and fix it; it is affecting my home life!
Github repo: https://github.com/glen-mac/jBoy
2
u/LightShadow Jun 22 '15
I looked through your code for about 10 minutes...my guess would be there's an error in your main
executefunction. Those nested switch statements are incredibly dirty; you made a case for each combination of instructions and registers.Because there's so much repetition, over 1000 lines, I think you missed a case or there's a typo.