It is currently Mon Dec 18, 2017 9:49 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 53 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: Resetting Micro Machines
PostPosted: Mon Jan 23, 2017 7:17 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 754
Location: New York, NY
In Nintendulator and my emulator, if you reset Micro Machines, it crashes the CPU (it jumps to a bad location and executes a KIL instruction). But, I have yet to figure out why. It must be sensitive to initial memory values or the state of the CPU. Anyone have a clue on this one?


Top
 Profile  
 
PostPosted: Mon Jan 23, 2017 8:14 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19356
Location: NE Indiana, USA (NTSC)
Did you try to reset twice in a row?

I don't own a copy of Micro Machines, but I do own a copy of Bee 52, and I know that all Codemasters games share library code, such as the "happy face" ROM test and possibly the CHR codec. While testing the Codemasters logo screen for zeroone, I discovered that if I press Reset once, the power light turns off and stays off. If I press Reset again, it comes back up. Perhaps a Reset press at certain points in the program confuses the code that drives the CIC stun circuit.


Top
 Profile  
 
PostPosted: Mon Jan 23, 2017 8:21 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 754
Location: New York, NY
tepples wrote:
Did you try to reset twice in a row?

I don't own a copy of Micro Machines, but I do own a copy of Bee 52, and I know that all Codemasters games share library code, such as the "happy face" ROM test and possibly the CHR codec. While testing the Codemasters logo screen for zeroone, I discovered that if I press Reset once, the power light turns off and stays off. If I press Reset again, it comes back up. Perhaps a Reset press at certain points in the program confuses the code that drives the CIC stun circuit.


It's a bit difficult to reset a crashed CPU in an emulator.


Top
 Profile  
 
PostPosted: Mon Jan 23, 2017 10:25 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19356
Location: NE Indiana, USA (NTSC)
Instead of choosing Emulation > Soft Reset (FCEUX SDL) or NES > Reset (FCEUX Windows) or Nintendulator's counterpart once, choose the menu item twice.


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 8:30 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 754
Location: New York, NY
tepples wrote:
Instead of choosing Emulation > Soft Reset (FCEUX SDL) or NES > Reset (FCEUX Windows) or Nintendulator's counterpart once, choose the menu item twice.


I don't follow. Can you please clarify what you want me to try?


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 8:48 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19356
Location: NE Indiana, USA (NTSC)
I want you to try a soft reset in your emulator, but try it twice in a row. If the first leads to a STP (also called KIL), the second may cause execution to continue.

Or am I misunderstanding what you meant by "a crashed CPU"? Is your emulator's core actually crashing? Or does a soft reset fail to pull it out of STP?


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 8:55 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 754
Location: New York, NY
tepples wrote:
I want you to try a soft reset in your emulator, but try it twice in a row. If the first leads to a STP (also called KIL), the second may cause execution to continue.

Or am I misunderstanding what you meant by "a crashed CPU"? Is your emulator's core actually crashing? Or does a soft reset fail to pull it out of STP?


Ah. I understand now.

The second reset does pull it out of the halt state; however, it shortly thereafter executes the same KIL instruction that halted it on the first reset. Successive resets produce more halts.

Edit: For testing purposes, I modified my emulator to clear main memory and vram on reset, to reset all the mapper banks and to clear all the CPU registers and flags. And, the CPU still jams on reset! That's really strange. Some other state information is causing this.


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 9:26 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2983
Location: Tampere, Finland
Create a trace log from a power-on, then from a soft reset. See where they diverge.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 11:30 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 754
Location: New York, NY
thefox wrote:
Create a trace log from a power-on, then from a soft reset. See where they diverge.


