**
**  $VER: personal_icon_io.asm	5.5 (20.5.97) some changes for pre PPaint7.0
**				5.4 (27.4.97)
**				5.2 (7.3.97)  icon loader
**				5.1 (27.2.97) first working version
**				5.0 (22.2.97)
**
**  first try of constructing an ICON saver for PPaint
**
**  written by Elmar Plischke <elmar@zfn.uni-bremen.de>
**
**

VERSION  equ 5
REVISION equ 5

 include "pio.i"
 include "exec/resident.i"
 include "exec/libraries.i"
 include "exec/initializers.i"
 include "exec/memory.i"
 include "intuition/intuition.i"
 include "workbench/workbench.i"
 include "mymacros.i"

* somewhere I used a scaled index , so we need
 mc68020

* standard lib header
start:
    moveq   #-1,d0
    rts
RomTag:
       dc.w RTC_MATCHWORD
       dc.l RomTag
       dc.l EndOfLibrary
       dc.b RTF_AUTOINIT,VERSION
       dc.b NT_LIBRARY,0
       dc.l pioname
       dc.l pioid
       dc.l LibInit
 STRUCTURE MyLib,LIB_SIZE
   APTR    my_SegList
   APTR    my_SysBase
   BYTE    my_OptionCount
   BYTE    my_ImageSelect
   WORD    my_IconType
   APTR    my_DiskObj
   STRUCT  my_BitMap,bm_SIZEOF
   STRUCT  my_Image,ig_SIZEOF
   STRUCT  my_DObj,78 ; do_SIZEOF
 LABEL	MyLib_SIZEOF
LibInit
    dc.l MyLib_SIZEOF	   ; Library base
    dc.l FuncTab
    dc.l DataTab
    dc.l InitLib
FuncTab
    dc.l    Open
    dc.l    Close
    dc.l    Expunge
    dc.l    Null
* Insert User Functions here
    dc.l    GetFirstDataInfo
    dc.l    GetNextDataInfo
    dc.l    GetPictureInfo
    dc.l    GetProgressBumps
    dc.l    ReadPicture
    dc.l    WritePicture
    dc.l    Null
    dc.l    GetFirstOption
    dc.l    GetNextOption
    dc.l    SetOption
    dc.l    Null
    dc.l    Cancel
    dc.l    Cancel
    dc.l    Cancel
    dc.l    -1
DataTab
    INITBYTE LN_TYPE,NT_LIBRARY
    INITLONG LN_NAME,pioname
    INITBYTE LIB_FLAGS,LIBF_SUMUSED|LIBF_CHANGED
    INITWORD LIB_VERSION,VERSION
    INITWORD LIB_REVISION,REVISION
    INITLONG LIB_IDSTRING,pioid
    INITWORD my_IconType,WBTOOL
    dc.w      0
    CNOP 0,4
InitLib
    move.l  d0,a1
    move.l  a0,(my_SegList,a1)
    move.l  a6,(my_SysBase,a1)
    rts
Open
; should only allow one user ...
    bclr    #LIBB_DELEXP,(LIB_FLAGS,a6)
    addq.w  #1,(LIB_OPENCNT,a6)
    move.l  a6,d0
    rts
Close
    moveq   #-$01,d0
    subq.w  #1,(LIB_OPENCNT,a6)
    bne     Null
Expunge
   movem.l  d2/a5/a6,-(sp)
   move.l   a6,a5
   move.l   (my_SysBase,a5),a6
   tst.w    (LIB_OPENCNT,a5)
   beq	    .goodbye

   bset    #LIBB_DELEXP,(LIB_FLAGS,a5)
   moveq   #0,d0
   bra.s   .expunge_end
.goodbye
   move.l   (my_SegList,a5),d2
   move.l   a5,a1
   CALL     Remove
.expunge_end
   move.l   d2,d0
   movem.l  (sp)+,d2/a5/a6
   rts
Null
     moveq   #$00,d0
     rts
pioname
    dc.b      'personal_icon_io.library',0
pioid
    dc.b      'personal_icon_io.library 5.5 (20.5.97)  by Bware',10,0
FullName:
 dc.b "Workbench Icon",0
ShortName
 dc.b "ICON",0
FileExtension
 dc.b ".info",0
Handshake
 dc.b "CloantoŽ",0
OptionName
 dc.b "Icon Type",0
