I'm developing a Motorola 68000 emulator, and I have found a million test cases to run, and currently I'm stuck with the first test with (d8, AX, Xn) addressing.
Here's the test case. Notice that prefetch values are provided as two words, and also only one instruction is tested. The problem is basically that I cannot even manually figure out how 13367077 is calculated. Whatever it is, I'm sure it's masked with 24-bits, and I cannot figure out the unmasked value.
d133 [ADD.b D0, (d8, A3, Xn)] 1
Len = 18
==== Initial ====
D0 = 2308435391 0x8997edbf 0b10001001 10010111 11101101 10111111
D1 = 1060694383 0x3f38e96f 0b00111111 00111000 11101001 01101111
D2 = 144798559 0x8a1735f 0b00001000 10100001 01110011 01011111
D3 = 1114670029 0x427083cd 0b01000010 01110000 10000011 11001101
D4 = 3546817942 0xd3682596 0b11010011 01101000 00100101 10010110
D5 = 3017016069 0xb3d40305 0b10110011 11010100 00000011 00000101
D6 = 157945861 0x96a1005 0b00001001 01101010 00010000 00000101
D7 = 3531664314 0xd280ebba 0b11010010 10000000 11101011 10111010
A0 = 1707790453 0x65cad075 0b01100101 11001010 11010000 01110101
A1 = 3858677903 0xe5fec08f 0b11100101 11111110 11000000 10001111
A2 = 3797006336 0xe251b800 0b11100010 01010001 10111000 00000000
A3 = 2874897130 0xab5b72ea 0b10101011 01011011 01110010 11101010
A4 = 3126142618 0xba55269a 0b10111010 01010101 00100110 10011010
A5 = 271034980 0x1027aa64 0b00010000 00100111 10101010 01100100
A6 = 2663102061 0x9ebbb66d 0b10011110 10111011 10110110 01101101
SSP = 2048 0x800 0b00000000000000000000100000000000
USP = 2048 0x800 0b00000000000000000000100000000000
PC = 3072 0xc00 0b00000000000000000000110000000000
SR = 9993 0x2709 0b00000000000000000010011100001001
Prefetch: 53555, 15214 0x3B6E 0b00111011 01101110
[MEMORY]
3079 = 160 A0 41206
3078 = 246 F6
13367077 = 228 E4
3077 = 181 B5
3076 = 237 ED 46573 87779 175558
==== Final ====
D0 = 2308435391 0x8997edbf 0b10001001 10010111 11101101 10111111
D1 = 1060694383 0x3f38e96f 0b00111111 00111000 11101001 01101111
D2 = 144798559 0x8a1735f 0b00001000 10100001 01110011 01011111
D3 = 1114670029 0x427083cd 0b01000010 01110000 10000011 11001101
D4 = 3546817942 0xd3682596 0b11010011 01101000 00100101 10010110
D5 = 3017016069 0xb3d40305 0b10110011 11010100 00000011 00000101
D6 = 157945861 0x96a1005 0b00001001 01101010 00010000 00000101
D7 = 3531664314 0xd280ebba 0b11010010 10000000 11101011 10111010
A0 = 1707790453 0x65cad075 0b01100101 11001010 11010000 01110101
A1 = 3858677903 0xe5fec08f 0b11100101 11111110 11000000 10001111
A2 = 3797006336 0xe251b800 0b11100010 01010001 10111000 00000000
A3 = 2874897130 0xab5b72ea 0b10101011 01011011 01110010 11101010
A4 = 3126142618 0xba55269a 0b10111010 01010101 00100110 10011010
A5 = 271034980 0x1027aa64 0b00010000 00100111 10101010 01100100
A6 = 2663102061 0x9ebbb66d 0b10011110 10111011 10110110 01101101
SSP = 2048 0x800 0b00000000000000000000100000000000
USP = 2048 0x800 0b00000000000000000000100000000000
PC = 3076 0xc04 0b00000000000000000000110000000100
SR = 10009 0x2719 0b00000000000000000010011100011001
Prefetch: 60853, 63136
[MEMORY]
3079 = 160
3078 = 246
13367077 [0xCBF725] = 163
3077 = 181
3076 = 237
Judging by the eighth bit of the second prefetch value (15214), we have a full-extension word to deal with. For some reason, I/IS bits map to a reserved combination! And when I read the next long word (judging by index size), and add all of that up, I can't get the result.
Here's the description of extension words from the documentation:
P.S. The tests are taken from https://github.com/TomHarte/ProcessorTests/tree/main/680x0/68000/v1
I was surprised that nobody pointed this out, but Motorola 68000 doesn't support Full Extension Words and ignores the bits 8-10; therefore it's only supported by other models of 68K family. So the word should be masked out first and then the test passes.