What's new

Game Boy

bcrew1375

New member
I think you need to look at the header to see how much external RAM the ROM has. Alot have 8K, but some have 32K, I think you need to save all four banks with those. Or, are you already doing that? :p
 

ShizZy

Emulator Developer
Yes, I am, but I don't think that part is working right. Oh well, works for Zelda and other games, good enough for now.

Edit: 9/10 side scrollers tested, the player immediatelly falls through the floor. Any ideas of what could cause that?
 
Last edited:

truth2

New member
That's weird... Can you show a pic of how it happens? (not because it'll help people solve your problem or anything (I'd say to recheck the flags altered by all cpu ops) , but because it sounds extremely funny!)
 

bcrew1375

New member
In Metroid 2, Samus falls through the floor into a cave of garbage.

ShizZie, I agree with truth2. The flags are more than likely the problem. I had a similar problem, but it was a while back, so I don't remember how I solved it :/
 

ShizZy

Emulator Developer
Thank you, I'll look those over once I am done with my new drawing code. I got it working well, but I don't get scrolling. I tried adding the SCY&SCX pixels to the address, then wrapping around when it maxes out, but that just gave me a bunch of gargbage. What is the correct way to handle it?
 

truth2

New member
here's how I do it:

Code:
byte xp=HRAM[SCX]+x;
	byte yp=HRAM[SCY]+y;
(byte is an unsigned char)
i no longer use x and y after these 2 lines of code (use xp and yp instead).
 
Last edited:

ShizZy

Emulator Developer
Thank you. I was thinking too complex. I had to set mine up a little different, but it works well. Y scrolling was easy, but X scrolling was a bitch. (Because I ended up having to write my tile calling code again if the pixels scrolled to a tile before them). It's a little awkeward, but it works :p I also was able to grasp WX and WY, so I could finish my window drawing code. Glad to say my drawing is 100% mine... and both windows and bg work perfectly (sprites work really well too, but still some glitching with mirroring, and some weird inverted colors at times).

Zelda is almost 100% perfect :D
 

truth2

New member
Damn.. I'm too lazy to keep working on mine.. (I need to resolve some serious timing issues, not that I know which)
shizzie, what is not woking 100% for you in Zelda. also, can you show us a pic of metroid falling through the floor?

everyone, can you give some hints and tips regarding common timing errors? thanks!
 
Last edited:

ShizZy

Emulator Developer
Bugs in zelda... Two ships in the beginning. Still some weird bg tile glitching. Here's also the metroid shot. I think the route of all these bugs are flag errors.

Also, got tired of debugging and worked on a very premature GBC support. AFAIK it's some what working, but I'm reading (and or writing) pallette data wrong so my colors are far off. Got some demos working though. I think my HDMA is wrong too :p If anyone knows of any (or has any) MBC5 docs and GBC specific docs please let me know. I think I have a pretty good understanding of how the GBC pallette works, but obviouselly not enough - pan docs didn't give me everything I needed. I'll post a shot when I get the colors a little better.
 

Sagon

New member
I've encountered stange bug, and still don't know what is it. My emu freezes at "Konami" screen in Zen - Intergalactic Ninja (U) or at "Palcom" screen at Zen - Intergalactic Ninja (E). If someone had this bug or know why this happens, please let me know.

2ShizZie:
Thanks for VSync help, in SDL i've used a similar code and wasn't satisfied with the results, but now i'm using DDraw and everything is smooth =) BTW I'm also searching for docs on MBC5 and on GBC, so if you find something interesting please let me know.
 

ShizZy

Emulator Developer
Added MBC2 support :p

@Sagon, I've searched around for MBC5... couldn't find much. I'm basically experimenting, seeing if I can get something working. Most of the MBC's are pretty similiar, so it can't be too difficult. As for GBC, I think everything you need is in the Pan Docs, but they don't go into much detail.
 
Last edited:

ShizZy

Emulator Developer
Added MBC5 :p Not trying to spam :D

Sagon: MBC5 is REALLY easy. It's very similiar to MBC1 through MBC3, except that the rom bank select is 9 bits. Okay, here is what you do. When your emulator writes a value between 0x2000 and 0x2FFF, that is the lower 8 bits of the address. So store that, and then when your emulator writes a value between 0x3000 and 0x3fff, the highest (9th bit) of the rom bank select is the least significant bit of that value. So, just combine the values as your 9 bit rom bank select, and then switch the rom banks (I believe you're supposed to switch the rom banks any time a value is written between 0x2000 and 0x3fff). This is how I did it. I havn't implemented RAM bank switching, but this should be all you need to get some MBC5 stuff working. If that explanation was unclear, here is my quick dirty implementation of it:

