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

  1.  include "prtequ.h"
  2.  
  3. *
  4. * HP PaintJet 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_BW,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.     lsl.w    #1,d0
  85.     lea    grmode_tbl,a1
  86.     move.l    0(a1,d0.w),grmode
  87.     lea    maxw_tbl,a1
  88.     move.l    0(a1,d0.w),pmaxw(a0)    ;maximum # pixels across
  89.     lea    maxh_tbl,a1
  90.     move.l    0(a1,d0.w),pmaxh(a0)    ;maximum # pixels down
  91.  
  92.     bra    prtok
  93.  
  94. *
  95. * going to begin printing a document
  96. *
  97. p_bgndoc:
  98.     move.l    grmode,a0        ;set the density
  99.     bra    sendline
  100.  
  101. *
  102. * about to start printing of a page
  103. *
  104. p_bgnpage:
  105.     bra    prtok
  106.  
  107. *
  108. * about to print a new tile for the page
  109. *
  110. p_bgntile:
  111.     bra    prtok
  112.  
  113.  
  114. *
  115. * print a block to the printer
  116. *
  117. p_block:
  118.     move.l    table,a0
  119.     move.l    pblockw(a0),d0
  120.     move.w    d0,width
  121.     move.l    pblockplane(a0),pplane
  122.     move.l    pblockptr(a0),a1
  123.     move.l    (a1),a1
  124.     add.l    pblockoff(a0),a1
  125.     move.l    a1,v_base
  126.  
  127.     move.w    width,d0
  128.     move.l    v_base,a0
  129. putln1:    tst.b    -1(a0,d0.w)
  130.     bne    putln2
  131.     subq.w    #1,d0
  132.     bne    putln1
  133.     moveq    #1,d0
  134. putln2:    move.w    d0,twidth
  135.  
  136.     lea    grfstart,a0
  137.     bsr    sendline
  138.     move.w    twidth,d0
  139.     bsr    sendn
  140.     move.b    #"W",d0
  141.     bsr    send
  142. *
  143.     move.w    twidth,d1
  144.     move.l    v_base,a0
  145. putln3:    move.b    (a0)+,d0
  146.     move.l    a0,-(sp)
  147.     move.w    d1,-(sp)
  148.     bsr    send
  149.     move.w    (sp)+,d1
  150.     move.l    (sp)+,a0
  151.     subq.w    #1,d1
  152.     bne    putln3
  153.     bra    prtok
  154.  
  155. *
  156. * just finished describing current tile
  157. *
  158. p_endtile:
  159.     bra    prtok
  160.  
  161. *
  162. * just finished describing all tiles for this page
  163. *
  164. p_endpage:
  165.     bra    prtok
  166.  
  167. *
  168. * finished printing the document
  169. *
  170. p_enddoc:
  171.     lea    cleanup,a0
  172.     bra    sendline
  173.  
  174. ***************************************************
  175. ***    these are the send routines for the    ***
  176. ***    dot matrix driver.            ***
  177. ***************************************************
  178. *
  179. sendline:
  180.     move.b    (a0)+,d0
  181.     beq    prtok
  182.     move.l    a0,-(sp)
  183.     bsr    send
  184.     move.l    (sp)+,a0
  185.     bra    sendline
  186. *
  187. *
  188. sendn:    cmp.w    #10,d0
  189.     bcs    sdn1
  190.     and.l    #$ffff,d0
  191.     divu    #10,d0
  192.     swap    d0
  193.     move.w    d0,-(sp)
  194.     swap    d0
  195.     bsr    sendn
  196.     move.w    (sp)+,d0
  197. sdn1:    or.b    #"0",d0
  198. *
  199. *    bra    send
  200. *
  201. *
  202. send:    jmp    $ffffff
  203. *
  204. *
  205. ***********************************
  206. ***                ***
  207. ***********************************
  208.  SECTION printer,DATA,PUBLIC
  209.  
  210. prntbl:    dc.l    prtok,prtok,prtok,prtok,p_init
  211.     dc.l    p_bgndoc,p_bgnpage,p_bgntile
  212.     dc.l    p_block
  213.     dc.l    p_endtile,p_endpage,p_enddoc
  214.     dc.l    prtok,p_ident
  215.  
  216.  
  217. xdpi_tbl:    dc.w    90,180,180,180,180,180,180
  218. ydpi_tbl:    dc.w    90,180,180,180,180,180,180
  219. minl_tbl:    dc.w    45,90,90,90,90,90,90
  220. minr_tbl:    dc.w    45,90,90,90,90,90,90
  221. mint_tbl:    dc.w    0,0,0,0,0,0,0
  222. minb_tbl:    dc.w    0,0,0,0,0,0,0
  223. maxw_tbl:    dc.l    720,1440,1440,1440,1440,1440,1440
  224. maxh_tbl:    dc.l    0,0,0,0,0,0,0
  225. xover_tbl:    dc.w    0,0,0,0,0,0,0
  226. yover_tbl:    dc.w    0,0,0,0,0,0,0
  227. rowht_tbl:    dc.w    1,1,1,1,1,1,1
  228. grmode_tbl:    dc.l    rez1,rez2,rez2,rez2,rez2,rez2,rez2
  229.  
  230.  
  231. driver:        dc.b    "HP PaintJet v2.0",0
  232.  
  233.  
  234. rez1:    dc.b    ESC,"E"
  235.     dc.b    ESC,"*t90R"        ;90 DPI
  236.     dc.b    ESC,"*r720S",0        ;720 pixels wide max
  237.     dc.b    ESC,"*r1U"        ;1 bitplane mode
  238.     dc.b    ESC,"*b0M"        ;unencoded bitmap
  239.     dc.b    ESC,"*r0A"        ;graphics mode
  240.     dc.b    0
  241.  
  242. rez2:    dc.b    ESC,"E"
  243.     dc.b    ESC,"*t180R"        ;180 DPI
  244.     dc.b    ESC,"*r1440S",0        ;1440 pixels wide max
  245.     dc.b    ESC,"*r1U"        ;1 bitplane mode
  246.     dc.b    ESC,"*b0M"        ;unencoded bitmap
  247.     dc.b    ESC,"*r0A"        ;graphics mode
  248.     dc.b    0
  249.  
  250. grfstart:    dc.b    ESC,"*b",0
  251. endline:    dc.b    ESC,"*b0W",0
  252. cleanup:    dc.b    ESC,"*r0B",0
  253.  
  254.  
  255.  SECTION printer,BSS,PUBLIC
  256. table:        ds.l    1
  257. twidth:        ds.w    1
  258. v_base:        ds.l    1
  259. v_ptr:        ds.l    1
  260. width:        ds.w    1
  261. pplane:        ds.l    1
  262. count:        ds.w    1
  263. rows:        ds.w    1
  264. rowht:        ds.w    1
  265. grmode:        ds.l    1
  266.