home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / apps / dtp / pgsmodst / atariimp / maceps.s < prev    next >
Text File  |  1991-06-21  |  40KB  |  1,570 lines

  1.  Include "equ.h"
  2.  Include "impequ.h"
  3.  
  4. CR    equ    $d
  5. LF    equ    $a
  6.  
  7. ;modes used to copy the data in PICT code $98 group
  8. SRCCOPY         equ     $0
  9. SRCOR           equ     $1
  10. SRCXOR          equ     $2
  11. SRCBIC          equ     $3
  12. NOTSRCCOPY      equ     $4
  13. NOTSRCOR        equ     $5
  14. NOTSRCXOR       equ     $6
  15. NOTSRCBIC       equ     $7
  16.  
  17.  
  18.  SECTION maceps,CODE,PUBLIC
  19. *******************************************
  20. ***                    ***
  21. *******************************************
  22. dumbentry:
  23.     clr.l    d0
  24.     rts
  25.  
  26.     dc.l    "IMPO"
  27.     dc.w    201
  28.     dc.l    0
  29.  
  30. table:    dc.l    0
  31.     dc.l    name,special,check,eps
  32.  
  33.  
  34. *******************************************************
  35. * check file for Encapsulated PostScript in Data Fork *
  36. *******************************************************
  37. check:    move.l    table,a0
  38.     move.l    buff1(a0),a1
  39.     move.l    (a1),a1
  40.     add.w    #128,a1
  41.     lea    epsfhdr,a2
  42. chk1:    cmp.b    (a2)+,(a1)+
  43.     bne    never
  44.     tst.b    (a2)
  45.     bne    chk1
  46.     moveq    #2,d0
  47. rrts:    rts
  48.  
  49.  
  50. *********************************
  51. *                               *
  52. *********************************
  53. eps:    clr.l   ehandle         ;zero pointers to malloc'ed mem used later
  54.         clr.l   rhandle
  55.         move.w  #7,abit
  56.         
  57.         bsr    geteps
  58.     beq    rrts
  59.  
  60.     move.b    #teps,object+ob_Type
  61.     clr.b    object+ob_Flag
  62.     clr.w    object+ob_Slant
  63.     clr.w    object+ob_Twist
  64.     move.w    #50,object+ob_LWidth
  65.     clr.b    object+ob_LType
  66.     move.b    #1,object+ob_LColor
  67.     clr.b    object+ob_FType
  68.     move.b    #1,object+ob_FColor
  69.     clr.b    object+ob_LBegin
  70.     clr.b    object+ob_LEnd
  71.     move.w    #900,object+ob_HStandOff
  72.     move.w    #900,object+ob_VStandOff
  73.  
  74.     clr.l    object+ob_Left
  75.     clr.l    object+ob_Top
  76.     move.l    eright,d0
  77.     sub.l    eleft,d0
  78.     bpl    eps1
  79.     neg.l    d0
  80. eps1:    move.l    etop,d1
  81.     sub.l    ebottom,d1
  82.     bpl    eps2
  83.     neg.l    d1
  84. eps2:    mulu    #100,d0
  85.     mulu    #100,d1
  86.     move.l    d0,object+ob_Right
  87.     move.l    d1,object+ob_Bottom
  88.  
  89.     move.l    table,a0
  90.     move.l    o_open(a0),a0
  91.     jsr    (a0)
  92.  
  93.     move.l    table,a1
  94.     move.l    o_obj(a1),a1
  95.     lea    object,a0
  96.     jsr    (a1)
  97.     beq    abortobj
  98.  
  99.     move.l    elength,d0              ;alloc mem for eps obj
  100.     add.l    #eps_Sizeof,d0
  101.     add.l    #16,d0
  102.     move.l    table,a0
  103.     move.l    o_malloc(a0),a0
  104.     jsr    (a0)
  105.     beq    abortobj
  106.         
  107.         move.l    table,a1                ;save an index to the eps obj
  108.     move.l    copybuf(a1),a1
  109.     move.l    (a1),a1
  110.     move.l    a0,d0
  111.     sub.l    (a1),d0
  112.         move.l  d0,eobj
  113.  
  114.     move.w    #3,eps_Type(a0)
  115.     move.l    object+ob_Right,eps_Width(a0)
  116.     move.l    object+ob_Bottom,eps_Height(a0)
  117.     clr.l    eps_PicPtr(a0)
  118.     clr.l    eps_PlyPtr(a0)
  119.     move.l    elength,d0
  120.     add.l    #16,d0
  121.     move.l    d0,eps_DataLen(a0)
  122.  
  123.     lea    eps_Sizeof(a0),a0
  124.     move.l    eleft,(a0)+
  125.     move.l    ebottom,(a0)+
  126.     move.l    eright,(a0)+
  127.     move.l    etop,(a0)+
  128.  
  129.     move.l    ehandle,a1
  130.     move.l    (a1),a1
  131.     move.l    elength,d0
  132.     move.l    d0,d1
  133.     swap    d1
  134.     bra    ce2
  135. ce1:    move.b    (a1)+,(a0)+
  136. ce2:    dbf    d0,ce1
  137.     dbf    d1,ce1
  138.  
  139.     move.l    ehandle,a0      ;free the mem for the eps read (data fork)
  140.     move.l    table,a1
  141.     move.l    m_delete(a1),a1
  142.     jsr    (a1)
  143.         
  144.         move.l  table,a0        ;did they want the PICT stuff?
  145.         move.l  spclnum(a0),a0
  146.         cmp.w   #1,(a0)
  147.         beq     eps3            ;no, do NOT show picture - so exit
  148.  
  149. *********************************************        
  150. ;check for PICT resource and if found use it
  151. *********************************************
  152.         
  153.         bsr     getpict         ;get the PICT data
  154.         beq     eps3            ;if no PICT data found do not use it
  155.         
  156.     lea    pic,a0
  157.     clr.l    pc_ID(a0)
  158.     clr.l    pc_ID+4(a0)
  159.     clr.l    pc_Version(a0)
  160.     move.w    #-1,pc_SFreq(a0)
  161.     move.w    #-1,pc_SAngle(a0)
  162.     clr.w    pc_SSpot(a0)
  163.     clr.l    pc_SMap(a0)
  164.     clr.l    pc_SMap+4(a0)
  165.     move.w    #72,pc_XDpi(a0)
  166.     move.w    #72,pc_YDpi(a0)
  167.         
  168.         move.w  pc_W(a0),d0
  169.     add.w    #15,d0
  170.     lsr.w    #3,d0
  171.     bclr    #0,d0
  172.     move.w    d0,pc_Width(a0)
  173.         
  174.     clr.l    pc_DPtr(a0)
  175.     clr.w    pc_DScale(a0)
  176.         move.w    pc_Palet(a0),d0
  177.     mulu    #pl_Sizeof,d0
  178.     add.l    #pc_Sizeof,d0
  179.     move.l    d0,pc_Ptr(a0)           ;bitmap data begins n-bytes from object
  180.  
  181.     move.w    pc_Width(a0),d0         ;alloc mem for bitmap obj
  182.     mulu    pc_BitPln(a0),d0
  183.     mulu    pc_H(a0),d0
  184.         move.w    pic+pc_Palet,d1
  185.     mulu    #pl_Sizeof,d1
  186.     add.l    d1,d0
  187.     add.l    #pc_Sizeof,d0
  188.     move.l    table,a0
  189.     move.l    o_malloc(a0),a0
  190.     jsr    (a0)
  191.         beq     abortobj
  192.  
  193.         move.l    table,a1                ;link pic to eps obj
  194.     move.l    copybuf(a1),a1
  195.     move.l    (a1),a1
  196.     move.l    (a1),a1
  197.     add.l    eobj,a1
  198.         move.l  #1,eps_PicPtr(a1)
  199.  
  200.     lea    pic,a1                  ;copy pic obj data into allocated struct
  201.     move.w    #pc_Sizeof/2-1,d0
  202. pic1:    move.w    (a1)+,(a0)+
  203.     dbf    d0,pic1
  204.         
  205.         cmp.b   #1,vers                 ;is this a version 1 PICT?
  206.         beq     pic2                    ;yes
  207.         
  208.         move.l  a0,palptr               ;pointer to PgS color pal data
  209.         move.l  picture,a0              ;pointer to start of file color pal data
  210.         bsr     putpal
  211.         move.l  palptr,a0
  212.         move.w  pic+pc_Palet,d0
  213.         mulu    #pl_Sizeof,d0
  214.         add.l   d0,a0
  215.         
  216. pic2:   move.l    a0,picptr               ;save pointer to bitmap data start
  217.         move.l  a0,picptrsave
  218.         
  219.         clr.l   d0
  220.         move.w    pic+pc_Width,d0         ;set amiga bitmap to all white ($00)
  221.         mulu    pic+pc_H,d0
  222.         move.l  d0,planesize            ;save for later
  223.     mulu    pic+pc_BitPln,d0
  224.     move.l    d0,d1
  225.     swap    d1
  226.     move.l    picptr,a0
  227.     bra    pp2
  228. pp1:    move.b    #$00,(a0)+
  229. pp2:    dbf    d0,pp1
  230.     dbf    d1,pp1
  231.  
  232.         move.l  sp,spsave       ;save the stack pointer incase of error in putpic
  233.         move.l  picture,a0
  234.         bsr     putpic          ;get the picture data and put it into the pic obj
  235.         
  236.         move.l    rhandle,d0      ;free mem required for rsrc fork (getpict)
  237.         beq     eps3
  238.         move.l  d0,a0  
  239.     move.l    table,a1
  240.     move.l    m_delete(a1),a1
  241.     jsr    (a1)
  242.  
  243. eps3:    move.l    table,a0
  244.     move.l    o_close(a0),a0
  245.     jmp    (a0)
  246.         
  247.         
  248. ***********************************
  249. ***                             ***
  250. ***********************************
  251. abortobj:
  252.     move.l    ehandle,d0
  253.         beq     ab1
  254.         move.l  d0,a0  
  255.     move.l    table,a1
  256.     move.l    m_delete(a1),a1
  257.     jsr    (a1)
  258.         
  259. ab1:    move.l    rhandle,d0
  260.         beq     ab2
  261.         move.l  d0,a0  
  262.     move.l    table,a1
  263.     move.l    m_delete(a1),a1
  264.     jsr    (a1)
  265.  
  266. ab2:    move.l    table,a0
  267.     move.l    o_abort(a0),a0
  268.     jmp    (a0)
  269.  
  270.  
  271. ***********************************
  272. ***                             ***
  273. ***********************************
  274. rtok:    moveq    #1,d0
  275.     rts
  276.  
  277.  
  278. ***********************************
  279. ***                             ***
  280. ***********************************
  281. rtf0:    move.l    ehandle,d0
  282.         beq     rtf1
  283.         move.l  d0,a0
  284.     move.l    table,a1
  285.     move.l    m_delete(a1),a1
  286.     jsr    (a1)
  287.         
  288. rtf1:   move.l    rhandle,d0
  289.         beq     rtfail
  290.         move.l  d0,a0
  291.     move.l    table,a1
  292.     move.l    m_delete(a1),a1
  293.     jsr    (a1)
  294.  
  295. rtfail:    moveq    #0,d0
  296.     rts
  297.  
  298.  
  299. ***********************************
  300. ***                ***
  301. ***********************************
  302. geteps:    move.l    table,a0
  303.     move.l    f_openr(a0),a0
  304.     jsr    (a0)
  305.     beq    rrts
  306.  
  307.     move.l    table,a1
  308.     move.l    buff1(a1),a0
  309.     move.l    (a0),a0
  310.     move.l    #128,d0
  311.     move.l    f_getr(a1),a1
  312.     jsr    (a1)
  313.  
  314.     move.l    table,a1
  315.     move.l    buff1(a1),a0
  316.     move.l    (a0),a0
  317.     add.w    #83,a0
  318.     move.b    (a0)+,elength
  319.     move.b    (a0)+,elength+1
  320.     move.b    (a0)+,elength+2
  321.     move.b    (a0)+,elength+3
  322.  
  323.     move.l    table,a1
  324.     move.l    m_alloc(a1),a1
  325.     move.l    elength,d0
  326.     clr.w    d1
  327.     clr.w    d2
  328.     jsr    (a1)
  329.     beq    rtfail
  330.  
  331.     move.l    a0,ehandle
  332.  
  333.     move.l    table,a1
  334.     move.l    f_getr(a1),a1
  335.     move.l    (a0),a0
  336.     move.l    elength,d0
  337.     jsr    (a1)
  338.  
  339.     move.l    table,a0
  340.     move.l    f_closer(a0),a0
  341.     jsr    (a0)
  342.  
  343.     move.l    ehandle,a0
  344.     move.l    (a0),a0
  345.     move.l    elength,d0
  346.  
  347.     move.l    #0,eleft
  348.     move.l    #0,etop
  349.     move.l    #72,eright
  350.     move.l    #72,ebottom
  351.     bra    geps9
  352. geps6:    lea    bbstr,a1
  353. geps7:    cmp.b    (a0)+,(a1)+
  354.     bne    geps9
  355.     subq.l    #1,d0
  356.     tst.b    (a1)
  357.     bne    geps7
  358.     bra    geps10
  359.  
  360. geps9:    subq.l    #1,d0
  361.     bcc    geps6
  362.     bra    geps11
  363. *
  364. * got a match
  365. *
  366. geps10:    bsr    getnum
  367.     move.l    d0,eleft
  368.     bsr    getnum
  369.     move.l    d0,ebottom
  370.     bsr    getnum
  371.     move.l    d0,eright
  372.     bsr    getnum
  373.     move.l    d0,etop
  374.  
  375. geps11:    bsr    putzero
  376.     beq    rrts
  377.  
  378.     move.l    elength,d0
  379.     btst    #0,d0
  380.     beq    even
  381.     bsr    putzero
  382.     beq    rrts
  383.  
  384. even:
  385. ;    rts
  386.  
  387. *
  388. *
  389. *
  390.     move.l    ehandle,a0
  391.     move.l    (a0),a0
  392.     move.l    elength,d0
  393.     bra    gclr3
  394. gclr1:    lea    ccstr,a1
  395. gclr2:    cmp.b    (a0)+,(a1)+
  396.     bne    gclr3
  397.     subq.l    #1,d0
  398.     tst.b    (a1)
  399.     bne    gclr2
  400.     bra    gclr4
  401.  
  402. gclr3:    subq.l    #1,d0
  403.     bcc    gclr1
  404.     bra    rtok
  405. *
  406. * got a match
  407. *
  408. gclr4:    bsr    getclr
  409.     move.w    d0,color+cl_Cyan
  410.     bsr    getclr
  411.     move.w    d0,color+cl_Magenta
  412.     bsr    getclr
  413.     move.w    d0,color+cl_Yellow
  414.     bsr    getclr
  415.     move.w    d0,color+cl_Black
  416.     clr.w    color+cl_Map
  417.     clr.w    color+cl_Type
  418. gclr5:    move.b    (a0)+,d0
  419.     cmp.b    #"(",d0
  420.     beq    gclr6
  421.     cmp.b    #" ",d0
  422.     beq    gclr5
  423.     bra    rtok
  424.  
  425. gclr6:    lea    color+cl_Name,a1
  426.     lea    color+cl_Name+23,a2
  427. gclr7:    move.b    (a0)+,d0
  428.     beq    rtok
  429.     cmp.b    #")",d0
  430.     beq    gclr8
  431.     cmp.b    #CR,d0
  432.     beq    rtok
  433.     cmp.b    #LF,d0
  434.     beq    rtok
  435.     move.b    d0,(a1)+
  436.     cmp.l    a2,a1
  437.     bcs    gclr7
  438.     subq.l    #1,a1
  439.     bra    gclr7
  440.  
  441. gclr8:    clr.b    (a1)
  442.  
  443.     move.l    ehandle,a1
  444.     sub.l    (a1),a0
  445.     move.l    a0,-(sp)
  446.  
  447.     lea    color,a0
  448.     move.l    table,a1
  449.     move.l    newcolor(a1),a1
  450.     jsr    (a1)
  451.  
  452.     move.l    ehandle,a0
  453.     move.l    (a0),a0
  454.     add.l    (sp)+,a0
  455.  
  456. gclr9:    move.b    (a0)+,d0
  457.     beq    rtok
  458.     cmp.b    #CR,d0
  459.     beq    gclr9
  460.     cmp.b    #LF,d0
  461.     beq    gclr9
  462.     cmp.b    #" ",d0
  463.     beq    gclr9
  464.     cmp.b    #"%",d0
  465.     bne    rtok
  466.     cmp.b    #"%",(a0)+
  467.     bne    rtok
  468.     cmp.b    #"+",(a0)+
  469.     beq    gclr4
  470.     bra    rtok
  471. *
  472. *
  473. *
  474.  
  475.  
  476. putzero:
  477.     move.l    #1,d0
  478.     move.l    ehandle,a0
  479.     move.l    table,a1
  480.     move.l    m_grow(a1),a1
  481.     jsr    (a1)
  482.     beq    rtf0
  483.  
  484.     move.l    ehandle,a0
  485.     move.l    (a0),a0
  486.     add.l    elength,a0
  487.     clr.b    (a0)
  488.     addq.l    #1,elength
  489.     moveq    #1,d0
  490.     rts
  491.  
  492.  
  493. getnum:    move.b    (a0),d1
  494.     moveq    #0,d0
  495.     moveq    #1,d2
  496.     cmp.b    #"-",d1
  497.     beq    gtnm2
  498.     cmp.b    #"0",d1
  499.     bcs    gtnm0
  500.     cmp.b    #"9",d1
  501.     bls    gtnm1
  502. gtnm0:    addq.l    #1,a0
  503.     bra    getnum
  504. gtnm1:    moveq    #0,d0
  505.     moveq    #0,d2
  506. gtnm2:    move.b    (a0)+,d1
  507.     beq    gtnm9
  508.     cmp.b    #"-",d1
  509.     bne    gtnm3
  510.     moveq    #1,d2
  511.     bra    gtnm2
  512. gtnm3:    cmp.b    #" ",d1
  513.     beq    gtnm9
  514.     cmp.b    #CR,d1
  515.     beq    gtnm9
  516.     cmp.b    #LF,d1
  517.     beq    gtnm9
  518.     cmp.b    #".",d1
  519.     beq    gtnm10
  520.     sub.b    #"0",d1
  521.     bcs    gtnm9
  522.     cmp.b    #9,d1
  523.     bhi    gtnm9
  524.     move.l    d0,-(sp)
  525.     lsl.l    #2,d0
  526.     add.l    (sp)+,d0
  527.     lsl.l    #1,d0
  528.     and.l    #$ff,d1
  529.     add.l    d1,d0
  530.     bra    gtnm2
  531. gtnm9:    tst.w    d2
  532.     beq    rrts
  533.     neg.l    d0
  534.     rts
  535.  
  536. gtnm10:    move.b    (a0)+,d1
  537.     beq    gtnm9
  538.     sub.b    #"0",d1
  539.     bcs    gtnm9
  540.     cmp.w    #9,d1
  541.     bhi    gtnm9
  542.     bra    gtnm10
  543.  
  544.  
  545.  
  546. getclr:    moveq    #0,d0
  547.     move.w    #10000,d1
  548. gtcl1:    move.b    (a0)+,d2
  549.     cmp.b    #" ",d2
  550.     beq    gtcl1
  551.     bra    gtcl3
  552.  
  553. gtcl2:    move.b    (a0)+,d2
  554. gtcl3:    cmp.b    #".",d2
  555.     beq    gtcl5
  556.     cmp.b    #" ",d2
  557.     beq    gtcl10
  558.     sub.b    #"0",d2
  559.     bcs    gtcl10
  560.     cmp.b    #9,d2
  561.     bhi    gtcl10
  562.     and.w    #$ff,d2
  563.     cmp.w    #10000,d1
  564.     beq    gtcl4
  565. *
  566. * decimal portion
  567. *
  568.     mulu    d1,d2
  569.     add.w    d2,d0
  570.     and.l    #$ffff,d1
  571.     divu    #10,d1
  572.     bra    gtcl2
  573. *
  574. * integer portion (should ONLY be a 0 or a 1)
  575. *
  576. gtcl4:    cmp.b    #2,d2
  577.     bcc    gtcl10
  578.     mulu    d1,d2
  579.     move.w    d2,d0
  580.     bra    gtcl2
  581. *
  582. * decimal point
  583. *
  584. gtcl5:    cmp.w    #10000,d1
  585.     bne    gtcl10
  586.     move.w    #1000,d1
  587.     bra    gtcl2
  588. *
  589. * return number 0-10000
  590. *
  591. gtcl10:    cmp.w    #10000,d0
  592.     bcs    rrts
  593.     move.w    #10000,d0
  594.     rts
  595.  
  596. *******************************************
  597. ***                    ***
  598. *******************************************
  599. getpict:
  600.         move.l    table,a0                ;open the file for reading
  601.     move.l    f_openr(a0),a0
  602.     jsr    (a0)
  603.     beq     gp10
  604.  
  605.     move.l    table,a1                ;read the Mac file header into buff1
  606.     move.l    buff1(a1),a0
  607.     move.l    (a0),a0
  608.     move.l    #128,d0
  609.     move.l    f_getr(a1),a1
  610.     jsr    (a1)
  611.         beq     gpe1                    ;if error, close file and rts w/ failure
  612.  
  613.     move.l    table,a1                ;get the length of the RSRC fork
  614.     move.l    buff1(a1),a0
  615.     move.l    (a0),a0
  616.     add.l    #87,a0
  617.     move.b    (a0)+,rlength
  618.     move.b    (a0)+,rlength+1
  619.     move.b    (a0)+,rlength+2
  620.     move.b    (a0)+,rlength+3
  621.         tst.l   rlength                 ;is there a rsrc fork?
  622.         bne     gp1                     ;yes, so...
  623.         
  624. gpe1:   move.l    table,a0                ;close file if there is no RSRC fork
  625.     move.l    f_closer(a0),a0
  626.     jsr    (a0)
  627.         moveq   #0,d0                   ;signal failure
  628.         rts                             ;and return
  629.  
  630. gp1:    move.l    table,a1                ;alloc the mem for the rsrc fork read
  631.     move.l    m_alloc(a1),a1
  632.     move.l    rlength,d0
  633.     clr.w    d1
  634.     clr.w    d2
  635.     jsr    (a1)
  636.     beq     gpe1                    ;if I didn't get the memory...
  637.         
  638.     move.l    a0,rhandle
  639.         
  640.         move.l  elength,d0              ;skip to where the rsrc stuff starts
  641.         and.l   #$ffffff80,d0
  642.         add.l   #128,d0
  643.         move.l  table,a0
  644.         move.l  f_skip(a0),a0
  645.         jsr     (a0)
  646.         
  647.         move.l  rhandle,a0              ;read in the RSRC fork
  648.         move.l    (a0),a0
  649.         move.l    rlength,d0
  650.     move.l    table,a1
  651.     move.l    f_getr(a1),a1
  652.     jsr    (a1)
  653.         bne     gp2                     ;if the read goes well...
  654.         
  655. gpe2:   move.l  table,a1                ;else, free the mem
  656.         move.l  m_delete(a1),a1
  657.         move.l  rhandle,a0
  658.         jsr     (a1)
  659.         bra     gpe1                    ;close the file and exit w/ failure
  660.  
  661. gp2:    move.l    table,a0
  662.     move.l    f_closer(a0),a0
  663.     jsr    (a0)
  664.  
  665. ;seek the PICT rsrc data
  666. ;and set picture to point to it
  667.  
  668.         clr.l   d1
  669.         move.l  rhandle,a0
  670.         move.l  (a0),a0
  671.         move.l  (a0),q                  ;q = offset to start of rsrc data
  672.         move.l  4(a0),d0                ;y = offset to the rsrc map
  673.         move.l  d0,y
  674.         move.b  24(a0,d0.l),d1          ;z = offset to the type list
  675.         lsl.w   #8,d1
  676.         move.b  25(a0,d0.l),d1
  677.         move.l  d1,z
  678.         add.l   d1,d0
  679.         move.b  0(a0,d0.l),d2           ;w = number of items in the ref list
  680.         lsl.w   #8,d2
  681.         move.b  1(a0,d0.l),d2
  682.         move.w  d2,w
  683.         
  684.         move.l  d0,s                    ;s = y+z
  685.         addq.l  #2,d0
  686.     
  687.         ;loop until I hit a PICT rsrc
  688. gp3:    move.b  0(a0,d0.l),d3           ;d3 = type of rsrc
  689.         lsl.l   #8,d3
  690.         move.b  1(a0,d0.l),d3
  691.         lsl.l   #8,d3
  692.         move.b  2(a0,d0.l),d3
  693.         lsl.l   #8,d3
  694.         move.b  3(a0,d0.l),d3
  695.  
  696.         cmp.l   #'PICT',d3
  697.         beq     gp4
  698.         addq.l  #8,d0
  699.         dbf     d2,gp3
  700.         bra     gpe2                    ;error - no PICT rsrc found so...
  701.         
  702. gp4:    move.b  6(a0,d0.l),d1
  703.         lsl.w   #8,d1
  704.         move.b  7(a0,d0.l),d1
  705.  
  706.         move.l  s,d0
  707.         add.l   d1,d0
  708.         move.b  5(a0,d0.l),d1
  709.         lsl.l   #8,d1
  710.         move.b  6(a0,d0.l),d1
  711.         lsl.l   #8,d1
  712.         move.b  7(a0,d0.l),d1
  713.         and.l   #$00ffffff,d1
  714.         move.l  q,d0
  715.         add.l   d1,d0
  716.         move.l  d0,d2
  717.         add.l   #14,d2
  718.         move.l  d2,pictoffset           ;= offset from rhandle to PICT data
  719.         lea     0(a0,d0.l),a1
  720.         add.l   #14,a1
  721.         move.l  a1,picture              ;= address of the PICT data in rhandle
  722.         
  723.         move.b  6(a0,d0.l),d1
  724.         lsl.w   #8,d1
  725.         move.b  7(a0,d0.l),d1
  726.         
  727.         move.b  8(a0,d0.l),d2
  728.         lsl.w   #8,d2
  729.         move.b  9(a0,d0.l),d2
  730.         
  731.         move.b  10(a0,d0.l),d3
  732.         lsl.w   #8,d3
  733.         move.b  11(a0,d0.l),d3
  734.         
  735.         move.b  12(a0,d0.l),d4
  736.         lsl.w   #8,d4
  737.         move.b  13(a0,d0.l),d4
  738.         
  739.         sub.w   d1,d3
  740.         sub.w   d2,d4
  741.         move.w  d4,pic+pc_W
  742.         move.w  d3,pic+pc_H
  743.         
  744.         move.l  picture,a0
  745. gp5:    cmp.b   #$11,(a0)+              ;look for the version code ($11)
  746.         bne     gp5
  747.         move.b  (a0)+,vers              ;store the PICT version #
  748.         
  749.         cmp.b   #1,vers
  750.         beq     gp6
  751.         add.l   #1,a0                   ;if vers==2 skip the next byte
  752. gp6:    bsr     getcode                 ;this will get the PICT code into d0
  753.         cmp.w   #$98,d0
  754.         beq     gp9
  755.         bsr     skipcode
  756.         bra     gp6
  757.         
  758. gp9:    move.w  #1,d0                   ;default to 1 bit-per-pixel
  759.         move.w    #PC_BW,pic+pc_Type      ;default to a BW PICT
  760.         clr.w   pic+pc_Palet            ;default to no palette
  761.         cmp.b   #1,vers                 ;is it a version 1 PICT?
  762.         beq     gp90                    ;yes, only 1 bpp
  763.         
  764.         move.w  #PC_PALET,pic+pc_Type
  765.         
  766.         move.b  28(a0),d0               ;get the bits-per-pixel for this image
  767.         lsl.w   #8,d0
  768.         move.b  29(a0),d0
  769.         move.b  52(a0),d1               ;get the number of palette entries
  770.         lsl.w   #8,d1
  771.         move.b  53(a0),d1
  772.         move.w  d1,pic+pc_Palet
  773.         
  774. gp90:   move.w  d0,pic+pc_BitPln
  775.         
  776.         sub.l   #1,a0                   ;rewind to start of $98 code
  777.         cmp.b   #1,vers
  778.         beq     gp91
  779.         sub.l   #1,a0
  780. gp91:   move.l  a0,picture
  781.         moveq   #1,d0                   ;signal PICT is OK    
  782. gp10:   rts
  783.  
  784.         
  785. *******************************************
  786. ***                    ***
  787. *******************************************
  788. getcode:
  789.         clr.w   d0                      ;clear space for next command
  790.         cmp.b   #1,vers                 ;is this a version 1 PICT
  791.         bne     gc2                     ;nope
  792.         move.b  (a0)+,d0                ;if yes, get q 1 byte code
  793.         bra     gc3
  794. gc2:    move.l  a0,d0                   ;check for word-align in version 2 PICT
  795.         btst    #0,d0
  796.         beq     gc21                    ;yes it is aligned
  797.         add.l   #1,a0                   ;if not, align it
  798. gc21:   move.w  (a0)+,d0                ;else, get a 2 byte code
  799. gc3:    rts
  800.  
  801.  
  802. *******************************************
  803. ***                    ***
  804. *******************************************
  805. skipcode:
  806.         lea     codetable,a1
  807.         
  808. sc1:    tst.w   (a1)                    ;end of table?
  809.         beq     sc4                     ;yes
  810.         cmp.w   (a1),d0                 ;look for the code contained in d0
  811.         beq     sc2
  812.         add.l   #4,a1
  813.         bra     sc1
  814.         
  815. sc2:    move.w  2(a1),d1
  816.         cmp.w   #$ffff,d1               ;-1 signals the len is in the next word
  817.         bne     sc3
  818.         move.b  (a0)+,d1                ;get the length from the data (word)
  819.         lsl.w   #8,d1
  820.         move.b  (a0)+,d1
  821.         sub.w   #2,d1
  822.         
  823. sc3:    cmp.w   #$fffe,d1               ;-2 signals the len is in the next long
  824.         beq     sc6
  825.         
  826.         add.w   d1,a0                   ;skip the data for this code
  827.         rts
  828.  
  829. sc4:    cmp.w   #$7fff,d0               ;is it greater than $7fff?
  830.         bcc     sc5                     ;yes
  831.         lsr.w   #8,d0
  832.         and.l   #$000000ff,d0
  833.         moveq   #1,d1
  834.         lsl.l   d1,d0
  835.         add.w   d1,a0
  836.         rts
  837.         
  838. sc5:    cmp.w   #$80ff,d0               ;$8000-$80ff is 0 length
  839.         bcc     sc6
  840.         rts
  841.         
  842. sc6:    move.b  (a0)+,d1                ;get the length from the data (long)
  843.         lsl.l   #8,d1
  844.         move.b  (a0)+,d1
  845.         lsl.l   #8,d1
  846.         move.b  (a0)+,d1
  847.         lsl.l   #8,d1
  848.         move.b  (a0)+,d1
  849.         subq    #4,d1
  850.         add.l   d1,a0
  851.         rts
  852.         
  853.         
  854. *******************************************
  855. ***                    ***
  856. *******************************************
  857. putpal:
  858.         move.l  palptr,a1
  859.         add.l   #56,a0                  ;point to start of palette data
  860.         move.w  pic+pc_Palet,d0
  861.         
  862. ptpl1:  move.b  (a0)+,d1                 ;get the color number
  863.         lsl.w   #8,d1
  864.         move.b  (a0)+,d1
  865.         mulu    #pl_Sizeof,d1           ;claculate its pos in PgS obj palette
  866.         
  867.         move.b  (a0)+,0(a1,d1.w)       ;red
  868.         move.b  (a0)+,1(a1,d1.w)
  869.         move.w  0(a1,d1.w),d2
  870.         
  871.         move.b  (a0)+,2(a1,d1.w)       ;green
  872.         move.b  (a0)+,3(a1,d1.w)
  873.         move.w  2(a1,d1.w),d3
  874.         
  875.         move.b  (a0)+,4(a1,d1.w)       ;blue
  876.         move.b  (a0)+,5(a1,d1.w)
  877.         move.w  4(a1,d1.w),d4
  878.         
  879.         mulu    #19661,d2
  880.     mulu    #38666,d3
  881.     mulu    #7209,d4
  882.     add.l    d3,d2
  883.     add.l    d4,d2
  884.     swap    d2
  885.     cmp.w    #$8000,d2
  886.     bcc    ge1
  887.     moveq    #1,d2
  888.     bra    ge2
  889. ge1:    moveq    #0,d2
  890. ge2:    move.w    d2,6(a1,d1.w)        ;screen color
  891.         
  892.         dbf     d0,ptpl1
  893.         rts
  894.         
  895.         
  896. *******************************************
  897. ***                    ***
  898. *******************************************
  899. putpic:
  900.         bsr     getcode
  901.         
  902.         cmp.w   #$98,d0
  903.         bne     ptpc1
  904.         
  905.         move.b  (a0)+,rowbytes
  906.         move.b  (a0)+,rowbytes+1
  907.         move.w  rowbytes,d0
  908.         bclr    #15,d0                  ;clear the high bit of word
  909.         move.w  d0,rowbytes
  910.         
  911.         move.b  (a0)+,bby1
  912.         move.b  (a0)+,bby1+1
  913.         
  914.         move.b  (a0)+,bbx1
  915.         move.b  (a0)+,bbx1+1
  916.         
  917.         move.b  (a0)+,bby2
  918.         move.b  (a0)+,bby2+1
  919.         
  920.         move.b  (a0)+,bbx2
  921.         move.b  (a0)+,bbx2+1
  922.         
  923.         cmp.b   #1,vers
  924.         beq     pp10
  925.         
  926.         ;version 2 stuff goes here
  927.         add.l   #16,a0                  ;skip the next 8 words
  928.         
  929.         move.b  (a0)+,pixeltype
  930.         move.b  (a0)+,pixeltype+1
  931.         
  932.         move.b  (a0)+,bpp
  933.         move.b  (a0)+,bpp+1
  934.         
  935.         add.l   #22,a0                  ;skip the next 10 words
  936.         
  937.         clr.l   d0
  938.         move.b  (a0)+,d0                ;the number of colors in the color table
  939.         lsl.l   #8,d0
  940.         move.b  (a0)+,d0
  941.         addq    #1,d0
  942.         lsl.l   #3,d0                   ;mulu by 8
  943.         add.l   d0,a0                   ;skip it
  944.         
  945. pp10:   move.b  (a0)+,srcy1
  946.         move.b  (a0)+,srcy1+1
  947.         
  948.         move.b  (a0)+,srcx1
  949.         move.b  (a0)+,srcx1+1
  950.         
  951.         move.b  (a0)+,srcy2
  952.         move.b  (a0)+,srcy2+1
  953.         
  954.         move.b  (a0)+,srcx2
  955.         move.b  (a0)+,srcx2+1
  956.         
  957.         move.b  (a0)+,desty1
  958.         move.b  (a0)+,desty1+1
  959.         
  960.         move.b  (a0)+,destx1
  961.         move.b  (a0)+,destx1+1
  962.         
  963.         move.b  (a0)+,desty2
  964.         move.b  (a0)+,desty2+1
  965.         
  966.         move.b  (a0)+,destx2
  967.         move.b  (a0)+,destx2+1
  968.         
  969.         move.b  (a0)+,copymode          ;get the mode of byte copy used
  970.         move.b  (a0)+,copymode+1
  971.         
  972.         move.w  bby2,d1                 ;calc number of rows in this code group
  973.         sub.w   bby1,d1
  974.         move.w  d1,numrows
  975.         
  976.         move.l  picptrsave,a1
  977.         clr.l   d0
  978.         move.w  pic+pc_Width,d0         ;calc bitmap addr of starting dest row
  979.         mulu    desty1,d0
  980.         add.l   d0,a1
  981.         move.w  destx1,d0               ;get the starting x value
  982.         addq.w  #7,d0   
  983.         lsr.w   #3,d0
  984.         add.w   d0,a1
  985.         move.l  a1,picptr               ;store it away for pckcomp
  986.         
  987.         cmp.b   #1,vers
  988.         bne     pp12
  989.         bsr     pckcompv1               ;decompress the data and put it vers 1
  990.         bra     putpic                  ;time to get the next code
  991. pp12:   bsr     pckcompv2               ;decompress the data and put it vers 2
  992.         bra     putpic                  ;time to get the next code
  993.         
  994. ptpc1:  cmp.w   #$ff,d0                 ;end of PICT data
  995.         beq     ptpc2                   ;so exit
  996.         bsr     skipcode
  997.         bra     putpic                  ;get the next code
  998.                 
  999. ptpc2:  rts
  1000.         
  1001. **********************************
  1002. **                              **
  1003. **********************************
  1004. pckcompv1:
  1005.         clr.l   d6
  1006.         clr.l   d0
  1007.         
  1008.         move.w  numrows,d5      ;d5 = bitmap height in this group
  1009.         move.w  rowbytes,d6     ;get the # of bytes in this row in this group
  1010.         move.w  d6,d0           ;d0 = save d6
  1011.     bra    pk8
  1012.  
  1013. pk1:    move.w    d0,d6           ;reset d6 to number of bytes in row
  1014.     move.l    picptr,a1       ;a1 = adress in amiga bitmap
  1015.         clr.l   d1
  1016.         move.b  (a0)+,d1        ;throw away packed byte count at start of line
  1017.  
  1018. pk2:    clr.l   d1
  1019.         move.b  (a0)+,d1        ;d1 = one byte code
  1020.         cmp.b   #128,d1
  1021.         beq     pk2             ;code 128 = do nothing, so get next byte
  1022.         
  1023.         btst    #7,d1           ;check the high bit
  1024.         beq     op2             ;if 0 copy the next d1+1 bytes as is
  1025.         
  1026. op1:    neg.b   d1              ;else copy the next byte -d1+1 times
  1027.         sub.b   d1,d6           ;decrement row byte count
  1028.         subq.w  #1,d6
  1029.         
  1030.         move.b  (a0)+,d2        ;get the byte to copy
  1031. op12:   move.b  (a1),d3
  1032.         bsr     domode          ;convert d2 and d3 according to the copy mode
  1033.         move.b  d3,(a1)+        ;copy the byte
  1034.         dbf     d1,op12         ;loop until done (d1=-1)
  1035.         bra     pk6
  1036.  
  1037. op2:    sub.b   d1,d6           ;decrement row byte count
  1038.         subq.w  #1,d6
  1039.  
  1040. op22:   move.b  (a0)+,d2
  1041.         move.b  (a1),d3
  1042.         bsr     domode          ;convert d2 and d3 according to the copy mode
  1043.         move.b  d3,(a1)+
  1044.     dbf     d1,op22
  1045.  
  1046. pk6:    tst.w   d6              ;are we done with a row yet
  1047.         bne     pk2             ;no - keep going
  1048.         
  1049.         move.l  a1,d6
  1050.         btst    #0,d6           ;did we end on an odd address
  1051.         beq     pk7
  1052.         move.b  #0,(a1)+
  1053.  
  1054. pk7:    move.l    picptr,a1
  1055.     add.w    pic+pc_Width,a1
  1056.     move.l    a1,picptr
  1057.         
  1058. pk8:    dbf     d5,pk1
  1059.         rts
  1060.  
  1061. **********************************
  1062. **                              **
  1063. **********************************
  1064. pckcompv2:
  1065.         clr.l   d6
  1066.         clr.l   d0
  1067.         
  1068.         move.w  numrows,d5      ;d5 = bitmap height in this group
  1069.         move.w  rowbytes,d6     ;get the # of bytes in this row in this group
  1070.         move.w  d6,d0           ;d0 = save d6
  1071.     bra    p2k8
  1072.  
  1073. p2k1:    move.w    d0,d6           ;reset d6 to number of bytes in row
  1074.     move.l    picptr,a1       ;a1 = adress in amiga bitmap
  1075.         clr.l   d1
  1076.         move.b  (a0)+,d1        ;throw away packed byte count at start of line
  1077.  
  1078. p2k2:   clr.l   d1
  1079.         move.b  (a0)+,d1        ;d1 = one byte code
  1080.         cmp.b   #128,d1
  1081.         beq     p2k2            ;code 128 = do nothing, so get next byte
  1082.         
  1083.         btst    #7,d1           ;check the high bit
  1084.         beq     o2p2            ;if 0 copy the next d1+1 bytes as is
  1085.         
  1086. o2p1:   neg.b   d1              ;else copy the next byte -d1+1 times
  1087.         sub.b   d1,d6           ;decrement row byte count
  1088.         subq.w  #1,d6
  1089.         
  1090.         move.b  (a0)+,d2        ;get the byte to copy
  1091. o2p12:  move.b  (a1),d3
  1092.         bsr     domode          ;convert d2 and d3 according to the copy mode
  1093.         bsr     copyone
  1094.         dbf     d1,o2p12
  1095.         bra     p2k6
  1096.  
  1097. o2p2:   sub.b   d1,d6           ;decrement row byte count
  1098.         subq.w  #1,d6
  1099.  
  1100. o2p22:  move.b  (a0)+,d2
  1101.         move.b  (a1),d3
  1102.         bsr     domode          ;convert d2 and d3 according to the copy mode
  1103.         bsr     copyone
  1104.         dbf     d1,o2p22
  1105.  
  1106. p2k6:   tst.w   d6              ;are we done with a row yet
  1107.         bne     p2k2            ;no - keep going
  1108.         
  1109.         move.l  a1,d6
  1110.         btst    #0,d6           ;did we end on an odd address
  1111.         beq     p2k7
  1112.         move.b  #0,(a1)+
  1113.  
  1114. p2k7:   move.l    picptr,a1
  1115.         move.w  pic+pc_Width,d4
  1116.     add.w    d4,a1
  1117.     move.l    a1,picptr
  1118.         move.w  #7,abit
  1119.         
  1120. p2k8:   dbf     d5,p2k1
  1121.         rts
  1122.  
  1123. **********************************
  1124. **                              **
  1125. **********************************
  1126. domode:
  1127.         cmp.w   #SRCCOPY,copymode
  1128.         bne     dm1
  1129.         move.b  d2,d3                   ;copy the value exactly
  1130.         rts
  1131.         
  1132. dm1:    cmp.w   #SRCOR,copymode         ;or d2 bits with d3 bits
  1133.         bne     dm2
  1134.         or.b    d2,d3
  1135.         rts
  1136.         
  1137. dm2:    cmp.w   #SRCXOR,copymode        ;xor d2 bits with d3 bits
  1138.         bne     dm3
  1139.         eor.b   d2,d3
  1140.         rts
  1141.         
  1142. dm3:    cmp.w   #SRCBIC,copymode        ;erase d2 bits from d3 bits
  1143.         bne     dm4
  1144.         not.b   d2
  1145.         and.b   d2,d3
  1146.         rts
  1147.         
  1148. dm4:    cmp.w   #NOTSRCCOPY,copymode    ;copy the opposite of d2 bits to d3
  1149.         bne     dm5
  1150.         not.b   d2
  1151.         move.b  d2,d3
  1152.         rts
  1153.         
  1154. dm5:    cmp.w   #NOTSRCOR,copymode      ;or not d2 bits with d3 bits
  1155.         bne     dm6
  1156.         not.b   d2
  1157.         or.b    d2,d3
  1158.         rts
  1159.         
  1160. dm6:    cmp.w   #NOTSRCXOR,copymode     ;xor not d2 bits with d3 bits
  1161.         bne     dm7
  1162.         not.b   d2
  1163.         eor.b   d2,d3
  1164.         rts
  1165.         
  1166. dm7:    cmp.w   #NOTSRCBIC,copymode     ;copy only the same bits in d2 to d3
  1167.         bne     dm8
  1168.         and.b   d2,d3
  1169.         rts
  1170.         
  1171. dm8:    move.b  d2,d3                   ;default to SRCCOPY
  1172.         rts
  1173.  
  1174. **********************************
  1175. **                              **
  1176. **********************************        
  1177. copyone:
  1178.         movem.l d0-d2,-(a7)
  1179.         
  1180.         move.w  bpp,d0
  1181.         subq.w  #1,d0
  1182.         move.w  #0,d1
  1183.         move.l  a1,a2
  1184.         move.w  abit,d2
  1185.         
  1186. cp0:    btst    d1,d3
  1187.         bne     cp1
  1188.         bclr    d2,(a2)
  1189.         bra     cp2
  1190. cp1:    bset    d2,(a2)
  1191. cp2:    dbf     d0,cp3          ;decrement source bitplane counter
  1192.         move.l  a1,a2           ;reset dest to plane one
  1193.         move.w  bpp,d0          ;reset source bitplane counter
  1194.         subq.w  #1,d0
  1195.  
  1196.         dbf     d2,cp4          ;decrement amiga bitplane bit pointer
  1197.         move.w  #7,d2           ;reset to high bit
  1198.         add.l   #1,a1           ;move dest to next byte
  1199.         move.l  a1,a2           ;reset dest to plane one
  1200.         bra     cp4
  1201.  
  1202. cp3:    add.l   planesize,a2    ;move to next dest bitplane
  1203. cp4:    ;dbf     d1,cp0          ;decrement source bit pointer
  1204.         addq.w  #1,d1
  1205.         cmp.w   bpp,d1
  1206.         bcs     cp0
  1207.         
  1208. cp10:   move.w  d2,abit
  1209.         movem.l (a7)+,d0-d2
  1210.         rts
  1211.         
  1212. *******************************************************************
  1213. ***    called when the import routine choosen finds something    ***
  1214. ***    wrong with the file loaded.                ***
  1215. *******************************************************************
  1216. notcorrect:
  1217.     rts
  1218.  
  1219. never:    moveq    #0,d0
  1220.     rts
  1221.  
  1222. maybe:    moveq    #1,d0
  1223.     rts
  1224.  
  1225. correct:
  1226.     moveq    #2,d0
  1227.     rts
  1228.  
  1229.  
  1230. *******************************************
  1231. ***                    ***
  1232. *******************************************
  1233.  SECTION maceps,DATA,PUBLIC
  1234.  
  1235. special:
  1236.     dc.w    2
  1237.     dc.l    spcl1,spcl2
  1238.         
  1239. codetable:      dc.w    $0001,$ffff
  1240.                 dc.w    $0002,8
  1241.                 dc.w    $0003,2
  1242.                 dc.w    $0004,1
  1243.                 dc.w    $0005,2
  1244.                 dc.w    $0006,4
  1245.                 dc.w    $0007,4
  1246.                 dc.w    $0008,2
  1247.                 dc.w    $0009,8
  1248.                 dc.w    $000a,8
  1249.                 dc.w    $000b,4
  1250.                 dc.w    $000c,4
  1251.                 dc.w    $000d,2
  1252.                 dc.w    $000e,4
  1253.                 dc.w    $000f,4
  1254.                 
  1255.                 dc.w    $0010,8
  1256.                 dc.w    $0011,1
  1257.                 dc.w    $0012,0         ;?
  1258.                 dc.w    $0013,0         ;?
  1259.                 dc.w    $0014,0         ;?
  1260.                 dc.w    $0015,2
  1261.                 dc.w    $0016,2
  1262.                 dc.w    $0017,0
  1263.                 dc.w    $0018,0
  1264.                 dc.w    $0019,0
  1265.                 dc.w    $001a,0         ;?
  1266.                 dc.w    $001b,0         ;?
  1267.                 dc.w    $001c,0
  1268.                 dc.w    $001d,0         ;?
  1269.                 dc.w    $001e,8
  1270.                 dc.w    $001f,4
  1271.                 
  1272.                 dc.w    $0020,8
  1273.                 dc.w    $0021,4
  1274.                 dc.w    $0022,6
  1275.                 dc.w    $0023,2
  1276.                 dc.w    $0024,$ffff
  1277.                 dc.w    $0025,$ffff
  1278.                 dc.w    $0026,$ffff
  1279.                 dc.w    $0027,$ffff
  1280.                 dc.w    $0028,0         ;? 5+text
  1281.                 dc.w    $0029,$ffff
  1282.                 dc.w    $002a,0         ;? 2+text
  1283.                 dc.w    $002b,0         ;? 3+text
  1284.                 dc.w    $002c,$ffff
  1285.                 dc.w    $002d,$ffff
  1286.                 dc.w    $002e,$ffff
  1287.                 dc.w    $002f,$ffff
  1288.                                 
  1289.                 dc.w    $0030,8
  1290.                 dc.w    $0031,8
  1291.                 dc.w    $0032,8
  1292.                 dc.w    $0033,8
  1293.                 dc.w    $0034,8
  1294.                 dc.w    $0035,8
  1295.                 dc.w    $0036,8
  1296.                 dc.w    $0037,8
  1297.                 dc.w    $0038,0
  1298.                 dc.w    $0039,0
  1299.                 dc.w    $003a,0
  1300.                 dc.w    $003b,0
  1301.                 dc.w    $003c,0
  1302.                 dc.w    $003d,0
  1303.                 dc.w    $003e,0
  1304.                 dc.w    $003f,0
  1305.                 
  1306.                 dc.w    $0040,8
  1307.                 dc.w    $0041,8
  1308.                 dc.w    $0042,8
  1309.                 dc.w    $0043,8
  1310.                 dc.w    $0044,8
  1311.                 dc.w    $0045,8
  1312.                 dc.w    $0046,8
  1313.                 dc.w    $0047,8
  1314.                 dc.w    $0048,0
  1315.                 dc.w    $0049,0
  1316.                 dc.w    $004a,0
  1317.                 dc.w    $004b,0
  1318.                 dc.w    $004c,0
  1319.                 dc.w    $004d,0
  1320.                 dc.w    $004e,0
  1321.                 dc.w    $004f,0
  1322.                 
  1323.                 dc.w    $0050,8
  1324.                 dc.w    $0051,8
  1325.                 dc.w    $0052,8
  1326.                 dc.w    $0053,8
  1327.                 dc.w    $0054,8
  1328.                 dc.w    $0055,8
  1329.                 dc.w    $0056,8
  1330.                 dc.w    $0057,8
  1331.                 dc.w    $0058,0
  1332.                 dc.w    $0059,0
  1333.                 dc.w    $005a,0
  1334.                 dc.w    $005b,0
  1335.                 dc.w    $005c,0
  1336.                 dc.w    $005d,0
  1337.                 dc.w    $005e,0
  1338.                 dc.w    $005f,0
  1339.                 
  1340.                 dc.w    $0060,12
  1341.                 dc.w    $0061,12
  1342.                 dc.w    $0062,12
  1343.                 dc.w    $0063,12
  1344.                 dc.w    $0064,12
  1345.                 dc.w    $0065,12
  1346.                 dc.w    $0066,12
  1347.                 dc.w    $0067,12
  1348.                 dc.w    $0068,4
  1349.                 dc.w    $0069,4
  1350.                 dc.w    $006a,4
  1351.                 dc.w    $006b,4
  1352.                 dc.w    $006c,4
  1353.                 dc.w    $006d,4
  1354.                 dc.w    $006e,4
  1355.                 dc.w    $006f,4
  1356.                 
  1357.                 dc.w    $0070,0         ;poly
  1358.                 dc.w    $0071,0         ;poly
  1359.                 dc.w    $0072,0         ;poly
  1360.                 dc.w    $0073,0         ;poly
  1361.                 dc.w    $0074,0         ;poly
  1362.                 dc.w    $0075,0         ;poly
  1363.                 dc.w    $0076,0         ;poly
  1364.                 dc.w    $0077,0         ;poly
  1365.                 dc.w    $0078,0
  1366.                 dc.w    $0079,0
  1367.                 dc.w    $007a,0
  1368.                 dc.w    $007b,0
  1369.                 dc.w    $007c,0
  1370.                 dc.w    $007d,0
  1371.                 dc.w    $007e,0
  1372.                 dc.w    $007f,0
  1373.                 
  1374.                 dc.w    $0080,0         ;region
  1375.                 dc.w    $0081,0         ;region
  1376.                 dc.w    $0082,0         ;region
  1377.                 dc.w    $0083,0         ;region
  1378.                 dc.w    $0084,0         ;region
  1379.                 dc.w    $0085,0         ;region
  1380.                 dc.w    $0086,0         ;region
  1381.                 dc.w    $0087,0         ;region
  1382.                 dc.w    $0088,0
  1383.                 dc.w    $0089,0
  1384.                 dc.w    $008a,0
  1385.                 dc.w    $008b,0
  1386.                 dc.w    $008c,0
  1387.                 dc.w    $008d,0
  1388.                 dc.w    $008e,0
  1389.                 dc.w    $008f,0
  1390.                 
  1391.                 dc.w    $0090,0         ;?
  1392.                 dc.w    $0091,0         ;?
  1393.                 dc.w    $0092,$ffff
  1394.                 dc.w    $0093,$ffff
  1395.                 dc.w    $0094,$ffff
  1396.                 dc.w    $0095,$ffff
  1397.                 dc.w    $0096,$ffff
  1398.                 dc.w    $0097,$ffff
  1399.                 dc.w    $0098,0         ;? - need not worry about this one
  1400.                 dc.w    $0099,0         ;?
  1401.                 dc.w    $009a,$ffff
  1402.                 dc.w    $009b,$ffff
  1403.                 dc.w    $009c,$ffff
  1404.                 dc.w    $009d,$ffff
  1405.                 dc.w    $009e,$ffff
  1406.                 dc.w    $009f,$ffff
  1407.                 
  1408.                 dc.w    $00a0,2
  1409.                 dc.w    $00a1,0         ;? 2+2+text
  1410.                 dc.w    $00a2,$ffff
  1411.                 dc.w    $00a3,$ffff
  1412.                 dc.w    $00a4,$ffff
  1413.                 dc.w    $00a5,$ffff
  1414.                 dc.w    $00a6,$ffff
  1415.                 dc.w    $00a7,$ffff
  1416.                 dc.w    $00a8,$ffff
  1417.                 dc.w    $00a9,$ffff
  1418.                 dc.w    $00aa,$ffff
  1419.                 dc.w    $00ab,$ffff
  1420.                 dc.w    $00ac,$ffff
  1421.                 dc.w    $00ad,$ffff
  1422.                 dc.w    $00ae,$ffff
  1423.                 dc.w    $00af,$ffff
  1424.                 
  1425.                 dc.w    $00b0,0
  1426.                 dc.w    $00b1,0
  1427.                 dc.w    $00b2,0
  1428.                 dc.w    $00b3,0
  1429.                 dc.w    $00b4,0
  1430.                 dc.w    $00b5,0
  1431.                 dc.w    $00b6,0
  1432.                 dc.w    $00b7,0
  1433.                 dc.w    $00b8,0
  1434.                 dc.w    $00b9,0
  1435.                 dc.w    $00ba,0
  1436.                 dc.w    $00bb,0
  1437.                 dc.w    $00bc,0
  1438.                 dc.w    $00bd,0
  1439.                 dc.w    $00be,0
  1440.                 dc.w    $00bf,0
  1441.                 
  1442.                 dc.w    $00c0,0
  1443.                 dc.w    $00c1,0
  1444.                 dc.w    $00c2,0
  1445.                 dc.w    $00c3,0
  1446.                 dc.w    $00c4,0
  1447.                 dc.w    $00c5,0
  1448.                 dc.w    $00c6,0
  1449.                 dc.w    $00c7,0
  1450.                 dc.w    $00c8,0
  1451.                 dc.w    $00c9,0
  1452.                 dc.w    $00ca,0
  1453.                 dc.w    $00cb,0
  1454.                 dc.w    $00cc,0
  1455.                 dc.w    $00cd,0
  1456.                 dc.w    $00ce,0
  1457.                 dc.w    $00cf,0
  1458.                 
  1459.                 dc.w    $00d0,$fffe
  1460.                 dc.w    $00d1,$fffe
  1461.                 dc.w    $00d2,$fffe
  1462.                 dc.w    $00d3,$fffe
  1463.                 dc.w    $00d4,$fffe
  1464.                 dc.w    $00d5,$fffe
  1465.                 dc.w    $00d6,$fffe
  1466.                 dc.w    $00d7,$fffe
  1467.                 dc.w    $00d8,$fffe
  1468.                 dc.w    $00d9,$fffe
  1469.                 dc.w    $00da,$fffe
  1470.                 dc.w    $00db,$fffe
  1471.                 dc.w    $00dc,$fffe
  1472.                 dc.w    $00dd,$fffe
  1473.                 dc.w    $00de,$fffe
  1474.                 dc.w    $00df,$fffe
  1475.                 
  1476.                 dc.w    $00f0,$fffe
  1477.                 dc.w    $00f1,$fffe
  1478.                 dc.w    $00f2,$fffe
  1479.                 dc.w    $00f3,$fffe
  1480.                 dc.w    $00f4,$fffe
  1481.                 dc.w    $00f5,$fffe
  1482.                 dc.w    $00f6,$fffe
  1483.                 dc.w    $00f7,$fffe
  1484.                 dc.w    $00f8,$fffe
  1485.                 dc.w    $00f9,$fffe
  1486.                 dc.w    $00fa,$fffe
  1487.                 dc.w    $00fb,$fffe
  1488.                 dc.w    $00fc,$fffe
  1489.                 dc.w    $00fd,$fffe
  1490.                 dc.w    $00fe,$fffe
  1491.                 dc.w    $00ff,2
  1492.                 
  1493.                 dc.w    0,0
  1494.  
  1495.  
  1496. version:        dc.b    0,"$VER: "
  1497. name:            dc.b    "Mac EPSF v2.1.2",0
  1498.  
  1499. spcl1:            dc.b    "Show pic",0
  1500. spcl2:          dc.b    "Do not show pic",0
  1501.  
  1502. bbstr:        dc.b    "%%BoundingBox:",0
  1503. ccstr:        dc.b    "%%CMYKCustomColor:",0
  1504. epsfhdr:    dc.b    "%!PS-Adobe",0
  1505.  
  1506. vers:           dc.b    0
  1507.  
  1508.  
  1509. ******************************************************
  1510. ******************************************************
  1511.  SECTION maceps,BSS,PUBLIC
  1512.  
  1513. data:        ds.w    1
  1514. object:        ds.w    ob_SizeOf/2
  1515. color:            ds.w    cl_Sizeof/2
  1516. pic:            ds.w    pc_Sizeof/2
  1517.  
  1518. array:        ds.w    3
  1519.  
  1520. eleft:        ds.l    1
  1521. etop:        ds.l    1
  1522. eright:        ds.l    1
  1523. ebottom:    ds.l    1
  1524.  
  1525. ehandle:    ds.l    1
  1526. elength:    ds.l    1
  1527. rhandle:        ds.l    1
  1528. rlength:        ds.l    1
  1529.  
  1530. picture:        ds.l    1
  1531. pictoffset:     ds.l    1
  1532. picptr:         ds.l    1
  1533. picptrsave:     ds.l    1
  1534. palptr:         ds.l    1        
  1535. spsave:         ds.l    1
  1536. eobj:           ds.l    1
  1537. q:              ds.l    1
  1538. y:              ds.l    1
  1539. z:              ds.l    1
  1540. s:              ds.l    1
  1541. planesize:      ds.l    1
  1542. w:              ds.w    1
  1543. rowbytes:       ds.w    1
  1544. numrows:        ds.w    1
  1545. bbx1:           ds.w    1
  1546. bby1:           ds.w    1
  1547. bbx2:           ds.w    1
  1548. bby2:           ds.w    1
  1549. srcx1:          ds.w    1
  1550. srcy1:          ds.w    1
  1551. srcx2:          ds.w    1
  1552. srcy2:          ds.w    1
  1553. destx1:         ds.w    1
  1554. desty1:         ds.w    1
  1555. destx2:         ds.w    1
  1556. desty2:         ds.w    1
  1557. copymode:       ds.w    1
  1558. pixeltype:      ds.w    1
  1559. bpp:            ds.w    1
  1560. abit:           ds.w    1
  1561.  
  1562.  
  1563. ;***************************** Changes **************************
  1564. ;
  1565. ;       version 2.1.2
  1566. ;
  1567. ;       - added a "version" string
  1568. ;
  1569. ;       - adding support for PICT headers
  1570.