Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All ThreadsNext Thread**


Subject6502 Instruction set Reply to this message
Posted bybruce_li
Posted on07/06/08 12:29 PM



hi there,
i am at the stage where i have got the addressing modes, memory map code, push & pop up and running on the nes emulator i an programming, i am now moving onto the instruction set, if there is anyone out there who has worked on a nes emulator - is the following function for the ADC instruction correct?
(its pseudo code)

processor_stat_reg &= ~ CARRY_FLAG;

accum += value + (processor_stat_reg & CARRY_FLAG);

if(accum > 255)
{
processor_stat_reg |= CARRY_FLAG | OVERFLOW_FLAG;

}
else if(accum == 0)
{

hw->cpu.processor_stat |= ZERO_FLAG;
}

processor_stat_reg |= (processor_stat_reg & NEGATIVE_FLAG) ? OVERFLOW_FLAG: 0;

any help would greatly be appreciated
thanks