unit Workbench; INTERFACE uses Exec, AmigaDOS, Intuition, Utility; type pAppWindow = ^tAppWindow; tAppWindow = record aw_PRIVATE: pointer; end; pWBArg = ^tWBArg; tWBArg = record wa_Lock: BPTR; wa_Name: pshortint; end; pOldDrawerData = ^tOldDrawerData; tOldDrawerData = record dd_NewWindow: tNewWindow; dd_CurrentX: longint; dd_CurrentY: longint; end; pAppIcon = ^tAppIcon; tAppIcon = record ai_PRIVATE: pointer; end; pDrawerData = ^tDrawerData; tDrawerData = record dd_NewWindow: tNewWindow; dd_CurrentX: longint; dd_CurrentY: longint; dd_Flags: long; dd_ViewModes: word; end; pAppMenuItem = ^tAppMenuItem; tAppMenuItem = record ami_PRIVATE: pointer; end; pDiskObject = ^tDiskObject; tDiskObject = record do_Magic: word; do_Version: word; do_Gadget: tGadget; do_Type: byte; do_DefaultTool: pbyte; do_ToolTypes: ppbyte; do_CurrentX: longint; do_CurrentY: longint; do_DrawerData: pDrawerData; do_ToolWindow: pbyte; do_StackSize: longint; end; pAppMessage = ^tAppMessage; tAppMessage = record am_Message: tMessage; am_Type: word; am_UserData: long; am_ID: long; am_NumArgs: longint; am_ArgList: pWBArg; am_Version: word; am_Class: word; am_MouseX: integer; am_MouseY: integer; am_Seconds: long; am_Micros: long; am_Reserved: array [0..7] of long; end; pFreeList = ^tFreeList; tFreeList = record fl_NumFree: integer; fl_MemList: tList; end; pWBStartup = ^tWBStartup; tWBStartup = record sm_Message: tMessage; sm_Process: pMsgPort; sm_Segment: BPTR; sm_NumArgs: longint; sm_ToolWindow: pbyte; sm_ArgList: pWBArg; end; var WorkbenchBase: pLibrary; const WBDRAWER = 2; MTYPE_PSTD = 1; MTYPE_DISKCHANGE = 3; MTYPE_APPICON = 8; MTYPE_COPYEXIT = $A; MTYPE_TOOLEXIT = 2; MTYPE_APPMENUITEM = 9; DRAWERDATAFILESIZE = $3E; MTYPE_ICONPUT = $B; GADGBACKFILL = 1; WBGARBAGE = 5; WBKICK = 7; MTYPE_IOPROC = 6; OLDDRAWERDATAFILESIZE = $38; WBDISK = 1; WORKBENCH_NAME = 'workbench.library'; WB_DISKREVISIONMASK = $FF; WB_DISKREVISION = 1; NO_ICON_POSITION = $80000000; WBTOOL = 3; WBAPPICON = 8; MTYPE_CLOSEDOWN = 5; MTYPE_TIMER = 4; WBDEVICE = 6; MTYPE_APPWINDOW = 7; AM_VERSION = 1; WBPROJECT = 4; WB_DISKVERSION = 1; WB_DISKMAGIC = $E310; function AddAppWindowA (id: long; userdata: long; window: pWindow; msgport: pMsgPort; taglist: pTagItem): pAppWindow; function RemoveAppWindow (appWindow: pAppWindow): boolean; function AddAppIconA (id: long; userdata: long; text_: STRPTR; msgport: pMsgPort; lock: pFileLock; diskobj: pDiskObject; taglist: pTagItem): pAppIcon; function RemoveAppIcon (appIcon: pAppIcon): boolean; function AddAppMenuItemA (id: long; userdata: long; text_: STRPTR; msgport: pMsgPort; taglist: pTagItem): pAppMenuItem; function RemoveAppMenuItem (appMenuItem: pAppMenuItem): boolean; IMPLEMENTATION function AddAppWindowA; xassembler; asm movem.l a2/a6,-(sp) lea $C(sp),a6 move.l (a6)+,a2 move.l (a6)+,a1 move.l (a6)+,a0 move.l (a6)+,d1 move.l (a6)+,d0 move.l WorkbenchBase,a6 jsr -$30(a6) move.l d0,$20(sp) movem.l (sp)+,a2/a6 end; function RemoveAppWindow; xassembler; asm move.l a6,-(sp) move.l 8(sp),a0 move.l WorkbenchBase,a6 jsr -$36(a6) tst.l d0 sne d0 neg.b d0 move.b d0,$C(sp) move.l (sp)+,a6 end; function AddAppIconA; xassembler; asm movem.l a2-a4/a6,-(sp) lea $14(sp),a6 move.l (a6)+,a4 move.l (a6)+,a3 move.l (a6)+,a2 move.l (a6)+,a1 move.l (a6)+,a0 move.l (a6)+,d1 move.l (a6)+,d0 move.l WorkbenchBase,a6 jsr -$3C(a6) move.l d0,$30(sp) movem.l (sp)+,a2-a4/a6 end; function RemoveAppIcon; xassembler; asm move.l a6,-(sp) move.l 8(sp),a0 move.l WorkbenchBase,a6 jsr -$42(a6) tst.l d0 sne d0 neg.b d0 move.b d0,$C(sp) move.l (sp)+,a6 end; function AddAppMenuItemA; xassembler; asm movem.l a2/a6,-(sp) lea $C(sp),a6 move.l (a6)+,a2 move.l (a6)+,a1 move.l (a6)+,a0 move.l (a6)+,d1 move.l (a6)+,d0 move.l WorkbenchBase,a6 jsr -$48(a6) move.l d0,$20(sp) movem.l (sp)+,a2/a6 end; function RemoveAppMenuItem; xassembler; asm move.l a6,-(sp) move.l 8(sp),a0 move.l WorkbenchBase,a6 jsr -$4E(a6) tst.l d0 sne d0 neg.b d0 move.b d0,$C(sp) move.l (sp)+,a6 end; end.