home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 2
/
crawlyvol2.bin
/
apps
/
dtp
/
pgsmodst
/
atariimp
/
eps.s
< prev
next >
Wrap
Text File
|
1991-05-23
|
7KB
|
483 lines
Include "equ.h"
Include "impequ.h"
CR equ $d
LF equ $a
SECTION eps,CODE,PUBLIC
*******************************************
*** ***
*******************************************
dumbentry:
clr.l d0
rts
dc.l "IMPO"
dc.w 201
dc.l 0
table: dc.l 0
dc.l name,special,check,eps
*
* Encapsulated PostScript
*
check: move.l table,a0
move.l buff1(a0),a1
move.l (a1),a1
lea epsfhdr,a2
chk1: cmp.b (a2)+,(a1)+
bne never
tst.b (a2)
bne chk1
moveq #2,d0
rrts: rts
*
*
*
eps: bsr geteps
beq rrts
move.b #teps,object+ob_Type
clr.b object+ob_Flag
clr.w object+ob_Slant
clr.w object+ob_Twist
move.w #50,object+ob_LWidth
clr.b object+ob_LType
move.b #1,object+ob_LColor
clr.b object+ob_FType
move.b #1,object+ob_FColor
clr.b object+ob_LBegin
clr.b object+ob_LEnd
move.w #900,object+ob_HStandOff
move.w #900,object+ob_VStandOff
clr.l object+ob_Left
clr.l object+ob_Top
move.l eright,d0
sub.l eleft,d0
bpl eps1
neg.l d0
eps1: move.l etop,d1
sub.l ebottom,d1
bpl eps2
neg.l d1
eps2: mulu #100,d0
mulu #100,d1
move.l d0,object+ob_Right
move.l d1,object+ob_Bottom
move.l table,a0
move.l o_open(a0),a0
jsr (a0)
move.l table,a1
move.l o_obj(a1),a1
lea object,a0
jsr (a1)
beq abortobj
move.l elength,d0
add.l #eps_Sizeof,d0
add.l #16,d0
move.l table,a0
move.l o_malloc(a0),a0
jsr (a0)
beq abortobj
move.w #3,eps_Type(a0)
move.l object+ob_Right,eps_Width(a0)
move.l object+ob_Bottom,eps_Height(a0)
clr.l eps_PicPtr(a0)
clr.l eps_PlyPtr(a0)
move.l elength,d0
add.l #16,d0
move.l d0,eps_DataLen(a0)
lea eps_Sizeof(a0),a0
move.l eleft,(a0)+
move.l ebottom,(a0)+
move.l eright,(a0)+
move.l etop,(a0)+
move.l ehandle,a1
move.l (a1),a1
move.l elength,d0
move.l d0,d1
swap d1
bra ce2
ce1: move.b (a1)+,(a0)+
ce2: dbf d0,ce1
dbf d1,ce1
move.l ehandle,a0
move.l table,a1
move.l m_delete(a1),a1
jsr (a1)
move.l table,a0
move.l o_close(a0),a0
jmp (a0)
abortobj:
move.l table,a0
move.l o_abort(a0),a0
jmp (a0)
*******************************************
*** ***
*******************************************
rtf0: move.l ehandle,a0
move.l table,a1
move.l m_delete(a1),a1
jsr (a1)
addq.l #4,sp
rtfail: moveq #0,d0
rts
rtok: moveq #1,d0
rts
*******************************************
*** ***
*******************************************
geteps:
move.l table,a1
move.l flen(a1),a0
move.l (a0),elength
move.l m_alloc(a1),a1
move.l elength,d0
clr.l d1
clr.l d2
jsr (a1)
beq rtfail
move.l a0,ehandle
move.l table,a0
move.l f_openr(a0),a0
jsr (a0)
beq rtf0
move.l table,a1
move.l f_getr(a1),a1
move.l ehandle,a0
move.l (a0),a0
move.l elength,d0
jsr (a1)
move.l table,a0
move.l f_closer(a0),a0
jsr (a0)
move.l ehandle,a0
move.l (a0),a0
move.l elength,d0
move.l #0,eleft
move.l #0,etop
move.l #72,eright
move.l #72,ebottom
bra geps9
geps6: lea bbstr,a1
geps7: cmp.b (a0)+,(a1)+
bne geps9
subq.l #1,d0
tst.b (a1)
bne geps7
bra geps10
geps9: subq.l #1,d0
bcc geps6
bra geps11
*
* got a match
*
geps10: bsr getnum
move.l d0,eleft
bsr getnum
move.l d0,ebottom
bsr getnum
move.l d0,eright
bsr getnum
move.l d0,etop
geps11: bsr putzero
beq rrts
move.l elength,d0
btst #0,d0
beq even
bsr putzero
beq rrts
even:
; rts
*
*
*
move.l ehandle,a0
move.l (a0),a0
move.l elength,d0
bra gclr3
gclr1: lea ccstr,a1
gclr2: cmp.b (a0)+,(a1)+
bne gclr3
subq.l #1,d0
tst.b (a1)
bne gclr2
bra gclr4
gclr3: subq.l #1,d0
bcc gclr1
bra rtok
*
* got a match
*
gclr4: bsr getclr
move.w d0,color+cl_Cyan
bsr getclr
move.w d0,color+cl_Magenta
bsr getclr
move.w d0,color+cl_Yellow
bsr getclr
move.w d0,color+cl_Black
clr.w color+cl_Map
clr.w color+cl_Type
gclr5: move.b (a0)+,d0
cmp.b #"(",d0
beq gclr6
cmp.b #" ",d0
beq gclr5
bra rtok
gclr6: lea color+cl_Name,a1
lea color+cl_Name+23,a2
gclr7: move.b (a0)+,d0
beq rtok
cmp.b #")",d0
beq gclr8
cmp.b #CR,d0
beq rtok
cmp.b #LF,d0
beq rtok
move.b d0,(a1)+
cmp.l a2,a1
bcs gclr7
subq.l #1,a1
bra gclr7
gclr8: clr.b (a1)
move.l ehandle,a1
sub.l (a1),a0
move.l a0,-(sp)
lea color,a0
move.l table,a1
move.l newcolor(a1),a1
jsr (a1)
move.l ehandle,a0
move.l (a0),a0
add.l (sp)+,a0
gclr9: move.b (a0)+,d0
beq rtok
cmp.b #CR,d0
beq gclr9
cmp.b #LF,d0
beq gclr9
cmp.b #" ",d0
beq gclr9
cmp.b #"%",d0
bne rtok
cmp.b #"%",(a0)+
bne rtok
cmp.b #"+",(a0)+
beq gclr4
rts
*
*
*
putzero:
move.l #1,d0
move.l ehandle,a0
move.l table,a1
move.l m_grow(a1),a1
jsr (a1)
beq rtf0
move.l ehandle,a0
move.l (a0),a0
add.l elength,a0
clr.b (a0)
addq.l #1,elength
moveq #1,d0
rts
getnum: move.b (a0),d1
moveq #0,d0
moveq #1,d2
cmp.b #"-",d1
beq gtnm2
cmp.b #"0",d1
bcs gtnm0
cmp.b #"9",d1
bls gtnm1
gtnm0: addq.l #1,a0
bra getnum
gtnm1: moveq #0,d0
moveq #0,d2
gtnm2: move.b (a0)+,d1
beq gtnm9
cmp.b #"-",d1
bne gtnm3
moveq #1,d2
bra gtnm2
gtnm3: cmp.b #" ",d1
beq gtnm9
cmp.b #CR,d1
beq gtnm9
cmp.b #LF,d1
beq gtnm9
cmp.b #".",d1
beq gtnm10
sub.b #"0",d1
bcs gtnm9
cmp.b #9,d1
bhi gtnm9
move.l d0,-(sp)
lsl.l #2,d0
add.l (sp)+,d0
lsl.l #1,d0
and.l #$ff,d1
add.l d1,d0
bra gtnm2
gtnm9: tst.w d2
beq rrts
neg.l d0
rts
gtnm10: move.b (a0)+,d1
beq gtnm9
sub.b #"0",d1
bcs gtnm9
cmp.w #9,d1
bhi gtnm9
bra gtnm10
getclr: moveq #0,d0
move.w #10000,d1
gtcl1: move.b (a0)+,d2
cmp.b #" ",d2
beq gtcl1
bra gtcl3
gtcl2: move.b (a0)+,d2
gtcl3: cmp.b #".",d2
beq gtcl5
cmp.b #" ",d2
beq gtcl10
sub.b #"0",d2
bcs gtcl10
cmp.b #9,d2
bhi gtcl10
and.w #$ff,d2
cmp.w #10000,d1
beq gtcl4
*
* decimal portion
*
mulu d1,d2
add.w d2,d0
and.l #$ffff,d1
divu #10,d1
bra gtcl2
*
* integer portion (should ONLY be a 0 or a 1)
*
gtcl4: cmp.b #2,d2
bcc gtcl10
mulu d1,d2
move.w d2,d0
bra gtcl2
*
* decimal point
*
gtcl5: cmp.w #10000,d1
bne gtcl10
move.w #1000,d1
bra gtcl2
*
* return number 0-10000
*
gtcl10: cmp.w #10000,d0
bcs rrts
move.w #10000,d0
rts
*******************************************************************
*** called when the import routine choosen finds something ***
*** wrong with the file loaded. ***
*******************************************************************
notcorrect:
rts
never: moveq #0,d0
rts
maybe: moveq #1,d0
rts
correct:
moveq #2,d0
rts
*******************************************
*** ***
*******************************************
SECTION eps,DATA,PUBLIC
*
special:
dc.w 1
dc.l spcl1
*
*
name: dc.b "Ascii EPSF v2.1.1",0
*
spcl1: dc.b "EPSF 1.2",0
bbstr: dc.b "%%BoundingBox:",0
ccstr: dc.b "%%CMYKCustomColor:",0
epsfhdr: dc.b "%!PS-Adobe",0
SECTION eps,BSS,PUBLIC
data: ds.w 1
object: ds.w ob_SizeOf/2
array: ds.w 3
eleft: ds.l 1
etop: ds.l 1
eright: ds.l 1
ebottom: ds.l 1
ehandle: ds.l 1
elength: ds.l 1
color: ds.w cl_Sizeof/2