Skip to content

Commit 8af5e25

Browse files
committed
py/asmarm: Add asm_arm_ldrh_reg_reg_offset() helper func.
Signed-off-by: Damien George <[email protected]>
1 parent 94ae023 commit 8af5e25

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

py/asmarm.c

+5
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ void asm_arm_ldrh_reg_reg(asm_arm_t *as, uint rd, uint rn) {
304304
emit_al(as, 0x1d000b0 | (rn << 16) | (rd << 12));
305305
}
306306

307+
void asm_arm_ldrh_reg_reg_offset(asm_arm_t *as, uint rd, uint rn, uint byte_offset) {
308+
// ldrh rd, [rn, #off]
309+
emit_al(as, 0x1f000b0 | (rn << 16) | (rd << 12) | ((byte_offset & 0xf0) << 4) | (byte_offset & 0xf));
310+
}
311+
307312
void asm_arm_ldrb_reg_reg(asm_arm_t *as, uint rd, uint rn) {
308313
// ldrb rd, [rn]
309314
emit_al(as, 0x5d00000 | (rn << 16) | (rd << 12));

py/asmarm.h

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ void asm_arm_asr_reg_reg(asm_arm_t *as, uint rd, uint rs);
109109
// memory
110110
void asm_arm_ldr_reg_reg(asm_arm_t *as, uint rd, uint rn, uint byte_offset);
111111
void asm_arm_ldrh_reg_reg(asm_arm_t *as, uint rd, uint rn);
112+
void asm_arm_ldrh_reg_reg_offset(asm_arm_t *as, uint rd, uint rn, uint byte_offset);
112113
void asm_arm_ldrb_reg_reg(asm_arm_t *as, uint rd, uint rn);
113114
void asm_arm_str_reg_reg(asm_arm_t *as, uint rd, uint rm, uint byte_offset);
114115
void asm_arm_strh_reg_reg(asm_arm_t *as, uint rd, uint rm);

0 commit comments

Comments
 (0)