home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / apps / dtp / pgsmodst / atariprt / hppaintx.s < prev    next >
Text File  |  1991-08-30  |  10KB  |  466 lines

  1.  include "prtequ.h"
  2.  
  3. *
  4. * HP PaintJet color print driver
  5. *
  6. CR    equ    $d
  7. LF    equ    $a
  8. FF    equ    $c
  9. ESC    equ    $1b
  10. DC2    equ    $12
  11.  
  12.  SECTION printer,CODE,PUBLIC
  13. ***************************************************************
  14. ***************************************************************
  15. ***************************************************************
  16. dumbentry:
  17.     clr.l    d0
  18.     rts
  19.  
  20.     dc.l    "PRNT"
  21.     dc.w    200
  22.  
  23. *
  24. * distribute the calls the the appropriate routines
  25. *
  26. hplaser:
  27.     move.l    a0,table
  28.     lsl.w    #2,d0
  29.     lea    prntbl,a1
  30.     move.l    0(a1,d0.w),a1
  31.     jmp    (a1)
  32.  
  33. *
  34. * identify who I am, and set up who I like to speak to.
  35. *
  36. p_ident:
  37.     move.l    #driver,pdrvrnm(a0)    ;pointer to string for driver name
  38.     move.w    #PARALLEL+ASCENDING,device(a0)
  39. prtok:    moveq    #1,d0
  40.     rts
  41.  
  42. *
  43. * initialize the table of printer specific routines
  44. *
  45. p_init:    move.l    #driver,pdrvrnm(a0)    ;pointer to string for driver name
  46.     clr.b    pdl(a0)            ;no page description language
  47.     move.b    #0,pmult(a0)        ;automatically print mulitiple copies?
  48.     move.b    #0,pman(a0)        ;handle manual feed?
  49.     move.b    #PRT_CMYK,ptype(a0)    ;printer type?
  50.  
  51.     move.l    sendout(a0),send+2    ;self-modifing code, tisk, tisk!
  52.  
  53.  
  54. *
  55. * pminlft and pmaxw must be evenly divisible by 16
  56. * this is the part that should be worked out
  57. *
  58.  
  59.     move.w    pdensity(a0),d0
  60.     cmp.w    #7,d0
  61.     bcs    pint1
  62.     moveq    #6,d0
  63. pint1:    lsl.w    #1,d0
  64.  
  65.     lea    xdpi_tbl,a1
  66.     move.w    0(a1,d0.w),pxdpi(a0)    ;x resolution
  67.     lea    ydpi_tbl,a1
  68.     move.w    0(a1,d0.w),pydpi(a0)    ;y resolution
  69.     lea    minl_tbl,a1
  70.     move.w    0(a1,d0.w),pminlft(a0)    ;pixels from the left
  71.         lea    minr_tbl,a1
  72.     move.w    0(a1,d0.w),pminrht(a0)    ;pixels from the right
  73.     lea    mint_tbl,a1
  74.     move.w    0(a1,d0.w),pmintop(a0)    ;pixels down from top
  75.     lea    minb_tbl,a1
  76.     move.w    0(a1,d0.w),pminbot(a0)    ;pixels up from bottom
  77.     lea    xover_tbl,a1
  78.     move.w    0(a1,d0.w),pxover(a0)    ;percentage of x overlap of dots
  79.     lea    yover_tbl,a1
  80.     move.w    0(a1,d0.w),pyover(a0)    ;percentage of y overlap of dots
  81.     lea    rowht_tbl,a1
  82.     move.w    0(a1,d0.w),prowht(a0)    ;rows height modula
  83.  
  84.  
  85.     lsl.w    #1,d0
  86.     lea    grmode_tbl,a1
  87.     move.l    0(a1,d0.w),grmode
  88.     lea    maxw_tbl,a1
  89.     move.l    0(a1,d0.w),pmaxw(a0)    ;maximum # pixels across
  90.         lea    maxh_tbl,a1
  91.     move.l    0(a1,d0.w),pmaxh(a0)    ;maximum # pixels down
  92.     bra    prtok
  93.  
  94. *
  95. * going to begin printing a document
  96. *
  97. p_bgndoc:
  98.     move.l    grmode,a0
  99.     bsr    sendline
  100.     lea    colorpal,a0
  101.     bsr    sendline
  102.     lea    bgnmode,a0
  103.     bra    sendline
  104.  
  105. *
  106. * about to start printing of a page
  107. *
  108. p_bgnpage:
  109.     bra    prtok
  110.  
  111. *
  112. * about to print a new tile for the page
  113. *
  114. p_bgntile:
  115.     bra    prtok
  116.  
  117. *
  118. * print a block to the printer
  119. *
  120. p_block:
  121.     move.l    table,a0
  122.     move.l    pblockw(a0),d0
  123.         move.w  d0,width
  124.     move.l    pblockplane(a0),pplane
  125.     move.l    pblockptr(a0),a1
  126.     move.l    (a1),a1
  127.     add.l    pblockoff(a0),a1
  128.     move.l    a1,v_base
  129. *
  130. * YMCK
  131.     move.l    v_base,v_ptr        ;yellow
  132.     move.l    pplane,d0
  133.     lsl.l    #1,d0
  134.     add.l    d0,v_ptr
  135.     bsr    putline
  136.  
  137.     move.l    v_base,v_ptr        ;magenta
  138.     move.l    pplane,d0
  139.     add.l    d0,v_ptr
  140.     bsr    putline
  141.  
  142.     move.l    v_base,v_ptr        ;cyan
  143.     bsr    putline
  144.  
  145.     move.l    v_base,v_ptr        ;black
  146.     move.l    pplane,d0
  147.     lsl.l    #1,d0
  148.     add.l    pplane,d0
  149.     add.l    d0,v_ptr
  150.     bsr    putline
  151.  
  152.     lea    endline,a0
  153.     bra    sendline
  154.         
  155.         
  156. **********************************
  157. **                              **
  158. **********************************
  159. putline:
  160.     move.w    width,d0
  161.     move.l    v_ptr,a0
  162. putln1:    tst.b    -1(a0,d0.w)
  163.     bne    putln2
  164.     subq.w    #1,d0
  165.     bne    putln1
  166.     moveq    #1,d0
  167.  
  168. putln2: move.l  v_ptr,a0
  169.         bsr     compit
  170.         
  171.         move.w    d0,twidth
  172.         
  173.         lea     compress,a0             ;turn data compression on
  174.         bsr     sendline
  175.         
  176.     lea    grfstart,a0
  177.     bsr    sendline
  178.     move.w    twidth,d0
  179.     bsr    sendn
  180.     move.b    #"V",d0
  181.     bsr    send        
  182. *
  183.         move.w    twidth,d1
  184.         lea     buffer,a0
  185.         
  186. putln3:    move.b    (a0)+,d0
  187.     move.l    a0,-(sp)
  188.     move.w    d1,-(sp)
  189.     bsr    send
  190.     move.w    (sp)+,d1
  191.     move.l    (sp)+,a0
  192.     subq.w    #1,d1
  193.     bne    putln3
  194.     bra    prtok
  195.  
  196.  
  197. ******************************************
  198. * just finished describing current tile **
  199. ******************************************
  200. p_endtile:
  201.     move.b    #FF,d0
  202.     bra    send
  203.  
  204.     move.l    table,a0
  205.     move.l    pblockh(a0),d0
  206.     mulu    #216,d0
  207.     divu    pydpi(a0),d0
  208.     move.w    d0,scroll
  209. pend1:    tst.b    scroll
  210.     beq    pend2
  211.     move.b    #ESC,d0
  212.     bsr    send
  213.     move.b    #"J",d0
  214.     bsr    send
  215.     move.b    #255,d0
  216.     bsr    send
  217.     sub.w    #255,scroll
  218.     bra    pend1
  219. pend2:    tst.w    scroll
  220.     beq    prtok
  221.     move.b    #ESC,d0
  222.     bsr    send
  223.     move.b    #"J",d0
  224.     bsr    send
  225.     move.w    scroll,d0
  226.     bra    send
  227.  
  228. p_break:
  229.     bra    p_endtile
  230.  
  231. *****************************************************
  232. * just finished describing all tiles for this page **
  233. *****************************************************
  234. p_endpage:
  235.     bra    prtok
  236.  
  237.  
  238. ***********************************
  239. * finished printing the document **
  240. ***********************************
  241. p_enddoc:
  242.     lea    cleanup,a0
  243.     bra    sendline
  244.  
  245.  
  246. ***************************************************
  247. ***    these are the send routines for the    ***
  248. ***    dot matrix driver.            ***
  249. ***************************************************
  250. *
  251. sendline:
  252.     move.b    (a0)+,d0
  253.     beq    prtok
  254.     move.l    a0,-(sp)
  255.     bsr    send
  256.     move.l    (sp)+,a0
  257.     bra    sendline
  258. *
  259. *
  260. sendn:    cmp.w    #10,d0
  261.     bcs    sdn1
  262.     and.l    #$ffff,d0
  263.     divu    #10,d0
  264.     swap    d0
  265.     move.w    d0,-(sp)
  266.     swap    d0
  267.     bsr    sendn
  268.     move.w    (sp)+,d0
  269. sdn1:    or.b    #"0",d0
  270. *
  271. *    bra    send
  272. *
  273. *
  274. send:    jmp    $ffffff
  275. *
  276. *
  277.  
  278. ************************************************
  279. **   compress the data going to the printer   **
  280. ************************************************
  281. compit:
  282.         lea     buffer,a2       ;get address of buffer
  283.         moveq   #0,d1              ;zero out the length counter
  284.         moveq   #0,d3              ;zero out the total length counter
  285.         
  286. cmpt2:  move.b  (a0)+,d2        ;get pattern byte from string
  287.         subq.w  #1,d0           ;subtract 1 from the string length (twidth)
  288.         beq.s   cmpt3
  289.         
  290.         cmp.b   (a0),d2
  291.         bne.s   cmpt3
  292.         
  293.         add.b   #1,d1           ;add 1 to the length
  294.         cmp.b   #255,d1         ;have i done the max count yet?
  295.         bne.s   cmpt2
  296.  
  297. cmpt3:  move.b  d1,(a2)+        ;store the length
  298.         clr.b   d1              ;reset the length to 0
  299.         move.b  d2,(a2)+        ;store the pattern byte
  300.         addq.w  #2,d3           ;add two the the total length
  301.         tst.w   d0              ;have i done the whole row yet?
  302.         bne.s   cmpt2           ;no
  303.         
  304.         move.w  d3,d0
  305.         rts
  306.         
  307. ***********************************
  308. ***                ***
  309. ***********************************
  310.  SECTION printer,DATA,PUBLIC
  311.  
  312. prntbl:    dc.l    prtok,prtok,prtok,prtok,p_init
  313.     dc.l    p_bgndoc,p_bgnpage,p_bgntile
  314.     dc.l    p_block
  315.     dc.l    p_endtile,p_endpage,p_enddoc
  316.     dc.l    p_break,p_ident
  317.  
  318.  
  319. xdpi_tbl:    dc.w    90,180,180,180,180,180,180
  320. ydpi_tbl:    dc.w    90,180,180,180,180,180,180
  321. minl_tbl:    dc.w    22,45,45,45,45,45,45
  322. minr_tbl:    dc.w    22,45,45,45,45,45,45
  323. maxw_tbl:    dc.l    945,1890,1890,1890,1890,1890,1890
  324. mint_tbl:    dc.w    45,90,90,90,90,90,90
  325. minb_tbl:    dc.w    45,90,90,90,90,90,90
  326. maxh_tbl:    dc.l    0,0,0,0,0,0,0
  327. xover_tbl:    dc.w    0,0,0,0,0,0,0
  328. yover_tbl:    dc.w    0,0,0,0,0,0,0
  329. rowht_tbl:    dc.w    1,1,1,1,1,1,1
  330. grmode_tbl:    dc.l    rez1,rez2,rez2,rez2,rez2,rez2,rez2
  331.  
  332.  
  333. driver:    dc.b    "HP PaintJetXL Color v2.0.1",0
  334.  
  335.  
  336. rez1:    dc.b    ESC,"E"
  337.     dc.b    ESC,"*t90R"        ;90 DPI
  338.     dc.b    ESC,"*r720S"        ;720 pixels wide max
  339.     dc.b    ESC,"*r4U"        ;4 bitplane mode
  340.     dc.b    ESC,"*b1M"        ;unencoded bitmap
  341.     dc.b    ESC,"*p0Y"
  342.     dc.b    0
  343.  
  344. rez2:    dc.b    ESC,"E"
  345.     dc.b    ESC,"*t180R"        ;180 DPI
  346.     dc.b    ESC,"*r1440S"        ;1440 pixels wide max
  347.     dc.b    ESC,"*r4U"        ;4 bitplane mode
  348.     dc.b    ESC,"*b1M"        ;unencoded bitmap
  349.     dc.b    ESC,"*p0Y"
  350.     dc.b    0
  351.  
  352.  
  353. bgnmode:    dc.b    ESC,"*r0A",0    ;graphics mode
  354. endline:    dc.b    ESC,"*b0W",0
  355. cleanup:    dc.b    ESC,"*r0B",0
  356. grfstart:    dc.b    ESC,"*b",0
  357. nocomp:         dc.b    ESC,"*b0M",0
  358. compress:       dc.b    ESC,"*b1M",0
  359.  
  360. *
  361. * Esc "*v",n,"I"
  362. * Esc "*v",red,"A"
  363. * Esc "*v",green,"B"
  364. * Esc "*v",blue,"C"
  365. *
  366. colorpal:
  367.     dc.b    ESC,"*v90A"
  368.     dc.b    ESC,"*v88B"
  369.     dc.b    ESC,"*v85C"
  370.     dc.b    ESC,"*v0I"        ;#0 white
  371.  
  372.     dc.b    ESC,"*v89A"
  373.     dc.b    ESC,"*v83B"
  374.     dc.b    ESC,"*v13C"
  375.     dc.b    ESC,"*v1I"        ;#1 yellow
  376.  
  377.     dc.b    ESC,"*v53A"
  378.     dc.b    ESC,"*v5B"
  379.     dc.b    ESC,"*v25C"
  380.     dc.b    ESC,"*v2I"        ;#2 magenta
  381.  
  382.     dc.b    ESC,"*v53A"
  383.     dc.b    ESC,"*v8B"
  384.     dc.b    ESC,"*v14C"
  385.     dc.b    ESC,"*v3I"        ;#3 red
  386.  
  387.     dc.b    ESC,"*v2A"
  388.     dc.b    ESC,"*v22B"
  389.     dc.b    ESC,"*v64C"
  390.     dc.b    ESC,"*v4I"        ;#4 cyan
  391.  
  392.     dc.b    ESC,"*v3A"
  393.     dc.b    ESC,"*v26B"
  394.     dc.b    ESC,"*v22C"
  395.     dc.b    ESC,"*v5I"        ;#5 green
  396.  
  397.     dc.b    ESC,"*v4A"
  398.     dc.b    ESC,"*v4B"
  399.     dc.b    ESC,"*v29C"
  400.     dc.b    ESC,"*v6I"        ;#6 blue
  401.  
  402.     dc.b    ESC,"*v4A"
  403.     dc.b    ESC,"*v4B"
  404.     dc.b    ESC,"*v6C"
  405.     dc.b    ESC,"*v7I"        ;#7 black
  406.  
  407.     dc.b    ESC,"*v4A"
  408.     dc.b    ESC,"*v4B"
  409.     dc.b    ESC,"*v6C"
  410.     dc.b    ESC,"*v8I"        ;#8 black
  411.  
  412.     dc.b    ESC,"*v4A"
  413.     dc.b    ESC,"*v4B"
  414.     dc.b    ESC,"*v6C"
  415.     dc.b    ESC,"*v9I"        ;#9 black
  416.  
  417.     dc.b    ESC,"*v4A"
  418.     dc.b    ESC,"*v4B"
  419.     dc.b    ESC,"*v6C"
  420.     dc.b    ESC,"*v10I"        ;#10 black
  421.  
  422.     dc.b    ESC,"*v4A"
  423.     dc.b    ESC,"*v4B"
  424.     dc.b    ESC,"*v6C"
  425.     dc.b    ESC,"*v11I"        ;#11 black
  426.  
  427.     dc.b    ESC,"*v4A"
  428.     dc.b    ESC,"*v4B"
  429.     dc.b    ESC,"*v6C"
  430.     dc.b    ESC,"*v12I"        ;#12 black
  431.  
  432.     dc.b    ESC,"*v4A"
  433.     dc.b    ESC,"*v4B"
  434.     dc.b    ESC,"*v6C"
  435.     dc.b    ESC,"*v13I"        ;#13 black
  436.  
  437.     dc.b    ESC,"*v4A"
  438.     dc.b    ESC,"*v4B"
  439.     dc.b    ESC,"*v6C"
  440.     dc.b    ESC,"*v14I"        ;#14 black
  441.  
  442.     dc.b    ESC,"*v4A"
  443.     dc.b    ESC,"*v4B"
  444.     dc.b    ESC,"*v6C"
  445.     dc.b    ESC,"*v15I"        ;#15 black
  446.  
  447.     dc.b    0
  448.  
  449.  
  450.  SECTION printer,BSS,PUBLIC
  451. table:        ds.l    1
  452. twidth:        ds.w    1
  453. v_base:        ds.l    1
  454. v_ptr:        ds.l    1
  455. width:        ds.w    1
  456. pplane:        ds.l    1
  457. count:        ds.w    1
  458. rows:        ds.w    1
  459. rowht:        ds.w    1
  460. grmode:        ds.l    1
  461. scroll:        ds.w    1
  462. buffer:         ds.b    1024
  463.  
  464. ;
  465. ; 2.0.1- change maxw to 10.5" from 8"
  466.