Option2Name:
 dc.b "Selected",0
;errstr:
; dc.b "Oops ! IO error %ld",10,0
 even
Cancel:
    moveq   #PIOERR_CANCEL,d0
    rts
OPT1 equ DIF_LOAD!DIF_LOADFILE!DIF_LOADOPTS
OPT  equ OPT1!DIF_SAVE!DIF_SAVEFILE!DIF_CUSTOMIO!DIF_SAVEOPTS
GetFirstDataInfo
; => a0: dinfo
;   ( a6: library base - unused )
    move.w  (di_Version,a0),d0
    cmpi.w  #3,d0
    blt     client_too_old
    cmpi.w  #5,d0
    blt     .skiphshake
    lea     (Handshake,pc),a1
    move.l  a1,(di_HandshakeText,a0)
.skiphshake
    move.l  #'ICON',(di_Code,a0)
    move.l  #OPT,(di_Flags,a0)
    move.l  #PCDT_FORMAT!PCDT_HANDLE!PCDT_IMAGE,(di_ProcessData,a0)
    move.l  #666,(di_Priority,a0)
    move.l  a2,-(sp)
    lea     (FullName,pc),a1
    lea     (di_Name,a0),a2
    strcpy  a1,a2
    lea     (ShortName,pc),a1
    lea     (di_ShortName,a0),a2
    strcpy  a1,a2
    move.l  (sp)+,a2
    lea     (di_FileSuffix,a0),a1
    move.l  #'.inf',(a1)+
    move.l  #$6f000000,(a1)+
    moveq   #1,d0
    rts
;.oops
;    moveq   #0,d0
;    rts
GetNextDataInfo
    move.w  (di_Version,a0),d0
    cmpi.w  #5,d0
    blt     noknok
    lea     (Handshake,pc),a1
    move.l  a1,(di_HandshakeText,a0)
noknok
    moveq   #0,d0
    rts
client_too_old
    moveq   #PIOERR_BADVER,d0
    rts
GetNextOption
; => a0: dinfo
;    a1: dopt
    cmpi.w  #3,(dto_Version,a1)
    blt.s   client_too_old
    tst.b   (my_OptionCount,a6)
    bmi.s   doloadopt
    beq.s   .ok
    moveq   #0,d0
    rts
.ok
    st	    (my_OptionCount,a6)
    clr.l   (dto_Flags,a1)
cont
    move.w  #DOT_BOOL,(dto_Type,a1)
    move.l  a2,-(sp)
    lea     (Option2Name,pc),a0
    lea     (dto_Name,a1),a2
    strcpy  a0,a2
    move.l  #DOUI_NONE,(dto_UITextStr,a1)
    move.l  (sp)+,a2
    move.b  (my_ImageSelect,a6),d0
    extb.l  d0
    neg.l   d0
    move.l  d0,(dto_Value,a1)
    moveq   #1,d0
    rts
doloadopt
    neg.b   (my_OptionCount,a6)
    move.l  #DOF_LOADOPTION,(dto_Flags,a1)
    bra.s   cont
GetFirstOption
; => a0: dinfo
;    a1: dopt
    cmpi.w  #3,(dto_Version,a1)
    blt     client_too_old
;    cmpi.l  #'ICON',(di_Code,a0)
;    bne     client_too_old

    sf	    (my_OptionCount,a6)
    move.w  #DOT_STRING,dto_Type(a1)
    clr.l   (dto_Flags,a1)
    move.l  a2,-(sp)
    lea     (OptionName,pc),a0
    lea     (dto_Name,a1),a2
    strcpy  a0,a2
    move.l  #DOUI_NONE,(dto_UITextStr,a1)

    lea     (dto_String,a1),a0
    move.w  (my_IconType,a6),d2
    subq.b  #1,d2
    lea     (OptionTypes,pc,d2*8),a1
    strcpy  a1,a0
    move.l  (sp)+,a2
    moveq   #1,d0
    rts
OptionTypes:
 dc.b "Disk",0,0,0,0
 dc.b "Drawer",0,0
 dc.b "Tool",0,0,0,0
 dc.b "Project",0
 dc.b "Trash",0
SetOption
    cmpi.w  #3,(dto_Version,a1)
    blt     client_too_old
    move.b  (dto_Name,a1),d0
    cmpi.b  #'S',d0
    bne     .isString
    move.l  (dto_Value,a1),d0
    neg.b   d0
    move.b  d0,(my_ImageSelect,a6)
    rts
