diff --git a/src/demo.html b/src/demo.html index b578a0e3..cdcbfd44 100644 --- a/src/demo.html +++ b/src/demo.html @@ -88,6 +88,7 @@

MicroPython-micro:bit simulator example embedding

+ diff --git a/src/examples/inline_assembler.py b/src/examples/inline_assembler.py new file mode 100644 index 00000000..56cf82e8 --- /dev/null +++ b/src/examples/inline_assembler.py @@ -0,0 +1,12 @@ +from microbit import * + +# Unsupported in the simulator +@micropython.asm_thumb +def asm_add(r0, r1): + add(r0, r0, r1) + +while True: + if button_a.was_pressed(): + print(1 + 2) + elif button_b.was_pressed(): + print(asm_add(1, 2)) \ No newline at end of file diff --git a/src/mpconfigport.h b/src/mpconfigport.h index 24c1c717..852e2685 100644 --- a/src/mpconfigport.h +++ b/src/mpconfigport.h @@ -162,4 +162,7 @@ extern uint32_t rng_generate_random_word(void); #define MICROPY_MACHINE_MEM_GET_READ_ADDR machine_mem_get_read_addr #define MICROPY_MACHINE_MEM_GET_WRITE_ADDR machine_mem_get_write_addr +#define MICROPY_MAKE_POINTER_CALLABLE(p) \ + ((mp_raise_NotImplementedError(MP_ERROR_TEXT("simulator limitation: asm_thumb code"))), p) + #endif