68000 instruction test suite QL
Posted: Sat Dec 24, 2016 9:28 pm
Did anyone ever develop a 68k instruction set test suite for QL?
Interested for emulator testing.
G
Interested for emulator testing.
G
RIP Sir Clive Sinclair 1940 - 2021
https://qlforum.co.uk/
Code: Select all
IDECL(nbcd)
{
w8 d,r;
w8 d2,r2;
d=ModifyAtEA_b((code>>3)&7,code&7);
d2=((d&0x0f)>9? 9:(d&0x0f));
d>>=8;
if(d>9) d2+=90; else d2+=d*10;
carry=d2!=0;
r2=100-d2;
if(xflag) r2--;
xflag=carry;
zero=zero && r2==0;
r=(r2%10)+((r2/10)<<4);
RewriteEA_b(r);
NEXT;
}
The only two results for d I can see are 0 and -1 (if it sign extends the top bit) so always < 9XorA wrote:It seems I could use your testsuite, as the following code from uqlx I guess means its nbcd instruction does not work.
Note the shifting d all 8 bits, then checking for a value > 0Code: Select all
IDECL(nbcd) { w8 d,r; w8 d2,r2; d=ModifyAtEA_b((code>>3)&7,code&7); d2=((d&0x0f)>9? 9:(d&0x0f)); d>>=8; if(d>9) d2+=90; else d2+=d*10; carry=d2!=0; r2=100-d2; if(xflag) r2--; xflag=carry; zero=zero && r2==0; r=(r2%10)+((r2/10)<<4); RewriteEA_b(r); NEXT; }
I finally uploaded one version to https://www.kilgus.net/soft/m68k_tester_gz.zip. You probably only need to adapt the dev$ variable in the boot file. It can run very long on slower machines, days even, so it makes a screenshot after every instruction tested. Not so much a problem for an emulator like yours I guess.XorA wrote:It seems I could use your testsuite, as the following code from uqlx I guess means its nbcd instruction does not work.
I haven't though about this stuff for 10 years, so I'm a bit rusty. But as far as I can see that is simply a bug because the TRAP shares code with other exceptions where the T bit must be cleared. Amazing that nobody including myself has ever noticed itjanbredenbeek wrote:When tracing 68000 instructions using the 68000's SR Trace bit, when I trace a TRAP instruction, the code of the TRAP itself can be traced too on a 68000.
However, on QPC2 which emulates the 68020, the trace is skipped during the trap and the next instruction after TRAP. Apparently the Trace bit is automatically reset during the trap on the 68020 but not on the 68000. I've tested this with Multimon (which always sets the Trace bit even with TRAP instructions) and QMON (which by default doesn't trace TRAPs but can optionally do).