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 popptr1 ; get buf
20 ; ldy #0 is guaranteed by popptr1
22 ; Get the old parameter stack
31 ; Get the old stack pointer
38 ; Get the return address and push it on the stack
46 ; Load the return value and return to the caller