Page 1 of 3

68000 instruction test suite QL

Posted: Sat Dec 24, 2016 9:28 pm
by XorA
Did anyone ever develop a 68k instruction set test suite for QL?

Interested for emulator testing.

G

Re: 68000 instruction test suite QL

Posted: Sat Dec 24, 2016 9:34 pm
by mk79
If the emulator is already advanced enough to run QDOS then yes, I ported a test suite to run within QDOS.

Re: 68000 instruction test suite QL

Posted: Sat Dec 24, 2016 9:42 pm
by XorA
Yes, it is running QDOS, its the uQlx port to 64bit I have been working on.

Re: 68000 instruction test suite QL

Posted: Sun Dec 25, 2016 6:50 pm
by mk79
I'm leaving for the Chaos Communication Congress early tomorrow plus a little bit of holidays afterwards, I can dig up the files when I return.

Cheers, Marcel

Re: 68000 instruction test suite QL

Posted: Fri Apr 05, 2019 6:48 pm
by TomHarte
Apologies for the revival; have these files surfaced anywhere public?

Re: 68000 instruction test suite QL

Posted: Mon Apr 12, 2021 10:53 pm
by XorA
It seems I could use your testsuite, as the following code from uqlx I guess means its nbcd instruction does not work.

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;
}
Note the shifting d all 8 bits, then checking for a value > 0

Re: 68000 instruction test suite QL

Posted: Mon Apr 12, 2021 10:59 pm
by XorA
XorA wrote:It seems I could use your testsuite, as the following code from uqlx I guess means its nbcd instruction does not work.

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;
}
Note the shifting d all 8 bits, then checking for a value > 0
The only two results for d I can see are 0 and -1 (if it sign extends the top bit) so always < 9

Re: 68000 instruction test suite QL

Posted: Tue Apr 13, 2021 12:04 am
by janbredenbeek
Something interesting I hit upon:

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).

The interesting part is that this feature is apparently not documented. I could't find anything about it in the Motorola/NXP manuals. Yes, I know that the Trace bit is reset during exceptions such as interrupts but that would mean that, if implemented consequently, TRAPs couldn't be traced too on the 68000.

Unfortunately I don't have hardware with a 'real' 68020 to test this...

Jan

Re: 68000 instruction test suite QL

Posted: Tue Apr 13, 2021 9:25 am
by mk79
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 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.

Cheers, Marcel

Re: 68000 instruction test suite QL

Posted: Tue Apr 13, 2021 10:28 am
by mk79
janbredenbeek 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).
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 it ;)

Cheers, Marcel