What's new

Game Boy

aprentice

Moderator
bcrew1375 said:
I've tested it with Tetris and Metroid 2.

Tested it with tetris, no problems here.

In your emu, in which cases are you generating the LCDC interrupt? I just generate on LYC coincidence, was wondering if there were any other situations I would generate this on.


edit: Actually there might be a bug in the code or in another opcodes code when going from 99 to 100 in score. It might have something to do with the carry flag, If i figure it out, i'll get back to you on it.
 
Last edited:

bcrew1375

New member
The high bits in STAT determine whether an interrupt should occur on certain conditions.

Edit: Ah, I've noticed a potential problem. The A register is being altered before the other checks are done. It shouldn't be altered until the end of the instruction, right?
 
Last edited:

glVertex3f

Crap Cracker
Ive bee ntaking a braek form my emu, I have been doing nothing but emulators for the past few months, I would spend ALOT of time every day. just programming.

It got so bad that I would try to sleep and I would wake up in the middle of the night, and cover up my whole body so that I would be "all in" the main function... I laughed myself to sleep...

So, I decided I probably needed a break.. lol
 

smcd

Active member
glVertex3f said:
Ive bee ntaking a braek form my emu, I have been doing nothing but emulators for the past few months, I would spend ALOT of time every day. just programming.

It got so bad that I would try to sleep and I would wake up in the middle of the night, and cover up my whole body so that I would be "all in" the main function... I laughed myself to sleep...

So, I decided I probably needed a break.. lol

You're weird :p

By the way, nice job @ color aprentice. One of these days I might sport a try at the GB... I just need to learn something like DirectDraw first, GDI only is kinda slow.
 

glVertex3f

Crap Cracker
Yeah it was a low point in my life, I think I have recovered and I think I am ready to return to the IDE...

Note: Geek, nut case,, try both! :p

EDIT: Emu question,
I want to make sure I understand interrupts.
Basically, an inturrupt is something that stops the current operation and goes and does something else and returns to where it "interrupted"?

So on a gameboy an inturrupt occurs on a time cycle, when the interrupt occurs you halt the current opcode and do the interupt then return to the opcode?
 
Last edited:

bcrew1375

New member
Interrupts work like this:

1. An event has occured that generates an interrupt.
2. The flag that applies to that interrupt is turned on.
3. If the *IME and the corresponding flag in IE register is turned on, the IME flag is then turned off and a call is made to that interrupt's jump location.

* IME stands for Interrupt Master Enable. This enables or disables all interrupts.

BTW, all you do is disable interrupts and jump to the address, the program should take care of the rest. I'm still working on when the interrupt flags should be reset :plain:.
 

glVertex3f

Crap Cracker
Oh ok, isee.

How long did it take you to get "any" results from your emu? (like a scrambled title screen or something)

I have a feeling mines gonna take a while as I have not even began to implement a timer or even touch the drawing.
 

bcrew1375

New member
I was afraid of the drawing for a long time until I realized how incredibly simple it is :p. I was stumped for a long time because for some reason I simply could not grasp the I/O ports. Once I finished with my Chip8 emu, it suddenly became clear for some reason :p. After I got the I/O ports implemented everything started to flow again. Finally, after getting some things sorted out, I got my first demo to run :happy:.
 

aprentice

Moderator
I never got to see that "first demo" :p My gameboy emulation was very complete before I even got gfx coded. I too was afraid of graphics and had trouble at first, so I spent most of my time working on other parts of the gameboy hardware. By the time I got gfx, the emu was already doing commercial games :p

To this day, my interrupt system is still shabby, and lacks correct implamentation. I still lack all cases where the LCDC interrupt is triggered, which causes some games to act wierd and some to glitch :p

A handful of games are playable now though, but a handful means nothing compared to the emus already released :p
 

zenogais

New member
@bcrew: I would recommend learning Direct3D9 instead of DirectDraw as DirectDraw has been deprecated, and Direct3D allows for far more complex techniques such as vertex/pixel shaders and shading.

