From: Greg King Date: Fri, 11 Sep 2015 18:18:22 +0000 (-0400) Subject: Improved longjmp() and setjmp(). X-Git-Tag: V2.16~232^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dbf0adcec962c35d2ba7c31b8ba91ded8b7e709a;p=cc65 Improved longjmp() and setjmp(). --- diff --git a/libsrc/common/longjmp.s b/libsrc/common/longjmp.s index a89f97fa0..e9bac42e6 100644 --- a/libsrc/common/longjmp.s +++ b/libsrc/common/longjmp.s @@ -1,7 +1,8 @@ ; -; 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 @@ -13,8 +14,8 @@ _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 @@ -49,4 +50,3 @@ _longjmp: lda ptr2 ldx ptr2+1 rts - diff --git a/libsrc/common/setjmp.s b/libsrc/common/setjmp.s index a6448b29f..a763ac3ec 100644 --- a/libsrc/common/setjmp.s +++ b/libsrc/common/setjmp.s @@ -1,10 +1,13 @@ ; -; 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: @@ -44,9 +47,4 @@ __setjmp: ; Return zero - lda #0 - tax - rts - - - + jmp return0