File tree Expand file tree Collapse file tree 2 files changed +24
-21
lines changed
BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS Expand file tree Collapse file tree 2 files changed +24
-21
lines changed Original file line number Diff line number Diff line change @@ -255,19 +255,29 @@ public override void WriteEXP(int addr, byte value)
255255 case 0x0020 :
256256 timerlatch &= 0xff00 ;
257257 timerlatch |= value ;
258- //timerirq = false;
259258 break ;
260259 case 0x0021 :
261260 timerlatch &= 0x00ff ;
262261 timerlatch |= value << 8 ;
263- //timerirq = false;
264262 break ;
265263 case 0x0022 :
266- timerreg = ( byte ) ( value & 3 ) ;
267- timervalue = timerlatch ;
264+ if ( diskenable )
265+ {
266+ timerreg = ( byte ) ( value & 3 ) ;
267+ if ( ( value & 0x02 ) == 0x02 )
268+ {
269+ timervalue = timerlatch ;
270+ }
271+ else
272+ {
273+ _timerirq = false ;
274+ }
275+ }
276+
268277 break ;
269278 case 0x0023 :
270279 diskenable = ( value & 1 ) != 0 ;
280+ if ( ! diskenable ) { _timerirq = false ; }
271281 soundenable = ( value & 2 ) != 0 ;
272282 break ;
273283 case 0x0024 :
@@ -344,30 +354,20 @@ public override byte PeekCart(int addr)
344354
345355 public override void ClockCPU ( )
346356 {
347- if ( ( timerreg & 2 ) != 0 ) // && timervalue > 0 )
357+ if ( ( timerreg & 2 ) != 0 && diskenable )
348358 {
349359 if ( timervalue != 0 )
350360 {
351361 timervalue -- ;
352362 }
353363 if ( timervalue == 0 )
354364 {
355-
356- /*
357- if ((timerreg & 1) != 0)
358- {
359- timervalue = timerlatch;
360- //timervalue = 0xFFFF;
361- }
362- else
363- {
364- timerreg &= unchecked((byte)~2);
365- timervalue = 0;
366- timerlatch = 0;
367- }
368- */
369365 timervalue = timerlatch ;
370366 timerirq = true ;
367+ if ( ( timerreg & 1 ) == 0 )
368+ {
369+ timerreg -= 2 ;
370+ }
371371 }
372372 }
373373 audio . Clock ( ) ;
Original file line number Diff line number Diff line change @@ -67,14 +67,17 @@ static byte[] FixFDSSide(byte[] inputdisk)
6767 byte [ ] fileheader = br . ReadBytes ( 16 ) ;
6868 if ( fileheader [ 0 ] != 0x03 )
6969 {
70- throw new Exception ( "Corrupt FDS block 3" ) ;
70+ // Instead of exceptions, display strong warnings
71+ Console . WriteLine ( "WARNING: INVALID FILE, BLOCK 3 ERROR" ) ;
72+ //throw new Exception("Corrupt FDS block 3");
7173 }
7274 int filesize = fileheader [ 13 ] + fileheader [ 14 ] * 256 ;
7375
7476 byte [ ] file = br . ReadBytes ( filesize + 1 ) ;
7577 if ( file [ 0 ] != 0x04 )
7678 {
77- throw new Exception ( "Corrupt FDS block 4" ) ;
79+ Console . WriteLine ( "WARNING: INVALID FILE, BLOCK 4 ERROR" ) ;
80+ //throw new Exception("Corrupt FDS block 4");
7881 }
7982
8083 WriteBlock ( ret , fileheader , 122 ) ;
You can’t perform that action at this time.
0 commit comments