What's new

Nes

aprentice

Moderator
hap said:
yes, though a xor 0x10 is simpler, oh, and remember to do an if addr&3==0.

yes, start rendering on line 1, just feed the render function with (line-1). vblank still ends at scanline 0 (sr=0).

doing the palette mirroring inverts the colors in every game, im probably doing something wrong, this change is in the ppu_write ?

edit: fixed it, overlooked your addr&0x3 :p

thanks dude for your help!
 
Last edited:

hap

New member
neat :p

addr&=0x3fff; // mirrored
if(addr>=0x3F00) {
// 0 4 8 c are the same as 10 14 18 1c
if ((addr&3)==0) vmem.vram[(addr&0x3F1F)^0x10]=data;
vmem.vram[addr&0x3F1F]=data;
}
else {
if (addr>=0x2000) { // <0x2000=patterntable. if you add external vram (like unrom), it should be allowed then
vmem.vrompage[addr>>10&0xf][addr&0x3FF]=data;
}
}


*edit* good, do you get the same results now as in those images ?
 
Last edited:

aprentice

Moderator
hap said:
neat :p

addr&=0x3fff; // mirrored
if(addr>=0x3F00) {
// 0 4 8 c are the same as 10 14 18 1c
if ((addr&3)==0) vmem.vram[(addr&0x3F1F)^0x10]=data;
vmem.vram[addr&0x3F1F]=data;
}
else {
if (addr>=0x2000) { // <0x2000=patterntable. if you add external vram (like unrom), it should be allowed then
vmem.vrompage[addr>>10&0xf][addr&0x3FF]=data;
}
}


*edit* good, do you get the same results now as in those images ?

yeah, exact down to the scanline, i went down your list and fixed everything, now i need to figure out sprite 0 hit, controllers and whatever mapper super mario bros 3 uses :)
 

aprentice

Moderator
implemented mapper4 (mmc3), only game that seems to run is super mario bros 2 though, there seems to be a bug in my code. What confuses me is command 6 and 7 on $8001 and how $8000 works, does $8000 swap banks in and out cause i know the banks suppose to change on $8001..
 

hap

New member
Let's say 'command' 6 is prg bank 3, and 7 is prg bank 4, then depending on 0x8000.6, the prg swap mode bit or whatever ;p, the prg banks will swap like this:

0x8000.6 is clear:
prg0=bank 3
prg1=bank 4
prg2=second to last bank
prg3=last bank

0x8000.6 is set:
prg0=second to last bank
prg1=bank 4
prg2=bank 3
prg3=last bank

writing to 0x8000 will change prg banks if bit 6 was different as it was before the write.
 

aprentice

Moderator
added controllers although they dont seem to be working 100%, in nestest every button except select works, select doesnt seem to work in any game, and in nesstress i cant seem to select anything except ppu tests. in mario bros 2 i can run around, jump and pause. wierd stuff :p

read:
shift = (pad&0x01);
pad>>=1;
return shift;

write:
if(data&0x01) update_padstate();
 

hap

New member
Perhaps the bug's not emulation related ?

INES Demo (PD).nes has got a joypad tester, though joypad 2 select and start don't work here with that.
*edit* you need to press the select key in nesstress to do other tests, that's why it won't let you do any other than ppu
 
Last edited:

smcd

Active member
Also i think it's ines (or tuxnes?) that comes with "cart.nes" that has a joypad test and stuff in it.
 

aprentice

Moderator
i got the select key working in nestest, but its giving me borked info, it keeps saying "42" for every single test which makes no sense whatso ever. nesstress doesnt want to accept my select key, but in the ppu tests this is what i got, dunno what some of these errors even mean :p
 

hap

New member
test 1 gives me all Oks here (and DPjr for the last 1, whatever that means), test 2 all errors (this is probably accurate), test 3 an Ok.

your 2nd error is probably due to memmap mirroring: 0xc000-0xffff=0x8000-0xbfff=0x4000-0x7fff=0x0-0x3fff.
you've implemented scrolling ? if you haven't yet, i think the other errors are due to that.
 

aprentice

Moderator
some sprite work done and fixed a few cpu bugs, some progress :p
sprite attribute is kinda off though, but still looks cool

*edit* fixed sprite colors, was pointing at the wrong palette before
 
Last edited:

hap

New member
I'm kind of on a break again, last thing I added was support for DDraw. Any progress on your side aprentice ?
 

|\/|-a-\/

Uli Hecht
Hi,
my NES emu is fetching the first instructions and emulates them correctly. pacman.nes lands in an infinite loop, which it does with other emus, too. i think the problem is that the PPU isn't emulated completly (means no gfx and the emu doesn't react on the ppu reg's flags).
I have problems continuing my work because i haven't any idea how to emulate the graphics. What is the background? The content of the nametables?
 

aprentice

Moderator
hap said:
I'm kind of on a break again, last thing I added was support for DDraw. Any progress on your side aprentice ?

ive been on break too, but i've got some progress since last time, double dragon 2 works aside from lack of scrolling and a lot of other games work now too, i might resume it sometime soon. i think theres still bugs in my emulation somewhere causing glitches here and there
 

|\/|-a-\/

Uli Hecht
i read a lot of things the last days and now i unterstood a lot after rereading rereading rereading :)

Question1: pacman is landing in its infinite loop as already mentioned. the first thing it does is clearing the ppu regs ($2000, $2001, $2002). How will it escape from the infinite loop because the NMI on VBlank flag isn't set?

Question2: mirroring - a few docs are talking about flags A10 and A11 to set mirroring. A10 and A11 are pins of the ppu chip as far i know. Can the mirroring direction be changed? i use the mirroring dir bit in rom control byte 1, but Patrick Diskin wrote in his nes doc something about "single screen mirroring" ?!
 

hap

New member
1: it probably exits the loop after 2002.7 gets set at vblank
2: yeah, some mappers can change mirroring 'direction' while a game is running, usually vertical/horizontal. single-screen mirroring means that all 4 nametables point to the same memory region.
 

Top