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

  1.  include "pdlequ.h"
  2.  
  3. *
  4. * HP ThinkJet 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    201
  22.  
  23. *
  24. * distribute the calls the the appropriate routines
  25. *
  26. hpthink:
  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. rrts:    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.     bra    prtok
  101.  
  102. *
  103. * about to start printing of a page
  104. *
  105. p_bgnpage:
  106.     bra    prtok
  107.  
  108.  
  109. *
  110. * about to print a new tile for the page
  111. *
  112. p_bgntile:
  113.     move.l    grmode,a0        ;set the density
  114.     bra    sendline
  115.  
  116.  
  117. *
  118. * print a block to the printer
  119. *
  120. p_block:
  121.     move.l    table,a0
  122.     move.l    pblockw(a0),width
  123.     move.l    pblockptr(a0),a1
  124.     move.l    (a1),a1
  125.     add.l    pblockoff(a0),a1
  126.     move.l    a1,v_base
  127.  
  128.     move.l    width,d0
  129.     move.l    v_base,a0
  130. putln1:    tst.b    -1(a0,d0.l)
  131.     bne    putln2
  132.     subq.l    #1,d0
  133.     bne    putln1
  134.     moveq    #1,d0
  135. putln2:    move.l    d0,twidth
  136.  
  137.     lea    bgnline,a0        ;start raster graphics transfer
  138.     bsr    sendline        ; with # of bytes to follow
  139.     move.l    twidth,d0
  140.     bsr    sendn
  141.     move.b    #"W",d0
  142.     bsr    send
  143. *
  144.     move.l    twidth,d1
  145.     move.l    v_base,a0
  146. putln3:    move.b    (a0)+,d0
  147.     move.l    a0,-(sp)
  148.     move.l    d1,-(sp)
  149.     bsr    send
  150.     move.l    (sp)+,d1
  151.     move.l    (sp)+,a0
  152.     subq.l    #1,d1
  153.     bne    putln3
  154.     bra    prtok
  155.  
  156. *
  157. * just finished describing current tile
  158. *
  159. p_endtile:
  160.     lea    endtile,a0
  161.     bra    sendline
  162.  
  163. *
  164. * just finished describing all tiles for this page
  165. *
  166. p_endpage:
  167.     bra    prtok
  168.  
  169. *
  170. * finished printing the document
  171. *
  172. p_enddoc:
  173.     bra    prtok
  174.  
  175. p_abort:
  176.     bra    p_endtile
  177.  
  178. ***************************************************
  179. ***    these are the send routines for the    ***
  180. ***    dot matrix driver.            ***
  181. ***************************************************
  182. *
  183. sendline:
  184.     move.b    (a0)+,d0
  185.     beq    prtok
  186.     move.l    a0,-(sp)
  187.     bsr    send
  188.     move.l    (sp)+,a0
  189.     bra    sendline
  190. *
  191. *
  192. sendn:    cmp.w    #10,d0
  193.     bcs    sdn1
  194.     and.l    #$ffff,d0
  195.     divu    #10,d0
  196.     swap    d0
  197.     move.w    d0,-(sp)
  198.     swap    d0
  199.     bsr    sendn
  200.     move.w    (sp)+,d0
  201. sdn1:    or.b    #"0",d0
  202. *
  203. *    bra    send
  204. *
  205. *
  206. send:    jmp    $ffffff
  207. *
  208. *
  209. ***********************************
  210. ***                ***
  211. ***********************************
  212.  SECTION printer,DATA,PUBLIC
  213.  
  214. prntbl:    dc.l    prtok,prtok,prtok,prtok,p_init
  215.     dc.l    p_bgndoc,p_bgnpage,p_bgntile
  216.     dc.l    p_block
  217.     dc.l    p_endtile,p_endpage,p_enddoc
  218.     dc.l    p_abort,p_ident
  219.  
  220.  
  221. xdpi_tbl:    dc.w    96,192,192,192,192,192,192
  222. ydpi_tbl:    dc.w    96,96,96,96,96,96,96
  223. minl_tbl:    dc.w    23,48,48,48,48,48,48
  224. minr_tbl:    dc.w    23,48,48,48,48,48,48
  225. mint_tbl:    dc.w    0,0,0,0,0,0,0
  226. minb_tbl:    dc.w    0,0,0,0,0,0,0
  227. maxw_tbl:    dc.l    640,1280,1280,1280,1280,1280,1280
  228. maxh_tbl:    dc.l    0,0,0,0,0,0,0
  229. xover_tbl:    dc.w    0,0,0,0,0,0,0
  230. yover_tbl:    dc.w    0,0,0,0,0,0,0
  231. rowht_tbl:    dc.w    1,1,1,1,1,1,1
  232. rows_tbl:    dc.w    1,1,1,1,1,1,1
  233. grmode_tbl:    dc.l    rstr1a,rstr1b,rstr1b,rstr1b,rstr1b,rstr1b,rstr1b
  234.  
  235.  
  236. driver:        dc.b    "HP ThinkJet Beta v2.1.0",0
  237.  
  238.  
  239. rstr1a:    dc.b    ESC,"*r640S",0    ;for 96 dpi
  240. rstr1b:    dc.b    ESC,"*r1280S",0    ;for 192 dpi
  241.  
  242. bgnline:    dc.b    ESC,"*b",0
  243. endtile:    dc.b    ESC,"*rB",0
  244.  
  245.  SECTION printer,BSS,PUBLIC
  246. table:        ds.l    1
  247. twidth:        ds.l    1
  248. v_base:        ds.l    1
  249. width:        ds.l    1
  250. rows:        ds.w    1
  251. rowht:        ds.w    1
  252. grmode:        ds.l    1
  253. papertype:    ds.w    1
  254.