1File formats
2============
3
4tests.in
5--------
6
7Each test has the format:
8
9<arbitrary test description>
10AF BC DE HL AF' BC' DE' HL' IX IY SP PC MEMPTR
11I R IFF1 IFF2 IM <halted> <tstates>
12
13<halted> specifies whether the Z80 is halted.
14<tstates> specifies the number of tstates to run the test for, in
15  decimal; the number actually executed may be higher, as the final
16  instruction is allowed to complete.
17
18Then followed by lines specifying the initial memory setup. Each has
19the format:
20
21<start address> <byte1> <byte2> ... -1
22
23eg
24
251234 56 78 9a -1
26
27says to put 0x56 at 0x1234, 0x78 at 0x1235 and 0x9a at 0x1236.
28
29Finally, -1 to end the test. Blank lines may follow before the next test.
30
31tests.expected
32--------------
33
34Each test output starts with the test description, followed by a list
35of 'events': each has the format
36
37<time> <type> <address> <data>
38
39<time> is simply the time at which the event occurs.
40<type> is one of MR (memory read), MW (memory write), MC (memory
41       contend), PR (port read), PW (port write) or PC (port contend).
42<address> is the address (or IO port) affected.
43<data> is the byte written or read. Missing for contentions.
44
45After that, lines specifying AF, BC etc as for .in files. <tstates>
46now specifies the final time.
47
48After that, lines specifying which bits of memory have changed since
49the initial setup. Same format as for .in files.
50
51Why some specific tests are here
52================================
53
54{02,0a,32}_1,edb[012389ab]_[12],d3_4:
55  check MEMPTR is set correctly after various instructions.
56
5737_{1,2,3}: check the behaviour of SCF with respect to bits 3 and 5
58	    (bug fixed on 20040225).
59
60cb46_{1,2,3,4,5}: check the correct bits of MEMPTR are copied to bits 3
61                  and 5 of the flags register after a BIT n,(HL) instruction.
62
63cb{4,5,6,7}{7,f}_1: designed to check that bits 3 and 5 are copied to
64		    F only for BIT 3,<arg> and BIT 5,<arg> respectively
65		    (bug fixed on 20040225).
66
67		    However, later research has revealed the bits 3
68		    and 5 are copied on all BIT instructions, so these
69		    tests are now essentially redundant.
70
71d{3,b}_{1,2,3}: check for correct port contention on IO in the four
72	        relevant states (port high byte in 0x40 to 0x7f or not,
73		port low bit set or reset).
74
75dd00.in, ddfd00.in: test timings of "extended NOP" opcodes DD 00 and
76		    DD FD 00; the extra 00 at the end is to check the
77		    next opcode executes at the right time (bug fixed
78		    on 20060722).
79
80