home *** CD-ROM | disk | FTP | other *** search
- * RunAMax - programed by Shachar Shemesh on 11th Feb, 1992.
- * A program to easily start AMax with right colors and with HD partitions
- * mounted.
-
- include exec/types.i
- include exec/exec_lib.i
- include exec/memory.i
- include libraries/dos_lib.i
- include intuition/intuition_lib.i
- include intuition/preferences.i
-
- BACKGROUND EQU $000
- FOREGROUND EQU $888
-
- _SYSBase EQU $4
-
- LEA IntuiName,A1
- MOVEQ #0,D0
- MOVE.L _SYSBase,A6
- JSR _LVOOpenLibrary(A6)
- MOVE.L D0,_IntuitionBase
- * I find checking whether Intuition and DOS were in fact opened pointless.
-
- MOVE.L #pf_color2,D0
- MOVEQ #MEMF_PUBLIC,D1
- JSR _LVOAllocMem(A6)
- TST.L D0
- BEQ.S NoMem
- ; AllocMem for the preferences buffer upto color2 (all we need)
-
- MOVE.L D0,A0
- MOVE.L D0,A2
- MOVE.L #pf_color2,D0
- MOVE.L _IntuitionBase,A6
- JSR _LVOGetPrefs(A6)
- ; GetPrefs upto same place
-
- MOVE.W pf_color0(A2),color0
- MOVE.W pf_color1(A2),color1
- ; Save old color0 and 1
- MOVE.W #BACKGROUND,pf_color0(A2)
- MOVE.W #FOREGROUND,pf_color1(A2)
- ; Set to Mac lookalike colors. Color0 will be foreground in AMax, color1
- ; background.
-
- MOVE.L A2,A0
- MOVE.L #pf_color2,D0
- MOVEQ #-1,D1
- JSR _LVOSetPrefs(A6)
- ; SetPrefs with sending the NEWPREFS message.
-
- MOVE.L A2,A1
- MOVE.L #pf_color2,D0
- MOVE.L _SYSBase,A6
- JSR _LVOFreeMem(A6)
-
- NoMem
- MOVE.L _IntuitionBase,A1
- JSR _LVOCloseLibrary(A6)
-
- LEA DOSName,A1
- MOVEQ #0,D0
- JSR _LVOOpenLibrary(A6)
- MOVE.L D0,_DOSBase
- MOVE.L D0,A6
-
- MOVE.L #MountCommand,D1
- MOVEQ #0,D2
- MOVEQ #0,D3
- JSR _LVOExecute(A6)
-
- MOVE.L #AMaxCommand,D1
- MOVEQ #0,D2
- MOVEQ #0,D3
- JSR _LVOExecute(A6)
- * The two "Execute" commands cannot be preformed well from a WB started
- * process. For this reason the program should be run from WB using IconX.
- * See docs for further instructions.
-
- MOVE.L A6,A1
- MOVE.L _SYSBase,A6
- JSR _LVOCloseLibrary(A6)
-
- ; Basicly, a repition of the first block, only this time setting the colors
- ; to whatever they were to begin with. This code will only be executed if
- ; user canceled AMax.
- LEA IntuiName,A1
- MOVEQ #0,D0
- MOVE.L _SYSBase,A6
- JSR _LVOOpenLibrary(A6)
- MOVE.L D0,_IntuitionBase
-
- MOVE.L #pf_color2,D0
- MOVEQ #MEMF_PUBLIC,D1
- JSR _LVOAllocMem(A6)
- TST.L D0
- BEQ.S NoMem2
-
- MOVE.L D0,A0
- MOVE.L D0,A2
- MOVE.L #pf_color2,D0
- MOVE.L _IntuitionBase,A6
- JSR _LVOGetPrefs(A6)
-
- MOVE.W color0,pf_color0(A2)
- MOVE.W color1,pf_color1(A2)
-
- MOVE.L A2,A0
- MOVE.L #pf_color2,D0
- MOVEQ #-1,D1
- JSR _LVOSetPrefs(A6)
-
- MOVE.L A2,A1
- MOVE.L #pf_color2,D0
- MOVE.L _SYSBase,A6
- JSR _LVOFreeMem(A6)
-
- NoMem2
- MOVE.L _IntuitionBase,A1
- JSR _LVOCloseLibrary(A6)
-
- MOVEQ #0,D0
- RTS
-
-
- _DOSBase ds.l 1
- _IntuitionBase ds.l 1
- color0 ds.w 1
- color1 ds.w 1
- IntuiName dc.b "intuition.library",0
- DOSName dc.b "dos.library",0
- MountCommand dc.b "C:Mount AMAX0:",0
- AMaxCommand dc.b "A-MaxStartup",0
-