home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-06-08 | 57.6 KB | 2,093 lines |
- opt l+,o+,ow-
- *
- * freq.s version 8.1 - © Copyright 1990 Jaba Development
- *
- * Author : Jan van den Baard
- * Assembler : Devpac version 2.14
- *
- incdir 'sys:devpac_inc/'
- include 'tool.i'
- include 'mymacros.i'
- include 'exec/exec_lib.i'
- include 'intuition/intuition_lib.i'
- include 'graphics/graphics_lib.i'
- include 'libraries/dos_lib.i'
- *
- * external symbol references
- *
- xref _DOSBase
- xref _IntuitionBase
- xref _GfxBase
-
- xref ShadowGList
- xref InitMemoryChain
- xref AllocItem
- xref FreeItem
- xref FreeMemoryChain
- xref StrCpy
- xref StrLen
- xref StriCmp
- xref BstrToCstr
- xref MatchPattern
- xref Isolate
- xref CreateTimeDelay
- xref DoTimeDelay
- xref DeleteTimeDelay
- xref QuickSort
- xref OpenDir
- xref GetEntry
- xref CloseDir
- xref FreeDir
- xref IoErrToStr
-
- *
- * This is the way data gets passed around ! This structure gets dynamicaly
- * allocated each time the filerequester is called.
- *
- STRUCTURE Global,0
- APTR gl_Freq
- APTR gl_WindowLock
- APTR gl_Window
- APTR gl_PRWindow
- APTR gl_RPort
- APTR gl_IAddress
- APTR gl_Prop
- APTR gl_FileG
- APTR gl_DirG
- APTR gl_Disk
- APTR gl_Drawer
- APTR gl_PInfo
- APTR gl_Font
- APTR gl_Proc
- APTR gl_FirstDisplayed
- APTR gl_TimeDelay
- STRUCT gl_Misc,mc_SIZEOF
- ULONG gl_IsNext
- ULONG gl_Displayed
- ULONG gl_Class
- USHORT gl_Code
- USHORT gl_Qualifier
- USHORT gl_Id
- USHORT gl_NumEntries
- USHORT gl_IsSorted
- APTR gl_FileBuf
- APTR gl_DrawerBuf
- STRUCT gl_Pattern,32
- LABEL gl_SIZEOF
-
- *
- * Draw a box in a rastport.
- * This routine is used to draw the gadget and requester borders.
- *
- _Box: movem.l d2-d6/a2/a6,-(sp)
- move.l 32(sp),a2
- movem.l 36(sp),d2-d6
- move.l _GfxBase,a6
- move.l a2,a1
- move.l d6,d0
- libcall SetAPen
- move.l a2,a1
- moveq #RP_JAM1,d0
- libcall SetDrMd
- move.l a2,a1
- move.l d2,d0
- move.l d3,d1
- libcall Move
- move.l d2,d0
- add.l d4,d0
- move.l d3,d1
- libcall Draw
- move.l d2,d0
- add.l d4,d0
- move.l d3,d1
- add.l d5,d1
- libcall Draw
- move.l d2,d0
- move.l d3,d1
- add.l d5,d1
- libcall Draw
- move.l d2,d0
- move.l d3,d1
- libcall Draw
- movem.l (sp)+,d2-d6/a2/a6
- rts
- *
- * Print a text in a rastport.
- * This routine is used to print the gadget & requester texts.
- *
- _Print: movem.l d2-d6/a2-a3/a6,-(sp)
- movem.l 36(sp),a2-a3
- movem.l 44(sp),d2-d6
- move.l _GfxBase,a6
- move.l a2,a1
- move.l d4,d0
- libcall SetAPen
- move.l a2,a1
- move.l d5,d0
- libcall SetBPen
- move.l a2,a1
- move.l d6,d0
- libcall SetDrMd
- move.l a2,a1
- move.l d2,d0
- move.l d3,d1
- addq.l #6,d1
- libcall Move
- move.l a2,a1
- move.l a3,a0
- bsr StrLen
- move.l a3,a0
- libcall Text
- movem.l (sp)+,d2-d6/a2/a3/a6
- rts
- *
- * (re)set the user colors (only if FR_CustColor was set in the Flags field
- * of the FileRequester structure).
- *
- _DoColors: movem.l d2-d5/a2-a3/a5/a6,-(sp)
- move.l 36(sp),a2
- move.l gl_Window(a2),a0
- move.l _IntuitionBase,a6
- libcall ViewPortAddress
- move.l d0,a3
- move.l gl_Freq(a2),a5
- lea.l fr_Color0(a5),a5
- move.l _GfxBase,a6
- cldat d4
- ColorLoop: move.l d4,d0
- move.l vp_ColorMap(a3),a0
- libcall GetRGB4
- move.l d0,d5
- move.l d4,d0
- add.l d0,d0
- cldat d1
- move.w (a5,d0.l),d1
- move.l a3,a0
- move.l d1,d2
- move.l d1,d3
- asr.l #8,d1
- asr.l #4,d2
- and.l #15,d1
- and.l #15,d2
- and.l #15,d3
- move.l d4,d0
- libcall SetRGB4
- move.l d4,d0
- add.l d0,d0
- move.w d5,(a5,d0.l)
- inc.l d4
- cmp.l #4,d4
- beq.s NoMoreCol
- bra.s ColorLoop
- NoMoreCol: movem.l (sp)+,d2-d5/a2-a3/a5/a6
- rts
- *
- * Open and setup the filerequester window.
- *
- _GetFSWindow:
- movem.l d2-d3/a2-a3/a5-a6,-(sp)
- move.l 28(sp),a2
- move.l #nw_SIZE,d0
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- lea.l gl_Misc(a2),a0
- bsr AllocItem
- move.l d0,a5
- bne.s GotNW
- NoOpen: cldat d0
- EndGFSW: movem.l (sp)+,d2-d3/a2-a3/a5-a6
- rts
- GotNW: lea.l fsnw,a0
- move.l a5,a1
- move.l #nw_SIZE,d0
- libcall CopyMem
- move.l gl_Freq(a2),a0
- move.w fr_LeftEdge(a0),d0
- move.w d0,nw_LeftEdge(a5)
- move.w fr_TopEdge(a0),d0
- move.w d0,nw_TopEdge(a5)
- move.l fr_Screen(a0),d0
- move.l d0,nw_Screen(a5)
- beq.s NoScreen
- move.w #CUSTOMSCREEN,nw_Type(a5)
- bra.s HaveScreen
- NoScreen: move.w #WBENCHSCREEN,nw_Type(a5)
- HaveScreen: lea.l TOPAZ_80,a0
- move.l _GfxBase,a6
- libcall OpenFont
- move.l d0,gl_Font(a2)
- move.l a5,a0
- move.l _IntuitionBase,a6
- libcall OpenWindow
- move.l d0,-(sp)
- move.l a5,a1
- move.l #nw_SIZE,d0
- lea.l gl_Misc(a2),a0
- bsr FreeItem
- move.l (sp)+,d0
- tst.l d0
- bne.s OpenOK
- bra.s NoOpen
- OpenOK: move.l d0,gl_Window(a2)
- move.l gl_Freq(a2),a0
- move.w fr_Flags(a0),d0
- btst #3,d0
- beq.s NoCols
- move.l a2,-(sp)
- bsr _DoColors
- addq.w #4,sp
- NoCols: move.l gl_Window(a2),a0
- move.l wd_RPort(a0),a3
- move.l a3,gl_RPort(a2)
- move.l a3,a1
- move.l gl_Font(a2),a0
- move.l _GfxBase,a6
- libcall SetFont
- move.l a2,-(sp)
- move.l gl_Window(a2),a0
- move.l gl_Freq(a2),a1
- move.l fr_HeadLine(a1),a1
- move.l #-1,a2
- move.l _IntuitionBase,a6
- libcall SetWindowTitles
- move.l (sp)+,a2
- move.l _GfxBase,a6
- move.l a3,a1
- moveq #1,d0
- libcall SetAPen
- move.l a3,a0
- cldat d0
- move.l #10,d1
- move.l #260,d2
- move.l #140,d3
- libcall RectFill
- pea 2
- pea 44
- pea 253
- pea 93
- pea 3
- move.l a3,-(sp)
- bsr _Box
- lea.l 24(sp),sp
- pea 2
- pea 81
- pea 21
- pea 11
- pea 235
- move.l a3,-(sp)
- bsr _Box
- lea.l 24(sp),sp
- pea 0
- pea 59
- pea 15
- pea 22
- pea 238
- move.l a3,-(sp)
- bsr _Box
- lea.l 24(sp),sp
- pea 2
- pea 81
- pea 231
- pea 11
- pea 3
- move.l a3,-(sp)
- bsr _Box
- lea.l 24(sp),sp
- pea 2
- pea 128
- pea 255
- pea 10
- pea 2
- move.l a3,-(sp)
- bsr _Box
- lea.l 24(sp),sp
- pea 2
- pea 12
- pea 69
- pea 121
- pea 179
- move.l a3,-(sp)
- bsr _Box
- lea.l 24(sp),sp
- pea 2
- pea 12
- pea 69
- pea 121
- pea 95
- move.l a3,-(sp)
- bsr _Box
- lea.l 24(sp),sp
- pea 2
- pea 12
- pea 69
- pea 121
- pea 11
- move.l a3,-(sp)
- bsr _Box
- lea.l 24(sp),sp
- pea 2
- pea 9
- pea 185
- pea 108
- pea 63
- move.l a3,-(sp)
- bsr _Box
- lea.l 24(sp),sp
- pea 2
- pea 9
- pea 185
- pea 96
- pea 63
- move.l a3,-(sp)
- bsr _Box
- lea.l 24(sp),sp
- pea 0
- pea 0
- pea 2
- pea 124
- pea 191
- pea cancel
- move.l a3,-(sp)
- bsr _Print
- lea.l 28(sp),sp
- pea 0
- pea 0
- pea 2
- pea 124
- pea 107
- pea parent
- move.l a3,-(sp)
- bsr _Print
- lea.l 28(sp),sp
- pea 0
- pea 0
- pea 2
- pea 124
- pea 38
- pea oktext
- move.l a3,-(sp)
- bsr _Print
- lea.l 28(sp),sp
- pea 0
- pea 0
- pea 2
- pea 109
- pea 11
- pea file
- move.l a3,-(sp)
- bsr _Print
- lea.l 28(sp),sp
- pea 0
- pea 0
- pea 2
- pea 97
- pea 11
- pea drawer
- move.l a3,-(sp)
- bsr _Print
- lea.l 28(sp),sp
- move.l a2,-(sp)
- bsr _DoGadgets
- addq.w #4,sp
- tst.l d0
- bne.s GadgetsOK
- move.l gl_Window(a2),a0
- move.l _IntuitionBase,a6
- libcall CloseWindow
- bra NoOpen
- GadgetsOK: cladr a1
- move.l _SysBase,a6
- libcall FindTask
- move.l d0,a0
- move.l pr_WindowPtr(a0),gl_PRWindow(a2)
- move.l gl_Window(a2),pr_WindowPtr(a0)
- move.l a0,gl_Proc(a2)
- moveq #1,d0
- bra EndGFSW
-
- *
- * allocate and setup the requester gadgets
- *
- _DoGadgets: movem.l d2-d7/a2-a3/a6,-(sp)
- move.l 40(sp),a2
- lea.l gl_Misc(a2),a3
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- move.l #16*gg_SIZEOF,d0
- move.l a3,a0
- bsr AllocItem
- move.l d0,d2
- beq NoMemory
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- move.l #5*ig_SIZEOF,d0
- move.l a3,a0
- bsr AllocItem
- move.l d0,d3
- beq NoMemory
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- moveq #pi_SIZEOF,d0
- move.l a3,a0
- bsr AllocItem
- move.l d0,d4
- beq NoMemory
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- move.l #2*si_SIZEOF,d0
- move.l a3,a0
- bsr AllocItem
- move.l d0,d5
- beq NoMemory
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- move.l #256,d0
- move.l a3,a0
- bsr AllocItem
- move.l d0,d6
- beq NoMemory
- move.l #MEMF_CHIP+MEMF_CLEAR,d1
- move.l #176,d0
- move.l a3,a0
- bsr AllocItem
- move.l d0,d7
- beq NoMemory
- move.l (_SysBase).w,a6
- lea.l FSG,a0
- move.l d2,a1
- move.l #8*gg_SIZEOF,d0
- libcall CopyMem
- cldat d0
- move.l d2,a0
- GLoop1: move.l a0,gg_NextGadget(a0)
- add.l #gg_SIZEOF,gg_NextGadget(a0)
- add.l #gg_SIZEOF,a0
- inc.l d0
- cmp.l #8,d0
- bne.s GLoop1
- move.w #12,d1
- GLoop2: movem.l d0/d1/a0,-(sp)
- move.l a0,a1
- lea.l FGAD,a0
- move.l #gg_SIZEOF,d0
- libcall CopyMem
- movem.l (sp)+,d0/d1/a0
- move.l a0,gg_NextGadget(a0)
- add.l #gg_SIZEOF,gg_NextGadget(a0)
- move.w d1,gg_TopEdge(a0)
- addq.w #2,d1
- addq.w #8,d1
- move.w d0,gg_GadgetID(a0)
- add.l #gg_SIZEOF,a0
- inc.l d0
- cmp.l #16,d0
- bne.s GLoop2
- clr.l gg_NextGadget(a0)
- lea.l FSI,a0
- move.l d3,a1
- move.l #ig_SIZEOF*4,d0
- libcall CopyMem
- lea.l FSD,a0
- move.l d7,a1
- move.l #176,d0
- libcall CopyMem
- move.l d3,a0
- move.l d7,ig_ImageData(a0)
- add.l #ig_SIZEOF,a0
- move.l d7,d0
- add.l #16,d0
- move.l d0,ig_ImageData(a0)
- add.l #ig_SIZEOF,a0
- move.l d7,d0
- add.l #80,d0
- move.l d0,ig_ImageData(a0)
- add.l #ig_SIZEOF,a0
- move.l d7,d0
- add.l #32,d0
- move.l d0,ig_ImageData(a0)
- move.l d3,d0
- add.l #2*ig_SIZEOF,d0
- move.l d0,gl_Disk(a2)
- add.l #ig_SIZEOF,d0
- move.l d0,gl_Drawer(a2)
- move.l d2,a0
- add.l #6*gg_SIZEOF,a0
- move.l d3,gg_GadgetRender(a0)
- add.l #gg_SIZEOF,a0
- move.l d3,d0
- add.l #ig_SIZEOF,d0
- move.l d0,gg_GadgetRender(a0)
- move.l d5,a0
- move.l d6,si_UndoBuffer(a0)
- move.l gl_DrawerBuf(a2),d0
- move.l d0,si_Buffer(a0)
- move.w #256,si_MaxChars(a0)
- add.l #si_SIZEOF,a0
- move.l d6,si_UndoBuffer(a0)
- move.l gl_FileBuf(a2),d0
- move.l d0,si_Buffer(a0)
- move.w #32,si_MaxChars(a0)
- move.l d2,a0
- add.l #3*gg_SIZEOF,a0
- move.l d5,d0
- add.l #si_SIZEOF,d0
- move.l d0,gg_SpecialInfo(a0)
- move.l a0,gl_FileG(a2)
- add.l #gg_SIZEOF,a0
- move.l d5,gg_SpecialInfo(a0)
- move.l a0,gl_DirG(a2)
- lea.l PINFO,a0
- move.l d4,a1
- move.l #pi_SIZEOF,d0
- libcall CopyMem
- move.l d2,a0
- add.l #5*gg_SIZEOF,a0
- move.l d4,gg_SpecialInfo(a0)
- move.l d3,d0
- add.l #4*ig_SIZEOF,d0
- move.l d0,gg_GadgetRender(a0)
- move.l a0,gl_Prop(a2)
- move.l d4,gl_PInfo(a2)
- move.l a2,-(sp)
- move.l gl_Window(a2),a0
- move.l d2,a1
- move.l #-1,d0
- move.l #16,d1
- cladr a2
- move.l _IntuitionBase,a6
- libcall AddGList
- move.l d2,a0
- move.l (sp),a1
- move.l gl_Window(a1),a1
- cladr a2
- moveq #8,d0
- libcall RefreshGList
- move.l (sp)+,a2
- moveq #3,d1
- cldat d0
- move.l gl_Window(a2),a0
- cladr a2
- move.l d2,a1
- bsr ShadowGList
- moveq #1,d0
- EndDG: movem.l (sp)+,d2-d7/a2-a3/a6
- rts
- NoMemory: lea.l gl_Misc(a2),a0
- bsr FreeMemoryChain
- cldat d0
- bra.s EndDG
- *
- * calculate the prop position
- *
- _PPos: movem.l d2/a2,-(sp)
- move.l 12(sp),a2
- move.l gl_PInfo(a2),a0
- cldat d0
- move.w pi_VertPot(a0),d0
- divs pi_VertBody(a0),d0
- swap d0
- clr.w d0
- swap d0
- move.l d0,d2
- addq.l #7,d0
- cldat d1
- move.w gl_NumEntries(a2),d1
- cmp.l d1,d0
- ble.s CheckZero
- subq.l #8,d1
- move.l d1,d2
- CheckZero: tst.l d2
- bge.s NotZero
- cldat d2
- NotZero: move.l d2,d0
- movem.l (sp)+,d2/a2
- rts
- *
- * read an IDCMP message
- * return TRUE if a message was read and FALSE if not
- *
- _DoMsg: movem.l a2-a3/a6,-(sp)
- move.l 16(sp),a2
- move.l gl_Window(a2),a0
- move.l wd_UserPort(a0),a0
- move.l (_SysBase).w,a6
- libcall GetMsg
- move.l d0,a3
- tst.l d0
- bne.s HaveMsg
- cldat d0
- EndDM: movem.l (sp)+,a2-a3/a6
- rts
- HaveMsg: move.l im_Class(a3),gl_Class(a2)
- move.w im_Code(a3),gl_Code(a2)
- move.w im_Qualifier(a3),gl_Qualifier(a2)
- move.l im_IAddress(a3),a0
- move.l a0,gl_IAddress(a2)
- move.w gg_GadgetID(a0),gl_Id(a2)
- move.l a3,a1
- libcall ReplyMsg
- moveq #1,d0
- bra.s EndDM
- *
- * sort the names from the files, dirs and devices
- *
- _SortNames: movem.l d2-d5/a2/a6,-(sp)
- move.l 28(sp),a2
- move.l dr_NumEntries(a2),d2 ; number of entries in d2
- cmp.l #1,d2 ; only sort if bigger than 1
- bhi.s NotEmpty
- NoSRT: cldat d0
- EndSN: movem.l (sp)+,d2-d5/a2/a6
- rts
- NotEmpty: moveq #ei_SIZEOF-8,d5
- mulu d2,d5 ; allocate buffer
- SetUp: move.l (_SysBase).w,a6
- move.l d5,d0
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- libcall AllocMem
- move.l d0,d3
- move.l d0,d4
- bne.s GotMem
- bra.s NoSRT
- GotMem: move.l dr_First(a2),a0
- MemLoop: move.l a0,-(sp)
- addq.w #8,a0 ; skip the list muck!
- move.l d4,a1
- move.l #ei_SIZEOF-8,d0
- libcall CopyMemQuick
- move.l (sp)+,a0
- cmp.l dr_Last(a2),a0
- beq.s AllCopied
- move.l ei_Next(a0),a0
- add.l #ei_SIZEOF-8,d4
- bra.s MemLoop
- AllCopied: lea.l _compare,a1
- moveq #ei_SIZEOF-8,d1
- move.l d2,d0
- move.l d3,a0
- bsr QuickSort ; sort it out
- move.l d3,d4
- move.l dr_First(a2),a1
- BackLoop: move.l a1,-(sp)
- addq.w #8,a1
- move.l d4,a0
- move.l #ei_SIZEOF-8,d0
- libcall CopyMemQuick
- move.l (sp)+,a1
- cmp.l dr_Last(a2),a1
- beq.s AllBack
- move.l ei_Next(a1),a1
- add.l #ei_SIZEOF-8,d4
- bra.s BackLoop
- AllBack: move.l d3,a1
- move.l d5,d0
- libcall FreeMem
- moveq #1,d0
- bra EndSN
-
- *
- * the comparrison routine for "QuickSort"
- *
- _compare: cmp.w #ENTRY_DEV,ei_Type-8(a0)
- bne.s NotDev
- cmp.w #ENTRY_DEV,ei_Type-8(a1)
- bne.s Minus
- NotDev: cmp.w #ENTRY_DIR,ei_Type-8(a0)
- bne.s NotDir
- cmp.w #ENTRY_DIR,ei_Type-8(a1)
- bne.s Plus
- NotDir: cmp.w #ENTRY_FILE,ei_Type-8(a0)
- bne.s NotFile
- cmp.w #ENTRY_DEV,ei_Type-8(a1)
- beq.s Plus
- NotFile: cmp.w #ENTRY_FILE,ei_Type-8(a0)
- bne.s StrCMP
- cmp.w #ENTRY_DIR,ei_Type-8(a1)
- beq.s Minus
- StrCMP: lea.l ei_Name-8(a0),a0
- lea.l ei_Name-8(a1),a1
- bsr StriCmp
- Endcp: rts
- Minus: moveq #-1,d0
- bra.s Endcp
- Plus: moveq #1,d0
- bra.s Endcp
-
- *
- * read the mounted disk devices
- *
- _ReadDevs: movem.l d2-d3/a2-a3/a6,-(sp)
- move.l 24(sp),a2
- cldat d2
- move.l (_SysBase).w,a6
- libcall Forbid
- move.l _DOSBase,a3
- move.l dl_Root(a3),a3
- move.l rn_Info(a3),a3
- add.l a3,a3
- add.l a3,a3
- move.l di_DevInfo(a3),a3
- add.l a3,a3
- add.l a3,a3
- DevLoop: tst.l dl_Type(a3)
- bne.s NotDisk
- tst.l dl_Task(a3)
- beq.s NotDisk
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- moveq #ei_SIZEOF,d0
- lea.l dr_DirMem(a2),a0
- bsr AllocItem
- move.l d0,a1
- beq.s MemFail
- move.l d0,d3
- inc.w d2
- lea.l ei_Name(a1),a1
- move.l dl_Name(a3),a0
- bsr BstrToCstr
- move.l d3,a1
- lea.l ei_Name(a1),a0
- ELoop: tst.b (a0)+
- bne.s ELoop
- dec.w a0
- move.b #':',(a0)+
- clr.b (a0)
- move.w #ENTRY_DEV,ei_Type(a1)
- inc.l dr_NumEntries(a2)
- move.l a2,a0
- move.l d3,a1
- ADDTAIL
- NotDisk: move.l dl_Next(a3),a3
- exg a3,d0
- lsl.l #2,d0
- tst.l d0
- beq.s NoMoreDevs
- exg d0,a3
- bra.s DevLoop
- NoMoreDevs: move.l (_SysBase).w,a6
- libcall Permit
- move.l d2,d0
- EndRD: movem.l (sp)+,d2-d3/a2-a3/a6
- rts
- MemFail: move.l (_SysBase).w,a6
- libcall Permit
- cldat d0
- bra.s EndRD
-
- *
- * put up a requester with an error message
- *
- _Error: movem.l d2-d3/a2-a3/a6,-(sp)
- move.l (_SysBase).w,a6
- move.l #it_SIZEOF,d0
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- libcall AllocMem
- move.l d0,a0
- bne.s DoErr
- EndE: movem.l (sp)+,d2-d3/a2-a3/a6
- rts
- DoErr: move.w #6,it_LeftEdge(a0)
- move.w #4,it_TopEdge(a0)
- lea.l TOPAZ_80,a1
- move.l a1,it_ITextFont(a0)
- move.l a0,-(sp)
- move.l 32(sp),a2
- bne.s DoReq
- bsr IoErrToStr
- move.l d0,a2
- DoReq: move.l (sp),a1
- move.l a2,it_IText(a1)
- move.l 28(sp),a0
- move.l gl_Window(a0),a0
- cladr a2
- lea.l ok,a3
- cldat d0
- cldat d1
- move.l #320,d2
- move.l #47,d3
- move.l _IntuitionBase,a6
- libcall AutoRequest
- move.l (sp)+,a1
- move.l #it_SIZEOF,d0
- move.l (_SysBase).w,a6
- libcall FreeMem
- bra EndE
-
- *
- * open up a directory for reading
- *
- _OpenUpDir: movem.l d2/a2-a3/a6,-(sp)
- move.l 20(sp),a2
- move.l gl_Freq(a2),a3
- move.l fr_Directory(a3),a3
- move.l a3,a0
- bsr CloseDir
- move.l a3,a0
- bsr FreeDir
- clr.l gl_Displayed(a2)
- clr.w gl_NumEntries(a2)
- clr.w gl_IsSorted(a2)
- movem.l d2-d5/a2,-(sp)
- move.l gl_Prop(a2),a0
- move.l gl_Window(a2),a1
- cladr a2
- move.l #AUTOKNOB+FREEVERT+PROPBORDERLESS+KNOBHIT,d0
- cldat d1
- cldat d2
- move.l #$ffff,d3
- move.l #$ffff,d4
- moveq #1,d5
- move.l _IntuitionBase,a6
- libcall NewModifyProp
- movem.l (sp)+,d2-d5/a2
- move.l a3,a0
- move.l gl_DrawerBuf(a2),a1
- bsr OpenDir
- tst.l d0
- bne.s DirOK
- bra.s OPENERROR
- DirOK: move.l gl_Freq(a2),a0
- move.w fr_Flags(a0),d0
- btst #1,d0
- bne.s FNS
- move.l a3,-(sp)
- bsr _ReadDevs
- addq.w #4,sp
- move.w d0,gl_NumEntries(a2)
- tst.l d0
- bne.s FNS
- pea nomem
- move.l a2,-(sp)
- bsr _Error
- addq.w #8,sp
- bra.s OPENERROR
- FNS: move.l #1,gl_IsNext(a2)
- EndOD: movem.l (sp)+,d2/a2-a3/a6
- rts
- OPENERROR: move.l _IntuitionBase,a6
- cladr a0
- libcall DisplayBeep
- move.l a3,a0
- bsr CloseDir
- move.l a3,a0
- bsr FreeDir
- move.l gl_Freq(a2),a0
- move.w fr_Flags(a0),d0
- btst #1,d0
- bne.s NoDvs
- move.l a3,-(sp)
- bsr _ReadDevs
- addq.w #4,sp
- move.w d0,gl_NumEntries(a2)
- tst.l d0
- bne.s NoDvs
- pea nomem
- move.l a2,-(sp)
- bsr _Error
- addq.w #8,sp
- NoDvs: clr.l gl_IsNext(a2)
- move.l a2,-(sp)
- bsr _SetProp
- addq.w #4,sp
- pea 0
- move.l a2,-(sp)
- bsr _PrintDir
- addq.w #8,sp
- bra.s EndOD
-
- *
- * read an entry of a directory
- *
- _GetNext: movem.l d2-d3/a2-a3/a6,-(sp)
- move.l 24(sp),a2
- move.l gl_Freq(a2),a0
- move.l fr_Directory(a0),d3
- move.l d3,a0
- bsr GetEntry
- move.l d0,a3
- beq NoNext
-
- moveq #NO_CASE,d0
- lea.l gl_Pattern(a2),a1
- lea.l ei_Name(a3),a0
- bsr MatchPattern
- tst.l d0
- beq NoMatch
- move.l gl_Freq(a2),a1
- move.l fr_DontShow(a1),a0
- bsr StrLen
- tst.l d0
- beq.s NoNoShow
-
- moveq #NO_CASE,d0
- move.l fr_DontShow(a1),a1
- lea.l ei_Name(a3),a0
- bsr MatchPattern
- tst.l d0
- bne NoMatch
-
- NoNoShow: move.l gl_Freq(a2),a0
- move.w fr_Flags(a0),d0
- btst #7,d0
- beq.s NoNoInfo
- moveq #NO_CASE,d0
- lea.l ninfo,a1
- lea.l ei_Name(a3),a0
- bsr MatchPattern
- tst.l d0
- bne NoMatch
-
- NoNoInfo: add.w #1,gl_NumEntries(a2)
- move.l a2,-(sp)
- bsr _SetProp
- addq.w #4,sp
- add.l #1,gl_Displayed(a2)
- cmp.l #9,gl_Displayed(a2)
- bcc.s NoDisp
- move.l a2,-(sp)
- bsr _PPos
- addq.w #4,sp
- move.l d0,-(sp)
- move.l a2,-(sp)
- bsr _PrintDir
- addq.w #8,sp
- bra.s NoDisp
- NoMatch:
- move.l a3,a1
- REMOVE
- move.l d3,a0
- move.l a3,a1
- sub.l #1,dr_NumEntries(a0)
- move.l #ei_SIZEOF,d0
- lea.l dr_DirMem(a0),a0
- bsr FreeItem
- NoDisp: move.l #1,gl_IsNext(a2)
- EndGN: movem.l (sp)+,d2-d3/a2-a3/a6
- rts
- NoNext:
- move.l _DOSBase,a6
- libcall IoErr
- cmp.l #ERROR_NO_MORE_ENTRIES,d0
- beq.s HaveAll
- pea 0
- move.l a2,-(sp)
- bsr _Error
- addq.w #8,sp
- bra.s DIRERROR
- HaveAll:
- ULock: move.l d3,a0
- bsr CloseDir
- Clse: clr.b gl_Pattern(a2)
- clr.l gl_IsNext(a2)
- move.l a2,-(sp)
- MsgS: bsr _DoMsg
- tst.l d0
- bne.s MsgS
- addq.w #4,sp
- cmp.l #9,gl_Displayed(a2)
- bcc.s EndGN
- move.l a2,-(sp)
- bsr _PPos
- addq.w #4,sp
- move.l d0,-(sp)
- move.l a2,-(sp)
- bsr _PrintDir
- addq.w #8,sp
- bra EndGN
- DIRERROR:
- move.l _IntuitionBase,a6
- cladr a0
- libcall DisplayBeep
- move.l d3,a0
- bsr CloseDir
- move.l d3,a0
- bsr FreeDir
- move.l gl_Freq(a2),a0
- move.w fr_Flags(a0),d0
- btst #1,d0
- beq.s Clse
- move.l d3,-(sp)
- bsr _ReadDevs
- addq.w #4,sp
- move.w d0,gl_NumEntries(a2)
- tst.l d0
- bne.s Clse
- pea nomem
- move.l a2,-(sp)
- bsr _Error
- addq.w #8,sp
- NoDe: bra Clse
-
- *
- * set the proportional gadget according to the number of entries
- *
- _SetProp: movem.l d2-d5/a2/a6,-(sp)
- move.l 28(sp),a2
- cldat d4
- cldat d2
- move.l gl_PInfo(a2),a0
- move.w pi_VertPot(a0),d2
- cmp.w #8,gl_NumEntries(a2)
- bhi.s NotSmall
- move.w #$ffff,d4
- bra.s SetIt
- NotSmall: cmp.w #9,gl_NumEntries(a2)
- bne.s NotEQ
- move.w #$08000,d4
- bra.s SetIt
- NotEQ: move.w gl_NumEntries(a2),d0
- subq.w #8,d0
- move.l #$ffff,d4
- divu d0,d4
- swap d4
- clr.w d4
- swap d4
- SetIt: move.l _IntuitionBase,a6
- move.l gl_Prop(a2),a0
- move.l gl_Window(a2),a1
- cladr a2
- move.l #AUTOKNOB+FREEVERT+PROPBORDERLESS+KNOBHIT,d0
- cldat d1
- move.l #$ffff,d3
- moveq #1,d5
- libcall NewModifyProp
- EndSPR: movem.l (sp)+,d2-d5/a2/a6
- rts
-
- *
- * find a EntryInfo structure
- *
- _GetEntryInfo:
- movem.l d2-d3/a2,-(sp)
- move.l 16(sp),a2
- move.l 20(sp),d2
- move.l dr_First(a2),a1
- bra.s CGL
- GLoop: move.l ei_Next(a1),a1
- CGL: dbra d2,GLoop
- HaveIt: move.l a1,d0
- EndGMI: movem.l (sp)+,d2-d3/a2
- rts
-
- *
- * set the frontpen
- *
- setpen: move.l _GfxBase,a6
- move.l gl_RPort(a2),a1
- moveq #1,d0
- libcall SetAPen
- rts
- *
- * print the directory
- *
- _PrintDir: movem.l d2-d6/a2-a3/a5-a6,-(sp)
- move.l 40(sp),a2
- move.l 44(sp),d0
- tst.w gl_NumEntries(a2)
- bne.s HaveEnt
- EndPD: movem.l (sp)+,d2-d6/a2-a3/a5-a6
- rts
- HaveEnt: cldat d2
- cldat d3
- moveq #13,d4
- move.w gl_NumEntries(a2),d3
- sub.l d0,d3
- cmp.l #9,d3
- blt.s LessTE
- moveq #8,d3
- LessTE: move.l d0,-(sp)
- move.l gl_Freq(a2),a0
- move.l fr_Directory(a0),-(sp)
- bsr _GetEntryInfo
- addq.w #8,sp
- move.l d0,gl_FirstDisplayed(a2)
- move.l d0,a3
- PLoop: bsr setpen
- move.l a3,a5
- cmp.w #ENTRY_DEV,ei_Type(a5)
- bne.s NotADev
- move.l gl_RPort(a2),a0
- move.l gl_Disk(a2),a1
- moveq #5,d0
- move.l d4,d1
- move.l _IntuitionBase,a6
- libcall DrawImage
- bra.s SetUPD
- NotADev: cmp.w #ENTRY_DIR,ei_Type(a5)
- bne.s IsAFile
- move.l gl_RPort(a2),a0
- move.l gl_Drawer(a2),a1
- moveq #5,d0
- move.l d4,d1
- move.l _IntuitionBase,a6
- libcall DrawImage
- SetUPD: movem.l d2-d3,-(sp)
- move.l gl_RPort(a2),a1
- move.l #42,d0
- move.l d4,d1
- move.l #44,d2
- move.l d4,d3
- addq.l #8,d3
- move.l _GfxBase,a6
- libcall RectFill
- movem.l (sp)+,d2-d3
- move.l #23,d6
- move.l #44,d5
- bra.s DoName
- IsAFile: moveq #5,d5
- move.l #28,d6
- DoName: lea.l ei_Name(a5),a0
- move.b (a0,d6.l),-(sp)
- clr.b (a0,d6.l)
- pea RP_JAM2
- pea 1
- pea 2
- move.l d4,-(sp)
- move.l d5,-(sp)
- move.l a0,-(sp)
- move.l gl_RPort(a2),-(sp)
- bsr _Print
- lea.l 28(sp),sp
- lea.l ei_Name(a5),a0
- move.b (sp)+,(a0,d6.l)
- bsr StrLen
- mulu #8,d0
- add.l d0,d5
- cmp.l #232,d5
- bge.s NoClear
- bsr setpen
- movem.l d2-d3,-(sp)
- move.l gl_RPort(a2),a1
- move.l d5,d0
- move.l d4,d1
- move.l #233,d2
- move.l d4,d3
- addq.l #8,d3
- libcall RectFill
- movem.l (sp)+,d2-d3
- NoClear: move.l ei_Next(a3),a3
- add.l #10,d4
- inc.l d2
- cmp.l d3,d2
- bne PLoop
- cmp.l #8,d2
- bge EndPD
- bsr setpen
- move.l gl_RPort(a2),a1
- moveq #4,d0
- move.l d4,d1
- move.l #233,d2
- move.l #91,d3
- libcall RectFill
- bra EndPD
-
- *
- * increase prop position by "x"
- *
- _AddProp: movem.l d2-d5/a2/a6,-(sp)
- move.l 28(sp),a2
- move.l 32(sp),d3
- cmp.w #8,gl_NumEntries(a2)
- bge.s AddIt
- RF: cldat d0
- EndAP: movem.l (sp)+,d2-d5/a2/a6
- rts
- AddIt: cldat d2
- cldat d4
- move.l gl_PInfo(a2),a0
- move.w pi_VertPot(a0),d2
- move.w pi_VertBody(a0),d4
- cmp.l #$ffff,d2
- beq.s RF
- move.l d4,d0
- mulu d3,d0
- add.l d0,d2
- cmp.l #$ffff,d2
- bmi.s NoMax
- move.l #$ffff,d2
- NoMax: move.l _IntuitionBase,a6
- move.l gl_Prop(a2),a0
- move.l gl_Window(a2),a1
- cladr a2
- move.l #AUTOKNOB+FREEVERT+PROPBORDERLESS+KNOBHIT,d0
- cldat d1
- move.l #$ffff,d3
- moveq #1,d5
- libcall NewModifyProp
- moveq #1,d0
- bra.s EndAP
-
- *
- * decrease the prop position by "x"
- *
- _SubProp: movem.l d2-d5/a2/a6,-(sp)
- move.l 28(sp),a2
- move.l 32(sp),d3
- cmp.w #8,gl_NumEntries(a2)
- bge.s SubIt
- RFA: cldat d0
- EndSP: movem.l (sp)+,d2-d5/a2/a6
- rts
- SubIt: cldat d2
- cldat d4
- move.l gl_PInfo(a2),a0
- move.w pi_VertPot(a0),d2
- move.w pi_VertBody(a0),d4
- tst.l d2
- beq.s RFA
- move.l d4,d0
- mulu d3,d0
- sub.l d0,d2
- tst.l d2
- bpl.s NoMin
- cldat d2
- NoMin: move.l _IntuitionBase,a6
- move.l gl_Prop(a2),a0
- move.l gl_Window(a2),a1
- cladr a2
- move.l #AUTOKNOB+FREEVERT+PROPBORDERLESS+KNOBHIT,d0
- cldat d1
- move.l #$ffff,d3
- moveq #1,d5
- libcall NewModifyProp
- moveq #1,d0
- bra.s EndSP
-
- *
- * a gadget in the fileselection block was selected. look what the type of
- * entry the gadget was and take appropiate action.
- *
- _DoFSel: movem.l d2/a2-a3/a5-a6,-(sp)
- move.l 24(sp),a2
- cldat d2
- move.w gl_Id(a2),d2
- subq.w #8,d2
- cmp.w gl_NumEntries(a2),d2
- bcs.s NumOK
- EndDF: movem.l (sp)+,d2/a2-a3/a5-a6
- rts
- NumOK: move.l gl_FirstDisplayed(a2),a3
- bra.s Test
- Loop: move.l ei_Next(a3),a3
- Test: dbra d2,Loop
- move.l _IntuitionBase,a6
- move.l a3,a5
- cmp.w #ENTRY_FILE,ei_Type(a5)
- bne.s NotAFile
- move.l gl_FileBuf(a2),a0
- lea.l ei_Name(a5),a1
- bsr StrCpy
- move.l gl_FileG(a2),a0
- move.l gl_Window(a2),a1
- cladr a2
- moveq #1,d0
- libcall RefreshGList
- bra.s EndDF
- NotAFile: cmp.w #ENTRY_DIR,ei_Type(a5)
- bne.s MustBeADev
- move.l gl_DrawerBuf(a2),a0
- bsr StrLen
- dec.w a0
- lea.l ei_Name(a5),a1
- bsr StrCpy
- move.b #'/',(a0)+
- clr.b (a0)
- bra.s Refr
- MustBeADev: move.l gl_DrawerBuf(a2),a0
- lea.l ei_Name(a5),a1
- bsr StrCpy
- Refr: move.l a2,-(sp)
- move.l gl_DirG(a2),a0
- move.l gl_Window(a2),a1
- cladr a2
- moveq #1,d0
- libcall RefreshGList
- move.l (sp),a2
- lea.l gl_Pattern(a2),a0
- clr.b (a0)
- bsr _OpenUpDir
- addq.w #4,sp
- bra EndDF
- *
- * append a '/' to the pathname if neacecary
- *
- _UpDatePath:
- move.l a2,-(sp)
- move.l 8(sp),a2
- move.l gl_DrawerBuf(a2),a0
- bsr StrLen
- tst.l d0
- beq.s NoUDP
- subq.w #2,a0
- cmp.b #':',(a0)
- beq.s NoUDP
- cmp.b #'/',(a0)
- beq.s NoUDP
- inc.w a0
- move.b #'/',(a0)+
- clr.b (a0)
- NoUDP: move.l (sp)+,a2
- rts
-
- *
- * read the parent directory of the current directory
- *
- _Parent: movem.l a2/a6,-(sp)
- move.l 12(sp),a2
- move.l gl_DrawerBuf(a2),a0
- bsr StrLen
- tst.l d0
- bne.s HavePath
- FALSE: cldat d0
- EndP: movem.l (sp)+,a2/a6
- rts
- HavePath: subq.w #2,a0
- cmp.b #':',(a0)
- beq.s FALSE
- dec.w a0
- Search: move.b -(a0),d0
- cmp.b #':',d0
- beq.s GotPar
- cmp.b #'/',d0
- bne.s Search
- GotPar: inc.w a0
- clr.b (a0)
- move.l gl_DirG(a2),a0
- move.l gl_Window(a2),a1
- cladr a2
- moveq #1,d0
- move.l _IntuitionBase,a6
- libcall RefreshGList
- moveq #1,d0
- bra.s EndP
-
- *
- * lock the caller window its IDCMP with a small requester
- *
- _LockCaller:
- movem.l a2-a3/a6,-(sp)
- move.l 16(sp),a2
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- move.l #rq_SIZEOF,d0
- lea.l gl_Misc(a2),a0
- bsr AllocItem
- move.l d0,a3
- bne.s GotReq
- EndLC: movem.l (sp)+,a2-a3/a6
- rts
- GotReq: move.l _IntuitionBase,a6
- move.l a3,a0
- libcall InitRequester
- move.w #1,rq_Width(a3)
- move.w #1,rq_Height(a3)
- move.l _GfxBase,a6
- move.l gl_Freq(a2),a1
- move.l fr_Caller(a1),a1
- move.l wd_RPort(a1),a1
- cldat d0
- cldat d1
- libcall ReadPixel
- move.b d0,rq_BackFill(a3)
- move.l _IntuitionBase,a6
- move.l a3,a0
- move.l gl_Freq(a2),a1
- move.l fr_Caller(a1),a1
- libcall Request
- tst.l d0
- beq.s EndLC
- move.l a3,gl_WindowLock(a2)
- bra.s EndLC
-
- *
- * remove the requester
- *
- _UnLockCaller:
- movem.l a2/a6,-(sp)
- move.l 12(sp),a2
- tst.l gl_WindowLock(a2)
- bne.s CanCL
- EndULC: movem.l (sp)+,a2/a6
- rts
- CanCL: move.l _IntuitionBase,a6
- move.l gl_WindowLock(a2),a0
- move.l gl_Freq(a2),a1
- move.l fr_Caller(a1),a1
- libcall EndRequest
- bra.s EndULC
-
- MODE_READWRITE EQU 1004 ; 'libraries/dos.i' ?!?!?!?!
- *
- * end the filerequester and open the selected file if requested
- *
- _TheEnd: link a5,#-256
- movem.l d2-d4/a2-a3/a6,-(sp)
- move.l 8(a5),a2
- move.l 12(a5),d2
- move.l gl_Freq(a2),a3
- cldat d3
- move.w fr_Flags(a3),d3
- moveq #1,d4
- lea.l -256(a5),a0
- move.l gl_DrawerBuf(a2),a1
- bsr StrCpy
- move.l gl_FileBuf(a2),a1
- bsr StrCpy
- move.l d3,d0
- btst #3,d0
- beq.s NoCC
- move.l a2,-(sp)
- bsr _DoColors
- addq.w #4,sp
- NoCC: move.l fr_Directory(a3),a0
- bsr CloseDir
- btst #0,d3
- beq.s DoPR
- move.l fr_Directory(a3),a0
- bsr FreeDir
- DoPR: tst.l gl_IsNext(a2) ; if the requester wasn't ready
- beq.s DoOpen ; reading the directory the dir
- move.l fr_Directory(a3),a0 ; is freed wheter FR_NoPreserve
- bsr FreeDir ; is set or not.
- DoOpen: move.l _DOSBase,a6
- cmp.l #FREQ_CANCELED,d2
- beq.s OpenDone
- btst #4,d3
- beq.s NoOld
- btst #5,d3
- bne.s DoVoid
- btst #6,d3
- bne.s DoVoid
- move.l #MODE_OLDFILE,d2
- bra.s OpenIt
- NoOld: btst #5,d3
- beq.s NoNew
- btst #4,d3
- bne.s DoVoid
- btst #6,d3
- bne.s DoVoid
- move.l #MODE_NEWFILE,d2
- bra.s OpenIt
- NoNew: btst #6,d3
- beq.s DoVoid
- btst #5,d3
- bne.s DoVoid
- btst #4,d3
- bne.s DoVoid
- move.l #MODE_READWRITE,d2
- OpenIt: lea.l -256(a5),a0
- move.l a0,d1
- libcall Open
- move.l d0,fr_Handle(a3)
- tst.l d0
- bne.s OpenDone
- cldat d4
- bra.s OpenDone
- DoVoid: clr.l fr_Handle(a3)
- OpenDone: move.l _GfxBase,a6
- move.l gl_Font(a2),a1
- libcall CloseFont
- move.l gl_Proc(a2),a0
- move.l gl_PRWindow(a2),pr_WindowPtr(a0)
- move.l gl_Window(a2),a0
- move.l _IntuitionBase,a6
- libcall CloseWindow
- tst.l fr_Caller(a3)
- beq.s NoCL
- move.l a2,-(sp)
- bsr _UnLockCaller
- addq.w #4,sp
- NoCL: lea.l gl_Misc(a2),a0
- bsr FreeMemoryChain
- move.l gl_TimeDelay(a2),a0
- bsr DeleteTimeDelay
- move.l d4,d0
- movem.l (sp)+,d2-d4/a2-a3/a6
- unlk a5
- rts
-
-
- *
- * the main routine
- *
- xdef FileRequest
-
- FileRequest:
- movem.l d2-d5/a2-a3/a6,-(sp)
- move.l a0,a3
-
- cldat d2
- cldat d3
-
- move.l (_SysBase).w,a6
- move.l #gl_SIZEOF,d0
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
- libcall AllocMem
- move.l d0,a2
- bne.s GotGlob
-
- moveq #FREQ_CANT_OPEN,d0
- EndFR: movem.l (sp)+,d2-d5/a2-a3/a6
- rts
- GotGlob:
- move.l a3,gl_Freq(a2)
- move.l fr_FileName(a3),gl_FileBuf(a2)
- move.l fr_DirName(a3),gl_DrawerBuf(a2)
-
- lea.l gl_Misc(a2),a0
- move.l #1024,d0
- bsr InitMemoryChain
-
- tst.l fr_Caller(a3)
- beq.s NoCaller
- move.l a2,-(sp)
- bsr _LockCaller
- addq.w #4,sp
- NoCaller:
- clr.w gl_IsSorted(a2)
-
- move.l a2,-(sp)
- bsr _GetFSWindow
- addq.w #4,sp
- tst.l d0
- beq FreqFailed
-
- move.l gl_Window(a2),a0
- move.l wd_UserPort(a0),a0
- cldat d0
- move.l #100000,d1
- bsr CreateTimeDelay
- move.l d0,gl_TimeDelay(a2)
- beq FreqFailed
-
- lea.l gl_Pattern(a2),a1
- move.l fr_DirName(a3),a0
- bsr Isolate
-
- move.l a2,-(sp)
- bsr _UpDatePath
- addq.w #4,sp
-
- move.l fr_Directory(a3),a0
- tst.l dr_NumEntries(a0)
- beq.s NewDir
- move.l dr_First(a0),gl_FirstDisplayed(a2)
- move.w dr_NumEntries+2(a0),gl_NumEntries(a2)
- move.l a2,-(sp)
- bsr _SetProp
- addq.w #4,sp
- move.l #0,gl_IsNext(a2)
- bra.s PrintIt
- NewDir:
- move.l a2,-(sp)
- bsr _OpenUpDir
- addq.w #4,sp
- PrintIt:
- pea 0
- move.l a2,-(sp)
- bsr _PrintDir
- addq.w #8,sp
-
- FOREVER:
- tst.l gl_IsNext(a2)
- beq.s Wait
- move.l a2,-(sp)
- bsr _GetNext
- addq.w #4,sp
- bra.s Eval
- Wait:
- move.l (_SysBase).w,a6
- move.l gl_Window(a2),a0
- move.l wd_UserPort(a0),a0
- libcall WaitPort
-
- move.l a2,-(sp)
- bsr _DoMsg
- addq.w #4,sp
- tst.w gl_IsSorted(a2)
- bne.s Evals
- cmp.w #7,gl_Id(a2)
- bhi.s Evals
- cldat d0
- move.w fr_Flags(a3),d0
- btst.l #2,d0
- bne.s Evals
- move.l fr_Directory(a3),-(sp)
- bsr _SortNames
- addq.w #4,sp
- move.l a2,-(sp)
- bsr _PPos
- addq.w #4,sp
- move.l d0,-(sp)
- move.l a2,-(sp)
- bsr _PrintDir
- addq.w #8,sp
- move.w #1,gl_IsSorted(a2)
- bra.s Evals
- Eval:
- move.l a2,-(sp)
- bsr _DoMsg
- addq.w #4,sp
- tst.l d0
- beq FOREVER
- Evals: cmp.l #CLOSEWINDOW,gl_Class(a2)
- bne.s NoCLW
- bra CloseW
- NoCLW: cmp.l #MOUSEBUTTONS,gl_Class(a2)
- bne.s NotMB
- cmp.w #MENUDOWN,gl_Code(a2)
- bne.s Eval
- movem.l d2-d5/a2,-(sp)
- cldat d4
- move.l gl_PInfo(a2),a0
- move.w pi_VertBody(a0),d4
- move.l _IntuitionBase,a6
- move.l gl_Prop(a2),a0
- move.l gl_Window(a2),a1
- cladr a2
- move.l #AUTOKNOB+FREEVERT+PROPBORDERLESS+KNOBHIT,d0
- cldat d1
- cldat d2
- move.l #$ffff,d3
- moveq #1,d5
- libcall NewModifyProp
- movem.l (sp)+,d2-d5/a2
- cldat d2
- pea 0
- move.l a2,-(sp)
- bsr _PrintDir
- addq.w #8,sp
- bra.s Eval
- NotMB:
- cmp.l #MOUSEMOVE,gl_Class(a2)
- bne.s NotMM
- bsr PropB
- bra Eval
- NotMM:
- cmp.l #GADGETDOWN,gl_Class(a2)
- bne.s NoGD
- cmp.w #5,gl_Id(a2)
- bne.s NotProp
- bsr PropB
- bra Eval
- NotProp: cmp.w #6,gl_Id(a2)
- bne.s NotDown
- bsr Down
- bra Eval
- NotDown: cmp.w #7,gl_Id(a2)
- bne Eval
- bsr Up
- bra Eval
- NoGD:
- cmp.l #GADGETUP,gl_Class(a2)
- bne.s NotGU
- cmp.w #8,gl_Id(a2)
- bmi.s NoFS
- move.l a2,-(sp)
- bsr _DoFSel
- addq.w #4,sp
- bra Eval
- NoFS: tst.w gl_Id(a2)
- bne.s NoCNC
- bra CloseW
- NoCNC: cmp.w #1,gl_Id(a2)
- bne.s NoPar
- bsr Par
- bra Eval
- NoPar: cmp.w #2,gl_Id(a2)
- beq.s DoOK
- cmp.w #3,gl_Id(a2)
- bne.s NoOK
- DoOK: bra TryOK
- NoOK: cmp.w #4,gl_Id(a2)
- bne Eval
- bsr NewPath
- bra Eval
- NotGU: cmp.l #RAWKEY,gl_Class(a2)
- bne Eval
- tst.l gl_IsNext(a2)
- bne Eval
- move.w gl_Code(a2),d0
- andi.w #IECODE_UP_PREFIX,d0
- cmp.w #IECODE_UP_PREFIX,d0
- beq Eval
- cmp.w #IEQUALIFIER_RELATIVEMOUSE,gl_Qualifier(a2)
- beq Good
- cmp.w #IEQUALIFIER_RELATIVEMOUSE+IEQUALIFIER_CAPSLOCK,gl_Qualifier(a2)
- bne Eval
- Good: cmp.w #$5F,gl_Code(a2)
- bne Eval
- move.l a2,-(sp)
- bsr _OpenUpDir
- addq.w #4,sp
- bra Eval
- FreqFailed: tst.l gl_WindowLock(a2)
- beq.s NoWDL
- move.l a2,-(sp)
- bsr _UnLockCaller
- addq.w #4,sp
- NoWDL: lea.l gl_Misc(a2),a0
- bsr FreeMemoryChain
- move.l #gl_SIZEOF,d0
- move.l a2,a1
- move.l (_SysBase).w,a6
- libcall FreeMem
- moveq #FREQ_CANT_OPEN,d0
- bra EndFR
-
- CloseW: pea FREQ_CANCELED
- move.l a2,-(sp)
- bsr _TheEnd
- addq.w #8,sp
- move.l #gl_SIZEOF,d0
- move.l a2,a1
- move.l (_SysBase).w,a6
- libcall FreeMem
- moveq #FREQ_CANCELED,d0
- bra EndFR
-
- PropB: move.l gl_PInfo(a2),a0
- move.w pi_Flags(a0),d0
- btst.l #8,d0
- bne.s PropM
- move.l a2,-(sp)
- bsr _PPos
- addq.w #4,sp
- pea 6
- move.l a2,-(sp)
- cmp.l d0,d2
- beq.s MsgL
- bhi.s SubP
- bsr _AddProp
- bra.s SetU
- SubP: bsr _SubProp
- SetU: addq.w #8,sp
- move.l a2,-(sp)
- bsr _PPos
- addq.w #4,sp
- move.l d0,d2
- move.l d0,-(sp)
- move.l a2,-(sp)
- bsr _PrintDir
- addq.w #8,sp
- MsgL: move.l a2,-(sp)
- bsr _DoMsg
- addq.w #4,sp
- tst.l d0
- bne.s MsgL
- rts
-
- PropM: move.l a2,-(sp)
- bsr _PPos
- addq.w #4,sp
- move.l d0,d3
- cmp.l d2,d3
- beq.s MsgL
- move.l d3,-(sp)
- move.l a2,-(sp)
- bsr _PrintDir
- addq.w #8,sp
- move.l d3,d2
- NoNxt: bra.s MsgL
-
- Down: cldat d0
- move.l gl_IAddress(a2),a0
- move.w gg_Flags(a0),d0
- andi.w #SELECTED,d0
- beq.s NotSL
- pea 1
- move.l a2,-(sp)
- bsr _AddProp
- addq.w #8,sp
- move.l a2,-(sp)
- bsr _PPos
- addq.w #4,sp
- move.l d0,d2
- move.l d2,-(sp)
- move.l a2,-(sp)
- bsr _PrintDir
- addq.w #8,sp
- tst.l gl_IsNext(a2)
- bne.s NoDel
- NotSL: move.l gl_TimeDelay(a2),a0
- bsr DoTimeDelay
- NoDel: move.l a2,-(sp)
- bsr _DoMsg
- addq.w #4,sp
- tst.l gl_IsNext(a2)
- beq.s NoNxt1
- move.l a2,-(sp)
- bsr _GetNext
- addq.w #4,sp
- NoNxt1: cmp.l #GADGETUP,gl_Class(a2)
- beq.s NoMoreD
- cmp.w #SELECTUP,gl_Code(a2)
- bne.s Down
- NoMoreD: move.l a2,-(sp)
- bsr _DoMsg
- addq.w #4,sp
- tst.l d0
- bne.s NoMoreD
- rts
-
- Up: cldat d0
- move.l gl_IAddress(a2),a0
- move.w gg_Flags(a0),d0
- andi.w #SELECTED,d0
- beq.s NotSL1
- pea 1
- move.l a2,-(sp)
- bsr _SubProp
- addq.w #8,sp
- move.l a2,-(sp)
- bsr _PPos
- addq.w #4,sp
- move.l d0,d2
- move.l d2,-(sp)
- move.l a2,-(sp)
- bsr _PrintDir
- addq.w #8,sp
- tst.l gl_IsNext(a2)
- bne.s NoDel1
- NotSL1: move.l gl_TimeDelay(a2),a0
- bsr DoTimeDelay
- NoDel1: move.l a2,-(sp)
- bsr _DoMsg
- addq.w #4,sp
- tst.l gl_IsNext(a2)
- beq.s NoNxt2
- move.l a2,-(sp)
- bsr _GetNext
- addq.w #4,sp
- NoNxt2: cmp.l #GADGETUP,gl_Class(a2)
- beq.s NoMoreU
- cmp.w #SELECTUP,gl_Code(a2)
- bne.s Up
- NoMoreU: move.l a2,-(sp)
- bsr _DoMsg
- addq.w #4,sp
- tst.l d0
- bne.s NoMoreU
- rts
-
- Par: move.l a2,-(sp)
- bsr _Parent
- addq.w #4,sp
- tst.l d0
- beq.s NoParent
- lea.l gl_Pattern(a2),a0
- clr.b (a0)
- move.l a2,-(sp)
- bsr _OpenUpDir
- addq.w #4,sp
- move.l a2,-(sp)
- bsr _PPos
- addq.w #4,sp
- move.l d0,d2
- NoParent: rts
-
- TryOK: move.l gl_FileBuf(a2),a0
- bsr StrLen
- tst.l d0
- beq Eval
- pea FREQ_OK
- move.l a2,-(sp)
- bsr _TheEnd
- addq.w #8,sp
- move.l d0,d5
- move.l (_SysBase).w,a6
- move.l a2,a1
- move.l #gl_SIZEOF,d0
- libcall FreeMem
- tst.l d5
- beq.s RetF
- moveq #FREQ_OK,d0
- bra EndFR
- RetF: moveq #FREQ_FILE_ERROR,d0
- bra EndFR
-
- NewPath: lea.l gl_Pattern(a2),a1
- move.l gl_DrawerBuf(a2),a0
- bsr Isolate
- move.l a2,-(sp)
- bsr _UpDatePath
- addq.w #4,sp
- move.l a2,-(sp)
- move.l _IntuitionBase,a6
- move.l gl_DirG(a2),a0
- move.l gl_Window(a2),a1
- cladr a2
- moveq #1,d0
- libcall RefreshGList
- move.l (sp),a2
- bsr _OpenUpDir
- bsr _PPos
- addq.w #4,sp
- move.l d0,d2
- rts
-
- *
- * Datas for the gadgets, window, texts e.c.t. This data get's read only.
- *
- even
- *
- * The PropInfo structure.
- *
- PINFO: dc.w AUTOKNOB+FREEVERT+PROPBORDERLESS+KNOBHIT
- dc.w $0000,$0000,$ffff,$ffff,0,0,0,0,0,0
-
- *
- * The Image structures.
- *
- FSI: dc.w 3,0,14,8,2
- dc.l 0
- dc.b 1,0
- dc.l 0
-
- dc.w 3,0,14,8,2
- dc.l 0
- dc.b 1,0
- dc.l 0
-
- dc.w 0,0,37,8,2
- dc.l 0
- dc.b 3,0
- dc.l 0
-
- dc.w 0,0,37,8,2
- dc.l 0
- dc.b 1,0
- dc.l 0
- *
- * The image data.
- *
- FSD: dc.w $FFFC,$8004,$C00C,$E01C,$F03C,$F87C,$FCFC,$FFFC
- dc.w $FFFC,$FCFC,$F87C,$F03C,$E01C,$C00C,$8004,$FFFC
- dc.w $FFFF,$FFFF,$F800,$8000,$0000,$0800,$BFFF,$FFFF
- dc.w $E800,$BFE3,$FC7F,$E800,$BFF0,$003F,$E800,$BFFF
- dc.w $FFFF,$E800,$8000,$0000,$0800,$FFFF,$FFFF,$F800
- dc.w $FFF8,$01FF,$F800,$FFF8,$017F,$F800,$FFF8,$01FF
- dc.w $F800,$FFF8,$01FF,$F800,$FFFF,$FFFF,$F800,$FFF8
- dc.w $01FF,$F800,$FFFB,$01FF,$F800,$FFF8,$01FF,$F800
- dc.w $003F,$FFC0,$0000,$003F,$FFC0,$0000,$003F,$FFC0
- dc.w $0000,$003F,$FFC0,$0000,$003F,$FFC0,$0000,$0038
- dc.w $01C0,$0000,$0038,$01C0,$0000,$0018,$01C0,$0000
- *
- * The FileRequester Gadgets.
- *
- FSG: dc.l 0
- dc.w 180,122,68,11
- dc.w GADGHCOMP
- dc.w RELVERIFY
- dc.w BOOLGADGET
- dc.l 0,0,0,0,0
- dc.w 0
- dc.l 0
-
- dc.l 0
- dc.w 96,122,68,11
- dc.w GADGHCOMP
- dc.w RELVERIFY
- dc.w BOOLGADGET
- dc.l 0,0,0,0,0
- dc.w 1
- dc.l 0
-
- dc.l 0
- dc.w 12,122,68,11
- dc.w GADGHCOMP
- dc.w RELVERIFY
- dc.w BOOLGADGET
- dc.l 0,0,0,0,0
- dc.w 2
- dc.l 0
-
- dc.l 0
- dc.w 64,109,184,8
- dc.w GADGHCOMP
- dc.w RELVERIFY
- dc.w STRGADGET
- dc.l 0,0,0,0,0
- dc.w 3
- dc.l 0
-
- dc.l 0
- dc.w 64,97,184,8
- dc.w GADGHCOMP
- dc.w RELVERIFY
- dc.w STRGADGET
- dc.l 0,0,0,0,0
- dc.w 4
- dc.l 0
-
- dc.l 0
- dc.w 239,23,14,58
- dc.w GADGHCOMP
- dc.w RELVERIFY+GADGIMMEDIATE+FOLLOWMOUSE
- dc.w PROPGADGET
- dc.l 0,0,0,0,0
- dc.w 5
- dc.l 0
-
- dc.l 0
- dc.w 236,84,20,8
- dc.w GADGHCOMP+GADGIMAGE
- dc.w RELVERIFY+GADGIMMEDIATE
- dc.w BOOLGADGET
- dc.l 0,0,0,0,0
- dc.w 6
- dc.l 0
-
- dc.l 0
- dc.w 236,12,20,8
- dc.w GADGHCOMP+GADGIMAGE
- dc.w RELVERIFY+GADGIMMEDIATE
- dc.w BOOLGADGET
- dc.l 0,0,0,0,0
- dc.w 7
- dc.l 0
- *
- * The Gadget structure for the File-Selection block.
- *
- FGAD: dc.l 0
- dc.w 4,12,230,10
- dc.w GADGHCOMP
- dc.w RELVERIFY
- dc.w BOOLGADGET
- dc.l 0,0,0,0,0
- dc.w 0
- dc.l 0
- *
- * The FileRequester NewWindow structure.
- *
- fsnw: dc.w 40,15,260,140
- dc.b 2,1
- dc.l GADGETDOWN+GADGETUP+CLOSEWINDOW+MOUSEBUTTONS+MOUSEMOVE+RAWKEY
- dc.l WINDOWDRAG+WINDOWCLOSE+ACTIVATE+RMBTRAP+NOCAREREFRESH
- dc.l 0,0,0,0,0
- dc.w 0,0,0,0,WBENCHSCREEN
- *
- * Various texts used.
- *
- fnam: dc.b 'topaz.font',0
- oktext: dc.b 'OK',0
- cancel: dc.b 'CANCEL',0
- parent: dc.b 'Parent',0
- file: dc.b 'File',0
- drawer: dc.b 'Drawer',0
- nomem: dc.b 'Out of memory !',0
- open: dc.b 'Can',96,'t open this dir !',0
- ninfo: dc.b '*.info',0
-
- even
- *
- * TextAttr structure (topaz 8)
- *
- TOPAZ_80:
- dc.l fnam
- dc.w TOPAZ_EIGHTY
- dc.b FS_NORMAL,FPF_ROMFONT
- *
- * OK text for the error requester
- *
- ok: dc.b 0,0,RP_JAM1,0 ; last byte is kludgefill
- dc.w 6,4
- dc.l TOPAZ_80,oktext,0
-
- even
-
-
-
-