News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: 68000 Syntax question  (Read 1163 times)

DPMHHacker

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
68000 Syntax question
« on: January 25, 2020, 03:20:57 pm »
(0x0,A0,D0*0x1),(DAT_00ffc7ea)
What does this mean?

RadioTails

  • Sr. Member
  • ****
  • Posts: 350
  • Holding the Mega Drive controller
    • View Profile
Re: 68000 Syntax question
« Reply #1 on: February 05, 2020, 07:50:16 am »
Well you've not given much to work with. Is it a Add, Compare, Move, etc.?

The first part looks like it is adding values: 0 + A0 + (D0 x 1)

A0 = Address Register 1
D0 = Data Register 2

(DAT_00ffc7ea) is the offset where the label DAT_00ffc7ea is in the disassembly.
Avatar by LazyNinjartist

Anime_World

  • RHDN Patreon Supporter!
  • Jr. Member
  • *****
  • Posts: 32
    • View Profile
Re: 68000 Syntax question
« Reply #2 on: August 31, 2020, 06:48:20 pm »
It's an addressing mode called "Indirect addressing with index and displacement"

Code: [Select]
(x,An,Dn*scale)
x = Index, an 16-bit immediate value
An = An Address Register (A0,A1,A2,A3,A5,A5,A6,A7)
Dn = An Data Register (D0,D1,D2,D3,D4,D5,D6,D7)
scale = an 4-bit immediate value which can be 1, 2, 4, or 8. Can use .b,.w,.l,.s too.

Which points to content inside resultant address obtained by the sum of values:
Code: [Select]
x+An+Dn
Example:
Code: [Select]
example_prg:
        ; put cursor at start of RAM and fill with some bytes
        movea.l #$FF0000,A0
        move.W #$0004,D0
        move.l #$10203040,(A0)+
        move.l #$50607080,(A0)+
        ; put cursor at start of RAM again
        movea.l #$FF0000,A0
        ; move a content using the indirect address mode
        ; with index and displacement to offset 0x40 of the RAM
        move ($2,A0,D0),($FF0040)
        ; After this instruction the value in offset 0x40 of the RAM
        ; will be the same as 0x6 of the RAM, which is 7080

-
You can use a m68k simulator to learn and understand all addressing modes or opcodes
Like: http://mrhelmi.tripod.com/simulator/ and https://web.archive.org/web/20200219135847/http://www.easy68k.com/index.html




« Last Edit: September 04, 2020, 02:35:04 pm by Anime_World »