Skip to content

Commit a5720e7

Browse files
committed
Improvements to step-test-Z80.
1 parent a9583b6 commit a5720e7

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

sources/step-test-Z80.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
____ \/__/ /\_\ __ \\ \/\ \ ________________________________________________
55
| /\_____\\_____\\_____\ |
66
| Zilog \/_____//_____//_____/ CPU Emulator - Step Testing Tool |
7-
| Copyright (C) 2024-2025 Manuel Sainz de Baranda y Goñi. |
7+
| Copyright (C) 2024-2026 Manuel Sainz de Baranda y Goñi. |
88
| |
99
| This program is free software: you can redistribute it and/or modify it |
1010
| under the terms of the GNU General Public License as published by the Free |
@@ -50,9 +50,9 @@ typedef struct {
5050
'====================================================================*/
5151

5252
typedef Z_PACKED_STRUCTURE_BEGIN {
53-
zuint16 address; /* Value on the address bus. */
54-
zsint16 value; /* Value on the data bus. */
55-
char pins[4]; /* State of the pins. */
53+
zuint16 address; /* Value on the address bus. */
54+
zsint16 value; /* Value on the data bus (-1 = do not check). */
55+
char pins[4]; /* State of the pins: /RD, WR, /MREQ, /IORQ. */
5656
} Z_PACKED_STRUCTURE_END Cycle;
5757

5858
typedef Z_PACKED_STRUCTURE_BEGIN {
@@ -159,9 +159,8 @@ static void add_port(zuint16 port, zuint8 value, char direction)
159159
if (ports_index == ports_size)
160160
{
161161
if (cpu_break) return;
162-
ports_size += Z80_MAXIMUM_CYCLES_PER_STEP;
163162

164-
if ((p = realloc(ports, ports_size * sizeof(Port))) == Z_NULL)
163+
if ((p = realloc(ports, ++ports_size * sizeof(Port))) == Z_NULL)
165164
{
166165
z80_break(&cpu);
167166
cpu_break = Z_TRUE;
@@ -320,10 +319,10 @@ static zbool validate_test_state(cJSON *state)
320319

321320
return Z_TRUE;
322321

323-
/*-------------------------------------------------------------.
324-
| EI and P are mutually exclusive, as the previous instruction |
325-
| cannot be `ei` and `ld a,{i|r}` at the same time. |
326-
'=============================================================
322+
/*--------------------------------------------------------------.
323+
| `"ei"` and `"p"` are mutually exclusive, as the previous |
324+
| instruction cannot be `ei` and `ld a,{i|r}` at the same time. |
325+
'==============================================================
327326
return 2.0 !=
328327
cJSON_GetNumberValue(cJSON_GetObjectItem(state, "ei")) +
329328
cJSON_GetNumberValue(cJSON_GetObjectItem(state, "p" ));*/
@@ -579,7 +578,7 @@ int main(int argc, char **argv)
579578
if (string_is_option(option, "V-version"))
580579
{
581580
puts( "step-test-Z80 v" Z80_LIBRARY_VERSION_STRING "\n"
582-
"Copyright (C) 2024-2025 Manuel Sainz de Baranda y Goñi.\n"
581+
"Copyright (C) 2024-2026 Manuel Sainz de Baranda y Goñi.\n"
583582
"Released under the terms of the GNU General Public License v3.");
584583

585584
return 0;
@@ -961,7 +960,6 @@ int main(int argc, char **argv)
961960
array_check_end();
962961

963962
/* Check cycles. */
964-
965963
if (test_pins)
966964
{
967965
for (j = 0; j != expected_cycle_count; j++)
@@ -990,7 +988,6 @@ int main(int argc, char **argv)
990988
}
991989

992990
/* Check ports. */
993-
994991
for (j = 0; j != expected_port_count; j++)
995992
{
996993
Port expected_port = read_port_item(cJSON_GetArrayItem(expected_ports, (int)j));
@@ -1042,7 +1039,6 @@ int main(int argc, char **argv)
10421039
}
10431040

10441041
/* Print the results. */
1045-
10461042
printf( "\nResults:%c%u file%s in total",
10471043
test_format_and_exit ? ' ' : '\n',
10481044
file_count,

0 commit comments

Comments
 (0)