home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / mntlib25.zoo / lattice / setjmp.s < prev    next >
Text File  |  1992-06-15  |  853b  |  41 lines

  1. ;
  2. ; setjmp.cpp 
  3. ;
  4.     text
  5.     even
  6.     xdef    _setjmp
  7. _setjmp:
  8.     move.l    4(sp),a0        ; address of jmp_buf[]
  9.     move.l    (sp),(a0)        ; save return address
  10.     movem.l    d2-d7/a2-a7,4(a0)    ; save registers d2-d7/a2-a7
  11.     clr.l    d0            ; return value is 0
  12.     rts
  13.  
  14.     xdef    _longjmp
  15.     xref    ___mint
  16.  
  17. _longjmp:
  18.     IFD    __MSHORT__
  19.     tst.w    ___mint            ; see if MiNT is active
  20.     ELSE
  21.     tst.l    ___mint
  22.     ENDC
  23.     beq.s    NOMINT            ; no -- do not call sigreturn
  24.     move.w    #$11a,-(sp)        ; Psigreturn() system call
  25.     trap    #1            ; (ignored if not in a sig handler)
  26.     addq.w    #2,sp
  27. NOMINT:
  28.     move.l    4(sp),a0        ; address of jmp_buf[]
  29.     IFD    __MSHORT__
  30.     move.w    8(sp),d0        ; value to return
  31.     ELSE
  32.     move.l    8(sp),d0        ; value to return
  33.     ENDC
  34.     bne.s    L1            ; may not be 0
  35.     move.l    #1,d0
  36. L1:
  37.     movem.l    4(a0),d2-d7/a2-a7    ; restore saved reggies
  38.     move.l    (a0),(sp)        ; and the saved return address
  39.     rts
  40.     end
  41.