I created a simple perl script to help my co-worker to extract the opcode from some assembly source files.
-----------------------------
Sample Input:
Reset_Handler
$a
Init
0xc0200000: e59ff190 .... LDR pc,[pc,#400] ; [0xc0200198] = 0xc0200004
Instruct_2
0xc0200004: e59f0190 .... LDR r0,[pc,#400] ; [0xc020019c] = 0xc01e0000
0xc0200008: e321f0d1 ..!. MSR CPSR_c,#0xd1
Sample Output:
90
f1
9f
e5
//
90
01
9f
e5
//
d1
f0
21
e3
//
00
d0
40
e2
//
----------------------------------------------
My oneliner version:
perl -e 'map {print "$4\n$3\n$2\n$1\n//\n" if (/^\s+0x\S+:\s+(\S\S)(\S\S)(\S\S)(\S\S)\s+/);} <>; '