What's new

Game Boy

bcrew1375

New member
I thought that myself, but I tried decrementing after, and it breaks alot of games. I also checked it against three other emulators with good compatibility, they all decrement first.
 

Soccr743

Cubed Member
So they do all decrement the stack pointer before writing to the memory... That is very strange. Thanks for the info on that. I would have never even thought it would turn out that way, ever.

-----Soccr743-----
 

bcrew1375

New member
Hmm, I'm curious about something... aprentice or DarkStalker, could you tell me what cycle timings you are using? Also, when you do conditional instructions, does the amount of cycles change depending on whether the condition is true or not?
 
Last edited:

Soccr743

Cubed Member
"Does the amount of cycles change depending on whether the condition is true or not?"

The processor in the Gameboy has to check if the condition is true. So, I think the cycles are still added on even if the condition proves to be false.

-----Soccr743-----
 
Last edited:

Pontifice

Learning
I think conditional RETs have different cycle length if it is done or not ( writing in the stack or not) and the same for conditional CALLs.

With conditional JRs i'm not sure because Z80 could read the displacement before checking the condition, but why some designer will lost time doing nothing when speed was ( is ) so important at that level.
 
Last edited:

Soccr743

Cubed Member
I checked the Gameboy PDF that I got from a zip in this post, and it says that there are 12 cpu cycles used for CALL nn and also for CALL cc,nn. So infact the cycles stay the same even when a condition check is required.

The same goes for RET and JR as well.

-----Soccr743----
 

aprentice

Moderator
bcrew1375 said:
Hmm, I'm curious about something... aprentice or DarkStalker, could you tell me what cycle timings you are using? Also, when you do conditional instructions, does the amount of cycles change depending on whether the condition is true or not?

the cycles are different if the condition is true, i used all my cycle timing from the pan docs :p
 

Soccr743

Cubed Member
aprentice, would you mind posting what those numbers are. The pdf I have says nothing about it being different if depending on how the condition turns out... :plain:

-----Soccr743-----
 

Soccr743

Cubed Member
This would have been helpful to have when I started out. Now to recode some of the processor that was wrong...

bcrew1375, thanks for posting that :happy:

-----Soccr743-----
 

Dark Stalker

New member
zenogais said:
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.
In case anyone's still interested, I've decided to make a sort of binary-only "technical preview" release. There's absolutely no usability features whatsoever. In other words, no gui, configuration, or speed-syncing (simply because I've not cared to implement any of those yet). If you want to enjoy playing games, this isn't for you. The compatibility has gotten quite good by now, if I may say so myself :p. Still no sound though. As for speed, the emu is currently slow, but it should be fast enough to run a few times faster than the real GB on a modern PC. I mean to remedy this later of course.

The emu doesn't really have a name yet, but it's been dubbed "lameboy" during development.

The win32 version is really ugly btw., since it's a direct, violent, unfitting port of the command-line linux version. To use it, just "drag and drop" a romfile onto the lameboy.exe icon, or associate the gb-filetype with lameboy.exe, or just pass the romfile as a parameter to lameboy.exe (using cmd, run, or a shortcut).

For the linux version you need to have libsdl>=1.2 installed (should be in your distros package-repository). To use it, just give the romfile as a parameter to lameboy (./lameboy <romfile>). The linux version has been compiled with two different versions of g++ for compatibility with libstdc++.so.5.

edit:
Just thought I might mention the keyboard controls:
Return = Start
Right Shift = Select
Key 'D' = Button A
Key 'C' = Button B



Download links:​
 
Last edited:

smcd

Active member
Nice work, Dark Stalker. I tried the windows version and aside from it playing too quickly and having no sound, it ran Castlevania II Belmont's Revenge perfectly :)
 

ShizZy

Emulator Developer
Nice, Dark Stalker.

@bcrew, I was just checking some things and spotted an error in your code. On SLA, you're reseting flags Z and C, when you should be reseting H and N. I'm sure it's just a typo, but just thought I'd point it out if you havn't corrected it yet. (Not that it'd make a whole hell of a difference anyways)

Anyways, a few more things I want to tack on, and I'll post my current cpu source tonight. Timings and interrupts are pretty much nonexistent, but other than that I have a good chunk of coding done.
 

bcrew1375

New member
Not exactly. I'm ANDing the flags register with FLAG_Z_ON and FLAG_C_ON, which are the values 0x80 and 0x10, respectively. So, I'm turning off flags H and N(That actually could make a big difference depending on the game. Thanks for that, though :p. That source is pretty outdated, I've made quite a few changes since then. There's a bug in the LY register updating that I can't seem to fish out. I'm almost certain it has to do with incorrect timing. Could someone run a test on Earthworm Jim for me? I need to know the value of the Program Counter when LY goes from 0 to 1 for the first time. Anyway, here's the updated source. I haven't really checked it... at all. So, it might have some really messed up stuff in it.
 
Last edited:

ShizZy

Emulator Developer
Ahhh...

Okay, here's my current CPU source. Any feedback appreciated. I know my rotates and shifts are really baddly off, I'm not really doing anything to the carry at all. At the moment, I'm just coding to get something to run... then I'll fix things. :p
 

bcrew1375

New member
Shizzie, looks good so far. I saw a few problems, but I'm sure you'll find them.

bcrew1375 said:
Could someone run a test on Earthworm Jim for me? I need to know the value of the Program Counter when LY goes from 0 to 1 for the first time.

Please, anyone? I can't seem to find an emu that let's me do this sort of test and get the data I need.
 

aprentice

Moderator
bcrew1375 said:
Shizzie, looks good so far. I saw a few problems, but I'm sure you'll find them.



Please, anyone? I can't seem to find an emu that let's me do this sort of test and get the data I need.

I'm not sure if this is correct but i guess it goes to 1 at pc 0x3ac3, but before it did that for me, it ran a few frames with the lcdc screen off so ly stayed at 0 for awhile, and ly starts at 144 on boot. hope this helps
 

bcrew1375

New member
Yes, it helped a great deal, thank you very much! With that information, I solved my Earthworm Jim and Super Mario Land 2 problems! :happy: SML2 freezes before the first level at the moment, but that should be nothing now that I solved that problem(Which I'd rather not mention, as it's pretty embarassing :blush:.) Once again, thank you, aprentice. That's been a plague on me for weeks!
 

Top