Skip to content

Commit c137515

Browse files
committed
Source code comments.
1 parent a363e27 commit c137515

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

sources/step-test-Z80.c

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,28 @@
3737
/* MARK: - Types */
3838

3939
typedef struct {
40-
/* Title of the member as shown in the mismatch reports. */
41-
char const *caption;
42-
43-
/* Key of the member as shown in the JSON files. */
44-
char const *key;
45-
46-
/* Offset of the member within the Z80 structure. */
47-
zusize offset;
48-
49-
/* Maximum value the member can hold. */
50-
zuint16 maximum_value;
40+
char const *caption; /* Name used in the mismatch reports. */
41+
char const *key; /* JSON key. */
42+
zusize offset; /* Offset within the Z80 structure. */
43+
zuint16 maximum_value; /* Maximum value the member can hold. */
5144
} Member;
5245

53-
/*-----------------------------------------------------------------------------.
54-
| `Cycle` and `Port` store information about a clock cycle and an I/O port |
55-
| operation, respectively. They are packed to avoid any padding bytes, so that |
56-
| the actual results can be compared directly with the expected ones read from |
57-
| the JSON test files. |
58-
'=============================================================================*/
46+
/*--------------------------------------------------------------------.
47+
| `Cycle` and `Port` store information about a clock cycle and an I/O |
48+
| operation, respectively. These structures are packed to avoid any |
49+
| padding bytes, so that they can be compared using `memcmp`. |
50+
'====================================================================*/
5951

6052
typedef Z_PACKED_STRUCTURE_BEGIN {
61-
zuint16 address;
62-
zsint16 value;
63-
char pins[4];
53+
zuint16 address; /* Value on the address bus. */
54+
zsint16 value; /* Value on the data bus. */
55+
char pins[4]; /* State of the pins. */
6456
} Z_PACKED_STRUCTURE_END Cycle;
6557

6658
typedef Z_PACKED_STRUCTURE_BEGIN {
67-
zuint16 port;
68-
zuint8 value;
69-
char direction;
59+
zuint16 port; /* I/O port number. */
60+
zuint8 value; /* Value read from or written to the I/O port. */
61+
char direction; /* 'r' = read, 'w' = write. */
7062
} Z_PACKED_STRUCTURE_END Port;
7163

7264

@@ -275,6 +267,8 @@ static void cpu_out(void *context, zuint16 port, zuint8 value)
275267
}
276268

277269

270+
/* MARK: - Instruction Clock Callback */
271+
278272
static zuint8 insn_clock_read(void *context, zuint16 address)
279273
{
280274
Z_UNUSED(context)

sources/test-Z80.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ int main(int argc, char **argv)
932932
| test programs do not require interrupts. |
933933
| * `nop`, `ld_i_a`, `ld_r_a`, `reti`, `retn`, and `illegal` are also |
934934
| not needed. |
935-
| * `fetch_opcode`, `write`, and `hook` will be set by `run_test()`. |
935+
| * `fetch_opcode`, `write`, and `hook` will be set by `run_test`. |
936936
'=====================================================================*/
937937
cpu.context = Z_NULL;
938938
cpu.fetch =

0 commit comments

Comments
 (0)