Micro Machines - The Ultimate PPU Test?

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
Great Hierophant
Posts: 780
Joined: Tue Nov 23, 2004 9:35 pm

Micro Machines - The Ultimate PPU Test?

Post by Great Hierophant »

Micro Machines non-racing screens do not display right on any emulator. (I own the game and know how it shoul be displayed. Even the mighty Nintendolator has graphics glitches (among the [b]very[/b] few games that it cannot display correctly.) Extra lines, shaking graphics, cut off letters. Did the Codemasters programmers decide to use some timing critical code in places where it is not really needed? Are the ROMs (both standalone and Alladin) bad ? Perhaps they are hitting "features/bugs" of the NES's PPU. But I would say that a truely accurate emulator should be able to display all the non-racing screens correctly.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Micro Machines - The Ultimate PPU Test?

Post by Quietust »

Great Hierophant wrote:Perhaps they are hitting "features/bugs" of the NES's PPU.
They read $2004 during rendering for some sort of timing checks. On a real PPU, this actually exposes the internal SPR-RAM accesses. No emulator is known to handle this properly.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Muchaserres
Posts: 96
Joined: Sat Nov 13, 2004 6:25 am

Post by Muchaserres »

On a real PPU, this actually exposes the internal SPR-RAM accesses.
How would reads from $2004 affect the way the screen is rendered? Is $2003 register the same used for accesses to SPR-RAM on screen render?
Hyde
Posts: 101
Joined: Mon Sep 27, 2004 11:51 pm

Post by Hyde »

I recall saying something about this on #nesdev. Basically what the game does is read data from SPR-RAM (bit $2004), then it performs a check on the value read and updates the screen based on such number. However, the $2004 read is performed during HBlank, which makes me think that it may be possible to read SPR-RAM data during HBlank. Here is a sample code that shows what I am talking about:

Code: Select all

---------------------- PROCESSING *SCANLINE* #017 ---------------------
$fd76 A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:246 pla 
$fd77 A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:234 pha 
$fd78 A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:225 pla 
$fd79 A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:213 pha 
$fd7a A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:204 pla 
$fd7b A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:192 pha 
$fd7c A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:183 pla 
$fd7d A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:171 pha 
$fd7e A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:162 pla 
$fd7f A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:150 pha 
$fd80 A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:141 pla 
$fd81 A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:129 pha 
$fd82 A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:120 pla 
$fd83 A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:108 pha 
$fd84 A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:099 pla 
$fd85 A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:087 pha 
$fd86 A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:078 pla 
$fd87 A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:066 pha 
$fd88 A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:057 pla 
$fd89 A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:045 pha 
$fd8a A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:036 pla 
$fd8b A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:024 pha 
$fd8c A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:015 pla 
$fd8d A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:003 pha 
------------------------ PROCESSING *HBLANK* #017 -------------------------
$fd8e A=$ff X=$08 Y=$00 SP=$f7 F= N       I   C  Cycle:003 pla 
$fd8f A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:072 nop 
$fd90 A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:066 nop 
$fd91 A=$ff X=$08 Y=$00 SP=$f8 F= N       I   C  Cycle:060 dex 
$fd92 A=$ff X=$07 Y=$00 SP=$f8 F=         I   C  Cycle:054 bne $fd6e
$fd6e A=$ff X=$07 Y=$00 SP=$f8 F=         I   C  Cycle:045 bit $2004
$fd71 A=$ff X=$07 Y=$00 SP=$f8 F= N V     I   C  Cycle:033 bmi $fd73
Eventually the N flags is reset and the game moves on to something else.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

Some of you might disagree... but I got a few good results by enabling sprite address++ on reads ;)
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust »

Fx3 wrote:Some of you might disagree... but I got a few good results by enabling sprite address++ on reads ;)
Guess what? It's been thoroughly tested that reading $2004 does NOT increment the SPR-RAM address ($2003), so that's not the way to do it.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

I know that.
Let me label it as "a hack" ;)
User avatar
laughy
Posts: 41
Joined: Wed Nov 17, 2004 12:34 pm
Contact:

:)

Post by laughy »

Quietust matches his facepic well.

Can someone set up a rig showing the values of $2004 during rendering of a particular scene? (in h-blank). Won't the output just be some "random" data from the sprites about to be rendered on the next scanline?
TimW
Posts: 6
Joined: Mon Dec 20, 2004 4:51 am

Post by TimW »

yeah these micro machienes games are difficult, the oddest things are discovered trying to pick through wack code, it's amazing some of this stuff worked in the first place.
Hyde
Posts: 101
Joined: Mon Sep 27, 2004 11:51 pm

Post by Hyde »

Could it be that reading from $2004 while rendering is on would take a few extra cycles?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

You're thinking of the GBA. The NES CPU doesn't have "wait states" in the same way as the GBA CPU.
Post Reply