.isString
* the icon type string matching is very simple
* check the length and (if needed) the first letter
*
    push    d2
    lea     (dto_String,a1),a0
    strlen  a0
    move.l  d0,d1
    move.b  (a0),d0
    bclr    #5,d0 ; mask out bit 5 for upper case letter
    subq.b  #4,d1
    bmi     oops
    bne     .two
    cmpi.b  #'T',d0
    bne     .one
    moveq   #3,d2
    bra     .ok
.one
    cmpi.b  #'D',d0
    bne     oops
    moveq   #1,d2
    bra     .ok
.two
    subq.b  #1,d1
    bne     .three
    moveq   #5,d2
    bra     .ok
.three
    subq.b  #1,d1
    bne     .four
    moveq   #2,d2
    bra     .ok
.four
    subq.b  #1,d1
    bne     oops
    moveq   #4,d2
.ok
nok
    move.w  d2,(my_IconType,a6)
    pop     d2
    rts
oops
    moveq   #3,d2
    bra.s   nok

;ResetOptions
;    move.w  #3,(my_IconType,a6)
;    rts

GetProgressBumps
; un - interruptable
 moveq	#0,d0
 rts
WritePicture
; => pinfo: a0
    cmpi.w  #3,(pti_Version,a0)
    bge.s   .ok
    moveq   #PIOERR_BADVER,d0
    rts
.ok
    push    all
* write out default icon
    move.l  a0,a5   ; picture info
    move.l  a6,a4   ; library base - globals
    move.l  (pti_FileName,a5),a0
* don't know if this is a good idea to mess around in the client provided name
* but it works ... ( should create local copy )
* delete trailing .info
	strlen	a0
	cmpi.w	#6,d0
	bmi	.nameok
	lea	(-5,a0,d0.w),a1
	cmp.b	#'.',(a1)
	bne	.nameok
	move.b	(1,a1),d0
	lsl.l	#8,d0
	move.b	(2,a1),d0
	lsl.l	#8,d0
	move.b	(3,a1),d0
	lsl.l	#8,d0
	move.b	(4,a1),d0
	cmp.l	#'info',d0
	bne	.nameok
	sf	(a1)
.nameok
    CICO    GetDiskObject
    tst.l   d0
    bne     .foundicon
* load default
    moveq   #0,d0
    move.w  (my_IconType,a4),d0
    CALL    GetDefDiskObject
    tst.l   d0
    beq     .oops
.foundicon
    move.l  d0,a0
    move.l  d0,a3
    lea     (my_DObj,a4),a1
    moveq   #78,d0 ; do_SIZEOF
    CSYS    CopyMem   ;  got a local copy in my_DObj
* compose image
    lea     (my_Image,a4),a2
    clr.w   (ig_LeftEdge,a2)
    clr.w   (ig_TopEdge,a2)
    move.w  (pti_Width,a5),(ig_Width,a2)
    move.w  (pti_Height,a5),(ig_Height,a2)
    moveq   #0,d0
    move.b  (pti_Depth,a5),d0
    move.w  d0,(ig_Depth,a2)
    st	    (ig_PlanePick,a2)
    sf	    (ig_PlaneOnOff,a2)
    clr.l   (ig_NextImage,a2)
    move.l  (pti_BMap,a5),a0
    bsr     bmap2imagedata
    move.l  d0,(ig_ImageData,a2)
* where to put the image
    lea     (my_DObj+do_Gadget,a4),a1
    tst.b   (my_ImageSelect,a4)
    bne     .writeSelected

    move.l  a2,(gg_GadgetRender,a1)
    clr.l   (gg_SelectRender,a1)
    move.w  (pti_Width,a5),(gg_Width,a1)
    move.w  (pti_Height,a5),d1
    addq.l  #1,d1
    move.w  d1,(gg_Height,a1)  ; Text Subscript

    move.w  #GFLG_GADGIMAGE!GFLG_GADGBACKFILL,(gg_Flags,a1)

    bra.s   .continue
.writeSelected
    move.l  a2,(gg_SelectRender,a1)
    move.w  #GFLG_GADGIMAGE!GFLG_GADGHIMAGE,(gg_Flags,a1)
