Calling arbitrary assembly code
Factor handbook > C library interface

Prev:Accessing C global variables
Next:DLL handles


It is possible to write a word whose body consists of arbitrary assembly code. The assembly receives parameters and returns values as per the platform's ABI; marshalling and unmarshalling Factor values is taken care of by the C library interface, as with alien-invoke.

Assembler opcodes are defined in CPU-specific vocabularies:
cpu.arm.assembler
cpu.ppc.assembler
cpu.x86.assembler

The combinator for generating arbitrary assembly by calling a quotation at compile time:
alien-assembly ( args... return parameters abi quot -- return... )