home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / proasm / routines / aslsupport.r < prev    next >
Text File  |  1994-11-14  |  21KB  |  723 lines

  1. *********************************************************************************
  2. *                                        *
  3. *                      ****   ASL Support  ****                    *
  4. *                                        *
  5. *    Author        René Eberhard                        *
  6. *    Version        0.30                            *
  7. *    Last Revision    14.11.94                        *
  8. *    Identifier    asl_defined                        *
  9. *       Prefix        asl_   (asl)                        *
  10. *                               ¯¯¯                              *
  11. *                                         *
  12. *-----------------------------[ UPDATES ]---------------------------------------*
  13. *                                        *
  14. *    -REB!    09-Apr-93    Start this Project                *
  15. *    -SWA!    14.11.94    Register chaos fixed...                *
  16. *                                        *
  17. *********************************************************************************
  18. *---------------------------[ Functions ]---------------------------------------*
  19. *                                        *
  20. * - InitASLFR, ResetASLFR, DisplayASLFR, LockToASLFR_Tag,            *
  21. *   DefFontToASLFR_Tag, ASLFR_GetFileName, ASLFR_GetPathName, SetLoadName    *
  22. *   ASL_DoValidTags                                *
  23. *                                        *
  24. *---------------------------[ COMMENT ]-----------------------------------------*
  25. *                                            *
  26. *********************************************************************************
  27.  
  28.     IFND    asl_support
  29. asl_support    SET    1
  30.  
  31. asls_oldbase    equ __BASE
  32.     BASE    asls_base
  33.  
  34. asls_base:
  35.         
  36. ;---------------[ Some includes ]-------------------------------------------
  37.  
  38.     include    "ASLSupport.i"
  39.         
  40. ;---------------------------------------------------------------------------
  41.  
  42.     IFND    USE_NEWROUTINES
  43.     NEED_    InitASLFR
  44.     NEED_    ResetASLFR
  45.     NEED_    DisplayASLFR
  46.     NEED_    LockToASLFR_Tag
  47.     NEED_    FontToASLFR_Tag
  48.     NEED_    ASLFR_GetFileName
  49.     NEED_    ASLFR_GetPathName
  50.     NEED_    SetLoadName
  51.     NEED_    ASL_DoValidTags
  52.     ENDIF
  53.         
  54. ;---------------------------------------------------------------------------
  55. *********************************************************************************
  56. *                                        *
  57. * NAME    : InitASLFR                                *
  58. *                                        *
  59. * SYNOPSIS:                                     *
  60. *       Result = InitASLFR (MyReqStruct,ReqTagList,MyOwnInitialTagList)        *
  61. *       D0.L                A0.L    A1.L       A2.L             *
  62. *                                        *
  63. * FUNCTION: Allocate an ASLFR structure and memory for the filename/path    *
  64. *           handling                                *
  65. *                                        *
  66. * RESULT  : Pointer to MyReqStruct or FALSE                     *
  67. *                                        *
  68. * COMMENT : - The standard asl_LoadName_SIZE is 512 bytes            *
  69. *           - The standard asl_Path/Filename_SIZE is 256 bytes            *
  70. *        - This routine needs 68 bytes of stack without system calls        *
  71. *        - A2.L MUST BE NULL if there is no MyOwnInitialTagList        *
  72. *                                        *
  73. *********************************************************************************
  74.     IFD    xxx_InitASLFR
  75. InitASLFR:
  76.     NEED_    ResetASLFR
  77.     NEED_    ASL_DoValidTags
  78.     NEED_    LockToASLFR_Tag
  79.     NEED_    SetLoadName
  80.  
  81.     PUSHM.L    d1-a6            ;Store all registers
  82.  
  83.     link    a5,#asli_SIZEOF
  84.  
  85.     move.l    a0,asli_Requester(a5)    ;Store MyReqStruct
  86.     move.l    a1,asli_ReqTagList(a5)    ;Store ReqTagList 
  87.     move.l    a2,asli_MyTagList(a5)    ;Store MyTagList 
  88.  
  89.     move.l    a0,a4            ;MyReqStruct
  90.  
  91. ;---------------        
  92. ;---------------[ Allocate memory ]-----------------------------------------
  93. ;---------------        
  94.  
  95.     move.l    AbsExecBase,a6            ;Get Execbase
  96.     tst.l    aslfrs_LoadName(a4)        ;Still initialized?
  97.     bne    \Exit                ;Yes
  98.  
  99.     move.l    #asl_LoadName_SIZE,d0        ;Allocate aslfrs_LoadName
  100.     move.l    #MEMF_CLEAR,d1
  101.     JSRLIB_    AllocMem
  102.     move.l    d0,aslfrs_LoadName(a4)        ;Put memorybase into structure
  103.     beq    \MasterExit
  104.  
  105.     move.l    #asl_PathName_SIZE,d0        ;Allocate aslfrs_InitialDrawe
  106.     move.l    #MEMF_CLEAR,d1
  107.     JSRLIB_    AllocMem
  108.     move.l    d0,aslfrs_InitialDrawer(a4)    ;Put memorybase into structure
  109.     beq    \MasterExit
  110.  
  111.     move.l    #asl_FileName_SIZE,d0        ;Allocate aslfrs_InitialFile
  112.     move.l    #MEMF_CLEAR,d1
  113.     JSRLIB_    AllocMem
  114.     move.l    d0,aslfrs_InitialFile(a4)    ;Put memorybase into structure
  115.     beq    \MasterExit
  116.  
  117. ;---------------        
  118. ;---------------[ DO ASLFS_InitialLoadName ]--------------------------------
  119. ;---------------        
  120.  
  121.     tst.l    asli_MyTagList(a5)
  122.     beq    \Asl            ;No TagList
  123.  
  124.     move.l    UtilBase(PC),a6            ;Get ASLFR_InitialDrawer
  125.     move.l    #ASLFS_InitialLoadName,d0
  126.     move.l    asli_MyTagList(a5),a0        ;MyTagList
  127.     JSRLIB_    FindTagItem
  128.     tst.l    d0            ;Tag in List?
  129.     beq.s    \ELN            ;Tag not in List -> End of LoadName
  130.     move.l    d0,a0
  131.     tst.l    ti_Data(a0)        ;Tag initialized ?
  132.     beq.s    \ELN            ;Tag not initialized -> End of LoadName
  133.  
  134.     move.l    ti_Data(a0),a2        ;Pointer to DefaultLoadName
  135.     move.l    asli_Requester(a5),a0    ;Restore MyReqStruct
  136.     move.l    asli_ReqTagList(a5),a1    ;Restore ReqTagList 
  137.     bsr    SetLoadName        ;Init Name
  138.     tst.l    d0
  139.     bne.s    \Win            ;Everything is OK
  140.  
  141. \ELN:
  142.  
  143. ;---------------        
  144. ;---------------[ DO ASLFS_InitialLock ]------------------------------------
  145. ;---------------        
  146.  
  147.     move.l    UtilBase(PC),a6        ;Get ASLFR_InitialDrawer
  148.     move.l    #ASLFS_InitialLock,d0
  149.     move.l    asli_MyTagList(a5),a0    ;MyTagList
  150.     JSRLIB_    FindTagItem
  151.     tst.l    d0            ;Tag in List?
  152.     beq.s    \EIL            ;Tag not in List -> End of InitialLock
  153.     move.l    d0,a0
  154.     move.l    ti_Data(a0),d1        ;Lock in D1.L
  155.     beq.s    \EIL            ;Tag not in List -> End of InitialLock
  156.  
  157.     move.l    asli_Requester(a5),a0    ;Restore MyReqStruct
  158.     move.l    asli_ReqTagList(a5),a1    ;Restore ReqTagList 
  159.     bsr    LockToASLFR_Tag        ;Init Name
  160.     tst.l    d0
  161.     bne.s    \EIL            ;Everything is OK
  162.  
  163.     bsr    ASL_DoValidTags        ;Something is wrong
  164.  
  165. \EIL:
  166.  
  167. ;---------------        
  168. ;---------------[ DO ASLFS_Window ]-----------------------------------------
  169. ;---------------        
  170.  
  171. \Win:    move.l    UtilBase(PC),a6        ;Get ASLFS_Window
  172.     move.l    #ASLFS_Window,d0
  173.     move.l    asli_MyTagList(a5),a0    ;MyTagList
  174.     JSRLIB_    FindTagItem
  175.     tst.l    d0            ;Tag in List?
  176.     beq.s    \EWIN            ;Tag not in List -> End of Window
  177.     move.l    d0,a0
  178.     move.l    ti_Data(a0),d7        ;Save Windowpointer
  179.     beq.s    \EWIN            ;Windowpointer not initialized -> End of Window
  180.  
  181.     move.l    #ASLFR_Window,d0    ;Get ASLFR_Window (Requester TagList)
  182.     move.l    asli_ReqTagList(a5),a0    ;Requester TagList
  183.     JSRLIB_    FindTagItem
  184.     tst.l    d0            ;Tag in List?
  185.     beq.s    \EWIN            ;Tag not in List -> End of Window
  186.     move.l    d0,a0
  187.     move.l    d7,ti_Data(a0)        ;Put WindowPointer into Requester TagList
  188.  
  189. \EWIN:
  190.  
  191. ;---------------        
  192. ;---------------[ Init ASL requester ]--------------------------------------
  193. ;---------------        
  194.  
  195. \Asl:    move.l    AslBase(PC),a6        ;Get AslBase
  196.     tst.l    aslfrs_Requester(a4)    ;Still initialised?
  197.     bne.s    \Exit            ;Yes
  198.  
  199.     move.l    asli_ReqTagList(a5),a0    ;Taglist
  200.     moveq    #ASL_FileRequest,d0    ;Type = FileRequest
  201.     JSRLIB_    AllocAslRequest
  202.     move.l    d0,aslfrs_Requester(a4)    ;Store requester
  203.     beq    \MasterExit
  204.  
  205.  
  206. \Exit:    unlk    a5
  207.  
  208.     POPM.L    d1-a6            ;Restore all registers
  209.     move.l    a0,d0            ;Restore MyReqStruct
  210.     rts
  211.  
  212. ;---------------        
  213. ;---------------[ Master exit ]---------------------------------------------
  214. ;---------------        
  215.  
  216. \MasterExit:
  217.  
  218.     unlk    a5
  219.  
  220.     move.l    a4,a0            ;Init for FailInitASLFR
  221.     bra.s    FailInitASLFR
  222.         
  223. ;---------------[ Stackvariabeln ]------------------------------------------
  224.  
  225.             FORESET
  226. asli_Requester:        FO.L    1
  227. asli_ReqTagList:    FO.L    1
  228. asli_MyTagList:        FO.L    1
  229. asli_SIZEOF        FOVAL
  230.  
  231.     ENDC
  232.  
  233. ;---------------------------------------------------------------------------
  234. *********************************************************************************
  235. *                                        *
  236. * NAME    : ResetASLFR                                *
  237. *                                        *
  238. * SYNOPSIS:                                     *
  239. *       Result = ResetASLFR (MyReqStruct)                    *
  240. *       D0.L                 A0.L                        *
  241. *                                        *
  242. * FUNCTION: Reset all memory and ASL entrys                    *
  243. *                                        *
  244. * RESULT  : Always FALSE                             *
  245. *                                        *
  246. *********************************************************************************
  247.     IFD    xxx_ResetASLFR
  248. ResetASLFR:
  249.     PUSHM.L    d1-a6
  250.     
  251. FailInitASLFR:
  252.     move.l    a0,a5            ;Store MyReqStruct
  253.  
  254.     move.l    AslBase(PC),a6        ;Get AslBase
  255.     move.l    aslfrs_Requester(a5),d0    ;Requster allocated ?
  256.     beq.s    \NoReq            ;No
  257.     move.l    d0,a0
  258.     JSRLIB_    FreeAslRequest
  259.     clr.l    aslfrs_Requester(a5)
  260.  
  261. \NoReq:
  262.     move.l    AbsExecBase,a6        ;Get Execbase
  263.     move.l    aslfrs_LoadName(a5),d0    ;Memory base
  264.     beq.s    \NoLoadName
  265.     move.l    d0,a1            ;MemoryBlock
  266.     move.l    #asl_LoadName_SIZE,d0    ;Memory size
  267.     JSRLIB_    FreeMem            ;Free LoadName
  268.     clr.l    aslfrs_LoadName(a5)
  269.  
  270. \NoLoadName:
  271.     move.l    aslfrs_InitialDrawer(a5),d0    ;Memory base
  272.     beq.s    \NoInitialDrawer
  273.     move.l    d0,a1                ;MemoryBlock
  274.     move.l    #asl_PathName_SIZE,d0        ;Memory size
  275.     JSRLIB_    FreeMem                ;Free InitialDrawer
  276.     clr.l    aslfrs_InitialDrawer(a5)
  277.  
  278. \NoInitialDrawer:
  279.     move.l    aslfrs_InitialFile(a5),d0    ;Memory base
  280.     beq.s    \NoInitialFile
  281.     move.l    d0,a1                ;MemoryBlock
  282.     move.l    #asl_FileName_SIZE,d0        ;Memory size
  283.     JSRLIB_    FreeMem                ;Free InitialDrawer
  284.     clr.l    aslfrs_InitialFile(a5)
  285.  
  286. \NoInitialFile:
  287.     POPM.L    d1-a6            ;Restore all registers
  288.     moveq    #0,d0            ;FALSE
  289.     rts
  290.  
  291.     ENDC
  292. ;---------------------------------------------------------------------------
  293. *********************************************************************************
  294. *                                        *
  295. * NAME    : DisplayASLFR                            *
  296. *                                        *
  297. * SYNOPSIS:                                     *
  298. *       Result = DisplayASLFR (MyReqStruct,Tags)                *
  299. *       D0.L                   A0.L       A1.L                    *
  300. *                                        *
  301. * RESULT  : Pointer to MyReqStruct or FALSE by an error or CANCEL        *
  302. *                                        *
  303. *********************************************************************************
  304.     IFD    xxx_DisplayASLFR
  305. DisplayASLFR:
  306.     PUSHM.L    d1-a6
  307.     move.l    a0,a5                ;Store MyReqStruct
  308.     
  309.     move.l    AslBase(PC),a6
  310.     move.l    aslfrs_Requester(a5),d0        ;Requester
  311.     beq.s    \Exit                ;Requester NOT initialised
  312.     move.l    d0,a0
  313.     JSRLIB_    AslRequest            ;Disply requester
  314.     tst.l    d0
  315.     beq    \Exit                ;Error or CANCEL
  316.         
  317. ;---------------[ Copy path and filename into aslfrs_LoadName buffer ]------
  318.  
  319.     move.l    a5,d0            ;Init result
  320.     move.l    aslfrs_Requester(a5),a0
  321.     move.l    fr_Drawer(a0),a1    ;Pointer to pathname
  322.     move.l    fr_File(a0),a2        ;Pointer to filename
  323.     move.l    aslfrs_LoadName(a5),d0    ;Pointer to loadname buffer
  324.     beq.s    \Exit            ;LoadName buffer NOT initialised
  325.     move.l    d0,a3                
  326.  
  327.     tst.b    (a1)            ;Pathname?
  328.     beq.s    \PathOk            ;No
  329.  
  330. 10$    move.b    (a1)+,(a3)+        ;Copy pathname
  331.     tst.b    (a1)            ;End of pathname?
  332.     bne.s    10$            ;No --> Loop
  333.  
  334.     cmp.b    #":",-1(a3)        ;Signed end of volume/assign?
  335.     beq.s    \PathOk
  336.     cmp.b    #"/",-1(a3)        ;Signed end of directory?
  337.     beq.s    \PathOk
  338.     move.b    #"/",(a3)+        ;Indicate end of directory
  339.  
  340. \PathOk:
  341.     clr.b    (a3)            ;Terminate with NULL if there is
  342.                     ;no filename
  343.  
  344.     tst.b    (a2)            ;Filename?
  345.     beq    \Exit            ;No --> Exit
  346.  
  347. 20$    move.b    (a2)+,(a3)+        ;Copy filename
  348.     tst.b    (a2)            ;End of filename?
  349.     bne.s    20$            ;No --> Loop
  350.  
  351.     clr.b    (a3)            ;Terminate with NULL
  352.  
  353. ;---------------[ Exit ]----------------------------------------------------
  354.  
  355. \Exit:    POPM.L    d1-a6                ;Restore all registers
  356.     rts
  357.  
  358.     ENDC
  359. ;---------------------------------------------------------------------------
  360. *********************************************************************************
  361. *                                        *
  362. * NAME    : LockToASLFR_Tag                            *
  363. *                                        *
  364. * SYNOPSIS:                                     *
  365. *       Result = LockToASLFR_Tag (Lock,MyReqStruct,Tags)            *
  366. *       D0.L                      D1.L A0.L        A1.L                *
  367. *                                        *
  368. * RESULT  : Pointer to MyReqStruct or FALSE by error.                *
  369. *                                        *
  370. *********************************************************************************
  371.     IFD    xxx_LockToASLFR_Tag
  372. LockToASLFR_Tag:
  373.     NEED_    ResetASLFR
  374.  
  375.     PUSHM.L    d1-a6
  376.  
  377.     move.l    a0,a5            ;Store MyReqStruct
  378.     move.l    a1,a4            ;Store TagList
  379.     move.l    d1,d7            ;Store Lock
  380.         
  381. ;---------------[ Find ASLFR_InitialDrawer ]--------------------------------
  382.  
  383.     move.l    UtilBase(PC),a6        ;Get ASLFR_InitialDrawer
  384.     move.l    #ASLFR_InitialDrawer,d0
  385.     move.l    a4,a0            ;TagList
  386.     JSRLIB_    FindTagItem
  387.     tst.l    d0
  388.     beq    \Exit            ;ASLFR_InitialDrawer not in TagList
  389.     move.l    d0,a4            ;Store pointer to Tag entry
  390.  
  391. ;---------------[ Lock to ASCII, put buffer in TagList ]--------------------
  392.  
  393. \Mem:    move.l    DosBase(PC),a6
  394.     move.l    d7,d1                ;Lock
  395.     move.l    aslfrs_InitialDrawer(a5),d2    ;Buffer
  396.     move.l    #asl_PathName_SIZE,d3        ;Length
  397.     JSRLIB_    NameFromLock
  398.     tst.l    d0
  399.     beq.s    \Exit
  400.  
  401.     move.l    aslfrs_InitialDrawer(a5),ti_Data(a4)    ;Put buffer into TagList
  402.     move.l    a5,d0                    ;Result
  403.  
  404. \Exit:    POPM.L    d1-a6                    ;Restore all registers
  405.     rts
  406.  
  407.     ENDC
  408. ;---------------------------------------------------------------------------
  409. *********************************************************************************
  410. *                                        *
  411. * NAME    : DefFontToASLFR_Tag                            *
  412. *                                        *
  413. * SYNOPSIS:                                     *
  414. *       DefFontToASLFR_Tag (TextAttr,Tags)                    *
  415. *                           A0.L     A1.L                    *
  416. *                                        *
  417. * RESULT  : none                                *
  418. *                                        *
  419. * COMMENT : DO NOT USE THIS FUNCTION                        *
  420. *        This function has not much sense.                    *
  421. *        You have the same effect, if you set ASLFR_TextAttr,0        *
  422. *        This function is a test for another function called            *
  423. *        NewFontToASLFR_Tag. It is comming soon.                *
  424. *           Put in A0.L a pointer to the TextAttr stucture. Use ta_SIZEOF.    *
  425. *                                        *
  426. *********************************************************************************
  427.     IFD    xxx_FontToASLFR_Tag
  428. DefFontToASLFR_Tag:
  429.  
  430.     PUSHM.L    d0-a6
  431.     move.l    a0,a3            ;Store my own TextAttr structure
  432.     move.l    a1,a4            ;Store TagList
  433.         
  434. ;---------------[ Find ASLFR_TextAttr ]-------------------------------------
  435.  
  436.     move.l    UtilBase(PC),a6        ;Get ASLFR_TextAttr
  437.     move.l    #ASLFR_TextAttr,d0
  438.     move.l    a4,a0            ;TagList
  439.     JSRLIB_    FindTagItem
  440.     tst.l    d0
  441.     beq    \Exit            ;ASLFR_InitialDrawer not in TagList
  442.     move.l    d0,a4            ;Store pointer to Tag entry
  443.  
  444. ;---------------[ Fill TextAttr structure ]---------------------------------
  445.  
  446.     move.l    GfxBase(PC),a6
  447.     move.l    gb_DefaultFont(a6),a0        ;Defaultfont
  448.     move.l    LN_NAME(a0),ta_Name(a3)        ;Put in Name
  449.     move.w    tf_YSize(a0),ta_YSize(a3)    ;Put in YSize
  450.     move.b    tf_Style(a0),ta_Style(a3)    ;Put in Style
  451.     move.b    tf_Flags(a0),ta_Flags(a3)    ;Put in Flags
  452.  
  453.     move.l    a3,ti_Data(a4)            ;Put in TextAttr in TagList
  454.  
  455. \Exit:    POPM.L    d0-a6                ;Restore all registers
  456.     rts
  457.  
  458.     ENDC
  459. ;---------------------------------------------------------------------------
  460. *********************************************************************************
  461. *                                        *
  462. * NAME    : ASLFR_GetFileName                            *
  463. *                                        *
  464. * SYNOPSIS:                                     *
  465. *       Result = ASLFR_GetFileName (MyReqStruct)                *
  466. *       D0.L                        A0.L                           *
  467. *                                        *
  468. * RESULT  : Pointer to filename                         *
  469. *                                        *
  470. * COMMENT : This is the ACTUAL filename. Use CopyString_ to copy the        *
  471. *          filename into your own buffer                    *
  472. *                                        *
  473. *********************************************************************************
  474.     IFD    xxx_ASLFR_GetFileName
  475. ASLFR_GetFileName:
  476.     tst.l    aslfrs_Requester(a0)
  477.     beq.s    \Rtn
  478.  
  479.     move.l    aslfrs_Requester(a0),a0
  480.     move.l    fr_File(a0),d0        ;Pointer to filename
  481.  
  482. \Rtn:    rts
  483.     ENDC
  484. ;---------------------------------------------------------------------------
  485. *********************************************************************************
  486. *                                        *
  487. * NAME    : ASLFR_GetPathName                            *
  488. *                                        *
  489. * SYNOPSIS:                                     *
  490. *       Result = ASLFR_GetPathName (MyReqStruct)                *
  491. *       D0.L                        A0.L                           *
  492. *                                        *
  493. * RESULT  : Pointer to pathname                         *
  494. *                                        *
  495. * COMMENT : This is the ACTUAL pathname. Use CopyString_ to copy the        *
  496. *          pathname into your own buffer                    *
  497. *                                        *
  498. *********************************************************************************
  499.     IFD    xxx_ASLFR_GetPathName
  500. ASLFR_GetPathName:
  501.     tst.l    aslfrs_Requester(a0)
  502.     beq.s    \Rtn
  503.  
  504.     move.l    aslfrs_Requester(a0),a0
  505.     move.l    fr_Drawer(a0),d0    ;Pointer to pathname
  506.  
  507. \Rtn:    rts
  508.     ENDC
  509. ;---------------------------------------------------------------------------
  510. *********************************************************************************
  511. *                                        *
  512. * NAME    : SetLoadName                                *
  513. *                                        *
  514. * SYNOPSIS:                                     *
  515. *       Result = SetLoadName (MyReqStruct,TagList,DefaultLoadName)        *
  516. *       D0.L                  A0.L        A1.L    A2.L                *
  517. *                                        *
  518. * RESULT  : Pointer to aslfrs_LoadName or FALSE by error.            *
  519. *                                        *
  520. * COMMENT : - The DefaultLoadName must be NULL TERMINATED            *
  521. *        - Include ASLFR_InitialDrawer and ASLFR_InitialFile in your        *
  522. *          TagList.                                *
  523. *        - This routine needs 84 bytes of stack without system calls        *
  524. *        - (Consult the ASLSupport.DOC for more details)            *
  525. *                                        *
  526. *********************************************************************************
  527.     IFD    xxx_SetLoadName
  528. SetLoadName:
  529.  
  530.     PUSHM.L    d1-a6
  531.  
  532.     link    a5,#asll_SIZEOF
  533.  
  534.     move.l    a0,asll_Requester(a5)    ;Store MyReqStruct
  535.     move.l    a1,asll_TagList(a5)    ;Store TagList
  536.     move.l    a2,asll_LoadName(a5)    ;Store DefaultLoadName
  537.     move.l    a0,a4            ;MyReqStruct SAVE A4.L
  538.  
  539.     move.l    aslfrs_LoadName(a4),d0    ;Get loadname buffer
  540.     beq    \Exit            ;NOT initialized -> Exit (FAIL)
  541.     move.l    d0,asll_LoadNameBuffer(a5)
  542.  
  543. ;---------------[ Initialize Taglist ]--------------------------------------
  544.  
  545.     move.l    UtilBase(PC),a6        ;Get ASLFR_InitialDrawer
  546.     move.l    #ASLFR_InitialDrawer,d0
  547.     move.l    asll_TagList(a5),a0    ;TagList
  548.     JSRLIB_    FindTagItem
  549.     move.l    d0,asll_DrawerTag(a5)    ;Store tag entry
  550.     beq.s    \TFile            ;ASLFR_InitialDrawer not in TagList
  551.  
  552.     move.l    d0,a1
  553.     lea    ASLS_NullName(PC),a0
  554.     move.l    a0,ti_Data(a1)        ;Important to do!!
  555.  
  556.  
  557. \TFile:    move.l    #ASLFR_InitialFile,d0
  558.     move.l    asll_TagList(a5),a0    ;TagList
  559.     JSRLIB_    FindTagItem
  560.     move.l    d0,asll_FileTag(a5)    ;Store tag entry
  561.     beq.s    \FGet            ;ASLFR_InitialDrawer not in TagList
  562.  
  563.     move.l    d0,a1
  564.     lea    ASLS_NullName(PC),a0
  565.     move.l    a0,ti_Data(a1)        ;Important to do!!
  566.  
  567. ;---------------
  568. ;---------------[ Get path and file part ]----------------------------------
  569. ;---------------
  570.  
  571. \FGet:    move.l    DosBase(PC),a6
  572.     move.l    aslfrs_InitialDrawer(a4),a0    ;Get drawer buffer
  573.     clr.b    (a0)                ;Clr aslfrs_InitialDrawer
  574.     move.l    asll_LoadName(a5),d1        ;Pointer to DefaultLoadName
  575.     JSRLIB_    PathPart
  576.     move.l    d0,d5
  577.     cmp.l    asll_LoadName(a5),d0        ;Same string adresse?
  578.     beq.s    \File                ;There is a pathname
  579.  
  580.  
  581. ;---------------
  582. ;---------------[ Copy pathname into aslfrs_InitialDrawer ]-----------------
  583. ;---------------
  584.  
  585. \Path:    move.l    #asl_PathName_SIZE-1,d7        ;Max size of pathname
  586.     move.l    aslfrs_InitialDrawer(a4),a0    ;Destination drawer buffer
  587.     move.l    aslfrs_LoadName(a4),a1        ;Destination loadname buffer
  588.     move.l    asll_LoadName(a5),a2        ;Source
  589.  
  590. \PCopy:    move.b    (a2),(a0)+            ;Copy complete pathname
  591.     move.b    (a2),(a1)+            ;Copy into LoadName buffer
  592.     addq.l    #1,a2
  593.     cmp.l    a2,d5
  594.     bls.s    \PTag
  595.     dbf    d7,\PCopy            ;--> Loop
  596.  
  597.     move.l    aslfrs_InitialDrawer(a4),a0    ;Buffer overflow
  598.     clr.b    (a0)                ;Clr aslfrs_InitialDrawer
  599.     move.l    aslfrs_LoadName(a4),a1        
  600.     clr.b    (a1)                ;Clr aslfrs_LoadName
  601.     clr.l    d0                ;FAIL
  602.     bra    \Exit
  603.  
  604. ;---------------[ Put buffer in TagList ]-----------------------------------
  605.  
  606. \PTag:    clr.b    (a0)                    ;Set end of aslfrs_InitialDrawer
  607.     move.l    a1,asll_LoadNameBuffer(a5)        ;Pointer after "/" or ":"
  608.  
  609.     tst.l    asll_DrawerTag(a5)
  610.     beq.s    \File
  611.     move.l    asll_DrawerTag(a5),a0            ;Tag entry
  612.     move.l    aslfrs_InitialDrawer(a4),ti_Data(a0)    ;Put buffer into TagList
  613.  
  614. ;---------------
  615. ;---------------[ Copy filename into aslfrs_InitialFile ]-------------------
  616. ;---------------
  617.  
  618. \File:    move.l    asll_LoadName(a5),d1        ;Pointer to DefaultLoadName
  619.     JSRLIB_    FilePart
  620.     move.l    d0,a2
  621.  
  622.     move.l    aslfrs_InitialFile(a4),a0    ;Destination file buffer
  623.     move.l    asll_LoadNameBuffer(a5),a1    ;Destination loadname buffer
  624.     move.l    #asl_FileName_SIZE-1,d7        ;Max size of filename
  625.  
  626. \FCopy:    move.b    (a2),(a0)+            ;Copy pathname
  627.     move.b    (a2)+,(a1)+            ;Copy  LoadName
  628.     beq.s    \FTag                ;Init Tag
  629.     dbf    d7,\FCopy            ;--> Loop
  630.  
  631.     move.l    aslfrs_InitialFile(a4),a0    ;Buffer overflow
  632.     clr.b    (a0)                ;Clr aslfrs_InitialFile
  633.     move.l    aslfrs_LoadName(a4),a1        
  634.     clr.b    (a1)                ;Clr aslfrs_LoadName
  635.     clr.l    d0                ;FAIL
  636.     bra    \Exit
  637.  
  638. ;---------------[ Put buffer in TagList ]-----------------------------------
  639.  
  640. \FTag:    tst.l    asll_FileTag(a5)
  641.     beq.s    \Exit
  642.     move.l    asll_FileTag(a5),a0            ;Tag entry
  643.     move.l    aslfrs_InitialFile(a4),ti_Data(a0)    ;Put buffer into TagList
  644.  
  645.     move.l    aslfrs_LoadName(a4),d0            ;Init result
  646.  
  647. ;---------------[ Exit ]----------------------------------------------------
  648.  
  649. \Exit:    unlk    a5
  650.     POPM.L    d1-a6
  651.     rts
  652.             FORESET
  653. asll_Requester:        FO.L    1
  654. asll_TagList:        FO.L    1
  655. asll_FileTag:        FO.L    1    ;ASLFR_InitialFile
  656. asll_DrawerTag:        FO.L    1    ;ASLFR_InitialDrawer
  657. asll_LoadName:        FO.L    1    ;Input loadname
  658. asll_LoadNameBuffer:    FO.L    1    ;Actual pointer in buffer
  659. asll_FileName:        FO.L    1    ;Pointer to Filename
  660. asll_SIZEOF        FOVAL
  661.  
  662.     ENDC
  663. ;---------------------------------------------------------------------------
  664. *********************************************************************************
  665. *                                        *
  666. * NAME    : ASL_DoValidTags                            *
  667. *                                        *
  668. * SYNOPSIS:                                     *
  669. *       ASL_DoValidTags (MyReqStruct,TagList)                    *
  670. *                        A0.L        A1.L                        *
  671. *                                        *
  672. * RESULT  : none                                *
  673. *                                        *
  674. * COMMENT : - This function initialize a ASL Taglist.                *
  675. *          If you are not shure what is in it, use this function.        *
  676. *          If there are some invalid entrys , the enforcer says "hello"    *
  677. *                                        *
  678. *********************************************************************************
  679.     IFD    xxx_ASL_DoValidTags
  680. ASL_DoValidTags:
  681.  
  682.     PUSHM.L    d0-a6
  683.  
  684.     move.l    a0,a4            ;Store MyReqStruct
  685.     move.l    a1,a5            ;Store TagList
  686.         
  687. ;---------------[ Searching for ASLFR_InitialDrawer ]-----------------------
  688.  
  689.     move.l    UtilBase(PC),a6        ;Get ASLFR_InitialDrawer
  690.     move.l    #ASLFR_InitialDrawer,d0
  691.     move.l    a5,a0            ;TagList
  692.     JSRLIB_    FindTagItem
  693.     tst.l    d0
  694.     beq.s    \ND            ;ASLFR_InitialDrawer not in TagList
  695.  
  696.     move.l    d0,a1
  697.     lea    ASLS_NullName(PC),a0
  698.     move.l    a0,ti_Data(a1)        ;Important to do!!
  699.  
  700. ;---------------[ Searching for ASLFR_InitialFile ]-------------------------
  701.  
  702. \ND:    move.l    #ASLFR_InitialFile,d0
  703.     move.l    a5,a0            ;TagList
  704.     JSRLIB_    FindTagItem
  705.     tst.l    d0
  706.     beq.s    \Rtn            ;ASLFR_InitialFile not in TagList
  707.  
  708.     move.l    d0,a1
  709.     lea    ASLS_NullName(PC),a0
  710.     move.l    a0,ti_Data(a1)        ;Important to do!!
  711.  
  712.  
  713. \Rtn:    POPM.L    d0-a6            ;Restore all registers
  714.     rts
  715.  
  716.     ENDC
  717.  
  718. ;---------------------------------------------------------------------------
  719.     BASE    asls_oldbase
  720.  
  721.     ENDC
  722. ;---------------------------------------------------------------------------
  723.