circuitpython/tests/inlineasm/asmargs.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
498 B
Python
Raw Normal View History

# test passing arguments
2021-03-15 09:57:36 -04:00
@micropython.asm_thumb
def arg0():
mov(r0, 1)
2021-03-15 09:57:36 -04:00
print(arg0())
2021-03-15 09:57:36 -04:00
@micropython.asm_thumb
def arg1(r0):
add(r0, r0, 1)
2021-03-15 09:57:36 -04:00
print(arg1(1))
2021-03-15 09:57:36 -04:00
@micropython.asm_thumb
def arg2(r0, r1):
add(r0, r0, r1)
2021-03-15 09:57:36 -04:00
print(arg2(1, 2))
2021-03-15 09:57:36 -04:00
@micropython.asm_thumb
def arg3(r0, r1, r2):
add(r0, r0, r1)
add(r0, r0, r2)
2021-03-15 09:57:36 -04:00
print(arg3(1, 2, 3))
2021-03-15 09:57:36 -04:00
@micropython.asm_thumb
def arg4(r0, r1, r2, r3):
add(r0, r0, r1)
add(r0, r0, r2)
add(r0, r0, r3)
2021-03-15 09:57:36 -04:00
print(arg4(1, 2, 3, 4))