home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / Misc / OTT-PHT3.DMS / in.adf / devdocs / paintmodes / paint.asm < prev    next >
Encoding:
Assembly Source File  |  1994-11-21  |  4.3 KB  |  173 lines

  1.         opt l-,o+
  2.  
  3. VERSION  equ    1
  4. REVISION equ    1
  5.  
  6. LIBNAME    macro
  7.         dc.b    "Paint",0
  8.         endm
  9. VSTRING macro
  10.         dc.b    "$VER Paint 1.1 (17/11/94)",0
  11.         dc.b    "Copyright © Paul Nolan & Almathera 1994. All Rights Reserved",0
  12.         endm
  13.  
  14.         SECTION    code
  15.  
  16.         machine mc68020
  17.  
  18.         incdir  "include:"
  19.         include "exec/funcdef.i"
  20.         include "exec/types.i"
  21.         INCLUDE "exec/initializers.i"
  22.         INCLUDE "exec/libraries.i"
  23.         INCLUDE "exec/lists.i"
  24.         include "exec/memory.i"
  25.         INCLUDE "exec/alerts.i"
  26.         INCLUDE "exec/resident.i"
  27.         INCLUDE "libraries/dos.i"
  28.         include "exec/exec_lib.i"
  29.         include "/photogenics.i"
  30.         include "paintbase.i"
  31.         include "paintmode.i"
  32.  
  33.         XDEF    InitTable
  34.         XDEF    Open
  35.         XDEF    Close
  36.         XDEF    Expunge
  37.         XDEF    Null
  38.         XDEF    LibName
  39.         XDEF    _main
  40.  
  41.         XREF    _PaintInfo
  42.         XREF    _PaintAddr
  43.         XREF    _PaintOptions
  44.  
  45. _main:
  46. Start:
  47.         moveq   #-1,d0
  48.         rts
  49.  
  50. MYPRI   EQU   0
  51.  
  52. RomTag:
  53.              ;STRUCTURE RT,0
  54.      DC.W    RTC_MATCHWORD      ; UWORD RT_MATCHWORD
  55.      DC.L    RomTag             ; APTR  RT_MATCHTAG
  56.      DC.L    EndCode            ; APTR  RT_ENDSKIP
  57.      DC.B    RTF_AUTOINIT       ; UBYTE RT_FLAGS
  58.      DC.B    VERSION            ; UBYTE RT_VERSION
  59.      DC.B    NT_LIBRARY         ; UBYTE RT_TYPE
  60.      DC.B    MYPRI              ; BYTE  RT_PRI
  61.      DC.L    LibName            ; APTR  RT_NAME
  62.      DC.L    IDString           ; APTR  RT_IDSTRING
  63.      DC.L    InitTable          ; APTR  RT_INIT  table for InitResident()
  64.  
  65. LibName:   LIBNAME
  66. IDString:  VSTRING
  67.         cnop    0,4
  68.  
  69. InitTable:
  70.    DC.L   PaintBase_SIZEOF
  71.    DC.L   funcTable
  72.    DC.L   dataTable
  73.    DC.L   init
  74.  
  75.  
  76. funcTable:
  77.    dc.l   Open
  78.    dc.l   Close
  79.    dc.l   Expunge
  80.    dc.l   Null
  81.    dc.l   _PaintInfo
  82.    dc.l   _PaintAddr
  83.    dc.l   _PaintOptions
  84.    dc.l   -1
  85.  
  86. dataTable:
  87.         INITBYTE        LN_TYPE,NT_LIBRARY
  88.         INITLONG        LN_NAME,LibName
  89.         INITBYTE        LIB_FLAGS,LIBF_SUMUSED!LIBF_CHANGED
  90.         INITWORD        LIB_VERSION,VERSION
  91.         INITWORD        LIB_REVISION,REVISION
  92.         INITLONG        LIB_IDSTRING,IDString
  93.         dc.l            0
  94.  
  95. init:   move.l   a5,-(sp)
  96.         move.l   d0,a5
  97.         move.l   a6,paintb_SysLib(a5)
  98.         move.l   a0,paintb_SegList(a5)
  99.         move.l   a5,d0
  100.         move.l   (sp)+,a5
  101.         rts
  102.  
  103. Open:   addq.w  #1,LIB_OPENCNT(a6)
  104.         bclr    #LIBB_DELEXP,paintb_Flags(a6)
  105.         move.l  a6,d0
  106.         rts
  107.  
  108. Close:  moveq   #0,d0
  109.         subq.w  #1,LIB_OPENCNT(a6)
  110.         bne.s   1$
  111.         btst    #LIBB_DELEXP,paintb_Flags(a6)
  112.         beq.s   1$
  113.         bsr.s   Expunge
  114. 1$:     rts
  115.  
  116. Expunge:
  117.         movem.l d2/a5/a6,-(sp)
  118.         move.l  a6,a5
  119.         move.l  paintb_SysLib(a5),a6
  120.         tst.w   LIB_OPENCNT(a5)
  121.         beq.s   1$
  122.         bset    #LIBB_DELEXP,paintb_Flags(a5)
  123.         moveq   #0,d0
  124.         bra.s   Expunge_End
  125. 1$:     move.l   paintb_SegList(a5),d2
  126.         move.l   a5,a1
  127.         jsr     _LVORemove(a6)
  128.         moveq   #0,d0
  129.         move.l  a5,a1
  130.         move.w  LIB_NEGSIZE(a5),d0
  131.         sub.l   d0,a1
  132.         add.w   LIB_POSSIZE(a5),d0
  133.         jsr     _LVOFreeMem(a6)
  134.         move.l  d2,d0
  135. Expunge_End:
  136.         movem.l (sp)+,d2/a5/a6
  137.         rts
  138.  
  139. Null:   moveq   #0,d0
  140.         rts
  141.  
  142. EndCode:
  143.  
  144. *******************************************************************
  145. *******************************************************************
  146. *******************************************************************
  147. ***                                                             ***
  148. *** Main code functions for library follow here...              ***
  149. ***                                                             ***
  150. *******************************************************************
  151. *******************************************************************
  152. *******************************************************************
  153.  
  154.  
  155. _PaintInfo
  156.         move.l  #PAINT_ID+PAINT_COLOUR+PAINT_NOOPTIONS,d0
  157.         rts
  158.  
  159. _PaintAddr
  160.         move.l  #_code,d0
  161.         rts
  162.  
  163. _code
  164. ; this code called with PhotoInfo in A5. Same rules as previous..
  165.         move.l  PHI_red(a5),d4
  166.         move.l  PHI_green(a5),d5
  167.         move.l  PHI_blue(a5),d6
  168.         rts
  169.  
  170. _PaintOptions
  171.         moveq   #0,d0
  172.         rts
  173.