Compute from rjmp opcode the relative distance, in bytes, of rjmp destination to rjmp address
| 222 | |
| 223 | // Compute from rjmp opcode the relative distance, in bytes, of rjmp destination to rjmp address |
| 224 | int16_t ub_dist_rjmp(uint16_t rjmp) { |
| 225 | int16_t dist; |
| 226 | |
| 227 | dist = (int16_t)(rjmp<<4) >> 3; // Sign-extend 12-bit word distance and multiply by 2 |
| 228 | |
| 229 | return ub_rjmpdistwrap(dist+2); // Wraps around in flashes smaller than 8k |
| 230 | } |
| 231 | |
| 232 | // rjmp opcode from byte distance (rjmp address minus destination address); 0xcfff is an endless loop, 0xc000 is a nop |
| 233 | uint16_t ub_rjmp_opcode(int16_t dist) { |
nothing calls this directly
no test coverage detected