What's new

Game Boy

smcd

Active member
Opfer said:
Also, portability to other systems is easier, there is even a way to easily port .NET applications to Linux, since it doesn't depend on the OS's functions anymore.

Not really.

Opfer said:
So .NET is the language of choice for me.
Technically it's a platform ;)
 

HyperHacker

Raving Lunatic
Opfer said:
I'm using the .NET Framework because it's far easier to use than native Win32 (especially since I don't have a forms designer for Win32).
XN Resource Editor is... well, it's the only one I've found that works. <_<
 

Opfer

New member
Okay, I released a new version of my emulator (check my website for more information).

The new version checks if managed DirectX is installed when being run, so that the ones of you that experience crashes should be able to get a useful error message (and if it isn't useful to you, post it somewhere, I will likely be able to tell you what it's about).

Also, I have now splitted the emulator completely into the managed GUI and the unmanaged DLL. There is also a SDK available on my site (on the forum), so that you can write your own GUI if you'd like to.

It also includes a few bugfixes (see changelog for more details).
 

smcd

Active member
The Mono project for linux is coming along rather nicely, though it still lacks support for some critical things such as Forms. Plus, it isn't compatible for .Net 2.0 as far as I know. I did some class projects using it a couple years ago. I was just being picky, but nice work and an interesting idea to make it separated like you did so if people don't like the interface they can make their own.
 

Opfer

New member
Thanks and yea, that's the idea behind it.

To be honest, a friend of mine is already developing a GUI using Visual Basic and OpenGL. It's coming along pretty nice, was a bit of a mess in the beginning, because Visual Basic really doesn't like pointers that much ;), but right now, it already has input support and from what I hear from my friend, the graphics are working really nice, too. He's still having trouble with syncing but taking that not even 12 hours went into it so far, it's advancing nicely. It'll probably be put on the site, once it's done, too, so people can pick and choose and aren't required to download the .NET Framework and DirectX.

And now that you say it, I think it was mono that he was talking about, but him being a Windows hater he proabably overstated the capabilities of mono running .NET applications.

But, to another topic, I didn't get any feedback so far, I'd be really interested in how you like it, and what you'd change, so I can improve it.

Thanks
 

cloudy

New member
hey all,

i coded a chip8 emu awhile ago, and am thinking of starting a gameboy emu now. I remember how the chip8 worked but cant seem to use that knowledge to start on the gameboy. My main problem is with the opcodes. For the chip8 you read in 2 bytes of data and combined them to form the opcode. You then converted this opcode to its hex equivelent so you knew what do with it as the opcodes for the chip8 were hex values. Looking at the gameboy opcodes they seem to be of form "ADD x,y" which is simple enough to understand but how do you derive these opcodes from the memory?

Thanks and sorry for the n00b question.
 

ShizZy

Emulator Developer
Each opcode is stored as a single byte in memory, the cpu doc should say what it is. If it has an immediate value, then that value follows the 8bit opcode as either one or two bytes.
 

huarifaifa

New member
New Gameboy emulator!

Hello guys,

This is my first post. I have been developing a Gameboy emulator (mono only) in Java in the last 6 weeks. I'm quite proud of the performance of the emulator (for Java, that's it). Right now, most of the CPU time is spent drawing the frame buffer on screen (roughtly 75-80% of the total CPU usage when the window size is 320x288).

The latest 2 weeks were spent testing and debugging the emulator with 1228 games. Most of them seem to be working fine, there are just 1 or 2 (as far I know) that are unplayable. I got bored of testing and re-testing so many games, so now I'd like to release it for the very first time in this forum, hoping to get some feedback :)

For those willing to test it, just type:

java -jar gameboy.jar <romfile.gb>

in the command prompt. It should work fine with Java 1.5 in Windows and Linux (It should also work with Java 1.4, but I haven't tested it).

In the mean time, I'd like to ask :) if someone can help me with the following issues:

- Information about HuC1, HuC3 and what is the "Rumble" thing of MBC5 (HuC1 seems to be almost identical to MBC1)

- LCD interlacing. How does it work?

- Sound. I still hear some glitches here and there. Also, anyone has more information about "zombie" channels? (ie. for Prehistorik Man and Little Endian in Big City).

- Muhammad Ali's Boxing. Anyone had problems with the graphics of this game?

- Star Trek - 25th Anniversary. My emulator gets locked. Any ideas?

- Mortal Kombat 3. The game gets locked randomly when the IRQ handler is called when LY=152 (the game gets locked waiting for LY=154). After a lot of tweaking, MK3 seems to work fine most of the time, but the race condition is still be there.

- Sonic 3D Blast 5. This is a pirate game as far I know. I don't emulate it because it has CPU instructions in the cartridge header! (ie. the cartridge type in the header is 0xEA, the opcode of a CPU instruction!). How do I determine the MBC type, ROM/RAM size, etc. in this case?


That's all for now :)

Thanks in advance!
 

bcrew1375

New member
cloudy said:
hey all,

i coded a chip8 emu awhile ago, and am thinking of starting a gameboy emu now. I remember how the chip8 worked but cant seem to use that knowledge to start on the gameboy. My main problem is with the opcodes. For the chip8 you read in 2 bytes of data and combined them to form the opcode. You then converted this opcode to its hex equivelent so you knew what do with it as the opcodes for the chip8 were hex values. Looking at the gameboy opcodes they seem to be of form "ADD x,y" which is simple enough to understand but how do you derive these opcodes from the memory?

Thanks and sorry for the n00b question.

The attached file has alot of information on the Gameboy along with the instructions and their opcodes. The opcodes are near the bottom.

huarifaifa: I'm not sure about the other games, but I tried Star Trek. I'm not sure if it's the same one. It doesn't have 25th Anniversary in the name. Anyway, it works flawlessly.
 

huarifaifa

New member
Thank you Lordus and bcrew1375 for testing my (unnamed) emulator :)