Code:
unsigned char mbc_lo,mbc_hi;
unsigned short RomBankRegister;

//.....

if(MBC5) // MBC5
{
	// grab the rom bank select bits
	if(address<0x3000)
		mbc_lo=data;
	else
		mbc_hi=data&BIT7;	

	// assamble the 9bit rom bank select
	RomBankRegister=(mbc_hi<<1)|mbc_lo;

	// switch the rom bank
	memcpy(&memory[0x4000],&rom.Buffer[RomBankRegister*0x4000],0x4000);
}
 

Sagon

New member
Oooh thank you! Now i have MBC5 implemententation, too =)))
BTW: is Zen working for you?

Edit: i finally catched this stupid bug... Zen rom tries to select the high bits of rom bank number, but this rom only 128K, so i should ignore this value. I've constructed the masks for rom sizes and now ANDing it with number of the bank.
 
Last edited:

ShizZy

Emulator Developer
Well... you can faintly make out the character sprite amoungst a bunch of bg rubbish. So I guess you could say Zen goes in game :p But the title screen is all warped like this too. Probably the same bug that causes some issues with Zelda. I still have lots of bugs...

On a separate note, anyone try anything with SGB? Looks interesting, but a little bit quasi (and a little more work) than it's worth. Also, still looking for GBC docs... as well as MBC4 and MBC7.

Edit: weird Sagon, I don't mask for the rom sizes at all, and I still get past the Konami screen just fine. (no freezes at all, just garbage as you can see)
 
Last edited:

Sagon

New member
Hmm strange... anyway it works and that good. MBC7? I haven't heard about this controller, it is GBC specific? What do you know about other controllers like MMM01, MBC4, HuC3, HuC1. I know only one game containing MMM01 - "Momotarou Collection 2 (J) ". On other controllers i haven't found any info and games too.

BTW i coded a tool for rom sorting by memory bank controllers, hope it will be helpful. Instructions: create a folder "Roms" in same folder with the tool, copy all roms in that folder.
 
Last edited:

Sagon

New member
The time has come for the first release of my emulator of Game Boy - "DGB".
What's done:
1) CPU fully implemented, interrupts handling and others.
2) Background, Window, Sprites drawing
3) MBC 1,2,3,5 support
4) Battery load, save
Requires at least DirectX7.
 
Last edited:

ShizZy

Emulator Developer
Excellent work Sagon. Very well debugged. Yes, I believe MBC7 is GBC-specific. As for MBC4, I know very little (I'm assuming it's similiar to mbc5, without officially supporting double speed mode...and maybe some extra limitations?). I think I have a doc on the Hu's though somewhere. Still really need to nail a few bugs before I move on :(

Edit: Why'd you remove the dl? :p
 

ShizZy

Emulator Developer
Tada! :happy: GBC. I have the buggiest emu out of all of us... but I just got plain tired of bug hunting. Still needs a lot of work. :p Nothing commercial runs quite right.

Edit: Most demos work mostly right. But I can't for the life of me find a commercial game that doesn't display the pallettes HORRIBLY wrong. Might be because I'm not emulating HDMA... though everything else is there.
 
Last edited:

ShizZy

Emulator Developer
All in a nights work :D

I'll squeeze in a little more coding, it's only 1... then it'll be bed time. Really need to get back to debugging gb monotone games :p
 
Last edited:

Top