home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
mint
/
mntlib16.lzh
/
MNTLIB16
/
SETJMP.CPP
< prev
next >
Wrap
Text File
|
1993-08-03
|
848b
|
40 lines
|
| setjmp.cpp
|
.text
.even
.globl _setjmp
_setjmp:
movel sp@(4),a0 | address of jmp_buf[]
movel sp@,a0@ | save return address
moveml d2-d7/a2-a7,a0@(4) | save registers d2-d7/a2-a7
clrl d0 | return value is 0
rts
.globl _longjmp
.globl ___mint
_longjmp:
#ifdef __MSHORT__
tstw ___mint | see if MiNT is active
#else
tstl ___mint
#endif
beq NOMINT | no -- do not call sigreturn
movew #0x11a, sp@- | Psigreturn() system call
trap #1 | (ignored if not in a sig handler)
addqw #2, sp
NOMINT:
movel sp@(4),a0 | address of jmp_buf[]
#ifdef __MSHORT__
movew sp@(8),d0 | value to return
#else
movel sp@(8),d0 | value to return
#endif
bne L1 | may not be 0
movl #1, d0
L1:
moveml a0@(4),d2-d7/a2-a7 | restore saved reggies
movl a0@,sp@ | and the saved return address
rts