Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Z80 Undocumented Instructions

Reply to topic
Author Message
  • Joined: 28 Mar 2002
  • Posts: 180
  • Location: Toronto, Canada
Reply with quote
Z80 Undocumented Instructions
Post Posted: Fri Oct 17, 2003 1:20 pm
Hi all,

I'm working in SayaRX to fix some bad implementation of undocumented instructions. In this first stage i removed all my previous implementation to rework from the scratch all that implementation.

Today, my Z80 Core is only supporting the "official" instructions and i'm planning to build a list of games that uses undocumented instructions, so it will be a good reference to emulator builders!

Bock, if you don't have a document like this, i will be happy if you add it to the SMS Power Dev Docs.


Thanks
  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8651
  • Location: Paris, France
Reply with quote
Post Posted: Mon Oct 27, 2003 7:57 am
Quote
> Today, my Z80 Core is only supporting the "official"
> instructions and i'm planning to build a list of games
> that uses undocumented instructions, so it will be a
> good reference to emulator builders!
> Bock, if you don't have a document like this, i will be
> happy if you add it to the SMS Power Dev Docs.

This is a good idea.

The process should ideally be automated. Can you modify your emulator for this purpose, or did you want to build a database manually?

I have tools in MEKA to extract Z80 instructions usage. Maybe, I could improve it so that information are saved to file for each game. Then, whenever I use MEKA, statistics are being created(with a small slowdown).
  View user's profile Send private message Visit poster's website
  • Joined: 11 Nov 2005
  • Posts: 52
Reply with quote
Post Posted: Mon Dec 12, 2005 8:33 pm
has anyone made any effort to do this yet?

i've finished all the documented opcodes in my emulator and i'm wondering if the cpu overhead is worth the trouble. if were talking compatibility with an extra 5 games, i might be less inclined to put forth the effort.
  View user's profile Send private message
  • Joined: 18 Sep 1999
  • Posts: 498
  • Location: Portland, Oregon USA
Reply with quote
Post Posted: Tue Dec 13, 2005 12:07 am
MesaDX 0.03a can trap (break) on undocumented instructions. To set the breakpoint, write 0x0081 in to the EHCR (Event Handling Code Register) in the 'Processor (PROC) AXRs view". This moves the event handling flags for event 0x81 (KOKINPROC_EVENT_BP_UNDOCUMENTED_INSTR ) into the EHFR (Event Handling Flags Register). Now, write 0x0100 into the EHFR. This is the command to suspend the emulator when the selected event occurs (in this case, fetching an undocumented instruction opcode).

Unfortunately, this will cause a break whenever an undocumented instruction is encountered (which could be a lot if it's in a loop). At this time, there's no way around this. If Monitor Mode was implemented in version 0.03a, you could write a monitor program to track and count all the different undocumented instructions that were encountered. It's possible for me to do this with the prerelease version of MesaDX I'm currently working on. However, it'll take some effort (1. to write the monitor program itself, and 2.) to test all the various SMS ROM images) and I'm not sure how much time I can devote to it. I can try.

You can find more information about how to set these (unusual) kinds of breakpoints or how to trap on certain events in the MesaDX User's Guide (see sections 4.5 and 5.2). Also check the Kokin Library User's Manual, Appendix C for a list of all the supported events for each emulator device. I'm in the process of improving all the documentation, but in the mean time, here's the new URL for the MesaDX web-page: http://home.comcast.net/~mesadx/.

--
Eric R. Quinn
  View user's profile Send private message Visit poster's website
  • Joined: 06 Jan 2005
  • Posts: 89
  • Location: Namur (Wallonia)
Reply with quote
Post Posted: Thu Dec 29, 2005 7:35 pm
See also this page :

http://www.myquest.nl/z80undocumented/

Originally written by Sean Young (responsible for the MSX emulation in MESS), the document about the undocumented Z80 instructions is now maintained by Jan Wilmans (that is part of the MSX Sargon group and will soon release Nowind, a new MSX2 emulator)
  View user's profile Send private message Visit poster's website
  • Joined: 06 Jan 2005
  • Posts: 89
  • Location: Namur (Wallonia)
Reply with quote
Post Posted: Fri Jan 06, 2006 5:52 pm
The above mentioned page has emigrated to the Nowind site :

http://www.myquest.nl/nowind/?q=node/10
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!