Merge pull request #208 from greg-king5/big-jump
Improve the longjmp() and setjmp() functions.
This commit is contained in:
@@ -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
|
.export _longjmp
|
||||||
@@ -13,8 +14,8 @@ _longjmp:
|
|||||||
stx ptr2+1
|
stx ptr2+1
|
||||||
ora ptr2+1 ; Check for 0
|
ora ptr2+1 ; Check for 0
|
||||||
bne @L1
|
bne @L1
|
||||||
lda #1 ; 0 is illegal according to the standard...
|
inc ptr2 ; 0 is illegal, according to the standard ...
|
||||||
sta ptr2 ; ... and must be replaced by 1
|
; ... and, must be replaced by 1
|
||||||
@L1: jsr popax ; get buf
|
@L1: jsr popax ; get buf
|
||||||
sta ptr1
|
sta ptr1
|
||||||
stx ptr1+1
|
stx ptr1+1
|
||||||
@@ -49,4 +50,3 @@ _longjmp:
|
|||||||
lda ptr2
|
lda ptr2
|
||||||
ldx ptr2+1
|
ldx ptr2+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
.export __setjmp
|
||||||
|
|
||||||
|
.import return0
|
||||||
.importzp sp, ptr1
|
.importzp sp, ptr1
|
||||||
|
|
||||||
__setjmp:
|
__setjmp:
|
||||||
@@ -44,9 +47,4 @@ __setjmp:
|
|||||||
|
|
||||||
; Return zero
|
; Return zero
|
||||||
|
|
||||||
lda #0
|
jmp return0
|
||||||
tax
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user