home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d543 / colorcatch.lha / ColorCatch / ColorCatchExe.asm < prev    next >
Assembly Source File  |  1991-09-20  |  2KB  |  88 lines

  1. *    ColorCatchExe
  2. *    By Preben Nielsen
  3. *
  4. *    This is the code created by ColorCatch V2.0
  5. *
  6. *HISTORY
  7. *          Made with Hisoft V2.12
  8. *
  9. *  V1.0   ??-???-90: First release.
  10. *  V2.0   06-Aug-91: Rewritten to get rid of Reloc-32 information in the
  11. *                    executable file. It is now smaller than V1.0.
  12. *                    It can now even be made resident (pure).
  13. *                    Works fine with kickstart 2.x.
  14.  
  15.     OPT O+
  16.     OPT O1+        ;Tells when a branch could be optimised to short
  17.     OPT i+        ;Tells when '#' is probably missing
  18.  
  19.         incdir        "AsmInc:"
  20.         include        "P.i"
  21.         include        "exec/exec_lib.i"
  22.         include        "graphics/view.i"
  23.         include        "graphics/graphics_lib.i"
  24.         include        "intuition/intuition.i"
  25.         include        "libraries/dosextens.i"
  26.  
  27. WBenchMsg    EQUR        D7
  28. GraphBase    EQUR        D6
  29. IntuiBase    EQUR        D5
  30.  
  31. ColorExe    moveq        #0,WBenchMsg
  32.         moveq        #0,GraphBase
  33.         moveq        #0,IntuiBase
  34.         Prepare        Exec_Call
  35.         suba.l        A1,A1
  36.         CallLib        FindTask        ;Find us
  37.         movea.l        D0,A2
  38.         tst.l        pr_CLI(A2)
  39.         bne.S        GetLibs
  40.         lea        pr_MsgPort(A2),A0
  41.         CallLib        WaitPort        ;wait for a message
  42.         lea        pr_MsgPort(A2),A0
  43.         CallLib        GetMsg            ;then get it
  44.         move.l        D0,WBenchMsg        ;save it for later reply
  45. GetLibs        lea        GfxName(PC),A1
  46.         CallLib        OldOpenLibrary
  47.         move.l        D0,GraphBase
  48.         beq.S        Error
  49.         lea        IntuiName(PC),A1
  50.         CallLib        OldOpenLibrary
  51.         move.l        D0,IntuiBase
  52.         beq.S        Error
  53.         move.l        IntuiBase,A0
  54.         move.l        ib_FirstScreen(A0),A0    ;IntuitionBase->FirstScreen
  55.         lea        sc_ViewPort(A0),A0    ;Screen.ViewPort
  56.         move.w        ColorCount(PC),D0
  57.         lea        ColorTable(PC),A1
  58.         move.l        GraphBase,A6
  59.         CallLib        LoadRGB4        ;Set new colors
  60.  
  61. Error
  62. Exit        Prepare        Exec_Call
  63. FreeIntui    move.l        IntuiBase,D0
  64.         beq.S        FreeGfx
  65.         movea.l        D0,A1
  66.         CallLib        CloseLibrary
  67. FreeGfx        move.l        GraphBase,D0
  68.         beq.S        ReplyWB
  69.         movea.l        D0,A1
  70.         CallLib        CloseLibrary
  71. ReplyWB        move.l        WBenchMsg,D2
  72.         beq.S        AllDone
  73.         CallLib        Forbid
  74.         movea.l        D2,A1
  75.         CallLib        ReplyMsg        ;Reply WBenchMessage if we are started from WB
  76. AllDone        moveq        #0,D0
  77.         rts
  78.  
  79. GfxName        dc.b        'graphics.library',0
  80. IntuiName    dc.b        'intuition.library',0
  81.         EVEN
  82.  
  83. ColorCount    dc.w        0
  84. *»»» This is where ColorCatch stores the colors
  85. ColorTable    dcb.w        32,0
  86.         END
  87.  
  88.