;
-; Ullrich von Bassewitz, 06.06.1998
+; 1998-06-06, Ullrich von Bassewitz
+; 2015-09-11, Greg King
 ;
-; void longjmp (jmp_buf buf, int retval);
+; void __fastcall__ longjmp (jmp_buf buf, int retval);
 ;
 
         .export         _longjmp
         stx     ptr2+1
         ora     ptr2+1          ; Check for 0
         bne     @L1
-        lda     #1              ; 0 is illegal according to the standard...
-        sta     ptr2            ; ... and must be replaced by 1
+        inc     ptr2            ; 0 is illegal, according to the standard ...
+                                ; ... and, must be replaced by 1
 @L1:    jsr     popax           ; get buf
         sta     ptr1
         stx     ptr1+1
         lda     ptr2
         ldx     ptr2+1
         rts
-
 
 ;
-; Ullrich von Bassewitz, 06.06.1998
+; 1998-06-06, Ullrich von Bassewitz
+; 2015-09-11, Greg King
 ;
-; int setjmp (jmp_buf buf);
+; int __fastcall__ setjmp (jmp_buf buf);
 ;
 
         .export         __setjmp
+
+        .import         return0
         .importzp       sp, ptr1
 
 __setjmp:
 
 ; Return zero
 
-        lda     #0
-        tax
-        rts
-
-
-  
+        jmp     return0