mirror of
https://github.com/cc65/cc65.git
synced 2024-08-27 11:29:12 +00:00
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://svn.cc65.org/cc65/trunk@3 b7a2c559-68d2-44c3-8de9-860c34a00d81
49 lines
590 B
ArmAsm
49 lines
590 B
ArmAsm
;
|
|
; Ullrich von Bassewitz, 06.06.1998
|
|
;
|
|
; void longjmp (jmp_buf buf, int retval);
|
|
;
|
|
|
|
.export _longjmp
|
|
.import popax
|
|
.importzp sp, ptr1, ptr2
|
|
|
|
_longjmp:
|
|
sta ptr2 ; Save retval
|
|
stx ptr2+1
|
|
jsr popax ; get buf
|
|
sta ptr1
|
|
stx ptr1+1
|
|
ldy #0
|
|
|
|
; Get the old parameter stack
|
|
|
|
lda (ptr1),y
|
|
iny
|
|
sta sp
|
|
lda (ptr1),y
|
|
iny
|
|
sta sp+1
|
|
|
|
; Get the old stack pointer
|
|
|
|
lda (ptr1),y
|
|
iny
|
|
tax
|
|
txs
|
|
|
|
; Get the return address and push it on the stack
|
|
|
|
lda (ptr1),y
|
|
iny
|
|
pha
|
|
lda (ptr1),y
|
|
pha
|
|
|
|
; Load the return value and return to the caller
|
|
|
|
lda ptr2
|
|
ldx ptr2+1
|
|
rts
|
|
|