.continue

    move.l  (pti_FileName,a5),a0
    lea     (my_DObj,a4),a1
    CICO    PutDiskObject
    tst.l   d0
    bne     .okay
;    CDOS    IoErr
;    move.l  d0,-(sp)
;    move.l  sp,d2
;    lea     (errstr,pc),a0
;    move.l  a0,d1
;    CALL    VPrintf
;    addq.l  #4,sp
    clra.l  a0
    CINT    DisplayBeep
.okay
    move.l  a3,a0
    CICO    FreeDiskObject

* freevec imagedata
    move.l  (my_Image+ig_ImageData,a4),a1
    CSYS    FreeVec

* we did our work ...
    move.l  (pti_ProcessData,a5),(pti_ProcessedData,a5)
    lea     (Null,pc),a0
    move.l  a0,(pti_SeekFile,a5)
.oops
    pop     all
    moveq   #PIOERR_OK,d0
    rts


bmap2imagedata
;=> a0: bmap
;<= d0: imagedata
	push	a2/d2-d6
	move.l	a0,a2
	move.w	2(a2),d5
	mulu	(a2),d5
	moveq	#0,d0
	move.b	5(a2),d0
	muls.l	d5,d0
	moveq	#MEMF_CHIP!MEMF_PUBLIC,d1
	CSYS	AllocVec
	move.l	d0,d6
	move.l	d0,d4
	moveq	#0,d2
	tst.b	5(a2)
	beq	lL3
	moveq	#0,d3
lL5:
	move.l	(8,a2,d2.l*4),a0
	move.l	d4,a1
	move.l	d5,d0
	CALL	CopyMem
	add.l	d5,d4
	addq.l	#1,d2
	move.b	5(a2),d3
	cmp.l	d2,d3
	bgt	lL5
lL3:
	move.l d6,d0
	pop    a2/d2-d6
	rts

GetPictureInfo:
; => a0: pictureinfo
    cmpi.w  #3,(pti_Version,a0)
    blt     client_too_old
	push	a2-a6

	move.l	a0,a5	; picture info
	move.l	a6,a4	; library base - globals

	move.l	(pti_FileName,a5),a0
* delete trailing .info if the asl-reqester is used
* see note above
	strlen	a0
	cmpi.w	#6,d0
	bmi	.nameok
	lea	(-5,a0,d0.w),a1
	cmp.b	#'.',(a1)
	bne	.nameok
	move.b	(1,a1),d0
	lsl.l	#8,d0
	move.b	(2,a1),d0
	lsl.l	#8,d0
	move.b	(3,a1),d0
	lsl.l	#8,d0
	move.b	(4,a1),d0
	cmp.l	#'info',d0
	bne	.nameok
	sf	(a1)
.nameok
	CICO	GetDiskObjectNew
	move.l	d0,a3
	move.l	d0,(my_DiskObj,a4)
	beq.s	.ohno
	tst.b	(my_ImageSelect,a4)
	bne	.readselect
.readfirst
	move.l	(do_Gadget+gg_GadgetRender,a3),a2
	bra.s	.cont
.readselect
	move.l	(do_Gadget+gg_SelectRender,a3),d0
	beq.s	.readfirst
	move.l	d0,a2
.cont
	move.w	(ig_Width,a2),d0
	move.w	d0,(pti_Width,a5)
	lsr.w	#1,d0
	move.w	d0,(pti_HandleX,a5)
	move.w	(ig_Height,a2),d0
	move.w	d0,(pti_Height,a5)
	lsr.w	#1,d0
	move.w	d0,(pti_HandleY,a5)
	move.w	(ig_Depth,a2),d0
	move.b	d0,(pti_Depth,a5)
	sf	(pti_PreviewDepth,a5)
	move.l	#PCDT_FORMAT!PCDT_HANDLE,(pti_ProcessedData,a5)
*    lea     (piexit,pc),a0
*    move.l  a0,d1
*    CDOS    VPrintf

	moveq	#PIOERR_OK,d0
.return
	pop	a2-a6
	rts
.ohno
	moveq	#PIOERR_FILE_ERR,d0
	bra.s	.return
ReadPicture:
* => a0 : pictureinfo
    cmpi.w  #3,(pti_Version,a0)
    bge     .okay
    moveq   #PIOERR_BADVER,d0
    rts
