home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / apps / dtp / pgsmodst / atariprt / deskjet.s < prev    next >
Text File  |  1991-05-23  |  6KB  |  280 lines

  1.  include "prtequ.h"
  2.  
  3. *
  4. * HP DeskJet 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. hpdesk:
  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.     clr.b    pmult(a0)        ;automatically print mulitiple copies?
  48.     clr.b    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.     move.w    0(a1,d0.w),rowht
  84.     lea    rows_tbl,a1
  85.     move.w    0(a1,d0.w),rows
  86.  
  87.     lsl.w    #1,d0
  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.     lea    grmode_tbl,a1
  93.     move.l    0(a1,d0.w),grmode
  94.     bra    prtok
  95.  
  96. *
  97. * going to begin printing a document
  98. *
  99. p_bgndoc:
  100.     tst.b    pmanual(a0)        ;manual paper feed?
  101.     bne    pmanfeed
  102. *
  103.     lea    rstr8a,a0        ;paper tray feed
  104.     bra    sendline
  105. *
  106. pmanfeed:
  107.     lea    rstr8b,a0        ;manual paper feed
  108.     bra    sendline
  109.  
  110. *
  111. * about to start printing of a page
  112. *
  113. p_bgnpage:
  114.     bra    prtok
  115.  
  116. *
  117. * about to print a new tile for the page
  118. *
  119. p_bgntile:
  120.     move.l    grmode,a0        ;set the density
  121.     bsr    sendline
  122.  
  123.     move.l    table,a0
  124.     move.w    pcopies(a0),d0
  125.  
  126.     bsr    sendn
  127.     move.b    #"X",d0
  128.     bsr    send
  129.  
  130.     lea    rstr2,a0        ;set to top posistion
  131.     bsr    sendline
  132.  
  133.     lea    rstr4,a0        ;start raster graphics at current
  134.     bra    sendline        ;posistion
  135.  
  136. *
  137. * print a block to the printer
  138. *
  139. p_block:
  140.     move.l    table,a0
  141.     move.l    pblockw(a0),width
  142.     move.l    pblockptr(a0),a1
  143.     move.l    (a1),a1
  144.     add.l    pblockoff(a0),a1
  145.     move.l    a1,v_base
  146.  
  147.     move.l    width,d0
  148.     move.l    v_base,a0
  149. putln1:    tst.b    -1(a0,d0.l)
  150.     bne    putln2
  151.     subq.l    #1,d0
  152.     bne    putln1
  153.     moveq    #1,d0
  154. putln2:    move.l    d0,twidth
  155.  
  156.     lea    rstr5,a0        ;start raster graphics transfer
  157.     bsr    sendline        ; with # of bytes to follow
  158.     move.l    twidth,d0
  159.     bsr    sendn
  160.     move.b    #"W",d0
  161.     bsr    send
  162. *
  163.     move.l    twidth,d1
  164.     move.l    v_base,a0
  165. putln3:    move.b    (a0)+,d0
  166.     move.l    a0,-(sp)
  167.     move.l    d1,-(sp)
  168.     bsr    send
  169.     move.l    (sp)+,d1
  170.     move.l    (sp)+,a0
  171.     subq.l    #1,d1
  172.     bne    putln3
  173.     bra    prtok
  174. *
  175.  
  176. *
  177. * just finished describing current tile
  178. *
  179. p_endtile:
  180.     lea    rstr6,a0
  181.     bsr    sendline
  182.     lea    rstr7,a0        ;print the page (multiple copies)
  183.     bra    sendline
  184.  
  185. *
  186. * just finished describing all tiles for this page
  187. *
  188. p_endpage:
  189.     bra    prtok
  190.  
  191. *
  192. * finished printing the document
  193. *
  194. p_enddoc:
  195.     bra    prtok
  196.  
  197. ***************************************************
  198. ***    these are the send routines for the    ***
  199. ***    dot matrix driver.            ***
  200. ***************************************************
  201. *
  202. sendline:
  203.     move.b    (a0)+,d0
  204.     beq    prtok
  205.     move.l    a0,-(sp)
  206.     bsr    send
  207.     move.l    (sp)+,a0
  208.     bra    sendline
  209. *
  210. *
  211. sendn:    cmp.w    #10,d0
  212.     bcs    sdn1
  213.     and.l    #$ffff,d0
  214.     divu    #10,d0
  215.     swap    d0
  216.     move.w    d0,-(sp)
  217.     swap    d0
  218.     bsr    sendn
  219.     move.w    (sp)+,d0
  220. sdn1:    or.b    #"0",d0
  221. *
  222. *    bra    send
  223. *
  224. *
  225. send:    jmp    $ffffff
  226. *
  227. *
  228. ***********************************
  229. ***                ***
  230. ***********************************
  231.  SECTION printer,DATA,PUBLIC
  232.  
  233. prntbl:    dc.l    prtok,prtok,prtok,prtok,p_init
  234.     dc.l    p_bgndoc,p_bgnpage,p_bgntile
  235.     dc.l    p_block
  236.     dc.l    p_endtile,p_endpage,p_enddoc
  237.     dc.l    prtok,p_ident
  238.  
  239.  
  240. xdpi_tbl:    dc.w    75,100,150,300,300,300,300
  241. ydpi_tbl:    dc.w    75,100,150,300,300,300,300
  242. minl_tbl:    dc.w    20,26,40,80,80,80,80
  243. minr_tbl:    dc.w    20,26,40,80,80,80,80
  244. mint_tbl:    dc.w    14,19,28,56,56,56,56
  245. minb_tbl:    dc.w    14,19,28,56,56,56,56
  246. maxw_tbl:    dc.l    600,800,1200,2400,2400,2400,2400
  247. maxh_tbl:    dc.l    0,0,0,0,0,0,0
  248. xover_tbl:    dc.w    0,0,0,0,0,0,0
  249. yover_tbl:    dc.w    0,0,0,0,0,0,0
  250. rowht_tbl:    dc.w    1,1,1,1,1,1,1
  251. rows_tbl:    dc.w    1,1,1,1,1,1,1
  252. grmode_tbl:    dc.l    rstr1d,rstr1c,rstr1b,rstr1a,rstr1a,rstr1a,rstr1a
  253.  
  254.  
  255. driver:        dc.b    "HP DeskJet v2.0",0
  256.  
  257.  
  258. rstr1a:    dc.b    ESC,"*t300R",ESC,"&l0E",ESC,"&l",0    ;for 300 dpi
  259. rstr1b:    dc.b    ESC,"*t150R",ESC,"&l0E",ESC,"&l",0    ;for 150 dpi
  260. rstr1c:    dc.b    ESC,"*t100R",ESC,"&l0E",ESC,"&l",0    ;for 100 dpi
  261. rstr1d:    dc.b    ESC,"*t75R",ESC,"&l0E",ESC,"&l",0    ;for 75 dpi
  262.  
  263. rstr2:    dc.b    ESC,"&a135V",ESC,"&a0H",0        ;posistion in upper left
  264. rstr4:    dc.b    ESC,"*r1A",0
  265. rstr5:    dc.b    ESC,"*b",0
  266. rstr6:    dc.b    ESC,"*rB",0
  267. rstr7:    dc.b    ESC,"E",0
  268.  
  269. rstr8a:    dc.b    ESC,"&l1H",0                ;paper tray feed
  270. rstr8b:    dc.b    ESC,"&l2H",0                ;manual paper feed
  271.  
  272.  SECTION printer,BSS,PUBLIC
  273. table:        ds.l    1
  274. twidth:        ds.l    1
  275. v_base:        ds.l    1
  276. width:        ds.l    1
  277. rows:        ds.w    1
  278. rowht:        ds.w    1
  279. grmode:        ds.l    1
  280.