1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-18 07:29:36 +00:00
cc65/libsrc/common/setjmp.s
uz 53dd513176 This commit was generated by cvs2svn to compensate for changes in r2,
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
2000-05-28 13:40:48 +00:00

53 lines
536 B
ArmAsm

;
; Ullrich von Bassewitz, 06.06.1998
;
; int setjmp (jmp_buf buf);
;
.export __setjmp
.importzp sp, ptr1
__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
lda #0
tax
rts