@@ -17,14 +17,12 @@ public Z80(Bus bus, InputOutput ports)
1717 this . UpdateRegisterBank ( ) ;
1818 this . UpdateAFBank ( ) ;
1919 this . RaisedPOWER += this . Z80_RaisedPOWER ;
20- this . LoweredRESET += this . Z80_LoweredRESET ;
2120 this . LoweredNMI += this . Z80_LoweredNMI ;
2221 this . LoweredINT += this . Z80_LoweredINT ;
2322 }
2423
2524 private bool _interruptPending ;
2625 private bool _nonMaskableInterruptPending ;
27- private bool _resetPending ;
2826
2927 private readonly InputOutput _ports ;
3028
@@ -182,9 +180,8 @@ public override void PoweredStep()
182180 this . _modifiedF = 0 ;
183181 this . _displaced = this . _prefixCB = this . _prefixDD = this . _prefixED = this . _prefixFD = false ;
184182
185- if ( this . _resetPending )
183+ if ( this . RESET . Lowered ( ) )
186184 {
187- this . _resetPending = false ;
188185 this . HandleRESET ( ) ;
189186 return ;
190187 }
@@ -204,6 +201,9 @@ public override void PoweredStep()
204201 }
205202 }
206203
204+ Debug . Assert ( this . RESET . Raised ( ) ) ;
205+ Debug . Assert ( this . NMI . Raised ( ) ) ;
206+
207207 // ** From the Z80 CPU User Manual
208208 // When a software HALT instruction is executed, the CPU executes NOPs until an interrupt
209209 // is received(either a non-maskable or a maskable interrupt while the interrupt flip-flop is
@@ -252,8 +252,6 @@ private void Z80_RaisedPOWER(object? sender, EventArgs e)
252252
253253 private void Z80_LoweredNMI ( object ? sender , EventArgs e ) => this . _nonMaskableInterruptPending = true ;
254254
255- private void Z80_LoweredRESET ( object ? sender , EventArgs e ) => this . _resetPending = true ;
256-
257255 #region Z80 specific pins
258256
259257 #region NMI pin
@@ -594,10 +592,10 @@ protected override void MemoryRead()
594592 protected override void HandleRESET ( )
595593 {
596594 base . HandleRESET ( ) ;
597- this . DisableInterrupts ( ) ;
598595 this . IM = 0 ;
599596 this . IV = this . REFRESH = 0 ;
600597 this . SP . Joined = this . AF . Joined = ( ushort ) Mask . Sixteen ;
598+ this . Tick ( ) ;
601599 }
602600
603601 private byte ReadDataUnderInterrupt ( )
0 commit comments