2 ; 1998-06-06, Ullrich von Bassewitz
3 ; 2015-09-11, Greg King
5 ; void __fastcall__ longjmp (jmp_buf buf, int retval);
10 .importzp sp, ptr1, ptr2
13 sta ptr2 ; Save retval
15 ora ptr2+1 ; Check for 0
17 inc ptr2 ; 0 is illegal, according to the standard ...
18 ; ... and, must be replaced by 1
19 @L1: jsr popax ; get buf
24 ; Get the old parameter stack
33 ; Get the old stack pointer
40 ; Get the return address and push it on the stack
48 ; Load the return value and return to the caller