radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
20.81k stars 3.02k forks source link

Implement assembler for m68k #21211

Open lavedon opened 1 year ago

lavedon commented 1 year ago

Environment

Wed Dec 28 03:22:07 PM EST 2022
radare2 5.8.1 29769 @ linux-x86-64 git.5.7.8-780-g99b72288bf
commit: 99b72288bf01b736e69ea5271935ec8b1cc2d495 build: 2022-12-28__14:38:38
Linux x86_64

Description

Can not assemble with the m68k plugin

Test

Hello, I have the Motorolla 68000 plugin installed as shown by rasm2

The disassembly works fine but the assembler does not work.

 rasm2 -L
_de 8           6502        LGPL3   6502/NES analysis plugin
_de 32          amd29k      BSD     AMD 29k decoder
a__ 16 32 64    any.as      LGPL3   Uses system gnu/clang 'as' assembler (by pancake)
a__ 8 16 32 64  any.vasm    MIT     Use -a arm.vasm, 6502.vasm, 6809, c16x, jagrisc, m68k, pdp11, ppc, qnice, tr3200, vidcore, x86, z80 (by http://sun.hasenbraten.de/vasm/ (r2pm -ci vasm))
a__ 16 32 64    arm         LGPL3   custom thumb, arm32 and arm64 assembler (by pancake)
ade 4           i4004       LGPL3   i4004 decoder plugin (by pancake, condret)
_de 16          jdh8        LGPL3   jdh-8 toy architecture
_de 8 16 32 64  null        LGPL3   Fallback/Null archysis plugin
ade 8           pickle      BSD     Python Pickle Machine Disassembler
ade 32 64       riscv       GPL     RISC-V analysis plugin
_de 32          rsp         LGPL3   RSP code analysis plugin
_de 32          sh          LGPL3   SH-4 code analysis plugin
_de 8 16        snes        LGPL3   SNES analysis plugin (by pancake)
_de 32          v810        LGPL3   V810 code analysis plugin
ade 32          v850        MIT     V850 code analysis plugin
a__ 16 32 64    x86.nasm    LGPL3   X86 nasm assembler
a__ 16 32 64    x86.nz      LGPL3   x86 handmade assembler (by pancake)
_de 16          xap         LGPL3   XAP code analysis plugin (by pancake)
rasm2 -d -a m68k '10 39 00 A1 00 01'
move.b 0xa10001.l, d0

rasm2 -a m68k 'move.b 0xa10001.l, d0'
ERROR: Cannot assemble 'move.b 0xa10001.l, d0' at line 3

rasm2 -a m68k -b 16 'move.b 0xa10001.l, d0'
ERROR: Cannot assemble 'move.b 0xa10001.l, d0' at line 3

 rasm2 -a m68k -b 32 'move.b 0xa10001.l, d0'
ERROR: Cannot assemble 'move.b 0xa10001.l, d0' at line 3

x86 works fine:

rasm2 -a x86 'push ebp'
55

rasm2 -a x86 'push esp'
54

The -w feature does seem to work:

 rasm2 -a m68k -w tst
test operand

Thank you, thank you, THANK YOU!

trufae commented 1 year ago

Theres no assembler for m68k in r2. So i guess this is a feature request.

Use -LL to see the plugins you want. Eventually all will be moved into -L