What's new

Game Boy

aprentice

Moderator
bcrew1375 said:
Well, I get some kind of result from just about any game(even though they're not always good. :p). I can't tell you if it's the best way. It's just the way I'm doing it.

7/10 games i test run an intro, but like 3/10 get ingame and are playable :\
 

refraction

PCSX2 Coder
ah its a z80 thing, but seen as the GB uses Z80 slightly modified i assumed it was relavant, this is what it says tho.


R is the Refresh register, whose value is increased by the length of every instruction, when they are executed. Only seven of its bits are updated, its MSB (most significant bit) is always zero. This register has normally no practical use for the programmer.


so all in all its a load of crap and ill shut up again ;p
 

refraction

PCSX2 Coder
aprentice said:
havent heard anything usefull from you yet :p

haha well cheers for that, im just trying to get to grips with the concept of the gameboy hardware, ive not even started my emu yet, all ive got is a very simple user interface ;p
 

aprentice

Moderator
Zelda is now fully playable in my emu :p

While optimizing my cpu core, i found a few bugs causing some games to glitch up, and crashing zelda before going in game :p
 

bcrew1375

New member
Nice! Hopefully, I will be there soon :p. I just got the X and Y flip for the sprites implemented. Now Link doesn't split in half on the game select screen :p.

BTW, could we see some screens :bouncy:?
 

aprentice

Moderator
bcrew1375 said:
Nice! Hopefully, I will be there soon :p. I just got the X and Y flip for the sprites implemented. Now Link doesn't split in half on the game select screen :p.

BTW, could we see some screens :bouncy:?

Actually, I need to implament X,Y flipping aswell before i make any screens, once thats done, the game will look flawless :)

I'd like to see screens from your emu too :p
 

retroK

New member
This is not 100% our code - we took over another GBC emu called Pgb added some new features and increased compatibility.
 

aprentice

Moderator
bccrew, how are you handling Sprite Y Flipping? I got X Flip working but my Y Flip code doesnt do anything :\

This is my code:
PHP:
int curr_pos=(160*ypos);
int dest_pos=(160*(y+8));
int diff_pos=(dest_pos-curr_pos);
int draw_pos=dest_pos-(160*(8-(diff_pos/160)));
vreg.memory[(draw_pos)+x+i]=gb_spr_pal[spr_pal][pixel];

Y is Sprite Y Coordinate
X is Sprite X Coordinate
YPos is Y position in the loop, either 8 or 16, depending on sprite.
 

aprentice

Moderator
bcrew1375 said:
To be honest, I'm not even sure if mine works(only in theory). Do you have a program I could test it with :p.

You could msg me the code and i could have a look at it, or you could explain what theory you based it on :p

I thought its top=bottom, top+1=bottom-1, etc etc, but that doesnt seem to work (as the code above tries to do) :\
 

bcrew1375

New member
Basically, I'm getting the pixel data in the reverse order. I have a variable j looping from 0 to the sprite height - 1. I'm taking the sprite data area(0x8000) and multiplying it by (currentSprite * 4). Since each line is 2 bytes. I then add (j * 2), get the data, then add (j * 2) + 1. If the Y-flip bit is on, I'm simply doing (j ^= sprite height - 1). After I get the data, I do another Exclusive OR to get j back to it's old value. Hope that's clear enough.
 

refraction

PCSX2 Coder
bcrew1375 said:
Basically, I'm getting the pixel data in the reverse order. I have a variable j looping from 0 to the sprite height - 1. I'm taking the sprite data area(0x8000) and multiplying it by (currentSprite * 4). Since each line is 2 bytes. I then add (j * 2), get the data, then add (j * 2) + 1. If the Y-flip bit is on, I'm simply doing (j ^= sprite height - 1). After I get the data, I do another Exclusive OR to get j back to it's old value. Hope that's clear enough.


wouldnt it be easier just to load the data in backwards :huh:
 

bcrew1375

New member
Um, that's exactly what I'm doing :p. I'm inverting the loop variable, using it as an index and then inverting it again. I'm only doing that if the Y-flip bit is on though. Of course, i could just have two separate sprite drawing routines, but I'm trying to keep it compact :p.

BTW, what I said earlier about the H and N flags. I know there are instructions that set or reset them, but there seems to be nothing at all that evaluates them. So, what's the point in even worrying about them :huh:? Maybe they're just useless flags that were used in the Z80.
 
Last edited:

refraction

PCSX2 Coder
hmm, i duno, some things seem to look at previous calculations and base their result upon what happened in the last operation.
 

glVertex3f

Crap Cracker
Sorry to "butt in", but I decided to try a GB emu anyway (it sure as heck wont hurt me).

I noticed you saying something about the edianess issue's. I take it the the GB and x86 processors are differet? (High.Low)

So for that I would just swap the bytes around and then write them to registers?

(Im not to sure how to word all of that so sorry if it seems hard to understand)
 

Top