x86 opcode, 8 bytes
fun:
call edx ; 2B
cmpxchg eax, ecx ; 3B, on 8086 use xchg and cmp instead
jnz fun ; 2B
ret ; 1B
Take input: ecx
(value x0
), edx
(function address, take input from ecx
, write result to eax
without modifying the value of ecx
and edx
)
8086 opcode, 7 bytes (but slow)
xor cx, cx
call dx
loop $-2
ret
If there exists a fixed point, looping 65536 times always drive it there.
Take input: ax
(initial value x0
), dx
(function address, take input from ax
, write output to ax
without modifying the value of cx
and dx
).
Output the fixed point in register ax
.