# Romhacking.net

## Romhacking => Programming => Topic started by: DPMHHacker on January 25, 2020, 03:20:57 pm

Title: 68000 Syntax question
Post by: DPMHHacker on January 25, 2020, 03:20:57 pm
(0x0,A0,D0*0x1),(DAT_00ffc7ea)
What does this mean?
Title: Re: 68000 Syntax question
Post by: RadioTails 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)

D0 = Data Register 2

(DAT_00ffc7ea) is the offset where the label DAT_00ffc7ea is in the disassembly.
Title: Re: 68000 Syntax question
Post by: Anime_World on August 31, 2020, 06:48:20 pm

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 (http://mrhelmi.tripod.com/simulator)/ and https://web.archive.org/web/20200219135847/http://www.easy68k.com/index.html (https://web.archive.org/web/20200219135847/http://www.easy68k.com/index.html)