home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI09.ARJ / ictari.09 / ASSEMBLY / COOKFIND / G_COOKIE.S < prev   
Text File  |  1993-11-25  |  1KB  |  38 lines

  1. ;Get the value of a Cookie, if Cookie Jar exists
  2. ;ENTRY:    D0 = Cookie to look for (e.g. #"_SND")
  3. ;EXIT:    D0 = 0 if found, -1 if not found
  4. ;    D1 = Value of cookie (or zero if not found)
  5. ;USES:    Registers d0-d1/a0
  6.  
  7.         TEXT
  8. Get_cookie    move.l    d0,Get_cook_cook
  9.         move.l    #Get_cookie_sub,-(sp)
  10.         move.w    #38,-(sp)
  11.         trap    #14        ;execute in supervisor mode
  12.         addq.w    #6,sp
  13.         movem.l    Get_cook_cook,d0-d1
  14.         rts
  15.  
  16. Get_cookie_sub    move.w    #$5a0,a0    ;cookie pointer
  17.         move.l    Get_cook_cook,d0
  18.         clr.l    d1        ;empty value
  19.         tst.l    (a0)        ;any cookie jar?
  20.         beq.s    Get_cookie_fail
  21.         move.l    (a0),a0        ;cookie_jar
  22. Get_cookie_lp    move.l    (a0)+,d1    ;cookie val
  23.         cmp.l    d0,d1        ;one we want?
  24.         beq.s    Get_cookie_ok
  25.         tst.l    d1
  26.         beq.s    Get_cookie_fail    ;end of list
  27.         addq.w    #4,a0        ;next cookie
  28.         bra.s    Get_cookie_lp
  29. Get_cookie_ok    move.l    (a0)+,Get_cook_data    ;cookie value
  30.         clr.l    Get_cook_cook        ;value valid
  31.         rts        
  32. Get_cookie_fail    move.l    #-1,Get_cook_cook
  33.         rts
  34.  
  35.         BSS
  36. Get_cook_cook    ds.l    1    
  37. Get_cook_data    ds.l    1
  38.