Search found 6 matches

by pdq
Thu Nov 18, 2010 7:53 am
Forum: NESemdev
Topic: emulator performance?
Replies: 18
Views: 7827

I managed to get a speed boost by eliminating all the times it switch out of the CPU core, increment the scanline number, set the next timeout, then resume the CPU core. Note that that is not likely to be a bottleneck for other emulators, but PocketNES has free PPU rasterization from the GBA's grap...
by pdq
Tue Jul 20, 2010 7:22 pm
Forum: NESemdev
Topic: Fixing Nestest failiures
Replies: 22
Views: 11394

Is this just my incompitance in not handling the brk flag correctly? Should the brk flag only be set by the brk instruction and never be set b any other instruction? Yes, in fact you shouldn't even implement the B flag in your P reg (it's always zero). However, when P is pushed onto the stack for B...
by pdq
Tue Jul 20, 2010 5:38 pm
Forum: NESemdev
Topic: Fixing Nestest failiures
Replies: 22
Views: 11394

If you have your nestest log, then you should just post the failing instruction along with the golden one here. It's much more obvious as to exactly what you got wrong. Your carry seems borked because a u8 - u8 is always >= 0. Have you tried this instead? (cmpReg>=toCmp) ? SET_C_FLAG : CLR_C_FLAG;
by pdq
Tue Jul 20, 2010 11:35 am
Forum: NESemdev
Topic: Fixing Nestest failiures
Replies: 22
Views: 11394

It's much easier if you grab the golden nestest log from here and compare your CPU state against it, instruction by instruction.

NOTE: you will need to set your PC to $C000 (ie bypass the reset/power interrupt vectors).

http://wiki.nesdev.com/w/index.php/Emulator_tests
by pdq
Wed Jul 14, 2010 7:29 am
Forum: NESemdev
Topic: A little help with Blargg's nes_instr_test?
Replies: 29
Views: 23441

Check that the PC pushed onto the stack is "PREV_PC+2", and that the P flags pushed onto the stack has the B bit set, but the actual P flags are not modified (B is still zero).

Also, ensure the RTI instruction overwrites the B flag to zero when P is popped from the stack.
by pdq
Fri Jun 25, 2010 6:34 am
Forum: NESemdev
Topic: Debugging the emulated program
Replies: 10
Views: 4239

I'd recommend getting nestest.nes to pass first. It will make sure your CPU is correct. Start with getting the PC/registers to match perfectly, and then get your cycle timings correct. Load the ROM into your emulator's memory and set the 6502 PC to C000. Turn off interrupts. Build a tracelogger to m...