Code:
BFC8  CA        DEX                             A:0B X:B3 Y:01 P:A5 SP:FB CYC:302 SL:240
BFC9  D0 FD     BNE $BFC8                       A:0B X:B3 Y:01 P:A5 SP:FB CYC:308 SL:240
BFC8  CA        DEX                             A:0B X:B2 Y:01 P:A5 SP:FB CYC:317 SL:240
BFC9  D0 FD     BNE $BFC8                       A:0B X:B2 Y:01 P:A5 SP:FB CYC:323 SL:240
BFC8  CA        DEX                             A:0B X:B1 Y:01 P:A5 SP:FB CYC:332 SL:240
BFC9  D0 FD     BNE $BFC8                       A:0B X:B1 Y:01 P:A5 SP:F8 CYC:338 SL:240
0300  4C 1A FC  JMP $FC1A                       A:0B X:B1 Y:01 P:A5 SP:F8 CYC: 27 SL:241
FC1A  A6 21     LDX $21 = FA                    A:0B X:FA Y:01 P:A5 SP:F8 CYC: 36 SL:241
FC1C  9A        TXS                             A:0B X:FA Y:01 P:A5 SP:FA CYC: 45 SL:241
FC1D  6C 03 03  JMP ($0303) = 9EC7              A:0B X:FA Y:01 P:A5 SP:FA CYC: 51 SL:241
9EC7  33 99     RLA ($99),Y = 0000 @ 0001 = 78  A:01 X:FA Y:01 P:24 SP:FA CYC: 66 SL:241
9EC9  CC E6 72  CPY $72E6 = 00                  A:01 X:FA Y:01 P:25 SP:FA CYC: 90 SL:241
9ECC  90 3C     BCC $9F0A                       A:01 X:FA Y:01 P:25 SP:FA CYC:102 SL:241
9ECE  18        CLC                             A:01 X:FA Y:01 P:24 SP:FA CYC:108 SL:241
9ECF  00        BRK                             A:01 X:FA Y:01 P:24 SP:F7 CYC:114 SL:241
FFFF  FF 00 F1  ISB $F100,X @ F1FA = 53         A:AC X:FA Y:01 P:A4 SP:F7 CYC:135 SL:241


The deviation happens at that spontaneous jump to $0300. From the SL, it coincides with NMI. Prior to the jump, it was in loop that was decrementing X to 0. I will keep investigating.

Edit:

The last bank in mapper 71 is fixed. Here is the NMI address:

Code:
 0F:FFFA:00        BRK
 0F:FFFB:03        UNDEFINED


NMI directs execution to code loaded into RAM.

Edit 2:

I can fix the problem by writing $00 to the PPU CTRL register ($2000) on reset, disabling NMI's. Should that be happening?


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 11:51 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2983
Location: Tampere, Finland
zeroone wrote:
I can fix the problem by writing $00 to the PPU CTRL register ($2000) on reset, disabling NMI's. Should that be happening?

Yes on NES. No on Famicom (reset line is not connected to PPU).

http://wiki.nesdev.com/w/index.php/PPU_power_up_state

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 2:38 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
So Micro Machines has yet another way that it runs properly on an NES but not a Famicom! Interesting.

(The other way is reading $2004.)


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 3:03 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 754
Location: New York, NY
rainwarrior wrote:
So Micro Machines has yet another way that it runs properly on an NES but not a Famicom! Interesting.

(The other way is reading $2004.)


It sounds like it should also fail on reset for the NES-101. If anyone has the hardware, please confirm.

What is the reading $2004 issue?


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 3:35 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
$2004 isn't readable on a lot of Famicom units. Micro Machines polls it to time some raster effects.


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 3:45 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3076
Location: Brazil
zeroone wrote:
I can fix the problem by writing $00 to the PPU CTRL register ($2000) on reset, disabling NMI's. Should that be happening?

The wiki says clearly to set $2000 to $00 on powerup and RESET in the NTSC version. Well, so the PPU state is different in a Famicom..???


Top
 Profile  
 
PostPosted: Tue Jan 24, 2017 4:40 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
Zepper wrote:
zeroone wrote:
I can fix the problem by writing $00 to the PPU CTRL register ($2000) on reset, disabling NMI's. Should that be happening?

The wiki says clearly to set $2000 to $00 on powerup and RESET in the NTSC version. Well, so the PPU state is different in a Famicom..???


Indeed:
The wiki wrote:
On top-loaders (Famicom, NES-101), the Reset button resets only the CPU.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 53 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group