Author Topic: [solved] Help what 68000 instruction is that OoCode  (Read 3631 times)

0 Members and 1 Guest are viewing this topic.

Offline peluleTopic starter

  • Frequent Contributor
  • **
  • Posts: 513
  • Country: de
  • What is business? It’s other people’s money
[solved] Help what 68000 instruction is that OoCode
« on: April 02, 2017, 09:31:46 pm »
I am working an analysing a 68k firmware and become confused regarding which instruction is the following opcode:
The following opcode

---ADR----- ---OPCODE---
000007A8 2E78 0000
000007AC 2C78 0004

give following disassembler and assembler outputs

ES-1800 in-circuit emulator:
   000007A8 2E78 0000                      MOVE.L   $0,A7
   000007AC 2C78 0004                      MOVE.L   $4,A6
dis68k program:
   000007A8 2E78 0000                       MOVEA.L  $0,A7
   000007AC 2C78 0004                       MOVEA.L  $4,A6
The ONDA online disassembler:
   000007a8 2e 78 00 00                     moveal 0x00000000,%sp
   000007ac 2c 78 00 04                     moveal 0x00000004,%fp
The masm68k generates the following:
   0007A8 2E79 0000 0000                 MOVE.L    $0,A7            ;    assembler output
   0007A8 2E79 0000 0000                 MOVEA.L   $0,A7            ;    assembler output
   0007AC 2C79 0000 0004                 MOVE.L    $4,A6            ;    assembler output
   0007AC 2C79 0000 0004                 MOVEA.L   $4,A6            ;    assembler output

Link to 68k Programmers Reference: http://www.nxp.com/files/archives/doc/ref_manual/M68000PRM.pdf

Both, the 68k Programmers Reference and the 68k Opcode Table are not helping.
Any experiance 68k fellow out there, ablle to help?
/PeLuLe
« Last Edit: April 04, 2017, 05:13:58 pm by pelule »
You will learn something new every single day
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Help what 68000 instruction is that OoCode
« Reply #1 on: April 02, 2017, 10:42:36 pm »
2E78 is a MOVE LONG IMMEDIATE Absolute Short 0 -> Address Register 7

Break down the instruction like it's shown in the map (starting from the high order bit)

00 10 111 001 111 000 - 0x2E78

00   -> MOVE
10   -> LONG
111 -> Register 7 is the destination
001 -> Address Register - so A7
111 -> IMMEDIATE
000 -> Absolute Short

followed by the constant 0x0000

http://www.scarpaz.com/Attic/Didattica/Scarpazza-2005-68k-1-addressing.pdf
 

Offline helius

  • Super Contributor
  • ***
  • Posts: 3640
  • Country: us
Re: Help what 68000 instruction is that OoCode
« Reply #2 on: April 02, 2017, 11:21:18 pm »
The Motorola standard assembly code would be MOVEA.L   #0,A7. The 68000 makes the distinction between "data writeable" and "address writeable" operands, because "data" writes update the condition codes, and "address" writes do not. Typically, each instruction can update either address registers or data, but not both (there are a few exceptions to this rule, like ADDQ and SUBQ). Moving a word into an address register requires a MOVEA instruction; with the .L size field, it affects all 32 bits of the destination A register. (The .W size field would only affect the lower 16 bits.)
You will see different syntax and mnemonics with different assembler tools since they follow different conventions. Besides Motorola, the Intel and AT&T conventions were also widespread, and the portability of software like Unix meant that they were adapted for the 68000. Another thing to keep in mind is that assemblers include "pseudo-opcodes": mnemonics that are not translated literally into machine language, but expand into sequences of other instructions, possibly conditionally. Many assemblers would automatically amend MOVE.L  #0,A6 to MOVEA.L #0,A6 because address registers always require MOVEA and this is a simple substitution that shouldn't cause an error.
« Last Edit: April 02, 2017, 11:26:20 pm by helius »
 

Offline Bruce Abbott

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: nz
    • Bruce Abbott's R/C Models and Electronics
Re: Help what 68000 instruction is that OoCode
« Reply #3 on: April 03, 2017, 04:35:40 am »
   000007AC 2C78 0004                      MOVE.L   $4,A6
According to my disassembler, this is:-

Code: [Select]
MOVE.L $0004.W, A6
The '.W' is necessary to distinguish between Word and Long immediate operands. This syntax is accepted by Hisoft Devpac. I don't know about masm68k (never heard of it and Google isn't helping).

 
 

Offline peluleTopic starter

  • Frequent Contributor
  • **
  • Posts: 513
  • Country: de
  • What is business? It’s other people’s money
Re: Help what 68000 instruction is that OoCode
« Reply #4 on: April 03, 2017, 06:07:47 pm »
Many thanks for the great help - both instruction work:
  000007A8 2E78 0000                     MOVE.L $0000.W, A7
  000007AC 2C78 0004                     MOVE.L $0004.W, A6
The masm68k  generates the correct code..
It is the Motorola MSDOS running 68000 makro cross-assembler V2.53 from 1989 (supporting 68000/68010/680020))
The Motorola Programmer Reference is not that clear on that instruction option.

I checked the reference table before. It leads to the MOVEA instruction, but the .W immediate adress option is not mentioned.


I sadly remember the great Philips documentation for the MCS-51 family. Not just listed all possible combination but also showed suitable examples.
« Last Edit: April 03, 2017, 06:10:10 pm by pelule »
You will learn something new every single day
 

Offline ale500

  • Frequent Contributor
  • **
  • Posts: 415
Re: Help what 68000 instruction is that OoCode
« Reply #5 on: April 03, 2017, 06:42:13 pm »
Quote
The '.W' is necessary to distinguish between Word and Long immediate operands.

It is not an immediate operand but a word address, mode is 111 and register 000. Absolute short addressing mode: it loads from that sign-extended address.
 

Offline Bruce Abbott

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: nz
    • Bruce Abbott's R/C Models and Electronics
Re: Help what 68000 instruction is that OoCode
« Reply #6 on: April 04, 2017, 04:51:39 am »
It is not an immediate operand but a word address
You're right! (immediate would have a '#' in front of the number). It's been a while since I programmed the 68000 and it's hard to remember all the variations between different CPUs!

So I cranked up the old Amiga 1200 and amazingly it still goes. Browsed through the assembler source I wrote in 1997, and it was like looking at someone else's code. Might get back into it if I can think of a good excuse reason... after finishing this Z80 project I am working on. :)


 
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf