home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Amiga / Workbench / Patches / ksc_Wildstar.lha / Wildstar.asm < prev    next >
Assembly Source File  |  1998-04-08  |  2KB  |  117 lines

  1. ; Wildstar 1.1 : Makes * equal to #? in filepatterns
  2. ; by Kyzer/CSG
  3. ; $VER: Wildstar.asm 1.1 (08.04.98)
  4. ;
  5.     incdir    include:
  6.     include    lvo/exec_lib.i
  7.     include    lvo/dos_lib.i
  8.     include    dos/dosextens.i
  9.  
  10. stackf    MACRO    ; stack_symbol, stackelement_symbol
  11.     IFND    \1
  12. \1    set    0
  13.     ENDC
  14. \1    set    \1-4
  15. \2    equ    \1
  16.     ENDM
  17.  
  18. print    MACRO
  19.     lea    \1,a4
  20.     move.l    a4,d1
  21.     IFNC    '\2',''
  22.     lea    \2,a4
  23.     move.l    a4,d2
  24.     ENDC
  25.     jsr    _LVOVPrintf(a6)
  26.     ENDM
  27.  
  28.     stackf    stackframe, swtoggle
  29.     stackf    stackframe, swoff
  30.     stackf    stackframe, swon
  31.     stackf    stackframe, rdargs
  32.     stackf    stackframe, arg2
  33.     stackf    stackframe, arg1
  34.     stackf    stackframe, retcode    
  35.  
  36.     move.l    4.w,a6
  37.     lea    dosname(pc),a1    ; dos.library v37+
  38.     moveq.l    #37,d0
  39.     jsr    _LVOOpenLibrary(a6)
  40.     move.l    d0,a6
  41.     tst.l    d0
  42.     bne.s    start
  43.     moveq    #10,d0
  44.     rts
  45. start    move.l    dl_Root(a6),a3
  46.     link    a5,#stackframe
  47.  
  48.     lea    st_curr(pc),a0
  49.     move.l    a0,arg1(a5)
  50.  
  51.     lea    templat(pc),a0
  52.     move.l    a0,d1
  53.     lea    swon(a5),a0    ; to fill swon, swoff and swtoggle
  54.     move.l    a0,d2
  55.     clr.l    (a0)+
  56.     clr.l    (a0)+
  57.     clr.l    (a0)+
  58.     moveq    #0,d3
  59.     jsr    _LVOReadArgs(a6)
  60.     move.l    d0,rdargs(a5)
  61.     beq.s    .noargs
  62.  
  63.     moveq    #0,d1
  64.     tst.l    swon(a5)
  65.     beq.s    .n1
  66.     addq    #1,d1
  67. .n1    tst.l    swoff(a5)
  68.     beq.s    .n2
  69.     addq    #1,d1
  70. .n2    tst.l    swtoggle(a5)
  71.     beq.s    .n3
  72.     addq    #1,d1
  73. .n3    cmp.b    #1,d1    ; exactly one of on, off or toggle
  74.     beq.s    .run
  75.     moveq    #ERROR_TOO_MANY_ARGS,d1
  76.     jsr    _LVOSetIoErr(a6)
  77.     bra.s    .done
  78.  
  79. .run    lea    st_now(pc),a0
  80.     move.l    a0,arg1(a5)
  81. .try1    tst.l    swon(a5)
  82.     beq.s    .try2
  83.     bset.b    #RNB_WILDSTAR-24,rn_Flags(a3)
  84. .try2    tst.l    swoff(a5)
  85.     beq.s    .try3
  86.     bclr.b    #RNB_WILDSTAR-24,rn_Flags(a3)
  87. .try3    tst.l    swtoggle(a5)
  88.     beq.s    .done
  89.     bchg.b    #RNB_WILDSTAR-24,rn_Flags(a3)
  90.  
  91. .done    move.l    rdargs(a5),d1
  92.     jsr    _LVOFreeArgs(a6)
  93. .noargs
  94.     lea    offword(pc),a0
  95.     move.l    a0,arg2(a5)
  96.     move.l    #0,retcode(a5)
  97.     btst.b    #RNB_WILDSTAR-24,rn_Flags(a3)
  98.     beq.s    .noton
  99.     lea    onword(pc),a0
  100.     move.l    a0,arg2(a5)
  101.     move.l    #5,retcode(a5)
  102. .noton    print    status(pc),arg1(a5)
  103. .exit    move.l    a6,a1
  104.     move.l    4.w,a6
  105.     jsr    _LVOCloseLibrary(a6)
  106.     move.l    retcode(a5),d0
  107.     unlk    a5
  108.     rts
  109.  
  110. dosname    dc.b    "dos.library",0
  111. status    dc.b    "Recognition of '*' in pattern matching is %s %s.",10,0
  112. st_curr    dc.b    "currently",0
  113. st_now    dc.b    "now",0
  114. onword    dc.b    "ON",0
  115. offword    dc.b    "OFF",0
  116. templat    dc.b    "ON/S,OFF/S,TOGGLE/S",0
  117.