★ APPLICATIONS ★ DIVERS ★ ZEXDOC: Z80 DOCUMENTED INSTRUCTION SET EXERCISER ★ |
Zexdoc: Z80 documented instruction set exerciser | Applications Divers |
For the purposes of this test program, the machine state consists of:
The program tests instructions (or groups of similar instructions) by cycling through a sequence of machine states, executing the test instruction for each one and running a 32-bit crc over the resulting machine states. At the end of the sequence the crc is compared to an expected value that was found empirically on a real Z80. A test case is defined by a descriptor which consists of:
The flag mask byte is used to prevent undefined flag bits from influencing the results. Documented flags are as per Mostek Z80 Technical Manual. The next three parts of the descriptor are 20 byte vectors corresponding to a 4 byte instruction and a 16 byte machine state. The first part is the base case, which is the first test case of the sequence. This base is then modified according to the next 2 vectors. Each 1 bit in the increment vector specifies a bit to be cycled in the form of a binary counter. For instance, if the byte corresponding to the accumulator is set to 0ffh in the increment The total number of test cases is the product of those caused by the counter and shift vectors and can easily become unweildy. Each individual test case can take a few milliseconds to execute, due to the overhead of test setup and crc calculation, so test design is a compromise between coverage and execution time. This program is designed to detect differences between implementations and is not ideal for diagnosing the causes of any discrepancies. However, provided a reference implementation (or real system) is available, a failing test case can be isolated by hand using a binary search of the test space.
|