This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to handle undocumented opcodes


Op maandag 10 oktober 2005 17:50, schreef Nick Clifton:
> 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" ?
>

"z80full" allows undocumented instructions that work on z80,but 
not on r800 and "z80" does not. 

The instructions that are undocumented on z80 and documented on 
r800 are the instructions that operate on a byte within  a 
16-bit indexregister, and an io-read that only affects the 
flag-register.

The undocumented z80-instructions that do not work on r800 are 
considered less useful. They include things like 
sli r ; r = (r<<1) +1
sla (ix+5),r ; ix[5] = r = ix[5]<<1 

> > 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).
>
This would result in the machine type only being known after 
assembling the source, I guess that would be ok.

> 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.
>
There is only a partial ordening, should linking "r800" with 
"z80full" result in "z80any" 

> Cheers
>    Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]