Today, 11:58 | #1 |
Registered User
Join Date: Apr 2019
Location: UK
Posts: 272
|
Disassembling/executing instructions with unused bits
How does the 68000 decode instructions with unused bits? Is this well-defined or undefined behaviour?
For example ORI.B $#ff,D1assembles to two words: 0001 00FF. The upper byte in the second word is not required to define the byte-sized instruction. What should happen if the CPU/disassembler/emulator encounters non-zero bits in there? For example: 0001 FFFF. Will the $ff00 bits in the second word simply be ignored (by the spec), or will the decoder class this as an illegal instruction. Sorry if this is in the manual - I couldn't find any information on it. Last edited by hop; Today at 11:59. Reason: Clarity |
Today, 13:54 | #2 |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,270
|
The unused bits are just ignored (by all M68K versions), same with 000/010 and the previously unused bits in the extension word (scale/full extension word bit). The latter is at least documented (68000PRM 2.4).
An emulator should obviously behave the same way or it will fail on actual code. A good disassembler will reproduce the original instruction, i.e. preserve the unused bits. Otherwise you can't reassemble the same binary. Maybe via a dc.w sequence if the original instruction can't be accurately re-used in context (e.g. for the extension word thing) |
Today, 14:48 | #3 |
Registered User
Join Date: Apr 2021
Location: Sydney
Posts: 8
|
You'd have to tell a disassembler which cpu the code was intended for, else it won't know the right thing to do with bits that are undefined on 68000 and used for something new on the 68020 or later.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Bug? Black Unused Display | Zilog | support.WinUAE | 4 | 28 October 2020 21:11 |
HDD: Wipe (Zero) unused Blocks | bladecgn | support.Apps | 7 | 01 November 2018 16:01 |
Error when executing PGA Europe | 1time | project.WHDLoad | 1 | 25 March 2010 18:57 |
Selling some unused parts | McVenco | MarketPlace | 3 | 18 October 2008 15:16 |
Unused Connectors/Ports | BippyM | support.Hardware | 16 | 26 July 2006 13:56 |
|
|