.okay
	push	all
	move.l	a0,a5	; picture info
	move.l	a6,a4	; library base - globals

	move.l	(my_DiskObj,a4),d0
	beq	.nofile
	move.l	d0,a3
	move.l	(pti_BMap,a5),a2
	move.w	(bm_BytesPerRow,a2),d3

	mulu.w	(bm_Rows,a2),d3
	tst.b	(my_ImageSelect,a4)
	bne	.readselect
.readfirst
	move.l	(do_Gadget+gg_GadgetRender,a3),a3
	bra.s	.cont
.readselect
	move.l	(do_Gadget+gg_SelectRender,a3),d0
	beq.s	.readfirst
	move.l	d0,a3
.cont
	move.w	(ig_Depth,a3),d4
	moveq	#0,d7
	move.w	(ig_Width,a3),d7
	addq.w	#8,d7
	addq.w	#7,d7
	lsr.w	#4,d7 ; bytes per row
	add.w	d7,d7

	move.l	d7,d6
	mulu.w	(ig_Height,a3),d7
	cmp.w	d7,d3
	bne	.muttuwatttun
*	 bra	 .muttuwatttun
; if the bitplane sizes match, do a simple byte-copy.
; this is not documented anywhere but it works ...
; if this does not work for you change the 'bne' in 'bra' in
; line above ( and pray for V39 in ROM as the rest of the code is untested).
	move.l	(ig_ImageData,a3),a3
	subq.l	#1,d4 ; for dbra
	moveq	#0,d5
	move.l	(pti_SysBase,a5),a6
.loop
	move.l	(bm_Planes,a2,d5*4),a1
	move.l	a3,a0
	move.l	d3,d0
	CALL	CopyMem
	lea	(a3,d3),a3
	addq.l	#1,d5
	dbra	d4,.loop

.back
	move.l	(my_DiskObj,a4),a0
	CICO	FreeDiskObject
	clr.l	(my_DiskObj,a4)

	moveq	#PCDT_IMAGE,d0
	or.l	d0,(pti_ProcessedData,a5)

	pop	all
	moveq	#PIOERR_OK,d0
	rts
.nofile
	pop	all
	moveq	#PIOERR_FILE_ERR,d0
	rts
.muttuwatttun
* ImageData BytesPerRow doesn't match BitMap BPR
* we'll call the CopyBitMap8 function lifted from
* the datatypes example code.

;    clra.l  a0
;    CINT    DisplayBeep  ; test

    lea     (my_BitMap,a4),a0
    move.w  d4,d0
    move.w  (ig_Width,a3),d1
    move.w  (ig_Height,a3),d2
    CGFX    InitBitMap

    lea     (bm_Planes+my_BitMap,a4),a0
    subq.w  #1,d4 ; for dbra
    move.l  (ig_ImageData,a3),a1
.loop2
    move.l  a1,(a0)+
    lea     (a1,d7),a1
    dbra    d4,.loop2
* Blit the Bitmap
    move.l  a5,-(sp)
    moveq   #0,d1
    move.w  (ig_Height,a3),d1
    move.l  d1,-(sp)
    move.w  (ig_Width,a3),d1
    move.l  d1,-(sp)
    move.l  a2,-(sp)
    pea     (my_BitMap,a4)
    bsr     CopyBitMap8
    addq.w  #8,sp
    addq.w  #8,sp
    addq.w  #4,sp

    bra     .back
; produced by Gcc and mit2mot by me
CopyBitMap8:
; stack: srcbm,destbm,width,height,picinfo
* this version should work with V36+
	add.w #-220,sp
	movem.l a2-a6/d2-d7,-(sp)
	move.l (272,sp),a5
	move.l (284,sp),a3
	move.w (278,sp),d5
	move.w (282,sp),(50,sp)
	clr.w (54,sp)
	move.l (546,a3),a6
	cmp.w #38,(20,a6)
	bls L2
	move.w d5,d0
	ext.l d0
	moveq #1,d1
	moveq #0,d2
	move.b (320,a3),d2
	moveq #1,d3
	suba.l a0,a0
	jsr (-$396,a6)
	move.l d0,(46,sp)
	bra L3
