Here's a crude program that tests all illegal instructions. It can be used to test your 68000 emulation. The screen is blue while testing, green when finished, and red if an error occurred. An error is when any other exception than the illegal instruction exception was triggered, or if the instruction caused no exception and executed normally.
Source is included. I tested it on a few Motorola and Signetics 68Ks and it works fine.
http://www.sendspace.com/file/tkuc27
In general illegal instructions happen when the EA encoding for an instruction is invalid, so there are some patterns to which combinations of bitfields are invalid. The lone exception is $4E74 (RTD on later processors) which matches no pattern. This is why there is an odd number of illegal instructions ($2D09 total).
To make the list of illegal instructions I used this thing:
http://cgfm2.emuviews.com/img/fdtool.png
with a normal 68000 plugged in and tested all 64K possible instructions. So the opcode list should be 100% accurate.
If there's any demand I can make a similar test for the 68010.
Illegal instruction test program
Moderator: BigEvilCorporation
-
- Very interested
- Posts: 292
- Joined: Sat Apr 21, 2007 1:14 am
Illegal instruction test program
Last edited by Charles MacDonald on Tue Feb 12, 2013 7:26 pm, edited 1 time in total.
Awesome! This was on my list of things to test! We really need more test programs like this that we can run on the Mega Drive.
Any thoughts of expanding this ROM to test more than just illegal instructions, but to actually verify instruction execution? IE, check instruction results, flag settings, etc?
Any thoughts of expanding this ROM to test more than just illegal instructions, but to actually verify instruction execution? IE, check instruction results, flag settings, etc?
Thanks, your test ROM just helped me correct 3 instructions where I was allowing addressing modes that were not allowed on the M68000, the TST, EOR, and CMPI instructions. The TST and CMPI opcodes were wrong because of errors in the 68khtml opcode reference I originally used to generate my instruction encodings. The EOR opcode was wrong because of my own mistake. Now that I've corrected those errors, your test ROM passes on my emulator. 

-
- Very interested
- Posts: 292
- Joined: Sat Apr 21, 2007 1:14 am
I'd love to, but I know I won't have the time to get it done. If there's anything specific you want checked or tested, I can definitely do that. Mainly what I have been looking at recently is bus activity during exceptions to get some insight on prefetch behavior. So making this illegal opcode list fit into that.Nemesis wrote:Any thoughts of expanding this ROM to test more than just illegal instructions, but to actually verify instruction execution? IE, check instruction results, flag settings, etc?
Glad to know the test ROM was useful.
