English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old Today, 11:58   #1
hop
Registered User
 
hop's Avatar
 
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,D1
assembles 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
hop is offline  
Old Today, 13:54   #2
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,269
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)
paraj is offline  
Old Today, 14:48   #3
jimshaw
Registered User
 
jimshaw's Avatar
 
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.
jimshaw is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 19:20.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.06559 seconds with 15 queries