home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
disks
/
disk396.lzh
/
PFiler
/
PFiler.asm
< prev
next >
Wrap
Assembly Source File
|
1990-10-29
|
36KB
|
1,129 lines
; OPT O+
; OPT O1+ ;Tells when a branch could be optimised to short
; OPT i+ ;Tells when '#' is probably missing
incdir "INCLUDE:"
include "exec/memory.i"
include "exec/exec_lib.i"
include "graphics/rastport.i"
include "graphics/graphics_lib.i"
include "intuition/intuition.i"
include "intuition/intuition_lib.i"
include "libraries/dos.i"
include "libraries/dosextens.i"
include "libraries/dos_lib.i"
incdir "DF0:PFiler/"
include "PFiler.i"
* A few macro's
LoadBase MACRO
IFNC '\1','ExecBase'
movea.l FD_\1(A5),A6
ENDC
IFC '\1','ExecBase'
movea.l 4.W,A6
ENDC
ENDM
CallLib MACRO
jsr _LVO\1(A6)
ENDM
Call MACRO
bsr \1
ENDM
PushS MACRO
move.l \1,-(SP)
ENDM
PopS MACRO
move.l (SP)+,\1
ENDM
Push MACRO
movem.l \1,-(SP)
ENDM
Pop MACRO
movem.l (SP)+,\1
ENDM
GADGET MACRO
dc.l \1
dc.w \2,\3,\4,\5,\6,\7,\8
ENDM
GADGET2 MACRO
dc.l \1,\2,\3,\4,\5
dc.w \6
dc.l \7
ENDM
BORDER MACRO
dc.w \1,\2
dc.b \3,\4,\5,\6
dc.l \7,\8
ENDM
IMAGE MACRO
dc.w \1,\2,\3,\4,\5
dc.l \6
dc.b \7,\8
dc.l \9
ENDM
INTUITEXT MACRO
dc.b \1,\2,\3,0
dc.w \4,\5
dc.l TxtAttr,\6,\7
ENDM
* These are MY definitions.
BUTCOLOR =3
STRCOLOR =3
PROPCOLOR =3
FILECOLOR =1
DIRCOLOR =3
DEVCOLOR =2
;The possible Node-Types
DIRTYPE =-1 ;Node contains the name of a directory ('c','libs','med-res' etc.)
DEVTYPE =-2 ;Node contains the name of a device ('DF1:','DH0:' etc.)
VOLTYPE =-3 ;Node contains the name of a volume ('CLIDisk:','AmigaLibDisk294:' etc.)
ASNTYPE =-4 ;Node contains the name of a logical device ('LIBS:','S:','FONTS:' etc.)
;A Node containing the name of file is
;characterized by having a type >=0 (the size actually)
;Flags indicating what has to be done
NEWDIR =0 ;Start scanning a new directory and the Device-List
REFSTR =1 ;Refresh string-gadgets
ACTFSG =2 ;Activate the file-string-gadget
GETDEVS =3 ;Get names from Device-List instead of from disk
NOTDEVS =4 ;Don't show devices until the user clicks RMB
LETSWAIT =5 ;Be nice and wait for next message
DONTPOS =6 ;Just a trick to help saving a few bytes
KEEPTOP =7 ;Keep the display steady for a while no matter what arrives in the list
Select1ID =0 ;Gadget ID's
Select2ID =1
Select3ID =2
Select4ID =3
Select5ID =4
Select6ID =5
Select7ID =6
ParentID =7
UpID =8
DownID =9
SlideID =10
PathID =11
PosID =12
NegID =13
;STRUCTURE EntryNode (Variable size)
EntryNext =0 ;APTR EntryNext This is a single-linked list
EntryType =4 ;WORD EntryType
EntrySize =8 ;LONG EntrySize
EntryName =10 ;APTR EntryName
EntrySIZEOF =10 ;Size of EntryNode (Except for the string)
;STRUCTURE FileSelectData
FD_DosBase =0 ;APTR FD_DosBase
FD_GfxBase =4 ;APTR FD_GfxBase
FD_IntBase =8 ;APTR FD_IntBase
FD_Window =12 ;APTR FD_Window
FD_Rp =16 ;APTR FD_Rp ;Rastport
FD_Up =20 ;APTR FD_Up ;UserPort (for messages)
FD_FIB =24 ;APTR FD_FIB ;FileInfoBlock
FD_Lock =28 ;APTR FD_Lock ;Lock)
FD_SlideHeight =32 ;WORD FD_SlideHeight ;Height of slide-knob
FD_SlideVPos =34 ;WORD FD_SlideVPos ;Vertical position of slide-knob
FD_Class =36 ;WORD FD_Class ;\
FD_Code =40 ;WORD FD_Code ; \
FD_IAddress =42 ;WORD FD_IAddress ; > Copied from last IntuiMessage
FD_Seconds =46 ;LONG FD_Seconds ; /
FD_Micros =50 ;LONG FD_Micros ;/
FD_OSeconds =54 ;LONG FD_OSeconds ;\
FD_OMicros =58 ;LONG FD_OMicros ; > Used to check for double-clicks
FD_LastSelect =62 ;LONG FD_LastSelect ;/
FD_TxtBuf =66 ;APTR FD_TxtBuf
FD_DisplayList =70 ;APTR FD_DisplayList
FD_SIZEOF =76 ;(74) ;Size of FileSelectBlock ((FD_SIZEOF mod 4) MUST be 0)
DisplayCols =32 ;Length of TxtBuffer
DisplayRows =7 ;Lines on display
InternalMem =FD_SIZEOF+fib_SIZEOF+4*DisplayRows+DisplayCols+10
SECTION SELECT,CODE
FReq EQUR A4
FData EQUR A5
*----------------------------------------------------
* Frees the memory for every node in FR_List
* Doesn't destroy registers
*----------------------------------------------------
XDEF _FreeFileSelect
_FreeFileSelect Push D0-D7/A0-A6
movea.l 4*15+4(SP),FReq ;FSRequest always in A4
LoadBase ExecBase
lea FR_List(FReq),A1
move.l EntryNext(A1),D2 ;Save first node in list for later
clr.l EntryNext(A1)
FreeLoop tst.l D2 ;Any node ?
beq.S DoneFreeList
movea.l D2,A1
move.l EntryNext(A1),D2 ;Save next node in list for later
move.w EntrySize(A1),D0
ext.l D0
CallLib FreeMem ;Free this node
bra.S FreeLoop
DoneFreeList Pop D0-D7/A0-A6
rts
*----------------------------------------------------
*FILESELECT
*Register usage:
* A4: Used for base-relative access to user-supplied FileSelectRequest-structure (Never changed)
* A5: Used for base-relative access to internally used/allocated data (Never changed)
* A6: Only used for base-relative library-calls (Changes all the time)
* All internally called sub-routines (referenced by the macro CALL)
* preserves all registers (except A6), apart from some
* (MyStrLen, ExNextD), which returns something in D0
* Sort does not preserve registers at all
* FileSelect itself returns an error-code in D0
*----------------------------------------------------
XDEF _FileSelect
* Here we enter the FileSelect
_FileSelect Push D1-D7/A0-A6
movea.l 4*14+4(SP),FReq ;FSRequest always in A4
move.l FR_PosTxt(FReq),D0 ;User-defined PosTxt ?
bne.S SetPosTxt
lea TxtPositiv(PC),A0 ;Set default PosTxt
move.l A0,D0
SetPosTxt lea ITxtPos(PC),A0
move.l D0,it_IText(A0) ;Put PosTxt into IntuiText
move.l FR_NegTxt(FReq),D0 ;User-defined NegTxt ?
bne.S SetNegTxt
lea TxtNegativ(PC),A0 ;Set default NegTxt
move.l A0,D0
SetNegTxt lea ITxtNeg(PC),A0
move.l D0,it_IText(A0) ;Put NegTxt into IntuiText
LoadBase ExecBase
move.l #InternalMem,D0
move.l #MEMF_PUBLIC!MEMF_CLEAR,D1
CallLib AllocMem ;Allocate local data block + FileInfoBlock
movea.l D0,FData ;Internal datablock always in A5
moveq #FSENoMem,D7
tst.l D0
beq Exit
lea FD_SIZEOF(FData),A0 ;fib MUST be longword-aligned
move.l A0,FD_FIB(FData) ;Use part of allocated memory as FileInfoBlock
lea fib_SIZEOF(A0),A0
move.l A0,FD_DisplayList(FData)
lea 4*DisplayRows(A0),A0
move.l A0,FD_TxtBuf(FData)
lea PathInfo(PC),A0 ;Put user-PathBuffer into StringInfo
move.w FR_PathChars(FReq),si_MaxChars(A0)
move.l FR_PathBuf(FReq),si_Buffer(A0)
lea FileInfo(PC),A0 ;Put user-FileBuffer into StringInfo
move.w FR_FileChars(FReq),si_MaxChars(A0)
move.l FR_FileBuf(FReq),si_Buffer(A0)
moveq #FSENoLib,D7
lea DosName(PC),A1
CallLib OldOpenLibrary ;Open dos
move.l D0,FD_DosBase(FData)
lea GfxName(PC),A1
CallLib OldOpenLibrary ;Open graphics
move.l D0,FD_GfxBase(FData)
lea IntuiName(PC),A1
CallLib OldOpenLibrary ;Open Intuition
move.l D0,FD_IntBase(FData)
lea FileNW(PC),A0
movem.w FR_LeftEdge(FReq),D0-D1
movem.w D0-D1,nw_LeftEdge(A0) ;Put coordinates into NewWindow-structure
moveq #WBENCHSCREEN,D0
move.l FR_Screen(FReq),nw_Screen(A0) ;Put screen-ptr or 0 into NewWindow-structure
beq.S SetScreenType
moveq #CUSTOMSCREEN,D0
SetScreenType move.w D0,nw_Type(A0) ;Put CUSTOMSCREEN or WBENCHSCREEN into NewWindow-structure
LoadBase IntBase
CallLib OpenWindow ;Open the Window
moveq #FSENoWin,D7
move.l D0,FD_Window(FData)
beq.S Exit
movea.l D0,A1
move.l wd_RPort(A1),FD_Rp(FData) ;Get RastPort
move.l wd_UserPort(A1),FD_Up(FData) ;Get UserPort
lea TxtAttr(PC),A0
LoadBase GfxBase
CallLib OpenFont ;Open Topaz-80
movea.l D0,A0
movea.l FD_Rp(FData),A1
CallLib SetFont ;Use Topaz-80
bra.S Main ;Lets begin
* Here we exits, D7 contains return-code
Exit btst #LETSWAIT,FR_ToDo(FReq) ;The completion of the list was interrupted ?
bne.S FreeLock
move.l FReq,-(SP)
Call _FreeFileSelect ;Free old list
addq.l #4,SP
FreeLock Call RemoveLock ;UnLock if not already done
FreeWindow LoadBase IntBase
move.l FD_Window(FData),D0
beq.S FreeInt
movea.l D0,A0
movem.w wd_LeftEdge(A0),D0-D1
movem.w D0-D1,FR_LeftEdge(FReq) ;Store window-position in FileSelectRequest structure
CallLib CloseWindow ;Close window if it was open
FreeInt LoadBase ExecBase
move.l FD_IntBase(FData),D0
beq.S FreeGfx
movea.l D0,A1
CallLib CloseLibrary ;Close intuition if it was open
FreeGfx move.l FD_GfxBase(FData),D0
beq.S FreeDos
movea.l D0,A1
CallLib CloseLibrary ;Close graphics if it was open
FreeDos move.l FD_DosBase(FData),D0
beq.S FreeFSMem
movea.l D0,A1
CallLib CloseLibrary ;Close dos if it was open
FreeFSMem move.l FData,D0
beq.S AllDone
movea.l D0,A1
move.l #InternalMem,D0
CallLib FreeMem ;Free allocated memory
AllDone move.l D7,D0 ;Set return-code
Pop D1-D7/A0-A6
rts ;Return to the caller
* Here we really begin
Main ori.b #(1<<REFSTR)!(1<<ACTFSG)!(1<<LETSWAIT),FR_ToDo(FReq)
tst.l FR_List(FReq) ;Called with a list ?. If so, use it
bne RefreshDisplay ;If not, lets start all over
move.b #(1<<REFSTR)!(1<<ACTFSG)!(1<<NEWDIR),FR_ToDo(FReq)
* This is the start of the event-loop
* See what happened since last time
GetNextMsg LoadBase IntBase
CheckRefresh bclr #REFSTR,FR_ToDo(FReq) ;Clear RefreshBit
beq.S CheckActivate ;Refresh String-Gadgets if it was set
lea PathGad(PC),A0
movea.l FD_Window(FData),A1
suba.l A2,A2
moveq #2,D0
CallLib RefreshGList ;Refresh String-Gadgets
CheckActivate bclr #ACTFSG,FR_ToDo(FReq) ;Clear activatebit
beq.S CheckNewDir ;Activate FileString-Gadget if it was set
lea FileGad(PC),A0
movea.l FD_Window(FData),A1
suba.l A2,A2
CallLib ActivateGadget ;Activate FileString-Gadget
CheckNewDir bclr #NEWDIR,FR_ToDo(FReq) ;Clear NewDirBit
bne.S DoNewPath ;Get new directory if it was set
LoadBase ExecBase
btst #LETSWAIT,FR_ToDo(FReq) ;Are we busy ?
beq.S NotWaiting
movea.l FD_Up(FData),A0
CallLib WaitPort ;We aren't busy, so we wait
NotWaiting movea.l FD_Up(FData),A0
CallLib GetMsg ;Get a message
tst.l D0
beq.S DoneWithMessage ;Did we get a message
DoMessage movea.l D0,A1 ;Yes, put message address to A1 and reply
move.l im_Class(A1),FD_Class(FData)
move.w im_Code(A1),FD_Code(FData)
move.l im_IAddress(A1),FD_IAddress(FData)
move.l im_Seconds(A1),FD_Seconds(FData)
move.l im_Micros(A1),FD_Micros(FData)
CallLib ReplyMsg ;Reply the message
move.l FD_Class(FData),D0
moveq #MOUSEBUTTONS,D1
cmp.l D1,D0
beq DoButtons
moveq #GADGETUP,D1
cmp.l D1,D0
beq DoGadgets
cmpi.l #INTUITICKS,D0 ;It is time to see if we should scroll
beq CheckScroll
DoneWithMessage btst #LETSWAIT,FR_ToDo(FReq)
beq.S GetNextFile ;If we are busy then get next file/dir/Device, else goto sleep
* Start scanning a new directory and the Device-List
DoNewPath bset #NOTDEVS,FR_ToDo(FReq) ;Lets get Devices first
bclr #KEEPTOP,FR_ToDo(FReq)
Call ResetKnob
Call ClearDisplay
move.l FReq,-(SP)
Call _FreeFileSelect ;Free old list
addq.l #4,SP
Call RemoveLock ;Free old lock
moveq #FR_ToDo-FR_TopView-1,D1
ResetLoop clr.b FR_TopView(FReq,D1.W) ;Clear FR_TopView and counters
dbf D1,ResetLoop
lea SelectTxt(PC),A1
tst.l FR_TitleTxt(FReq) ;Has the user supplied us with a title ?
beq.S SetWTitle
movea.l FR_TitleTxt(FReq),A1
SetWTitle movea.l FD_Window(FData),A0
suba.l A2,A2
LoadBase IntBase
CallLib SetWindowTitles ;Set window-title (User-supplied or default)
GetDevs bset #GETDEVS,FR_ToDo(FReq) ;Lets get Devices first
Call LockD ;Lock DeviceList
bra.S SignalDontWait
GetFiles LoadBase DosBase ;When that is done, we can get Files/Dirs
move.l FR_PathBuf(FReq),D1
moveq #ACCESS_READ,D2
CallLib Lock ;Lock new directory
move.l D0,FD_Lock(FData)
beq DirError
move.l D0,D1
move.l FD_FIB(FData),D2
CallLib Examine ;Examine new directory
tst.l D0
beq DirError
SignalDontWait bclr #LETSWAIT,FR_ToDo(FReq) ;We are busy, Can't wait
* Read next entry from directory or Device-list
GetNextFile btst #GETDEVS,FR_ToDo(FReq)
beq.S GettingFiles
GettingDevs Call ExNextD ;Try to get next device
bra.S DidWeGetOne
GettingFiles LoadBase DosBase
move.l FD_Lock(FData),D1 ;Try to get next file
move.l FD_FIB(FData),D2
CallLib ExNext
DidWeGetOne tst.l D0
beq NoMore ;Success, found something
movea.l FD_FIB(FData),A3
lea fib_FileName(A3),A0
Call MyStrLen
tst.l D0
beq GetNextMsg ;Could it happen ?
btst #GETDEVS,FR_ToDo(FReq) ;Is it a device ?
beq.S SpecFDs
SpecDevs move.l fib_DirEntryType(A3),D1
bne.S SpecDevs2
btst #FSB_NODRIVE,FR_Flags+1(FReq)
bra.S Trick ;This doesn't destroy cc
SpecDevs2 subq.l #1,D1
bne.S SpecDevs3
btst #FSB_NOASSIGN,FR_Flags+1(FReq)
bra.S Trick
SpecDevs3 btst #FSB_NOVOL,FR_Flags+1(FReq)
bra.S Trick
SpecFDs tst.l fib_DirEntryType(A3) ;Is it a directory ?
bmi.S SpecFiles
SpecDirs btst #FSB_NODIR,FR_Flags+1(FReq)
Trick bne GetNextMsg
bra.S DoneSpec
SpecFiles btst #FSB_NOFILE,FR_Flags+1(FReq)
bne GetNextMsg
btst #FSB_NOINFO,FR_Flags+1(FReq)
beq.S DoneSpec
cmpi.w #5,D0 ;Too short
blt.S DoneSpec
lea fib_FileName(A3),A0
lea -5(A0,D0.W),A0
lea InfoTxt(PC),A1
moveq #4,D1
InfoLoop cmpm.b (A1)+,(A0)+
bne.S DoneSpec
dbf D1,InfoLoop
bra GetNextMsg
DoneSpec addi.w #EntrySIZEOF+1,D0 ;Make room for null character
move.l D0,D6
move.l #MEMF_PUBLIC!MEMF_CLEAR,D1
LoadBase ExecBase
CallLib AllocMem ;AllocMem(EntryBaseSize+MyStrLen(Name)+1,MEM_CLEAR)
movea.l D0,A0
tst.l D0
beq MemError
move.w D6,EntrySize(A0) ;Store size of allocated blok in the block itself
btst #GETDEVS,FR_ToDo(FReq) ;Is it a device ?
beq.S IsItDirType
addq.w #1,FR_Devs(FReq) ;One more device
moveq #DEVTYPE,D0 ;The next few lines is here just for sorting reasons
move.l fib_DirEntryType(A3),D1
beq.S OneMoreOfThese ;DLT_DEVICE
moveq #ASNTYPE,D0
subq.l #1,D1
beq.S OneMoreOfThese ;DLT_DIRECTORY
moveq #VOLTYPE,D0
bra.S OneMoreOfThese ;DLT_VOLUME
IsItDirType tst.l fib_DirEntryType(A3) ;Is it a directory ?
bmi.S IsItFileType
addq.w #1,FR_Dirs(FReq) ;One more directory
moveq #DIRTYPE,D0
bra.S OneMoreOfThese
IsItFileType addq.w #1,FR_Files(FReq) ;One more file
move.l fib_Size(A3),D0 ;Store size instead of type
OneMoreOfThese move.l D0,EntryType(A0) ;D0=Type/Size
move.w FR_Files(FReq),D0
add.w FR_Dirs(FReq),D0
btst #NOTDEVS,FR_ToDo(FReq)
bne.S DontCountDevs
add.w FR_Devs(FReq),D0
DontCountDevs move.w D0,FR_Count(FReq)
lea fib_FileName(A3),A1
lea EntryName(A0),A2
StoreNameLoop move.b (A1)+,(A2)+ ;Copy name from FIB to EntryNode
bne.S StoreNameLoop
move.w SlideInfo+pi_VertPot(PC),FD_SlideVPos(FData) ;Necessary, otherwise the user couldn't drag the slider
Call SortFiles ;while a directory is being scanned
move.w FR_Count(FReq),D0
beq GetNextMsg ;Only devices so far ?
sub.w FR_TopCount(FReq),D0
subq.w #DisplayRows,D0
bgt.S AdjustKnob ;Full display ?
Here move.w FR_TopCount(FReq),D0
bra SeeThem
AdjustKnob Call SetKnobHeight ;Display is full
Call SetKnobPos
Call SetKnob ;slider while the directory/device-List is being scanned
bra GetNextMsg
MemError lea MemErrorTxt(PC),A1 ;Could not get memory for a node
bra.S ShowError
DirError lea DirErrorTxt(PC),A1 ;Could not Lock/Examine a directory
ShowError LoadBase IntBase
movea.l FD_Window(FData),A0
suba.l A2,A2
CallLib SetWindowTitles
NoMore Call RemoveLock ;Let's unlock
bclr #GETDEVS,FR_ToDo(FReq)
bne GetFiles ;Were we getting Devices ?
WasFileLock bset #LETSWAIT,FR_ToDo(FReq) ;We are done getting Files/Dirs. We can wait now
move.w FR_Count(FReq),D0
beq.S Here
subq.w #DisplayRows,D0
bgt.S Here
clr.w FR_TopCount(FReq)
move.l FR_List(FReq),FR_TopView(FReq)
bra.S Here
* Have just recieved a MOUSEBUTTONS-message
DoButtons bset #ACTFSG,FR_ToDo(FReq) ;Always activate FileString-gadget
cmpi.w #MENUDOWN,FD_Code(FData);Pressed the Menu-button
bne GetNextMsg
Call ClearDisplay
moveq #0,D0
bclr #NOTDEVS,FR_ToDo(FReq) ;yes
beq.S DontAddDevs
move.w FR_Devs(FReq),D1
add.w D1,FR_Count(FReq) ;Now devices can be shown
bra.S SeeDevs
DontAddDevs movea.l FR_TopView(FReq),A0
moveq #DIRTYPE,D1
cmp.l EntryType(A0),D1
bgt.S SeeFiles
bne.S SeeDirs
bra.S SeeDevs
SeeFiles tst.w FR_Files(FReq)
bne.S SeeThese
SeeDirs tst.w FR_Dirs(FReq)
bne.S SeeTrick
SeeDevs tst.w FR_Devs(FReq)
beq.S SeeFiles
add.w FR_Dirs(FReq),D0
SeeTrick add.w FR_Files(FReq),D0
SeeThese bset #KEEPTOP,FR_ToDo(FReq)
bra SeeThem ;Look at files
* Have just recieved a GADGETUP-message
DoGadgets bset #ACTFSG,FR_ToDo(FReq) ;Always activate FileString-gadget
movea.l FD_IAddress(FData),A1
move.w gg_GadgetID(A1),D0
lsl.w #1,D0
move.w GJ(PC,D0.W),D0
jmp GJ(PC,D0.W)
GJ dc.w DoSelect-GJ ;Gadget indirect jumptable
dc.w DoSelect-GJ
dc.w DoSelect-GJ
dc.w DoSelect-GJ
dc.w DoSelect-GJ
dc.w DoSelect-GJ
dc.w DoSelect-GJ
dc.w DoParent-GJ
dc.w GetNextMsg-GJ ;Up arrow
dc.w GetNextMsg-GJ ;Down arrow
dc.w SlideScroll-GJ ;Clicked in Slide-gadget box beside the knob
dc.w DoPathStr-GJ
dc.w DoPosExit-GJ
dc.w DoNegExit-GJ
* You clicked on one of the 7 gadgets on the display
DoSelect movea.l FD_IAddress(FData),A1
move.w gg_GadgetID(A1),D0
lsl.l #2,D0
movea.l FD_DisplayList(FData),A2
move.l 0(A2,D0.W),D0
beq.S DoneSelect
movea.l D0,A2 ;A2=EntryNode
tst.l EntryType(A2) ;Test type
bmi.S NewDir
NewFile cmpa.l FD_LastSelect(FData),A2 ;Same as last time ?
bne.S NoDouble
LoadBase IntBase ;Same as last time. Check time between clicks
movem.l FD_OSeconds(FData),D0-D1;Time of previous select
movem.l FD_Seconds(FData),D2-D3 ;Time of this select
CallLib DoubleClick
tst.l D0
bne DoPosExit ;Double-clicked on a file. Let's exit
NoDouble move.l A2,FD_LastSelect(FData) ;New last select
movem.l FD_Seconds(FData),D0-D1
movem.l D0-D1,FD_OSeconds(FData);Store time this select
movea.l FR_FileBuf(FReq),A0
move.w FR_FileChars(FReq),D1
ext.l D1
add.l A0,D1 ;This is the end of the FileBuffer
bra.S CopyFile
NewDir bset #NEWDIR,FR_ToDo(FReq)
movea.l FR_PathBuf(FReq),A0
move.w FR_PathChars(FReq),D1
subq.w #1,D1 ;Need room for '/' in the end
ext.l D1
add.l A0,D1 ;This is the end of the PathBuffer
cmpi.l #DEVTYPE,EntryType(A2)
ble.S CopyFile ;Clicked on something ending with a ':' ?
Call TackOn ;Clicked on a directory
CopyFile lea EntryName(A2),A1
subq.l #1,D1
FileCopyLoop cmpa.l D1,A0
beq.S BufOverflow
move.b (A1)+,(A0)+ ;Copy name to String-Gadget
bne.S FileCopyLoop
BufOverflow clr.b (A0) ;Just in case we overflowed
bset #REFSTR,FR_ToDo(FReq)
DoneSelect bra GetNextMsg
* The slide-knob is currently selected and you moved the mouse, or
* you clicked in the prop-gadget box beside the knob
SlideScroll move.w SlideInfo+pi_VertPot(PC),FD_SlideVPos(FData)
moveq #0,D0
move.w FR_Count(FReq),D2
subq.w #DisplayRows,D2 ;TopCount must not be greater than Count-DisplayRows
ble.S NoNewTop ;If less than DisplayRows files then TopIt
move.l #MAXPOT,D1
divu D2,D1 ;65535/(Count-DisplayRows)
move.w FD_SlideVPos(FData),D0
divu D1,D0 ;D0=Slide.vertpot/(65535/(Count-DisplayRows))
cmp.w FR_TopCount(FReq),D0 ;Last line will cause a crash if Count-DisplayRows>65535
beq.S DoneScroll ;Don't scroll if knob hasn't moved enough
cmp.w D2,D0 ;If TopCount>D2 then
ble.S NoNewTop
move.w D2,D0 ;TopCount=D2
NoNewTop bset #DONTPOS,FR_ToDo(FReq)
bclr #KEEPTOP,FR_ToDo(FReq)
bra.S SeeThem
* Have just recieved a INTUITICK-message, and are now going to examine
* whether the arrow-gadget are currently selected
CheckScroll btst #7,SlideGad+gg_Flags+1(PC) ;SlideGad Selected ?
bne.S SlideScroll
btst #7,UpGad+gg_Flags+1(PC) ;UpGad Selected ?
bne.S ScrollOneUp
btst #7,DownGad+gg_Flags+1(PC) ;DownGad Selected ?
beq.S DoneScroll
* The down-arrow is currently selected
ScrollOneDown move.w FR_TopCount(FReq),D0
move.w FR_Count(FReq),D1
subq.w #DisplayRows,D1
cmp.w D0,D1 ;If TopCount+DisplayRows>Count then dont scroll
ble.S DoneScroll
addq.w #1,D0
bra.S SeeThem
* The up-arrow is currently selected
ScrollOneUp move.w FR_TopCount(FReq),D0
beq.S DoneScroll ;If TopCount=0 then dont scroll
subq.w #1,D0
* D0=count of node to display on top of the display
* Finds node and fills the display
SeeThem move.w D0,FR_TopCount(FReq) ;Show the list from the 'D0'th node
FindEntry lea FR_List(FReq),A0
movea.l EntryNext(A0),A0
EntryLoop subq.w #1,D0
bmi.S DoneFindEntry
movea.l EntryNext(A0),A0
bra.S EntryLoop
DoneFindEntry move.l A0,FR_TopView(FReq)
RefreshDisplay Call WriteDisplay
bclr #DONTPOS,FR_ToDo(FReq)
bne.S DoneScroll ;If called from SlideScroll then
Call SetKnobHeight ;don't do any of these
Call SetKnobPos ;because intuition
Call SetKnob ;has already done it
DoneScroll bra GetNextMsg
* You clicked the 'Parent' button
DoParent ori.b #(1<<REFSTR)!(1<<NEWDIR),FR_ToDo(FReq)
movea.l FR_PathBuf(FReq),A0
Call MyStrLen ;Returns length excluding the null
subq.w #1,D0 ;Skip the last character
beq.S DoneParent2 ;One more than besides the null ?
bmi.S DoneParent3 ;Only the null was present ?
CutOffLoop subq.w #1,D0
bmi.S DoneParent1
move.b 0(A0,D0.W),D1
cmpi.b #'/',D1
beq.S DoneParent2 ;If '/' then clear this byte
cmpi.b #':',D1
bne.S CutOffLoop ;If ':' then clear next byte
DoneParent1 addq.w #1,D0
DoneParent2 clr.b 0(A0,D0.W)
DoneParent3 bra GetNextMsg
* You pressed return while the path-string-gadget was active
DoPathStr bset #NEWDIR,FR_ToDo(FReq)
bra GetNextMsg
* You clicked the 'Ok' button, or
* you pressed return while the file-string-gadget was active, or
* you double-clicked on a filename
DoPosExit movea.l FR_PathBuf(FReq),A0
Call TackOn ;Append a '/'
bra.S DoExit
* You clicked the 'Cancel' button
DoNegExit moveq #FSENeg,D7
DoExit bra Exit
* ----------------------- Misc sub-routines ----------------------------
* A0=String, returns i D0.L the length of string excluding the null character
* Destroys D0
MyStrLen PushS A0
moveq #-1,D0
MyStrLenLoop addq.l #1,D0
tst.b (A0)+
bne.S MyStrLenLoop
PopS A0
rts
* A0=Buffer to extend with a '/' if the buffer is non-empty, and
* if it doesn't already end with a '/' or a ':'
* Destroys A0 which on return points to NULL-byte after ':' or '/'
TackOn PushS D0
Call MyStrLen
tst.w D0
adda.w D0,A0 ;End of the path-string
beq.S EndTackOn
cmpi.b #':',-1(A0) ;If path ends on anything else than
beq.S EndTackOn ;a ':'
moveq #'/',D0
cmp.b -1(A0),D0 ;or a '/'
beq.S EndTackOn
move.b D0,(A0)+ ;then add a '/'
EndTackOn clr.b (A0) ;and a NULL
PopS D0
rts
* Sets the Slide-Knob vertical size according to FR_Count
* Doesn't destroys registers
SetKnobHeight Push D0-D2
move.l #MAXBODY,D0
move.w FR_Count(FReq),D1
moveq #DisplayRows,D2 ;Count<=DisplayRows means full-sized knob
cmp.w D2,D1
ble.S DoneSH
divu D1,D0 ;D0=65535/Count*DisplayRows
mulu D2,D0
DoneSH move.w D0,FD_SlideHeight(FData)
Pop D0-D2
rts
* Sets the Slide-Knob vertical position according to FR_TopCount
* Doesn't destroys registers
SetKnobPos Push D0-D1
moveq #0,D0
move.w FR_Count(FReq),D1
subq.w #DisplayRows,D1
ble.S SetKnobToTop ;Count<=DisplayRows means top-placed knob
move.w FR_TopCount(FReq),D0
swap D0
divu D1,D0 ;(D0*65535)/(Count-DisplayRows)
bvc.S SetKnobToTop
moveq #-1,D0 ;move.l #MAXPOS,D0
SetKnobToTop move.w D0,FD_SlideVPos(FData)
Pop D0-D1
rts
* Makes the Slide-Knob fill the entire Prop-Gadget
* Doesn't destroys registers
ResetKnob clr.w FD_SlideVPos(FData) ;Knob to the top
move.w #-1,FD_SlideHeight(FData);Full size
* Updates/refreshes the Prop-Gadget
* Doesn't destroys registers
SetKnob Push D0-D5/A0-A2
lea SlideGad(PC),A0
movea.l FD_Window(FData),A1
suba.l A2,A2
moveq #AUTOKNOB!FREEVERT!PROPBORDERLESS,D0
moveq #0,D1
move.w FD_SlideVPos(FData),D2
moveq #-1,D3 ;move.w #$FFFF,D3 (HorizBody)
move.w FD_SlideHeight(FData),D4
moveq #1,D5
LoadBase IntBase
CallLib NewModifyProp
Pop D0-D5/A0-A2
rts
* Fills the display with color 0
* Doesn't destroys registers
ClearDisplay Push D0-D3/A0-A1
LoadBase GfxBase ;Clear display
moveq #0,D0
movea.l FD_Rp(FData),A1
CallLib SetAPen
moveq #6,D0
moveq #12,D1
move.w #6+DisplayCols*8,D2
moveq #81,D3
movea.l FD_Rp(FData),A1
CallLib RectFill
moveq #1,D0
movea.l FD_Rp(FData),A1
CallLib SetAPen
Pop D0-D3/A0-A1 ;Fall through
* Clears then DisplayList-array
* Doesn't destroys registers
ClearDisplayArr Push D0/A0
movea.l FD_DisplayList(FData),A0
moveq #DisplayRows-1,D0
ClearArrLoop clr.l (A0)+
dbf D0,ClearArrLoop
Pop D0/A0
rts
* Fills the display with filenames plus size/type
* Stores the address of the nodes containing the displayed filenames in DisplayRows
* This routine could be made faster (but its fast enough for now)
* Doesn't destroys registers
WriteDisplay Push D0-D4/A0-A3
Call ClearDisplayArr
LoadBase GfxBase
move.w FR_TopCount(FReq),D4
movea.l FR_TopView(FReq),A3
movea.l FD_DisplayList(FData),A2
moveq #19,D3
WriteLoop cmp.l #0,A3 ;This double-condition is necessary in order
beq DoneWriting ;to keep the devices from being shown
cmp.w FR_Count(FReq),D4 ;because FR_TopCount doesn't correspond to
bge DoneWriting ;FR_TopView while the list is being build
move.l A3,(A2)+ ;Save address of EntryNode
movea.l FD_TxtBuf(FData),A0
move.l EntryType(A3),D0 ;D0=Type or Size
bge.S CopyName
InsertType addq.w #1,D0 ;Find correct text to insert
mulu #-5,D0
lea TxtDirs(PC),A1
adda.w D0,A1 ;One more directory,device,volume or 'assign'
movea.l FD_TxtBuf(FData),A0
moveq #4,D0
InsertTypeLoop move.b (A1)+,(A0)+ ;Insert '(Dir)','<Dev>','<Vol>' or '<Asn>'
dbf D0,InsertTypeLoop
move.b #' ',(A0)+
CopyName lea EntryName(A3),A1
NameCopyLoop move.b (A1)+,(A0)+ ;Copy name to Txtbuffer
bne.S NameCopyLoop
subq.l #1,A0
move.l A0,D0
sub.l FD_TxtBuf(FData),D0
moveq #DisplayCols-1,D1
sub.w D0,D1
moveq #' ',D0
BuffClearLoop move.b D0,(A0)+ ;Clear rest of Txtbuffer
dbf D1,BuffClearLoop
move.l EntryType(A3),D0 ;D0=Type or Size
cmpi.l #DIRTYPE,D0
blt.S TxtInDevColor
beq.S TxtInDirColor
btst #FSB_NOFILESIZE,FR_Flags+1(FReq)
bne.S TxtInFileColor ;This doesn't destroy cc
InsertSize move.b #'0',-1(A0) ;This has to be done If D0=0
ConvertLoop tst.l D0 ;A0=end of Txtbuffer
ble.S TxtInFileColor
divu #10,D0
swap D0
addi.b #'0',D0
move.b D0,-(A0)
clr.w D0
swap D0
bra.S ConvertLoop
TxtInFileColor moveq #FILECOLOR,D0
bra.S WriteLine
TxtInDirColor moveq #DIRCOLOR,D0
bra.S WriteLine
TxtInDevColor moveq #DEVCOLOR,D0
WriteLine movea.l FD_Rp(FData),A1
cmp.b rp_FgPen(A1),D0
beq.S DontSetColor
CallLib SetAPen ;Shouldn't do this everytime
DontSetColor moveq #6,D0
move.w D3,D1
movea.l FD_Rp(FData),A1
CallLib Move
moveq #DisplayCols,D0
movea.l FD_TxtBuf(FData),A0
movea.l FD_Rp(FData),A1
move.b #%00000011,rp_Mask(A1) ;Only write in bitplanes 0 and 1
CallLib Text
addq.w #1,D4
movea.l EntryNext(A3),A3
addi.w #10,D3 ;Add 10 to vertical Write-position
cmpi.w #19+(DisplayRows-1)*10,D3
ble WriteLoop
DoneWriting Pop D0-D4/A0-A3
rts
* A0=Node to insert in list
* Sorts according to EntryType and EntryName
* Destroys D0-D4,A0-A3
SortFiles lea EntryName(A0),A2
movea.l FD_TxtBuf(FData),A3
UpperCaseLoop move.b (A2)+,D0 ;Convert name to uppercase
beq.S DoneUpperCase
cmpi.b #'a',D0
blt.S StoreUpperCase
cmpi.b #'z',D0
bgt.S StoreUpperCase
subi.b #32,D0
StoreUpperCase move.b D0,(A3)+
bra.S UpperCaseLoop
DoneUpperCase move.l EntryType(A0),D0
bmi.S TypeOk
moveq #1,D0 ;Type 1 is File
TypeOk lea FR_List(FReq),A1
move.l FR_TopView(FReq),D4
SortLoop cmp.l A1,D4
bne.S LowerThan
moveq #0,D4
LowerThan move.l A1,D3 ;D3 always entry to insert after
tst.l EntryNext(A1)
beq.S Insert ;End of list ?
movea.l EntryNext(A1),A1 ;We go further down
move.l EntryType(A1),D2
bmi.S TypeOk2
moveq #1,D2 ;Type 1 is File
TypeOk2 cmp.l D2,D0
blt.S SortLoop
bgt.S Insert
CmpStr movea.l FD_TxtBuf(FData),A2 ;Name to insert
lea EntryName(A1),A3 ;Name to compare to
CmpLoop move.b (A3)+,D1
beq.S SortLoop
cmpi.b #'a',D1
blt.S Compare
cmpi.b #'z',D1
bgt.S Compare
subi.b #32,D1
Compare cmp.b (A2)+,D1 ;Compare in uppercase
beq.S CmpLoop
blt.S SortLoop ;If name to insert>name in list then continue
Insert movea.l D3,A1
move.l EntryNext(A1),EntryNext(A0) ;A0 is entry to insert
move.l A0,EntryNext(A1)
tst.w D4
beq.S DoneSort
btst #KEEPTOP,FR_ToDo(FReq)
beq.S DoneSort
addq.w #1,FR_TopCount(FReq) ;Inserted the new entry before TopView
DoneSort rts
* UnLocks, whether FD_Lock is on a file or on the Device-list
* Doesn't destroy registers
RemoveLock Push D0-D1/A0-A1
move.l FD_Lock(FData),D1
beq.S DoneRemoveLock
btst #GETDEVS,FR_ToDo(FReq)
beq.S RemoveFileLock
RemoveDevLock Call UnLockD ;Unlock Device-List
bra.S DoneRemoveLock
RemoveFileLock LoadBase DosBase
CallLib UnLock
DoneRemoveLock clr.l FD_Lock(FData)
Pop D0-D1/A0-A1
rts
* The next three sub-routines fakes a Lock/UnLock/ExNext (Not Examine) on the Device-List
* LockD disables multitasking to make sure the Device-List is not changed while doing ExNextD's
* UnLockD enables multitasking again
* Stores the Device-List in FD_Lock
* Doesn't destroys registers
LockD Push D0-D1/A0-A1
LoadBase ExecBase
CallLib Forbid
movea.l FD_DosBase(FData),A0
movea.l dl_Root(A0),A0 ;dl_Root
movea.l rn_Info(A0),A0 ;dl_Root->rn_Info
adda.l A0,A0
adda.l A0,A0
movea.l di_DevInfo(A0),A0 ;Dosbase->dl_Root->rn_Info->di_DevInfo
adda.l A0,A0
adda.l A0,A0
move.l A0,FD_Lock(FData)
Pop D0-D1/A0-A1
rts
* Clears FD_Lock
* Doesn't destroys registers
UnLockD Push D0-D1/A0-A1
LoadBase ExecBase
CallLib Permit
clr.l FD_Lock(FData)
Pop D0-D1/A0-A1
rts
* Fills the FileInfoBlock FD_FIB with name and type
* Returns 0 in D0 if no more entries on the Device-List and 1 otherwise
* Destroys D0
ExNextD Push D1-D2/A0-A3
FindNextDev movea.l FD_FIB(FData),A2 ;A2=FIB
movea.l FD_Lock(FData),A3 ;A3=(struct DeviceList *)Lock
moveq #0,D0 ;Return code
tst.l FD_Lock(FData) ;while not end of list
beq.S EndOfList
move.l dl_Next(A3),D0
asl.l #2,D0
move.l D0,FD_Lock(FData)
move.l dl_Type(A3),D1
moveq #DLT_VOLUME,D0
cmp.l D0,D1
beq.S GetTheDevice
moveq #DLT_DIRECTORY,D0
cmp.l D0,D1
beq.S GetTheDevice
moveq #DLT_DEVICE,D0
cmp.l D0,D1
bne.S FindNextDev
tst.l dl_Task(A3) ;if(dn->dn_Task == 0 then skip it
beq.S FindNextDev
GetTheDevice movea.l dl_Name(A3),A1 ;A1=(BPTR)list->dl_Name
adda.l A1,A1
adda.l A1,A1
move.b (A1)+,D0 ;D0=Length of string, A0=string
ext.w D0
moveq #32,D2
cmp.w D2,D0 ;if(D0 > 32)
ble.S NameLengthIsOk
move.w D2,D0 ;D0 = 32;
NameLengthIsOk lea fib_FileName(A2),A0 ;A0=fib->fib_FileName
subq.w #1,D0
CopyLoop move.b (A1)+,(A0)+
dbf D0,CopyLoop
move.b #':',(A0)+ ;Append a ':'
clr.b (A0)+ ;and a NULL
move.l dl_Type(A3),fib_DirEntryType(A2) ;fib->fib_DirEntryType=list->dl_type
moveq #1,D0 ;return 1;
EndOfList Pop D1-D2/A0-A3
rts ;return 1 or return 0
DosName dc.b 'dos.library',0
GfxName dc.b 'graphics.library',0
IntuiName dc.b 'intuition.library',0
EVEN
FileNW dc.w 111,58,299,126
dc.b 0,1
dc.l MOUSEBUTTONS!GADGETUP!INTUITICKS,ACTIVATE!RMBTRAP!WINDOWDRAG,GadgetList,0,0,0,0
dc.w 0,0,0,0,0
BWIDTH =74
BHEIGHT =11
ButBorder BORDER -2,-1,BUTCOLOR,0,RP_JAM2,17,ButVectors,0
ButVectors dc.w 2,0,BWIDTH+1,0,BWIDTH+3,2,BWIDTH+3,BHEIGHT-1,BWIDTH+1,BHEIGHT+1,2,BHEIGHT+1,0,BHEIGHT-1,0,2,2,0
dc.w 1,0,-1,2,-1,BHEIGHT-1,1,BHEIGHT+1,BWIDTH+2,BHEIGHT+1,BWIDTH+4,BHEIGHT-1,BWIDTH+4,2,BWIDTH+2,0
SWIDTH =215
SHEIGHT =10
StrBorder BORDER -4,-2,STRCOLOR,0,RP_JAM2,17,SVectors,0
SVectors dc.w 2,0,SWIDTH+1,0,SWIDTH+3,2,SWIDTH+3,SHEIGHT-1,SWIDTH+1,SHEIGHT+1,2,SHEIGHT+1,0,SHEIGHT-1,0,2,2,0
dc.w 1,0,-1,2,-1,SHEIGHT-1,1,SHEIGHT+1,SWIDTH+2,SHEIGHT+1,SWIDTH+4,SHEIGHT-1,SWIDTH+4,2,SWIDTH+2,0
PWIDTH =18
PHEIGHT =70
P2HEIGHT =92
SlideBorder BORDER -2,-82,PROPCOLOR,0,RP_JAM2,17,PVectors,0
PVectors dc.w 2,0,PWIDTH+1,0,PWIDTH+3,2,PWIDTH+3,P2HEIGHT-1,PWIDTH+1,P2HEIGHT+1,2,P2HEIGHT+1,0,P2HEIGHT-1,0,2,2,0
dc.w 1,0,-1,2,-1,P2HEIGHT-1,1,P2HEIGHT+1,PWIDTH+2,P2HEIGHT+1,PWIDTH+4,P2HEIGHT-1,PWIDTH+4,2,PWIDTH+2,0
ITxtParent INTUITEXT 1,0,RP_JAM2,13,2,TxtParent,0
ITxtPath INTUITEXT 1,0,RP_JAM2,-41,0,TxtPath,0
ITxtFile INTUITEXT 1,0,RP_JAM2,-41,0,TxtFile,0
ITxtPos INTUITEXT 1,0,RP_JAM2,5,2,TxtPositiv,0
ITxtNeg INTUITEXT 1,0,RP_JAM2,5,2,TxtNegativ,0
TxtAttr dc.l FontName
dc.w TOPAZ_EIGHTY
dc.b FS_NORMAL,FPB_ROMFONT
FontName dc.b 'topaz.font',0
MemErrorTxt dc.b 'Out of memory',0
DirErrorTxt dc.b 'Directory error',0
SelectTxt dc.b 'Select a file',0
InfoTxt dc.b '.info'
TxtDirs dc.b '(dir)' ;\
TxtDevs dc.b '<dev>' ; \The order and length of these strings is important to 'WriteDisplay'
TxtVols dc.b '<vol>' ; /
TxtAsns dc.b '<asn>' ;/
TxtParent dc.b 'Parent',0
TxtPath dc.b 'Path',0
TxtFile dc.b 'File',0
TxtNegativ dc.b ' Cancel',0
TxtPositiv dc.b ' Ok',0
EVEN
SlideImage IMAGE 0,0,0,0,0,0,0,0,0
ArrowsImage IMAGE 1,0,16,22,1,ArrowsData,%00000001,%00000000,0
PathInfo ds.b 36
FileInfo ds.b 36
SlideInfo dc.w AUTOKNOB!FREEVERT!PROPBORDERLESS,0,0,0,8700,0,0,0,0,0,0
GadgetList
Select1Gad GADGET Select2Gad,4,12,DisplayCols*8+3,10,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 0,0,0,0,0,Select1ID,0
Select2Gad GADGET Select3Gad,4,22,DisplayCols*8+3,10,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 0,0,0,0,0,Select2ID,0
Select3Gad GADGET Select4Gad,4,32,DisplayCols*8+3,10,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 0,0,0,0,0,Select3ID,0
Select4Gad GADGET Select5Gad,4,42,DisplayCols*8+3,10,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 0,0,0,0,0,Select4ID,0
Select5Gad GADGET Select6Gad,4,52,DisplayCols*8+3,10,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 0,0,0,0,0,Select5ID,0
Select6Gad GADGET Select7Gad,4,62,DisplayCols*8+3,10,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 0,0,0,0,0,Select6ID,0
Select7Gad GADGET ParentGad,4,72,DisplayCols*8+3,10,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 0,0,0,0,0,Select7ID,0
ParentGad GADGET UpGad,112,110,BWIDTH,BHEIGHT,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 ButBorder,0,ITxtParent,0,0,ParentID,0
UpGad GADGET DownGad,271,83,18,12,GADGHCOMP!GADGIMAGE,RELVERIFY,BOOLGADGET
GADGET2 ArrowsImage,0,0,0,0,UpID,0
DownGad GADGET SlideGad,271,94,18,12,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 SlideBorder,0,0,0,0,DownID,0
SlideGad GADGET PathGad,271,13,PWIDTH,PHEIGHT,GADGHCOMP,RELVERIFY,PROPGADGET
GADGET2 SlideImage,0,0,0,SlideInfo,SlideID,0
PathGad GADGET FileGad,48,85,SWIDTH,SHEIGHT,GADGHCOMP,RELVERIFY,STRGADGET
GADGET2 StrBorder,0,ITxtPath,0,PathInfo,PathID,0
FileGad GADGET PosGad,48,96,SWIDTH,SHEIGHT,GADGHCOMP,RELVERIFY,STRGADGET
GADGET2 StrBorder,0,ITxtFile,0,FileInfo,PosID,0
PosGad GADGET NegGad,10,110,BWIDTH,BHEIGHT,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 ButBorder,0,ITxtPos,0,0,PosID,0
NegGad GADGET 0,215,110,BWIDTH,BHEIGHT,GADGHCOMP,RELVERIFY,BOOLGADGET
GADGET2 ButBorder,0,ITxtNeg,0,0,NegID,0
EVEN
SECTION IMAGEDATA,DATA_C ;Image-data has to be in CHIP-RAM
ArrowsData dc.w %0000000110000000
dc.w %0000001111000000
dc.w %0000011001100000
dc.w %0000110000110000
dc.w %0001100000011000
dc.w %0011000000001100
dc.w %0110000000000110
dc.w %1100000000000011
dc.w %1100000000000011
dc.w %0110000000000110
dc.w %0011000000001100
dc.w %0011111111111100
dc.w %0110000000000110
dc.w %1100000000000011
dc.w %1100000000000011
dc.w %0110000000000110
dc.w %0011000000001100
dc.w %0001100000011000
dc.w %0000110000110000
dc.w %0000011001100000
dc.w %0000001111000000
dc.w %0000000110000000
END