2000-05-28 13:40:48 +00:00
|
|
|
;
|
2015-09-11 18:18:22 +00:00
|
|
|
; 1998-06-06, Ullrich von Bassewitz
|
|
|
|
; 2015-09-11, Greg King
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
2022-08-28 18:05:11 +00:00
|
|
|
; int __fastcall__ __setjmp (jmp_buf buf);
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
|
2022-08-28 18:05:11 +00:00
|
|
|
.export ___setjmp
|
2015-09-11 18:18:22 +00:00
|
|
|
|
|
|
|
.import return0
|
2013-05-09 11:56:54 +00:00
|
|
|
.importzp sp, ptr1
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2022-08-28 18:05:11 +00:00
|
|
|
___setjmp:
|
2013-05-09 11:56:54 +00:00
|
|
|
sta ptr1 ; Save buf
|
|
|
|
stx ptr1+1
|
|
|
|
ldy #0
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; The parameter stack is now empty, put it into buf
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
lda sp
|
|
|
|
sta (ptr1),y
|
|
|
|
iny
|
|
|
|
lda sp+1
|
|
|
|
sta (ptr1),y
|
|
|
|
iny
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Put the return stack pointer next
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
tsx
|
|
|
|
inx
|
|
|
|
inx ; drop return address
|
|
|
|
txa
|
|
|
|
sta (ptr1),y
|
|
|
|
iny
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Last thing is the return address.
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
pla
|
|
|
|
tax
|
|
|
|
pla
|
|
|
|
sta (ptr1),y ; high byte first
|
|
|
|
iny
|
|
|
|
pha
|
|
|
|
txa
|
|
|
|
sta (ptr1),y
|
|
|
|
pha
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
; Return zero
|
|
|
|
|
2015-09-11 18:18:22 +00:00
|
|
|
jmp return0
|