How to handle undocumented opcodes

Nick Clifton nickc@redhat.com
Mon Oct 10 15:40:00 GMT 2005


Hi Arnold,

> I use different machine numbers to distinguish between z80 code 
> with and without undocumented instructions. My current naming 
> scheme for processor variants is:
> z80strict - only documented Z80 instructions
> z80       - adds support for undocumented instructions that are
> 	legal on R800
> z80full   - all Z80 instructions
> r800      - documented r800 instructions

What is the difference between "z80" and "z80full" ?

> I'm not completely satisfied with this scheme as it may be too 
> finegrained, and "z80" should probably refer to the documented 
> instructions only.

If the undocumented instructions are actually well known and used then I 
think that it is fair that you include them in the default z80 target.

> Are there any standards or conventions I should adhere to? 

No :-)  But in general you should try to make your port both flexible 
and functional.  So by default I would recommend accepting all Z80 
instructions, but producing a warning when assembling undocumented 
instructions.  Provide a command line switch to disable the warnings, 
and a separate switch to enforce strict adherence to the Z80 
specification (ie effectively turning the warnings into errors).

The disassembler should be agnostic - it should disassemble anything.

The linker ought to accept mixed (Z80) format input files, but select 
the output format based on the most permissive of the input formats.

Cheers
   Nick



More information about the Binutils mailing list