L2:
	clr.w d3
	move.b (320,a3),d3
	move.l (538,a3),a6
	moveq #40,d0
	move.l #65537,d1
	jsr (-$2ac,a6)
	move.l d0,(46,sp)
	move.l (546,a3),a6
	move.l d0,a0
	moveq #0,d0
	move.b d3,d0
	move.w d5,d1
	ext.l d1
	moveq #1,d2
	jsr (-$186,a6)
	move.l (46,sp),a4
	move.w (a4),d4
	move.w d4,d0
	muls d3,d0
	move.l (538,a3),a6
	move.l #65539,d1
	jsr (-$2ac,a6)
	move.l d0,a1
	clr.w d1
	cmp.w (54,sp),d3
	ble L3
	moveq	#0,d2
L7:
	move.w d1,a0
	move.w d4,d0
	muls d1,d0
	move.b (a1,d0.l),d2
	move.l (46,sp),a4
	move.l d2,(8,a4,a0.l*4)
	addq.w #1,d1
	cmp.w d1,d3
	bgt L7
L3:
	tst.l (46,sp)
	beq L9
	move.w d5,a0
	moveq #15,d0
	add.l a0,d0
	moveq #-16,d7
	and.l d0,d7
	move.l d7,(56,sp)
	move.l (538,a3),a6
	move.l d7,d0
	moveq #0,d1
	jsr (-$c6,a6)
	move.l d0,d6
	beq L10
	move.w #1,(54,sp)
	move.l (546,a3),a6
	lea (160,sp),a1
	jsr (-$c6,a6)
	move.l (268,sp),(164,sp)
	move.l (546,a3),a6
	lea (60,sp),a1
	jsr (-$c6,a6)
	move.l (46,sp),(64,sp)
	clr.w d4
	cmp.w (50,sp),d4
	bge L12
L14:
	move.w d4,d3
	ext.l d3
	move.l (546,a3),a6
	lea (160,sp),a0
	moveq #0,d0
	move.l d3,d1
	move.w d5,d2
	ext.l d2
	move.l d6,a2
	lea (60,sp),a1
	jsr (-$300,a6)
	move.w	d5,d0
	andi.w	#31,d0
	bne L15
	moveq #0,d0
	move.w (a5),d0
	muls.l d0,d3
	move.w d5,d2
	asr.w #5,d2
	subq.w #1,d2
	bmi L13
L19:
	move.l d3,-(sp)
	move.l a5,-(sp)
	move.l a2,-(sp)
	move.l (622,a3),a0
	jsr (a0)
	addq.w #8,sp
	addq.w #4,sp
	add.w #32,a2
	addq.l #4,d3
	dbra d2,L19
	bra L13
L15:
	clr.l -(sp)
	clr.l -(sp)
	pea -1.w
	move.l a5,-(sp)
	move.l (618,a3),a0
	jsr (a0)
	clr.w d2
	addq.w #8,sp
	addq.w #8,sp
	cmp.w d2,d5
	ble L23
	moveq #0,d3
L25:
	move.b (a2)+,d0
	move.b d0,d3
	move.l d3,-(sp)
	move.w d4,a4
	move.l a4,-(sp)
	move.w d2,a4
	move.l a4,-(sp)
	move.l a5,-(sp)
	move.l (618,a3),a0
	jsr (a0)
	addq.w #8,sp
	addq.w #8,sp
	addq.w #1,d2
	cmp.w d2,d5
	bgt L25
L23:
	clr.l -(sp)
	clr.l -(sp)
	pea -2.w
	move.l a5,-(sp)
	move.l (618,a3),a0
	jsr (a0)
	addq.w #8,sp
	addq.w #8,sp
L13:
	addq.w #1,d4
	cmp.w (50,sp),d4
	blt L14
L12:
	move.l (538,a3),a6
	move.l d6,a1
	move.l (56,sp),d0
	jsr (-$d2,a6)
L10:
	move.l (546,a3),a6
	cmp.w #38,(20,a6)
	bls L28
	move.l (46,sp),a0
	jsr (-$39c,a6)
	bra L9
L28:
	move.l (538,a3),a6
	move.l (46,sp),a4
	move.l (8,a4),a1
	jsr (-$2b2,a6)
	move.l (538,a3),a6
	move.l a4,a1
	jsr (-$2b2,a6)
L9:
	moveq #1,d0
	and.l (52,sp),d0
	movem.l (sp)+,d2-d7/a2-a6
	add.w #220,sp
	rts

EndOfLibrary
 end


