radare2/libr/asm/t/test.arm
pancake 8846cb79cf Pass t/test.arm, new cmd !123 to run historic command
Fix all opcode constructions listed in t/test.arm
Add 'hlt' opcode for arm.
Minor changes in arm disassembly output
Typing !#number you re-run the command in !history
!history is now listed (! is an alias)
Added API to access history from dietline
2013-03-14 02:32:53 +01:00

48 lines
818 B
Bash
Executable File

#!/bin/sh
AS=arm
foo() {
A=$(rasm2 -a arm -b ${BITS} "$1")
B=$(rasm2 -d -a arm -b ${BITS} "$A" | cut -d ';' -f 1 | sed -e 's,\ *$,,g')
if [ "${1}" = "${B}" ]; then
printf "OK %s %20s %20s\n" "$A" "$B" "$1"
else
printf "FAILED %s %20s %20s\n" "$A" "$B" "$1"
fi
}
if [ -n "$1" ]; then
foo "$1"
exit 0
fi
BITS=32
# arm32
foo 'bkpt 0x0000'
foo 'svc 0x1024'
foo 'hlt 0x1024'
foo 'hlt 0x1234'
#foo 'cmp r7, 1338'
#foo 'cmp r7, 666'
foo 'cmp r7, 0xfe'
foo 'cmp r7, 0x20'
foo 'tst r4, r5' # e1140505
foo 'tst r4, r5, lsl 10' # e1140505
foo 'cmp r1, r2'
foo 'cmp r1, r2, lsl r3'
foo 'cmp sl, fp, lsl r3'
foo 'cmp sl, fp, ror r1'
foo 'mvn r4, 0x21' # e3e04020
foo 'add r2, r2, r1'
foo 'mov r2, 0x21'
foo 'mov r2, 0x21'
foo 'sub r1, r3, r3'
foo 'push {r1, r2}'
foo 'bx r3'
foo 'blx r4'
# thumb
BITS=16