diff --git a/docs/reference/asm_thumb2_hints_tips.rst b/docs/reference/asm_thumb2_hints_tips.rst index 119bf980ec947c043c130fef162fd0d799494c0c..f0826e47ef880671b61de27d3519a067e552f224 100644 --- a/docs/reference/asm_thumb2_hints_tips.rst +++ b/docs/reference/asm_thumb2_hints_tips.rst @@ -78,11 +78,23 @@ three arguments, which must (if used) be named ``r0``, ``r1`` and ``r2``. When the code executes the registers will be initialised to those values. The data types which can be passed in this way are integers and memory -addresses. With current firmware all possible 32 bit values may be passed. -Returned integers are restricted in that the top two bits must be identical, -limiting the range to -2**30 to 2**30 -1. The limitations on number of arguments -and return values can be overcome by means of the ``array`` module which enables -any number of values of any type to be accessed. +addresses. With current firmware all possible 32 bit values may be passed and +returned. If the return value may have the most significant bit set a Python +type hint should be employed to enable MicroPython to determine whether the +value should be interpreted as a signed or unsigned integer: types are +``int`` or ``uint``. + +:: + + @micropython.asm_thumb + def uadd(r0, r1) -> uint: + add(r0, r0, r1) + +``hex(uadd(0x40000000,0x40000000))`` will return 0x80000000, demonstrating the +passing and return of integers where bits 30 and 31 differ. + +The limitations on the number of arguments and return values can be overcome by means +of the ``array`` module which enables any number of values of any type to be accessed. Multiple arguments ~~~~~~~~~~~~~~~~~~