What's new

Game Boy

aprentice

Moderator
refraction said:
now your trying to confuse me :p right so i need a routine incrementing that and checking it for overflow got it.

thats the DIV register that increments right?

TIMA increments in 1/4 the time of DIV if TAC is set to 4096 (which is 1/4 the number of times DIV updates)

that sound right to you?

thisd be so much easier if you could contact me on msn :p

you dont need to check for overflow with div's, it can wrap around by itself. tima is a different story though, i posted my div function above, very easy to follow code :p

to figure out how many cycles to incrament TIMA its 4194304 / TAC frequency.
 

Dark Stalker

New member
I just started setting all the modes (presumably at the right time), and now many games just work.
I also fixed my Zelda-problem. Zelda sets wx to 6, and in gamboy logic 6-7=0 apparently. As opposed to my result of 255, which might not be quite natural to most people anyway though :p


edit: Just forgot to satisfy my boasting needs :p:

zelda.png
ffl3.png


mario2.png
wario1.png


donkey1.png
mm4.png
 
Last edited:

bcrew1375

New member
As I said before, you probably just blew me out of the water. I still can't get SML2 to run. :p You must be a great programmer to get it done so quickly. Congrats!
 

aprentice

Moderator
super mario land 2 wont go in game for me either, i have no idea why...
also, does wave race run for you dark stalker?
 

hap

New member
Good to see so many people working on GB emulation, maybe I'll join in later... much later, stubborn NES emu ;-)
 

Dark Stalker

New member
Wave Race obviously won't run, since I haven't bothered to implement mbc2 support yet.
Super mario land 2 even works in my old versions, from before I fixed my lcd-mode timing. So I guess the issue you have with it lies elsewhere.

Out of the mbc1 games I've tested (which aren't really that many), these seems to have issues:
Kirby's dreamland 2
Final Fantasy Legend II and III

Kirby2 just shows a black screen. Final Fantasy Legend II goes to unknown opcodes in the rom after a few seconds, regardless of if I start the intro or not. Final Fantasy Legend III works, but is a bit unstable in that it goes to unknown opcodes every few minutes on a random basis.
 

Shpongled

News Junkie
Does anyone happen to know a really old black-and-white gameboy game which you could pick either a rabbit or a penguin or a walrus and you had to roll balls across a table so the other player couldn't block it?

Thanks :)
 

aprentice

Moderator
Dark Stalker said:
Wave Race obviously won't run, since I haven't bothered to implement mbc2 support yet.
Super mario land 2 even works in my old versions, from before I fixed my lcd-mode timing. So I guess the issue you have with it lies elsewhere.

Out of the mbc1 games I've tested (which aren't really that many), these seems to have issues:
Kirby's dreamland 2
Final Fantasy Legend II and III

Kirby2 just shows a black screen. Final Fantasy Legend II goes to unknown opcodes in the rom after a few seconds, regardless of if I start the intro or not. Final Fantasy Legend III works, but is a bit unstable in that it goes to unknown opcodes every few minutes on a random basis.

how is the ram page handling in your emulator done?
i'm still not 100% sure mine is correct, wouldn't be surprised if this is whats breaking mario land 2
 

Dark Stalker

New member
This is roughly how I handle mbc1 ram for now:
If the rom writes to 0x4000-0x5FFF and ram is enabled, and the rom is in rambank-mode, I make the rom write the rambank number (only caring about the 2 ls bits of course) to a variable (and set the bool rambankchange=1).

Then the next time the rom tries to read or write to ram (and rambankchange is true), I swap rambanks right before giving it access. Meaning I basically copy the contents of the active ram to the previous rambank, and then copy the contents of the new rambank to active ram.

(This array represents my rambanks: "Uint8 rambankdata[4][0x2000];" which I copy back and forth from/to.)

I hope this is what you wanted to know.
 

zenogais

New member
I have a request to those who have working emus, it would be cool if you guys would make occassional releases (executable releases) just so those of use who don't have working emu's yet can check out your progress.
 
Last edited:

Dark Stalker

New member
Heh :p

waverace.png
waverace1.png



edit: update :saint:,
I just toyed around a bit with mbc3, and it seems to work, except my rtc currently follows actual time while the rest of my emu is based on clock cycles. I'll probably reimplement it according to clock cycles later.

:p:p:p
pokeblue1.png
warioland2.png

(no pun intended)


