Tekk
Active member
This is a very unfinished project I started a long time ago but recently picked back up - a Game Boy emulator targeting System 6 with the (impractical?) goal of running at a playable speed on an unmodified Mac Plus. Today I managed to get to a milestone: it displays something on the screen.
I also created a OpenGL/ImGui-based UI to use on my modern laptop for enhanced iteration speed and less crashiness:
It is SLOW. I haven't tried it on my real Mac Plus yet, but on Mini vMac set to 1x speed, it takes around 90 seconds to get to the Tetris title screen, with rendering turned off and not even calling WaitNextEvent - i.e. basically just:
With Mini vMac set to "all out" speed and rendering/event handling turned on, it gets there in a few seconds. I knew it would be slow, but I didn't expect it to be this slow. There is still a lot of optimization I can do - for example, rendering directly into a 1bpp bitmap instead of using a one-byte-per-pixel array and copying everything down to 1bpp. My CPU code also has a lot of layers of function calls and I imagine the call/return overhead is actually significant on a machine this slow. I need to figure out how to do real profiling to see where the machine is spending all of its time. I think if I move the rendering into a vblank interrupt handler it might help.
The code is over on github if anyone is interested. I have been working on this pretty consistently recently and want to get it to a point where a few games are playable. I don't care too much about emulation accuracy, I just think this would be a neat program to have on 68k Mac. Even if it turns out to be impractical on a Plus, maybe it would be playable on a 68030?
I think once I implement the memory mapper chips for more complicated games and implement the LCD scroll registers and sprites, it will actually be useful. I will post any significant updates here!
I also created a OpenGL/ImGui-based UI to use on my modern laptop for enhanced iteration speed and less crashiness:
It is SLOW. I haven't tried it on my real Mac Plus yet, but on Mini vMac set to 1x speed, it takes around 90 seconds to get to the Tetris title screen, with rendering turned off and not even calling WaitNextEvent - i.e. basically just:
C:
while (1) {
step emulation;
if (at title screen) {
render output once;
break;
}
}
With Mini vMac set to "all out" speed and rendering/event handling turned on, it gets there in a few seconds. I knew it would be slow, but I didn't expect it to be this slow. There is still a lot of optimization I can do - for example, rendering directly into a 1bpp bitmap instead of using a one-byte-per-pixel array and copying everything down to 1bpp. My CPU code also has a lot of layers of function calls and I imagine the call/return overhead is actually significant on a machine this slow. I need to figure out how to do real profiling to see where the machine is spending all of its time. I think if I move the rendering into a vblank interrupt handler it might help.
The code is over on github if anyone is interested. I have been working on this pretty consistently recently and want to get it to a point where a few games are playable. I don't care too much about emulation accuracy, I just think this would be a neat program to have on 68k Mac. Even if it turns out to be impractical on a Plus, maybe it would be playable on a 68030?
I think once I implement the memory mapper chips for more complicated games and implement the LCD scroll registers and sprites, it will actually be useful. I will post any significant updates here!