home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 432a.lha / ReqLibrary_v2.2 / asm / customizefile.asm < prev    next >
Assembly Source File  |  1990-11-10  |  3KB  |  97 lines

  1.  
  2. ;         Written by Bruce Dawson, Copyright © 1989.
  3. ;
  4. ;         This  program  and  source  may  be  freely distributed as long as
  5. ; credit  to  the  original  author  is left in the source and documentation
  6. ; accompanying  the  executable.   This program may be modified for your own
  7. ; purposes.
  8. ;
  9. ;
  10. ;         This  program  is  designed to an example of how you can customize
  11. ; the  req.library  file  requester (or any of the other requesters) to suit
  12. ; your  own  personal tastes.  This program is designed to be used by people
  13. ; who  USE  programs  that  use  the  file  requester,  not people who WRITE
  14. ; programs that use the file requester.  This program patches into all calls
  15. ; to  the  file  requester  and  modifies  the  requester structure, without
  16. ; telling the calling program.
  17. ;         Note  that  this  program  opens  the  requester library but never
  18. ; closes  it.   This  is  necessary if the patch is to stay in effect.  This
  19. ; does,  however,  mean that the requester library can not be flushed out of
  20. ; memory.   In  addition,  this  program  must  stay  in memory forever.  To
  21. ; conserve  memory,  it  would  be  wise to run this program with as small a
  22. ; stack as possible.
  23. ;         This  technique of patching the requester library could be used to
  24. ; patch other functions in the requester library also.  Have fun customizing
  25. ; your system, while still using a 'standard' file requester.
  26.  
  27.  
  28.     include    "libraries/reqbase.i"
  29.  
  30.  
  31. SYS    MACRO
  32.     XREF    _LVO\1
  33.     JSR    _LVO\1(A6)
  34.     ENDM
  35.  
  36.     dseg
  37. _ReqBase    DC.L    0
  38. OldLocation    DC.L    0
  39. reqname        DC.B    "req.library",0
  40.     cseg
  41.  
  42.  
  43.  
  44.     MOVE.L    4,A6    ;Load SysBase.
  45.     LEA    reqname,A1
  46.     MOVEQ    #0,D0
  47.     SYS    OpenLibrary
  48.     MOVE.L    D0,_ReqBase
  49.     BEQ    ErrorOpeningReqBase
  50.  
  51.     MOVE.L    D0,A1
  52.     LEA    FileRequesterPatchFunction,A0
  53.     MOVE.L    A0,D0
  54.     MOVE.L    #_LVOFileRequester,A0
  55.     SYS    SetFunction
  56.     MOVE.L    D0,OldLocation
  57.  
  58.     MOVEQ    #-1,D0
  59.     SYS    AllocSignal        ;Allocate any signal.
  60.  
  61.     MOVEQ    #1,D1
  62.     LSL.L    D0,D1
  63.     MOVE.L    D1,D0
  64.     SYS    Wait            ;Wait for a signal that will never come.
  65.  
  66. ErrorOpeningReqBase
  67.     RTS
  68.  
  69.  
  70.  
  71.  
  72.  
  73. FileRequesterPatchFunction
  74. ;         Here is where you adjust the file requester structure to suit your
  75. ; own  particular tastes.  Examples of things that you can safely adjust are
  76. ; the  color  fields  (dirnamescolor, devicenamescolor etc.), the numcolumns
  77. ; and  numlines  fields.  Most of the flags can safely be set from here, the
  78. ; exceptions  being  the EXTSELECT and CACHING flags, because if the calling
  79. ; program doesn't have the necessary code to deal with these (processing the
  80. ; extra  files  and purging buffers left by both flags) then some memory may
  81. ; not  get  freed  up.  These two flags can be safely cleared though, if you
  82. ; don't  want  extended select or caching.  I believe all of the other flags
  83. ; can safely be set or cleared or set.
  84.  
  85.         ;If you like a particular width of file requester.
  86.     MOVE.W    #20,frq_numcolumns(A0)
  87.  
  88.         ;If you want the cache to be purged whenever the directory
  89.         ;modification date changes and if you don't want half read
  90.         ;directories to get cached.
  91.     OR.L    #FRQCACHEPURGEM!FRQNOHALFCACHEM,frq_Flags(A0)
  92.     MOVE.L    OldLocation,A1
  93.     JMP    (A1)
  94.  
  95.  
  96.  
  97.