Mercurial > lcfOS
diff python/cortexm3.py @ 251:6ed3d3a82a63
Added another c3 example. First import attempt
author | Windel Bouwman |
---|---|
date | Mon, 29 Jul 2013 20:23:13 +0200 |
parents | 90637d1bbfad |
children | 04c19282a5aa |
line wrap: on
line diff
--- a/python/cortexm3.py Sun Jul 28 19:07:51 2013 +0200 +++ b/python/cortexm3.py Mon Jul 29 20:23:13 2013 +0200 @@ -487,6 +487,20 @@ h = (0b11100 << 11) | imm11 # | 1 # 1 to enable thumb mode return u16(h) +@armtarget.instruction +class bl_ins(jumpBase_ins): + mnemonic = 'BL' + def encode(self): + imm32 = wrap_negative(self.offset >> 1, 32) + imm11 = imm32 & 0x7FF + imm10 = (imm32 >> 11) & 0x3FF + j1 = 1 # TODO: what do these mean? + j2 = 1 + s = (imm32 >> 24) & 0x1 + h1 = (0b11110 << 11) | (s << 10) | imm10 + h2 = (0b1101 << 12) | (j1 << 13) | (j2 << 11) | imm11 + return u16(h1) + u16(h2) + class cond_base_ins(jumpBase_ins): def encode(self): imm8 = wrap_negative(self.offset >> 1, 8)