|
37 | 37 | /* MARK: - Types */ |
38 | 38 |
|
39 | 39 | 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. */ |
51 | 44 | } Member; |
52 | 45 |
|
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 | +'====================================================================*/ |
59 | 51 |
|
60 | 52 | 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. */ |
64 | 56 | } Z_PACKED_STRUCTURE_END Cycle; |
65 | 57 |
|
66 | 58 | 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. */ |
70 | 62 | } Z_PACKED_STRUCTURE_END Port; |
71 | 63 |
|
72 | 64 |
|
@@ -275,6 +267,8 @@ static void cpu_out(void *context, zuint16 port, zuint8 value) |
275 | 267 | } |
276 | 268 |
|
277 | 269 |
|
| 270 | +/* MARK: - Instruction Clock Callback */ |
| 271 | + |
278 | 272 | static zuint8 insn_clock_read(void *context, zuint16 address) |
279 | 273 | { |
280 | 274 | Z_UNUSED(context) |
|
0 commit comments