Function SetAsm(asm As *Byte, codesize As Long) As VoidPtr
SetAsm=VirtualAlloc(NULL, codesize, MEM_COMMIT, PAGE_EXECUTE_READWRITE) '追加
memcpy(SetAsm,asm,codesize)
End Function

Sub FreeAsm(func As VoidPtr)
VirtualFree(func, 0, MEM_DECOMMIT or MEM_RELEASE) '追加
End Sub

'機械語コード(_stdcall)
Dim asm[ELM(40)]=[
&h55, &h8B, &hEC, &h51, &h8B, &h45, &h08, &h8B, &h08, &h89,
&h4D, &hFC, &h8B, &h55, &h08, &h8B, &h45, &h0C, &h8B, &h08,
&h89, &h0A, &h8B, &h55, &h0C, &h8B, &h45, &hFC, &h89, &h02,
&h8B, &hE5, &h5D, &hC2, &h08, &h00, &hCC, &hCC, &hCC, &hCC
] As Byte

'プロトタイプ
Dim swap As *Sub(p1 As *Long, p2 As *Long)

#N88BASIC
Dim a As Long, b As Long
swap = SetAsm(asm, ELM(40))
a=666:b=893
Print a;b
swap(VarPtr(a),VarPtr(b))
Print a;b
FreeAsm(swap)