final(?) edit:
I just went ahead and threw in support for mbc5 too when I was at it (what? what is it? no, I'm not spamming :p):

dw2-2.png



As for releases, I really don't think I want to do any before I've at least made a half-decent user interface (currently command-line only). I'll probably GPL it too, so I don't want my code to be too ugly. It's nice that someone is interested though. How is your emu doing Zenogais? Previous posts from you indicate you're writing a whole OS around your emulator :p
I guess that means you've done all those things I haven't even started to think about yet :blush: and probably more at that.
 
Last edited:

aprentice

Moderator
Dark Stalker said:
This is roughly how I handle mbc1 ram for now:
If the rom writes to 0x4000-0x5FFF and ram is enabled, and the rom is in rambank-mode, I make the rom write the rambank number (only caring about the 2 ls bits of course) to a variable (and set the bool rambankchange=1).

Then the next time the rom tries to read or write to ram (and rambankchange is true), I swap rambanks right before giving it access. Meaning I basically copy the contents of the active ram to the previous rambank, and then copy the contents of the new rambank to active ram.

(This array represents my rambanks: "Uint8 rambankdata[4][0x2000];" which I copy back and forth from/to.)

I hope this is what you wanted to know.

opps, i wasnt thinking right when i wrote that, i meant sram not wram :blushing:

Setting up sram pages is pretty odd, since some roms have less sram than a a full bank (eg. 2kb instead of 8kb).

basically right now i set up the 2kb one like
mem.rampage[0]=(mem.sram+(0*0x800));
and the 8kb one like:
mem.rampage[0]=(mem.sram+(0*0x2000));
 

Dark Stalker

New member
What is this sram you speak of? :p I don't really handle sram very much at all. I've been going around the problem for now by just backing up all rambanks. (Actually my docs haven't mentioned a whole lot on sram). I just treat all my mbc1 ram as 4 arrays of 0x2000 bytes. For mbc5 I just use 16 arrays. I'll be looking at doing sram correctly later. :blush:

I tried to point out that I don't perform the bank swap until the game actually wants to access the ram (this goes for rom-swapping too). Not doing this breaks things for me (probably because the rom is changing modes meanwhile or something). This might be obvious for all I know though. :p
 

zenogais

New member
I suppose we can let the cat out of the bag...

Refraction and I have been working on NeoGameboy now for about 2-3 weeks, and we've already gotten quite alot done. I've been mostly working on getting the GUI up and running so we have the frontend set up and all we have to do is code the backend. Refraction has been working on CPU/Timing emulation for a while now, and I'm slotted to go over it tommorow and basically "refactor" it in order to make the code more managable.

Check out some screenies of what we've got HERE

P.S. Don't try to keep up on source releases, they change 2-3 times a day :p
 

aprentice

Moderator
Dark Stalker said:
What is this sram you speak of? :p I don't really handle sram very much at all. I've been going around the problem for now by just backing up all rambanks. (Actually my docs haven't mentioned a whole lot on sram). I just treat all my mbc1 ram as 4 arrays of 0x2000 bytes. For mbc5 I just use 16 arrays. I'll be looking at doing sram correctly later. :blush:

I tried to point out that I don't perform the bank swap until the game actually wants to access the ram (this goes for rom-swapping too). Not doing this breaks things for me (probably because the rom is changing modes meanwhile or something). This might be obvious for all I know though. :p

are you physically moving the memory or controlling a pointer? I really hope your not physically moving the memory :p

srams external memory, located in the cartridge :p
 

refraction

PCSX2 Coder
zenogais said:
I suppose we can let the cat out of the bag...

Refraction and I have been working on NeoGameboy now for about 2-3 weeks, and we've already gotten quite alot done. I've been mostly working on getting the GUI up and running so we have the frontend set up and all we have to do is code the backend. Refraction has been working on CPU/Timing emulation for a while now, and I'm slotted to go over it tommorow and basically "refactor" it in order to make the code more managable.

Check out some screenies of what we've got HERE

P.S. Don't try to keep up on source releases, they change 2-3 times a day :p

gah party pooper :p yes its true, hence all the timing questions, hopefully we will get something showing within the next week or so, even if its just minimal emulation
 

Dark Stalker

New member
aprentice said:
are you physically moving the memory or controlling a pointer? I really hope your not physically moving the memory :p

srams external memory, located in the cartridge :p
I've only been talking about external memory all the time, so I guess we've got some kind of misunderstanding going. At least I thought all rambanks were located in the cartridge (no, I don't mean the GameBoy's internal work ram at C000h-DFFFh). I've been lazy about it for now, so I'm actually copying the memory in and out of address space and haven't seen very much of an overhead anyway (according to my profiler, my swapping function uses 0.01 % cputime :p).
 
Last edited:

bcrew1375

New member
RAM banks are extra memory for the cartridge. The SRAM is Save or Shadow RAM. It is what the game's save data is recorded on, aka the battery backup. Anyway, I've been controlling RAM banks pretty much the same as Dark Stalker, yet I still have problems with SML2. :plain:
 

zenogais

New member
Progress update on NeoGameboy - CPU refactoring is about 25% complete, I'm trying to make the code a lot more readable and maintainable, despite that being somewhat of an oxymoron, it seems, when talking about the gameboy. The GUI is pretty much finished, though I'd like to add a ROM browser once ROM loading and emulating is taken care of. Nice to see your incredible progress Dark Stalker, seems like you really know your stuff :)
 

Dark Stalker

New member
I've mostly been bug-fixing lately and I've worked a lot on timing. Regression testing was hell, but I think I've finally just about hit the spot (or pretty close to it, since new surprises have been appearing all the time up until now). During this I came across a few things that may be relevant to some of your problems (bcrew/aprentice).

For super mario land 2 to work, you need to allow execution of vblank-interrupts when the display is disabled.

For waverace to work, you need to do lyc-compare during vblank (note that if you don't take some precations, this will break other games).
 

Top