summaryrefslogtreecommitdiff
path: root/py/asmthumb.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/asmthumb.c')
-rw-r--r--py/asmthumb.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/py/asmthumb.c b/py/asmthumb.c
index e3558b2cf..f7ac87fa0 100644
--- a/py/asmthumb.c
+++ b/py/asmthumb.c
@@ -564,6 +564,18 @@ void asm_thumb_bcc_label(asm_thumb_t *as, int cond, uint label) {
}
}
+void asm_thumb_bcc_rel9(asm_thumb_t *as, int cond, int rel) {
+ rel -= 4; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
+ assert(SIGNED_FIT9(rel));
+ asm_thumb_op16(as, OP_BCC_N(cond, rel));
+}
+
+void asm_thumb_b_rel12(asm_thumb_t *as, int rel) {
+ rel -= 4; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
+ assert(SIGNED_FIT12(rel));
+ asm_thumb_op16(as, OP_B_N(rel));
+}
+
#define OP_BLX(reg) (0x4780 | ((reg) << 3))
#define OP_SVC(arg) (0xdf00 | (arg))