home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 621.lha / RunAMax / RunAMax.s < prev    next >
Text File  |  1992-02-12  |  3KB  |  134 lines

  1. * RunAMax - programed by Shachar Shemesh on 11th Feb, 1992.
  2. * A  program  to  easily  start AMax with right colors and with HD partitions
  3. * mounted.
  4.     
  5.     include    exec/types.i
  6.     include    exec/exec_lib.i
  7.     include    exec/memory.i
  8.     include    libraries/dos_lib.i
  9.     include    intuition/intuition_lib.i
  10.     include    intuition/preferences.i
  11.     
  12. BACKGROUND    EQU    $000
  13. FOREGROUND    EQU    $888
  14.     
  15. _SYSBase    EQU    $4
  16.     
  17.     LEA    IntuiName,A1
  18.     MOVEQ    #0,D0
  19.     MOVE.L    _SYSBase,A6
  20.     JSR    _LVOOpenLibrary(A6)
  21.     MOVE.L    D0,_IntuitionBase
  22. * I find checking whether Intuition and DOS were in fact opened pointless.
  23.     
  24.     MOVE.L    #pf_color2,D0
  25.     MOVEQ    #MEMF_PUBLIC,D1
  26.     JSR    _LVOAllocMem(A6)
  27.     TST.L    D0
  28.     BEQ.S    NoMem
  29. ; AllocMem for the preferences buffer upto color2 (all we need)
  30.     
  31.     MOVE.L    D0,A0
  32.     MOVE.L    D0,A2
  33.     MOVE.L    #pf_color2,D0
  34.     MOVE.L    _IntuitionBase,A6
  35.     JSR    _LVOGetPrefs(A6)
  36. ; GetPrefs upto same place
  37.     
  38.     MOVE.W    pf_color0(A2),color0
  39.     MOVE.W    pf_color1(A2),color1
  40. ; Save old color0 and 1
  41.     MOVE.W    #BACKGROUND,pf_color0(A2)
  42.     MOVE.W    #FOREGROUND,pf_color1(A2)
  43. ; Set to Mac lookalike colors. Color0 will be foreground in AMax, color1
  44. ; background.
  45.     
  46.     MOVE.L    A2,A0
  47.     MOVE.L    #pf_color2,D0
  48.     MOVEQ    #-1,D1
  49.     JSR    _LVOSetPrefs(A6)
  50. ; SetPrefs with sending the NEWPREFS message.
  51.     
  52.     MOVE.L    A2,A1
  53.     MOVE.L    #pf_color2,D0
  54.     MOVE.L    _SYSBase,A6
  55.     JSR    _LVOFreeMem(A6)
  56.     
  57. NoMem    
  58.     MOVE.L    _IntuitionBase,A1
  59.     JSR    _LVOCloseLibrary(A6)
  60.     
  61.     LEA    DOSName,A1
  62.     MOVEQ    #0,D0
  63.     JSR    _LVOOpenLibrary(A6)
  64.     MOVE.L    D0,_DOSBase
  65.     MOVE.L    D0,A6
  66.     
  67.     MOVE.L    #MountCommand,D1
  68.     MOVEQ    #0,D2
  69.     MOVEQ    #0,D3
  70.     JSR    _LVOExecute(A6)
  71.     
  72.     MOVE.L    #AMaxCommand,D1
  73.     MOVEQ    #0,D2
  74.     MOVEQ    #0,D3
  75.     JSR    _LVOExecute(A6)
  76. * The  two  "Execute"  commands  cannot  be  preformed well from a WB started
  77. * process.   For  this  reason the program should be run from WB using IconX.
  78. * See docs for further instructions.
  79.     
  80.     MOVE.L    A6,A1
  81.     MOVE.L    _SYSBase,A6
  82.     JSR    _LVOCloseLibrary(A6)
  83.     
  84. ; Basicly,  a  repition of the first block, only this time setting the colors
  85. ; to  whatever  they  were to begin with.  This code will only be executed if
  86. ; user canceled AMax.
  87.     LEA    IntuiName,A1
  88.     MOVEQ    #0,D0
  89.     MOVE.L    _SYSBase,A6
  90.     JSR    _LVOOpenLibrary(A6)
  91.     MOVE.L    D0,_IntuitionBase
  92.     
  93.     MOVE.L    #pf_color2,D0
  94.     MOVEQ    #MEMF_PUBLIC,D1
  95.     JSR    _LVOAllocMem(A6)
  96.     TST.L    D0
  97.     BEQ.S    NoMem2
  98.     
  99.     MOVE.L    D0,A0
  100.     MOVE.L    D0,A2
  101.     MOVE.L    #pf_color2,D0
  102.     MOVE.L    _IntuitionBase,A6
  103.     JSR    _LVOGetPrefs(A6)
  104.     
  105.     MOVE.W    color0,pf_color0(A2)
  106.     MOVE.W    color1,pf_color1(A2)
  107.     
  108.     MOVE.L    A2,A0
  109.     MOVE.L    #pf_color2,D0
  110.     MOVEQ    #-1,D1
  111.     JSR    _LVOSetPrefs(A6)
  112.     
  113.     MOVE.L    A2,A1
  114.     MOVE.L    #pf_color2,D0
  115.     MOVE.L    _SYSBase,A6
  116.     JSR    _LVOFreeMem(A6)
  117.     
  118. NoMem2    
  119.     MOVE.L    _IntuitionBase,A1
  120.     JSR    _LVOCloseLibrary(A6)
  121.     
  122.     MOVEQ    #0,D0
  123.     RTS
  124.     
  125.     
  126. _DOSBase    ds.l    1
  127. _IntuitionBase    ds.l    1
  128. color0    ds.w    1
  129. color1    ds.w    1
  130. IntuiName    dc.b    "intuition.library",0
  131. DOSName    dc.b    "dos.library",0
  132. MountCommand    dc.b    "C:Mount AMAX0:",0
  133. AMaxCommand    dc.b    "A-MaxStartup",0
  134.