68000 instruction test suite QL

Discussion and advice about emulating the QL on other machines.
User avatar
XorA
Site Admin
Posts: 1359
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

68000 instruction test suite QL

Post by XorA »

Did anyone ever develop a 68k instruction set test suite for QL?

Interested for emulator testing.

G


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: 68000 instruction test suite QL

Post by mk79 »

If the emulator is already advanced enough to run QDOS then yes, I ported a test suite to run within QDOS.


User avatar
XorA
Site Admin
Posts: 1359
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: 68000 instruction test suite QL

Post by XorA »

Yes, it is running QDOS, its the uQlx port to 64bit I have been working on.


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: 68000 instruction test suite QL

Post 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


TomHarte
ROM Dongle
Posts: 1
Joined: Tue Mar 05, 2019 7:23 pm

Re: 68000 instruction test suite QL

Post by TomHarte »

Apologies for the revival; have these files surfaced anywhere public?


User avatar
XorA
Site Admin
Posts: 1359
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: 68000 instruction test suite QL

Post 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


User avatar
XorA
Site Admin
Posts: 1359
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: 68000 instruction test suite QL

Post 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


User avatar
janbredenbeek
Super Gold Card
Posts: 629
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: 68000 instruction test suite QL

Post 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


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: 68000 instruction test suite QL

Post 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


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: 68000 instruction test suite QL

Post 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


Post Reply