Also, I've just had my wisdom teeth taken out yesterday, but I should be back to working on my Gameboy emulator soon. I've made alot of progress since the last source release.
 

bcrew1375

New member
zenogais said:
@bcrew: I would recommend learning Direct3D9 instead of DirectDraw as DirectDraw has been deprecated, and Direct3D allows for far more complex techniques such as vertex/pixel shaders and shading.

Also, I've just had my wisdom teeth taken out yesterday, but I should be back to working on my Gameboy emulator soon. I've made alot of progress since the last source release.

Huh, what brought DirectDraw up all of a sudden? When I was referring to drawing, I meant the interpretation of the Gameboy's graphic data :p.

Edit: BTW, this is unrelated to this thread, but is anyone good at file handling? I'm working on another program where I need to search exceptionally large files (> 4 GB) for certain patterns. The problem is that it is going incredibly slow. I'm pretty sure it's the file reading and not the search algorithm. I'm only able to search like 1 MB per second :/.
 
Last edited:

smcd

Active member
bcrew1375 said:
Huh, what brought DirectDraw up all of a sudden? When I was referring to drawing, I meant the interpretation of the Gameboy's graphic data :p.

Edit: BTW, this is unrelated to this thread, but is anyone good at file handling? I'm working on another program where I need to search exceptionally large files (> 4 GB) for certain patterns. The problem is that it is going incredibly slow. I'm pretty sure it's the file reading and not the search algorithm. I'm only able to search like 1 MB per second :/.

I believe he was talking to me @ DirectDraw, see post #184.
 

aprentice

Moderator
bcrew1375 said:
Edit: BTW, this is unrelated to this thread, but is anyone good at file handling? I'm working on another program where I need to search exceptionally large files (> 4 GB) for certain patterns. The problem is that it is going incredibly slow. I'm pretty sure it's the file reading and not the search algorithm. I'm only able to search like 1 MB per second :/.

Your harddrive is the bottleneck, sorry buddy :p
 

smcd

Active member
I was making a program to search large files and would allocate a buffer, then read a block (for this size i would recommend 4 to 32 MB, not too high because allocation could fail easier), then use memcmp to search for my stuff. if not found, skip along. Since the portion was in memory, searching was a lot faster, but speed came at the expense of memory.
 

zenogais

New member
bcrew1375 said:
If my harddrive is the problem, why can other programs read from it so fast? :p

Of course the hard-drive isn't the major bottleneck. Its really just the algorithm you're using that makes the difference. I ran into this problem when writing a program to calculate the SHA-1 hash of any given file. The basic idea is if the file exceeds X megabytes, where X is a number of your choosing then you'll read the file into memory and process it in Y megabyte chunks. Basically what I did, was if the file was larger than 10 megabytes then I read it into memory from the file in 5 megabyte chunks and processed each chunk through the hash algorithm, then read the next 5 megabyte chunk and so on until I was out of chunks, then I processed the final hash and badda bing badda boom. I can post some source code if you like, but its really quite simple. Of course the chunks weren't always 5 megabytes in size, but thats easy to account for. Just read as much as you can into the 5 megabyte buffer and process it.
 

glVertex3f

Crap Cracker
On the rotate opcodes, do you need to shift the register or just swap the necessary bytes?

I am currently doing it like this, I am just wondering if I am supposed to shift or not.

Code:
void GBcpu::RL(unsigned char &reg)
{
	
    unsigned char bit_7 = (reg & 0x80) ? 1 : 0;
    unsigned char carry = (REG_F & CF_MASK) ? 1 : 0;
	
    if(REG_F & CF_MASK)
        if(!bit_7) REG_F -= CF_MASK;
      
    else 
        if(bit_7) REG_F += CF_MASK;
	
    reg <<= 1;  // < Heres the part in question!
	
    if(reg & 1)
        if(!carry) reg -= 1;
        
    else if(!(reg & 1))
        if(carry) reg += 1;            
	
}
 

Top