@@ -535,14 +535,12 @@ static zuint8 run_test(int test_index)
535
535
536
536
memset (memory , 0 , Z_USIZE (65536 ));
537
537
538
- for (; i < search_path_count &&
539
- !load_test (search_paths [i ], test , memory + ( start_address & Z_UINT16 (0xFF00 )) );
540
- i ++
538
+ for ( i = search_path_count ;
539
+ i && !load_test (search_paths [i - 1 ], test , & memory [ start_address & Z_UINT16 (0xFF00 )] );
540
+ i --
541
541
);
542
542
543
- if ( i == search_path_count &&
544
- !load_test (Z_NULL , test , memory + (start_address & Z_UINT16 (0xFF00 )))
545
- )
543
+ if (!i && !load_test (Z_NULL , test , & memory [start_address & Z_UINT16 (0xFF00 )]))
546
544
{
547
545
error_loading_file :
548
546
if (verbosity ) printf ("error, test skipped\n%s" , test_spacing );
@@ -571,15 +569,12 @@ static zuint8 run_test(int test_index)
571
569
{
572
570
if (verbosity >= 3 ) printf ("* Loading firmware... " );
573
571
574
- for ( i = 0 ;
575
- i < search_path_count &&
576
- !load_file (search_paths [i ], "ZX Spectrum.rom" , 16384 , 0 , 16384 , memory );
577
- i ++
572
+ for ( i = search_path_count ;
573
+ i && !load_file (search_paths [i - 1 ], "ZX Spectrum.rom" , 16384 , 0 , 16384 , memory );
574
+ i --
578
575
);
579
576
580
- if ( i == search_path_count &&
581
- !load_file (Z_NULL , "ZX Spectrum.rom" , 16384 , 0 , 16384 , memory )
582
- )
577
+ if (!i && !load_file (Z_NULL , "ZX Spectrum.rom" , 16384 , 0 , 16384 , memory ))
583
578
goto error_loading_file ;
584
579
585
580
if (verbosity >= 3 ) puts ("OK" );
0 commit comments