
 Include "equ.h"
 Include "impequ.h"

 SECTION PCX,CODE,PUBLIC

***************************************************
***						***
***************************************************
dumbentry:
	clr.l	d0
	rts

	dc.l	"IMPP"		; magik number for pic import
	dc.w	200
	dc.l	0

table:	dc.l	0
	dc.l	name,special,check,PCX


*****************************
* Is it really a PCX pic?   *
*****************************
check:	move.l	table,a0
	move.l	buff1(a0),a1
	move.l	(a1),a1
	cmp.b	#10,(a1)
	bne	never
	bra	right

rrts:   rts

***********************************
***                             ***
***********************************
PCX:	move.l	sp,savesp
        clr.l   palhndl
        clr.b   flag

	move.l	table,a0
	move.l	f_openr(a0),a0
	jsr	(a0)
	beq	rrts

	move.l	table,a0
	move.l	spclnum(a0),a0
	cmp.w	#1,(a0)
	beq	impobj
        
        
*********************************
*                               *
*********************************
imppic:	move.l	table,a0
	move.l	p_open(a0),a0
	jsr	(a0)
	beq	rrts

	bsr	getpicinfo

	move.l	table,a4
	move.l	cwptr(a4),a4		;ptr to window handle
	move.l	(a4),a4			;window handle
	move.l	(a4),a4			;ptr to window structure
        
	lea	pic,a0
	move.w	pc_Type(a0),pi_Type(a4)
	move.w	pc_SFreq(a0),pi_SFreq(a4)
	move.w	pc_SAngle(a0),pi_SAngle(a4)
	move.w	pc_SSpot(a0),pi_SSpot(a4)
	move.l	pc_SMap(a0),pi_SMap(a4)
	move.l	pc_SMap+4(a0),pi_SMap+4(a4)
	move.w	pc_XDpi(a0),pi_XDpi(a4)
	move.w	pc_YDpi(a0),pi_YDpi(a4)
	move.w	pc_W(a0),pi_W(a4)
	move.w	pc_H(a0),pi_H(a4)
	move.w	pc_Width(a0),pi_Width(a4)
	move.w	pc_BitPln(a0),pi_BitPln(a4)
	move.w	pc_Palet(a0),pi_Palet(a4)

	move.w	pi_Palet(a4),d1
	mulu	#pl_Sizeof,d1
	move.w	pi_Width(a4),d0
	mulu	pi_BitPln(a4),d0
	mulu	pi_H(a4),d0
	add.l	d1,d0		;size of bitmap +( 4 words * #colors)

	clr.w	d1
	clr.w	d2
	move.l	table,a0
	move.l	m_alloc(a0),a0
	jsr	(a0)
	beq	abortpic

	move.l	table,a3
	move.l	cwptr(a3),a3
	move.l	(a3),a3
	move.l	(a3),a3
	move.l	a0,pi_Ptr(a3)
	move.l	(a0),a4
	move.l	a4,picptr
        move.l  a4,palptr

        cmp.b   #2,version
        bne     imp0
	bsr	putcolor
        bra     impic2

imp0:   cmp.b   #5,version
        bne     impic2
        cmp.w   #256,numcolors
        bne     impic2
        
        clr.l   d0
        move.w  numcolors,d0
        move.w  d0,temp
	mulu	#pl_Sizeof,d0
        add.l   d0,a4
        move.l  a4,picptr

impic2: bsr	putpic
        
        cmp.b   #5,version
        bne     impic3
        cmp.w   #256,numcolors
        bne     impic3
        
imp21:  bsr     pget
        cmp.b   #$0c,d0
        bne     imp21
        bsr     cmap
	bsr	putcolor

impic3:	move.l	table,a0
	move.l	p_close(a0),a0
	jsr	(a0)

	move.l	table,a0
	move.l	f_closer(a0),a0
	jmp	(a0)


abortpic:
	move.l	table,a0
	move.l	p_abort(a0),a0
	jsr	(a0)

abort0:	move.l	table,a0
	move.l	f_closer(a0),a0
	jmp	(a0)


*********************************
*                               *
*********************************
impobj:	move.l	table,a0
	move.l	o_open(a0),a0
	jsr	(a0)
	beq	abort0

	bsr	getpicinfo
        
	move.b	#tpic,object+ob_Type
	clr.l	object+ob_Left
	clr.l	object+ob_Top

	move.w	pic+pc_W,d1
	move.l	#7200,d0
	bsr	Mulu1632
	move.w	pic+pc_XDpi,d2
	bsr	Divu1648
	move.l	d0,object+ob_Right

	move.w	pic+pc_H,d1
	move.l	#7200,d0
	bsr	Mulu1632
	move.w	pic+pc_YDpi,d2
	bsr	Divu1648
	move.l	d0,object+ob_Bottom

	clr.b	object+ob_Flag
	clr.w	object+ob_Slant
	clr.w	object+ob_Twist
	move.w	#50,object+ob_LWidth		;1 point line
	clr.b	object+ob_LType			;no line
	move.b	#1,object+ob_LColor		;black line
	clr.b	object+ob_FType			;no fill
	move.b	#1,object+ob_FColor		;black fill
	clr.b	object+ob_LBegin
	clr.b	object+ob_LEnd
	move.w	#900,object+ob_HStandOff	;1/8 inch
	move.w	#900,object+ob_VStandOff	;1/8 inch

	move.l	table,a1
	move.l	o_obj(a1),a1
	lea	object,a0
	jsr	(a1)
	beq	abortobj

	move.w	pic+pc_Width,d0
	mulu	pic+pc_BitPln,d0
	mulu	pic+pc_H,d0
	move.w	pic+pc_Palet,d1
	mulu	#pl_Sizeof,d1
	add.l	d1,d0
	add.l	#pc_Sizeof,d0

	move.l	table,a0
	move.l	o_malloc(a0),a0
	jsr	(a0)
	beq	abortobj

	lea	pic,a1
	clr.l	pc_DPtr(a1)
	clr.w	pc_DScale(a1)
	move.w	pc_Palet(a1),d0
	mulu	#pl_Sizeof,d0
	add.l	#pc_Sizeof,d0
	move.l	d0,pc_Ptr(a1)

	move.w	#pc_Sizeof/2-1,d0
oppic1:	move.w	(a1)+,(a0)+
	dbf	d0,oppic1
        move.l  a0,palptr
        move.l	a0,picptr

        cmp.b   #2,version
        bne     oppic2
	bsr	putcolor
        bra     iop20
        
oppic2: cmp.b   #5,version
        bne     iop20
        cmp.w   #256,numcolors
        bne     iop20
        
        clr.l   d0
        move.w  numcolors,d0
        move.w  d0,temp
	mulu	#pl_Sizeof,d0
        add.l   d0,a0
        move.l  a0,picptr

iop20:  bsr	putpic
        
        cmp.b   #5,version
        bne     oppic3
        cmp.w   #256,numcolors
        bne     oppic3
        
iop21:  bsr     pget
        cmp.b   #$0c,d0
        bne     iop21
        bsr     cmap
	bsr	putcolor

oppic3:	move.l	table,a0
        move.l	o_close(a0),a0
	jsr	(a0)

	move.l	table,a0
	move.l	f_closer(a0),a0
	jmp	(a0)


abortobj:
	move.l	table,a0
	move.l	o_abort(a0),a0
	jsr	(a0)

	move.l	table,a0
	move.l	f_closer(a0),a0
	jmp	(a0)
        
        
*********************************
*                               *
*********************************
getpicinfo:
	lea	pic,a0
	move.w	#pc_Sizeof-1,d0
gpi1:	clr.b	(a0)+
	dbra	d0,gpi1

        move.w	#-1,pic+pc_SFreq
	move.w	#-1,pic+pc_SAngle

	clr.b	flag
	clr.l	palhndl

	bsr	pgetl		; get first four bytes
        move.l  d0,d1
        and.l   #$000000ff,d1   ; mask off the lower byte (bits per pixel)
        move.l  d1,bpp
        move.l  d0,d1
        lsr.l   #8,d1
        and.l   #$000000ff,d1
        move.b  d1,compression
        move.l  d0,d1
        lsr.l   #8,d1
        lsr.l   #8,d1
        and.l   #$000000ff,d1
        move.b  d1,version

	bsr	ipgetw
        move.w  d0,xmin
        bsr     ipgetw
        move.w  d0,ymin
        bsr     ipgetw
        addq.w  #1,d0
        move.w  d0,xmax
        bsr     ipgetw
        addq.w  #1,d0
        move.w  d0,ymax
        
        move.w  xmax,d0                 ;calculate the width in pixels
        sub.w   xmin,d0
        move.w	d0,pc_W+pic
	add.w	#15,d0
	lsr.w	#3,d0
	bclr	#0,d0
	move.w	d0,pc_Width+pic		; width in bytes (even)
        
        move.w  ymax,d0                 ;calculate the height in pixels
        sub.w   ymin,d0
        move.w  d0,pic+pc_H

	mulu	pc_Width+pic,d0         ;calculate the size of a bitplane
	move.l	d0,planesize

        bsr     ipgetw                  ;skip the next two words
        bsr     ipgetw
        
        move.w  #75,pic+pc_XDpi
        move.w  #75,pic+pc_YDpi

        cmp.b   #0,version
        bne     gpi2
        move.w  #PC_BW,pc_Type+pic
        move.w  #11,d4
gpi11:  bsr     pgetl                   ;skip the 48 byte palette
        dbf     d4,gpi11
        bra     gpi5
        
gpi2:   cmp.b   #2,version
        bne     gpi3
        bclr    #1,flag                 ;clear bit reverse flag
        move.w  #16,numcolors
        move.w  #16,pc_Palet+pic
        move.w	#PC_PALET,pc_Type+pic   ;all version 2 pcx pics are PC_PALET
        bsr     cmap                    ;get the 16 color palette
        bra     gpi5 
                
gpi3:   cmp.b   #5,version
        bne     gpi4
        move.w  #256,numcolors
        move.w  #256,pc_Palet+pic
        move.w	#PC_PALET,pc_Type+pic   ;all version 5 pcx pics are PC_PALET
        move.w  #11,d4
gpi31:  bsr     pgetl                   ;skip the 48 byte palette
        dbf     d4,gpi31
        bra     gpi5                    ;get the cmap at the end of the pic

gpi4:   cmp.b   #3,version
        bne     gpi49
        bset    #1,flag                 ;set flag to reverse the bits
        move.w  #2,numcolors
        move.w  #0,pc_Palet+pic         ;no palette
        move.w	#PC_BW,pc_Type+pic      ;version 3 pics are PC_BW
        move.w  #11,d4
gpi41:  bsr     pgetl                   ;skip the 48 byte palette
        dbf     d4,gpi41
        bra     gpi5
        
gpi49:  bra     errrts                  ;unknown version get out

gpi5:   bsr     pget                    ;reserved byte
        bsr     pget                    ;get the number of bitplanes
        move.b  d0,numplanes
        move.l  bpp,d1
        mulu    d1,d0
        move.w  d0,truebitpln
        move.w  d0,pc_BitPln+pic
        move.w  #1,d1
        lsl.w   d0,d1
        move.w  d1,pc_Palet+pic
        move.w  d1,numcolors
        
        cmp.w   #2,d1                   ;is it a BW pic?
        bne     gpi51                   ;no
        bset    #1,flag                 ;set flag to reverse the bits
        move.w  #PC_BW,pc_Type+pic
        move.w  #0,pc_Palet+pic
        bra     gpi52
        
gpi51:  cmp.b   #5,version
        bne     gpi52
        cmp.w   #256,d1
        beq     gpi52
        move.w  #PC_BW,pc_Type+pic
        move.w  #0,pc_Palet+pic
        
gpi52:  bsr     ipgetw
        move.w  d0,bpr                  ;bytes per row
        
        bsr     pgetw                   ;skip the palette type (1=gray, 2=rgb)
        move.w  #28,d4                  ;skip the remaining header bytes
gpi6:   bsr     pgetw
        dbf     d4,gpi6

        rts



;bmhd3:	move.l	table,a0                ;check for manual DPI override
;	move.l	spclname(a0),a0
;	lea	4(a0),a0
;	move.w	-2(a0),d0
;	clr.b	0(a0,d0.w)
;	lea	dpistr1,a1
;        lea     dpistr2,a2
;        
;bmh3a:  move.b  (a0)+,d0
;        move.b  (a1)+,d1
;        cmp.b	d0,d1
;	bne	bmh3ab
;	tst.b	(a1)
;	bne	bmh3a
;        bra     bmh3ac
;        
;bmh3ab: move.b  (a2)+,d1
;        cmp.b	d0,d1
;	bne	bmh3b
;	tst.b	(a2)
;	bne	bmh3a
;
;bmh3ac: bset    #5,flag                 ;set resolution override flag
;	bsr	getnum
;	move.w	d0,pc_XDpi+pic
;	bsr	getnum
;	move.w	d0,pc_YDpi+pic
;
;bmh3b:  rts
        

*********************************
*                               *
*********************************
cmap:
        clr.l   d0
        move.w  numcolors,d0
        move.w  d0,temp
	mulu	#pl_Sizeof,d0
	jsr	allocpalet              ;returns palette pointer in a4

getentry:
	bsr	pget			; red
	and.w	#$ff,d0
	mulu	#65535,d0
	divu	#240,d0
	move.w	d0,(a4)
	bsr	pget			; green
	and.w	#$ff,d0
	mulu	#65535,d0
	divu	#240,d0
	move.w	d0,2(a4)
	bsr	pget			; blue
	and.w	#$ff,d0
	mulu	#65535,d0
	divu	#240,d0
	move.w	d0,4(a4)

	move.w	(a4)+,d0
	move.w	(a4)+,d1
	move.w	(a4)+,d2
	mulu	#19661,d0
	mulu	#38666,d1
	mulu	#7209,d2
	add.l	d1,d0
	add.l	d2,d0
	swap	d0
	cmp.w	#$8000,d0
	bcc	ge1
	moveq	#1,d0
	bra	ge2
ge1:	moveq	#0,d0
ge2:	move.w	d0,(a4)+		; black
	sub.w	#1,temp
	bne	getentry
        
ge4:    rts

        
***********************************
***				***
***********************************
allocpalet:
	move.l	table,a1
	clr.l	d1
	clr.l	d2
	move.l	m_alloc(a1),a1
	jsr	(a1)			; allocate memory for the color map
        beq     errrts
	move.l	a0,palhndl
	move.l	(a0),a4
	rts


***********************************
**                               **
***********************************
getnum:	moveq	#0,d0
gn1:	move.b	(a0)+,d1
	sub.b	#"0",d1
	bcs	gn2
	cmp.b	#10,d1
	bcc	gn2
	and.w	#$ff,d1
	mulu	#10,d0
	add.w	d1,d0
	bra	gn1

gn2:    rts


*********************************
*                               *
*********************************
ipgetl:	move.l	table,a0
	move.l	f_getl(a0),a0
	jsr	(a0)
	beq	errrts
        move.l  d0,temp1
        move.b  temp1+3,temp2
        move.b  temp1+2,temp2+1
        move.b  temp1+1,temp2+2
        move.b  temp1,temp2+3
        move.l  temp2,d0
	rts

*********************************
*                               *
*********************************
ipgetw:	move.l	table,a0
	move.l	f_getw(a0),a0
	jsr	(a0)
	beq	errrts
        move.w  d0,temp1
        move.b  temp1+1,temp2
        move.b  temp1,temp2+1
        clr.l   d0
        move.w  temp2,d0
	rts

*********************************
*                               *
*********************************
pgetl:	move.l	table,a0
	move.l	f_getl(a0),a0
	jsr	(a0)
	beq	errrts
	rts

*********************************
*                               *
*********************************
pgetw:	move.l	table,a0
	move.l	f_getw(a0),a0
	jsr	(a0)
	beq	errrts
        and.l   #$0000ffff,d0
	rts

*********************************
*                               *
*********************************
pget:	movem.l d2-d4/a1/a4,-(sp)
        move.l	table,a0
	move.l	f_get(a0),a0
	jsr	(a0)
	beq	errrts
        and.l   #$000000ff,d0
        movem.l (sp)+,d2-d4/a1/a4
	rts


***********************************
***				***
***********************************
errrts:	tst.l	palhndl
	beq	er1
	move.l	palhndl,a0
	move.l	table,a1
	move.l	m_delete(a1),a1
	jsr	(a1)
        clr.l   palhndl

er1:    move.l	savesp,sp
        
	move.l	table,a0        
	move.l	spclnum(a0),a0  
	cmp.w	#1,(a0)         
	beq	abortobj        
        bra     abortpic        
        

***********************************************************
***							***
***********************************************************
putcolor:
        cmp.w   #PC_PALET,pc_Type+pic
        bne     pc3
        
	move.w	pc_Palet+pic,d1
	mulu	#pl_Sizeof,d1

	move.l	palptr,a0
	move.l	palhndl,a1
	move.l	(a1),a1
	bra	pc2
pc1:	move.b	(a1)+,(a0)+
pc2:	dbf	d1,pc1
	move.l	a0,picptr

pc3:	rts


***********************************************************
***							***
***********************************************************
putpic:
        cmp.l   #1,bpp
        beq     putilpic
        cmp.b   #1,numplanes
        beq     putchunkypic
                
putilpic:        
        move.w	truebitpln,bitplanes
	move.w	pc_H+pic,theight
	move.l	picptr,a4
	move.l	a4,pptr

pi1:	bsr	getilrow        ;put a row into the amiga bitmap
	add.l	planesize,a4    ;one for each bit plane
	sub.w	#1,bitplanes
	bne	pi1

	move.w	truebitpln,bitplanes    ;get next row
	move.l	picptr,a4
	add.w	pc_Width+pic,a4
	move.l	a4,picptr
	sub.w	#1,theight
        bne     pi1
        bra     pp1
        
putchunkypic:
	move.w	pc_H+pic,theight
	move.l	picptr,a4
	move.l	a4,pptr

pk1:	bsr	getckrow                ;put a row into the amiga bitmap
	move.l	picptr,a4
	add.w	pc_Width+pic,a4
	move.l	a4,picptr
	sub.w	#1,theight
        bne     pk1

        
pp1:    tst.l   palhndl                 ;clean up memory
        beq     pp2
	move.l	palhndl,a0
	move.l	table,a1
	move.l	m_delete(a1),a1
	jsr	(a1)
        clr.l   palhndl

pp2:    rts


*******************************************
***					***
*******************************************
getilrow:                       ;get interleaved row from file
	move.l	a4,temp
	move.w	bpr,d0
        move.w  d0,twidth

gi1:	move.w  twidth,d2
        cmp.w	#0,twidth
	beq	gitn
        
	bsr	pget
        move.b  d0,d1
        and.b   #$c0,d1
        cmp.b   #$c0,d1
        bne     gi3
        
        and.w   #$003f,d0
        move.b	d0,temp1
	bsr	pget
        tst.b   temp1
        beq     gi1

        btst    #1,flag         ;check for reverse bits flag
        beq     gi2             ;do not reverse bits
        not.b   d0
                
gi2:    move.b	d0,(a4)+
	sub.w	#1,twidth
	sub.b	#1,temp1
	bne	gi2
	bra	gi1

gi3:    btst    #1,flag
        beq     gi4
        not.b   d0
                     
gi4:    move.b	d0,(a4)+
	sub.w	#1,twidth
	bra	gi1
	
gitn:	move.l	temp,a4
	rts

*******************************************
***					***
*******************************************
getckrow:                       ;get chunk row from file
	move.l	a4,temp
	move.w	bpr,d0
        move.w  d0,twidth
        move.w  #7,d2           ;bit pointer for amiga bitmap
        move.w  truebitpln,d4   ;bit plane counter
        subq.w  #1,d4
        move.w  #7,d3           ;bit pointer for pcx data byte
        move.l  a4,a1           ;set a1 to amiga bitmap pointer
        
gc1:	cmp.w	#0,twidth
	beq	gctn
        
	bsr	pget
        move.b  d0,d1
        and.b   #$c0,d1
        cmp.b   #$c0,d1
        bne     gc3
        
        and.w   #$003f,d0
        move.b	d0,temp1
	bsr	pget
        tst.b   temp1
        beq     gc1

        ;compressed run of bytes
gc2:    bsr     reversebyte
gc20:   btst    d3,d0
        beq     gc21
        bset    d2,(a1)
        bra     gc22
gc21:   bclr    d2,(a1) 
gc22:   add.l	planesize,a1    ;move to the next amiga bit plane
        dbf     d4,gc25         ;decrement the bitplane counter
        move.w  truebitpln,d4   ;if done - restore bit plane counter
        subq.w  #1,d4
        move.l  a4,a1           ;reset a1 to first bitplane
        
        dbf     d2,gc25         ;decrement amiga bitmap bit pointer
        addq.l  #1,a4           ;move to next amiga bitmap byte
        move.l  a4,a1           ;rest to first amiga bitplane
        move.w  #7,d2           ;restore the amiga bitmap pointer
        
gc25:   dbf     d3,gc20         ;decrement the pcx data bit counter
        move.w  #7,d3           ;restore the pcx data bit pointer
	sub.w	#1,twidth
	sub.b	#1,temp1
	bne	gc20
	bra	gc1

        ;single uncompressed byte
gc3:    bsr     reversebyte   
gc30:   btst    d3,d0
        beq     gc31
        bset    d2,(a1)
        bra     gc32
gc31:   bclr    d2,(a1) 
gc32:   add.l	planesize,a1    ;move to the next amiga bit plane
        dbf     d4,gc35         ;decrement the bitplane counter
        move.w  truebitpln,d4   ;if done - restore bit plane counter
        subq.w  #1,d4
        move.l  a4,a1           ;rest to first amiga bitplane
        
        dbf     d2,gc35         ;decrement amiga bitmap bit pointer
        addq.l  #1,a4           ;move to next amiga bitmap byte
        move.l  a4,a1
        move.w  #7,d2           ;restore the amiga bitmap pointer
        
gc35:   dbf     d3,gc30         ;decrement the pcx data bit counter
        move.w  #7,d3           ;restore the pcx data bit pointer
	sub.w	#1,twidth
	bra	gc1
	
gctn:	move.l	temp,a4
	rts

***********************************
***				***
***********************************
reversebyte:
        cmp.l   #8,bpp          ;is it a whole byte to reverse?
        beq     rb              ;yes
        
        cmp.l   #4,bpp          ;is it a nibble I need to reverse?
        beq     rn              ;yes
        
        ;cmp.l   #2,bpp          ;is it 2 bits I need to reverse?
        ;beq     r2b             ;yes
        
        rts                     ;if not any of these, don't do anything
        
        ;reverse bytes
rb:     clr.l   d7
        move.w  #7,d5
        move.w  #0,d6
        
rb0:    btst    d5,d0
        beq     rb1
        bset    d6,d7
        bra     rb2
rb1:    bclr    d6,d7
rb2:    addq.w  #1,d6
        dbf     d5,rb0
        move.l  d7,d0
        rts
        
        ;reverse nibbles
rn:     clr.l   d7
        moveq   #7,d5
        moveq   #4,d6
        
rn0:    btst    d5,d0
        beq     rn1
        bset    d6,d7
        bra     rn2
rn1:    bclr    d6,d7
rn2:    addq.w  #1,d6
        subq    #1,d5
        cmp.w   #3,d5
        bne     rn0
        
        moveq   #0,d6
rn3:    btst    d5,d0
        beq     rn4
        bset    d6,d7
        bra     rn5
rn4:    bclr    d6,d7
rn5:    addq.w  #1,d6
        subq    #1,d5
        cmp.w   #3,d5
        bne     rn3
        move.l  d7,d0
        rts
        
        ;reverse every 2 bits
r2b:    clr.l   d7
        moveq   #7,d5
        moveq   #6,d6
        
r2b0:   btst    d5,d0
        beq     r2b1
        bset    d6,d7
        bra     r2b2
r2b1:   bclr    d6,d7
r2b2:   addq    #1,d6
        subq    #1,d5
        cmp.w   #5,d5
        bne     r2b0
        
        moveq   #4,d6
r2b3:   btst    d5,d0
        beq     r2b4
        bset    d6,d7
        bra     r2b5
r2b4:   bclr    d6,d7
r2b5:   addq    #1,d6
        subq    #1,d5
        cmp.w   #3,d5
        bne     r2b3
        
        moveq   #2,d6
r2b6:   btst    d5,d0
        beq     r2b7
        bset    d6,d7
        bra     r2b8
r2b7:   bclr    d6,d7
r2b8:   addq    #1,d6
        subq    #1,d5
        cmp.w   #1,d5
        bne     r2b6
        
        moveq   #0,d6
r2b9:   btst    d5,d0
        beq     r2b10
        bset    d6,d7
        bra     r2b11
r2b10:  bclr    d6,d7
r2b11:  addq    #1,d6
        subq    #1,d5
        cmp.w   #$ffff,d5
        bne     r2b9
        
        move.l  d7,d0
        rts
        
***********************************
***				***
***********************************
Mulu1632:
	move.l	table,a0
	move.l	mulu1632(a0),a0
	jmp	(a0)


***********************************
***				***
***********************************
Divu1648:
	move.l	table,a0
	move.l	divu1648(a0),a0
	jmp	(a0)

        
*******************************************************************
***	called when the import routine choosen finds something	***
***	wrong with the file loaded.				***
*******************************************************************
never:	clr.w	d0
	rts

maybe:	move.w	#1,d0
	rts

right:	move.w	#2,d0
	rts


*************************************************************
*************************************************************
 SECTION PCX,DATA,PUBLIC

special:
	dc.w	2
	dc.l	spcl1,spcl2

vers:   dc.b    "$VER: "
name:	dc.b	"PCX  v2.1.1",0

spcl1:	dc.b	"Picture Window",0
spcl2:	dc.b	"Object",0

dpistr1:        dc.b	"dpi=",0
dpistr2:        dc.b    "DPI=",0


**************************************************************
**************************************************************
 SECTION PCX,BSS,PUBLIC
savesp:		ds.l	1
bpp:            ds.l    1
xmin:           ds.w    1
ymin:           ds.w    1
xmax:           ds.w    1
ymax:           ds.w    1
temp1:          ds.l    1
temp2:          ds.l    1
compression:    ds.b    1
version:        ds.b    1
numplanes:      ds.b    1
flag:		ds.b	1
pic:		ds.w	pc_Sizeof/2
object:		ds.w	ob_SizeOf/2
palhndl:        ds.l    1
picptr:		ds.l	1
pptr:		ds.l	1
planesize:	ds.l	1
twidth:		ds.w	1
theight:	ds.w	1
bitplanes:	ds.w	1
truebitpln:	ds.w	1
numcolors:      ds.w    1
bpr:            ds.w    1
palptr:         ds.l    1
temp:		ds.l	1


******************************* CHANGES ************************************
;
;       version 2.1.1
;
;       - added a version string
;
;
;       version 2.1.0
;
;       - initial release
