1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-24 11:31:31 +00:00
cc65/libsrc/common/setjmp.s

51 lines
877 B
ArmAsm
Raw Normal View History

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