Skip to content

Commit a983676

Browse files
committed
Reverse the priority order of the search paths specified by using the -p option.
1 parent c591357 commit a983676

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

sources/test-Z80.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -535,14 +535,12 @@ static zuint8 run_test(int test_index)
535535

536536
memset(memory, 0, Z_USIZE(65536));
537537

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--
541541
);
542542

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)]))
546544
{
547545
error_loading_file:
548546
if (verbosity) printf("error, test skipped\n%s", test_spacing);
@@ -571,15 +569,12 @@ static zuint8 run_test(int test_index)
571569
{
572570
if (verbosity >= 3) printf("* Loading firmware... ");
573571

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--
578575
);
579576

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))
583578
goto error_loading_file;
584579

585580
if (verbosity >= 3) puts("OK");

0 commit comments

Comments
 (0)