aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-10-15 19:37:09 +0200
committerAyke van Laethem <[email protected]>2018-10-15 19:37:09 +0200
commit392bba8394ece9e8b90ee2d6e82590b1492bc62d (patch)
tree8ed23edd34d89cd52c64bd24287bf38636950b7e /docs
parent52199f4a14c20cda8c2c33227b5a1d5b593c2934 (diff)
downloadtinygo-392bba8394ece9e8b90ee2d6e82590b1492bc62d.tar.gz
tinygo-392bba8394ece9e8b90ee2d6e82590b1492bc62d.zip
compiler: add support for parameters to inline assembly
Diffstat (limited to 'docs')
-rw-r--r--docs/microcontrollers.rst21
1 files changed, 19 insertions, 2 deletions
diff --git a/docs/microcontrollers.rst b/docs/microcontrollers.rst
index 7509190d8..0e764643a 100644
--- a/docs/microcontrollers.rst
+++ b/docs/microcontrollers.rst
@@ -113,8 +113,25 @@ The device-specific packages like ``device/avr`` and ``device/arm`` provide
arm.Asm("wfi")
-There is no support yet for inline assembly that takes (register) parameters or
-returns a value.
+You can also pass parameters to the inline assembly::
+
+ var result int32
+ arm.AsmFull(`
+ lsls {value}, #1
+ str {value}, {result}
+ `, map[string]interface{}{
+ "value": 42,
+ "result": &result,
+ })
+ println("result:", result)
+
+In general, types are autodetected. That is, integer types are passed as raw
+registers and pointer types are passed as memory locations. This means you can't
+easily do pointer arithmetic. To do that, convert a pointer value to a
+``uintptr``.
+
+Inline assembly support is expected to change in the future and may change in a
+backwards-incompatible manner.
Harvard architectures (AVR)