glVertex3f said:I finally decided to get back to work on my emu,
A really easy question here (sorry aprentice!)
Since there are no opcodes for drawing.. I assume it is done through interrupts?
So, a certain interrupt will occur every few loops, and you draw the screen when the interrupt occurs?
glVertex3f said:Heh, the reason I deleted my post is that for somereason my picture disapeared...
I figured that a mod took it out because of the rom name and stuff.
But heres my progress.
I have done all the opcodes (I'll probably have to redo them)
I have implemented a rom info Dialog and I am working on a debug dialog.
I am also reading various docs about the LCDC and how it works. I would love to get some actual visual progression.
But other than that Ive been playing around with the tile format.. (the 'A' example in the docs) Havent figured out the nintendo logo yet...![]()
bcrew1375 said:My current progress... Well, I'm still trying to find bugs in the CPU emulation, alot of games have really strange errors. What was the opcode giving you problems, aprentice? Maybe mine is the same one. Anyway, I've been kind of lazy lately, so just trying to kink some bugs out every once in a while. About optimization, I'm favoring readability over speed. There are plenty of fast Gameboy emulators, but I don't think I've seen one with source that is easy on the eyes, at least not to me
.
void z80_SLA_reg8(unsigned char *reg)
{
// Put *reg's old bit 7 data in Carry flag.
if (*reg & 0x80)
regs.F |= FLAG_C_ON;
else
regs.F &= FLAG_C_OFF;
// Shift *reg left once. 0 is shifted in from right.
*reg <<= 1;
// If the result was 0, set flag Z, otherwise reset it.
if (*reg == 0)
regs.F |= FLAG_Z_ON;
else
regs.F &= FLAG_Z_OFF;
// Flags H and N are reset.
regs.F &= (FLAG_Z_ON | FLAG_C_ON);
// Machine cycles used is dependant on opcode.
if (opcode == 0x26)
cycles += 4;
else
cycles += 2;
}
void z80_SRA_reg8(unsigned char *reg)
{
// Put *reg's old bit 0 data in Carry flag.
if (*reg & 0x01)
regs.F |= FLAG_C_ON;
else
regs.F &= FLAG_C_OFF;
// Shift *reg right once. 0 is shifted in from left. If bit 7
// is set, make sure it stays set.
if (*reg & 0x80)
*reg = (*reg >> 1) + 0x80;
else
*reg >>= 1;
// If the result was 0, set flag Z, otherwise reset it.
if (*reg == 0)
regs.F |= FLAG_Z_ON;
else
regs.F &= FLAG_Z_OFF;
// Flags H and N are reset.
regs.F &= (FLAG_Z_ON | FLAG_C_ON);
// Machine cycles used is dependant on opcode.
if (opcode == 0x2E)
cycles += 4;
else
cycles += 2;
}
void z80_SRL_reg8(unsigned char *reg)
{
// Put *reg's old bit 0 data in Carry flag.
if (*reg & 0x01)
regs.F |= FLAG_C_ON;
else
regs.F &= FLAG_C_OFF;
// Shift *reg right once. 0 is shifted in from right.
*reg >>= 1;
// If the result was 0, set flag Z, otherwise reset it.
if (*reg == 0)
regs.F |= FLAG_Z_ON;
else
regs.F &= FLAG_Z_OFF;
// Flags H and N are reset.
regs.F &= (FLAG_Z_ON | FLAG_C_ON);
// Machine cycles used is dependant on opcode.
if (opcode == 0x3E)
cycles += 4;
else
cycles += 2;
}
zenogais said:I was also playing around with some stuff involving the "Observer" pattern in order to pass data between the various components i.e. Video, Sound, and CPU/Memory. I'm just looking forward to trying out some cool new ideas for this project, but first I want to clean it up. 'll get back to you guys when I have a chance to work on it.
bcrew1375 said:Well, I don't know if there is a problem with them or not, but here they are:
Code:void z80_SLA_reg8(unsigned char *reg)
If you can't understand the variables, I'll explain them.
aprentice said:Did you check to make sure the flags are getting reset like they should?
and change if (*reg & 0x80) to if(reg & 0x80) because reg is already pointing at an address