Today I fixed Muhammad Ali and Star-Trek (I wasn't raising the H-Blank IRQ under certain conditions, and I had to change the timing of the Transfer and H-Blank to avoid timing/race-conditions with Star-Trek).

I'm now quite lost about how to correctly handle the OAM, H-Blank, and LY=LYC interrupts. Currently what works best for me is:

Code:
// raise OAM interrupt if LY=LYC IRQ is(was) not raised in this line
if ((stat & 0x20) != 0 && (stat & 0x44) != 0x44)
    interrupt.raise(LCD)

// the same thing for H-Blank interrupt
if ((stat & 0x08) != 0 && (stat & 0x44) != 0x44)
    interrupt.raise(LCD)

does that makes any sense?

Also, when the CPU writes the LYC register, when should it raise the LY=LYC interrupt? If I don't raise it, Muhammad Ali fails, and if I raise it, Prehistorik Man fails. What I do now is:

Code:
void setLYC(int value)
{
    lyc = value
    if ((lcdc & 0x80) != 0) {
        if (ly == lyc) {
            if ((stat & 0x04) == 0) {   // do not raise it "again" for the same line.
                stat |= 0x04;
                if ((stat & 0x40) != 0)
                    interrupt.raise(LCD)
            }
        }
        else {
            stat &= 0xFB;
        }
    }
}

is that right?

PS: Edited to add Code tags and fix a bug in the sample code :)
 
Last edited:

HyperHacker

Raving Lunatic
Code tags, man!
Code:
void setLYC(int value)
{
  lyc = value
  if ((lcdc & 0x80) != 0) {
   if (ly == lyc) {
     if ((stat & 0x04) == 0) {   // do not raise it "again" for the same line.
         stat |= 0x04;
         if ((stat & 0x40) != 0)
            interrupt.raise(LCD)
      }
   }
   else {
    stat &= 0xFB;
   }
 }
}
 

huarifaifa

New member
bcrew1375 said:
Well, HyperHacker is right, but I can't find anything wrong with it aside from that.

The "patch" is the "if" line:

Code:
  // avoid raising the interrupt multiple times in the same line
  if ((stat & 0x04) == 0) {
    ...
  }

I haven't seen that in other emulators (VisualBoyAdvance, gnuboy, etc), so I'm wondering if that is right (or if I'm just hiding the real bug with this "patch").
 

huarifaifa

New member
Since this thread is quite quiet lately, I'd like to report the progress of my emulator :)

I have managed to emulate Zerd no Densetsu's scrolling text in the menu perfectly! I had to tweak the HALT instruction, for those who might be interested.

Now all the games I have (1228+) are running without any known problems, including Muhammad Ali, A-Force, Star Trek 25th Anniversary, King of Fighters 95, Mortal Kombat 3, Stunt Race FX, Prehistorik Man, Railway, Sonic 3D Blast 5, Double Dragon 3, Mr. Do!, Thunderbirds, Ant Soldiers, Ghost 'N Goblins, Amazing Penguin, Alfred Chicken, Cliffhanger, Out of Gas, NHL Hockey 95/96, Undoukai, Killer Instinct, F-1 Pole Position, Magic Maze, Total Carnage, Super Scrabble, Altered Space, and Jeep Jamboree!

I'm now porting the Java code to C++. Hopefully I will have a working emulator running in my Palm in a few weeks :)

Cheers.
 

huarifaifa

New member
I took me 2 days to fully port the Java code to C++ using mingw32 (g++) and the SDL library! I get 1250+ fps on my P4 1.40 GHz machine playing Kirby's Dream Land 2 :)
 

huarifaifa

New member
Since this thread is so damn quiet lately :) I'll make some noise.

I finished the port of my GameBoy emulator to the Palm OS platform. It runs quite well given the limited resources of my Tungsten T2 (ARM 144 MHz, 32MB RAM). I'm able to play Super Mario Land 2, Donkey Kong Land 3, etc. at 320x288 30 fps with audio at 22050 Hz.

Now, I will start working in the GUI and hopefully release it in a few weeks.
 

Top