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

  1.  include "prtequ.h"
  2.  
  3. *
  4. * Canon Bubble-Jet 130e print driver
  5. *
  6. CR    equ    $d
  7. LF    equ    $a
  8. FF    equ    $c
  9. ESC    equ    $1b
  10. FS    equ    $1c
  11. BACK    equ    "\\"
  12.  
  13.  SECTION printer,CODE,PUBLIC
  14. ***************************************************************
  15. ***************************************************************
  16. ***************************************************************
  17. dumbentry:
  18.     clr.l    d0
  19. rrts:    rts
  20.  
  21.     dc.l    "PRNT"
  22.     dc.w    200
  23.  
  24. *
  25. * distribute the calls to the appropriate routines
  26. *
  27. BJ130e:    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:    clr.b    pdl(a0)            ;no page description language
  46.     clr.b    pmult(a0)        ;automatically print mulitiple copies?
  47.     clr.b    pman(a0)        ;handle manual feed?
  48.     move.b    #PRT_BW,ptype(a0)    ;printer type?
  49.  
  50.     move.l    sendout(a0),send+2    ;self-modifing code, tisk, tisk!
  51. *
  52. * pminlft and pmaxw must be evenly divisible by 16
  53. * this is the part that should be worked out
  54. *
  55.  
  56.     move.w    pdensity(a0),d0
  57.     cmp.w    #7,d0
  58.     bcs    pint1
  59.     moveq    #6,d0
  60. pint1:    lsl.w    #1,d0
  61.  
  62.     lea    xdpi_tbl,a1
  63.     move.w    0(a1,d0.w),pxdpi(a0)    ;x resolution
  64.     lea    ydpi_tbl,a1
  65.     move.w    0(a1,d0.w),pydpi(a0)    ;y resolution
  66.     lea    minl_tbl,a1
  67.     move.w    0(a1,d0.w),pminlft(a0)    ;pixels from the left
  68.     lea    minr_tbl,a1
  69.     move.w    0(a1,d0.w),pminrht(a0)    ;pixels from the right
  70.     lea    mint_tbl,a1
  71.     move.w    0(a1,d0.w),pmintop(a0)    ;pixels down from top
  72.     lea    minb_tbl,a1
  73.     move.w    0(a1,d0.w),pminbot(a0)    ;pixels up from bottom
  74.     lea    xover_tbl,a1
  75.     move.w    0(a1,d0.w),pxover(a0)    ;percentage of x overlap of dots
  76.     lea    yover_tbl,a1
  77.     move.w    0(a1,d0.w),pyover(a0)    ;percentage of y overlap of dots
  78.     lea    rowht_tbl,a1
  79.     move.w    0(a1,d0.w),prowht(a0)    ;rows height modula
  80.  
  81.     lea    grmode_tbl,a1
  82.     move.w    0(a1,d0.w),grmode
  83.  
  84.     lsl.w    #1,d0
  85.     lea    maxw_tbl,a1
  86.     move.l    0(a1,d0.w),pmaxw(a0)    ;maximum # pixels across
  87.     lea    maxh_tbl,a1
  88.     move.l    0(a1,d0.w),pmaxh(a0)    ;maximum # pixels down
  89.     bra    prtok
  90.  
  91.  
  92. *
  93. * going to begin printing a document
  94. *
  95. p_bgndoc:
  96.     bra    prtok
  97.  
  98. *
  99. * about to start printing of a page
  100. *
  101. p_bgnpage:
  102.     lea    bgnpage,a0
  103.     bsr    sendline
  104.     moveq    #4,d0
  105.     bsr    send
  106.     moveq    #0,d0
  107.     bsr    send
  108.     moveq    #0,d0
  109.     bsr    send
  110.     moveq    #0,d0
  111.     bsr    send
  112.     move.w    #180,d0
  113.     bsr    send
  114.     moveq    #0,d0
  115.     bsr    send
  116.  
  117.     bra    prtok
  118.  
  119. *
  120. * about to print a new tile for the page
  121. *
  122. p_bgntile:
  123.     bra    prtok
  124.  
  125. *
  126. * print a block to the printer
  127. *
  128. p_block:
  129.     move.l    table,a0
  130.     move.l    pblockw(a0),d0
  131.     move.w    d0,width
  132.     move.l    pblockptr(a0),a1
  133.     move.l    (a1),a1
  134.     add.l    pblockoff(a0),a1
  135.     move.l    a1,v_base
  136.  
  137. *
  138. *print the block
  139. *
  140. printt:    move.l    v_base,lineptr
  141.     bsr    putline            ;first 48
  142.  
  143.     lea    linefeed,a0
  144.     bra    sendline
  145.  
  146.  
  147. **************************************
  148. putline:
  149.     move.l    lineptr,a0
  150.     clr.w    twidth
  151.     move.w    #47,d1
  152. print0:    move.w    width,d0
  153. print1:    tst.b    -1(a0,d0.w)
  154.     bne    print2
  155.     subq.w    #1,d0
  156.     bne    print1
  157. print2:    cmp.w    twidth,d0
  158.     bls    print3
  159.     move.w    d0,twidth
  160. print3:    add.w    width,a0
  161.     dbf    d1,print0
  162.     tst.w    twidth
  163.     beq    rrts
  164.  
  165. *
  166.     lea    setgr,a0
  167.     bsr    sendline
  168.     move.w    twidth,d0        ;send number of graphic bytes to follow
  169.     mulu    #48,d0
  170.     addq.w    #1,d0
  171.     bsr    send
  172.     move.w    twidth,d0    
  173.     mulu    #48,d0
  174.     addq.w    #1,d0
  175.     lsr.w    #8,d0
  176.     bsr    send
  177.     move.w    grmode,d0
  178.     bsr    send
  179.  
  180.     move.w    twidth,d2                 ;length of the data in byte
  181. print4:    move.w    d2,twidth
  182.     moveq    #7,d4
  183. print6:    move.w    d4,pixel
  184.     moveq    #5,d3
  185.     move.l    lineptr,a0
  186. print5:    move.w    d3,bytes
  187.     moveq    #7,d1
  188.     moveq    #0,d0
  189. *
  190. s1:    btst    d4,(a0)
  191.     beq     s2
  192.     bset    d1,d0
  193. s2:    add.w    width,a0
  194.     dbf    d1,s1
  195.     move.l    a0,-(sp)
  196.     bsr    send
  197.     move.l    (sp)+,a0
  198. *
  199.     move.w    pixel,d4
  200.     move.w    bytes,d3
  201.     dbf    d3,print5
  202. *
  203.     move.w    pixel,d4
  204.     dbf    d4,print6
  205. *
  206.     add.l    #1,lineptr
  207.     move.w    twidth,d2
  208.     subq.w    #1,d2
  209.     bgt    print4
  210. *
  211.     bra    prtok
  212.  
  213. ************************************
  214. *
  215. * just finished describing current tile
  216. *
  217. p_endtile:
  218.     move.l    table,a0
  219.     move.l    pblockh(a0),d0
  220.     rts
  221. *
  222. * just finished describing all tiles for this page
  223. *
  224. p_endpage:
  225.     bra    prtok
  226.  
  227. *
  228. * finished printing the document
  229. *
  230. p_enddoc:
  231.     bra    prtok
  232.  
  233. *
  234. * user requested stop
  235. *
  236. p_break:
  237.     bra    p_endtile
  238.  
  239. ***************************************************
  240. ***    these are the send routines for the    ***
  241. ***    dot matrix driver.            ***
  242. ***************************************************
  243. sendline:
  244.     move.b    (a0)+,d0
  245.     beq    prtok
  246.     move.l    a0,-(sp)
  247.     bsr    send
  248.     move.l    (sp)+,a0
  249.     bra    sendline
  250.  
  251. send:    jmp    $ffffff
  252.  
  253. ***********************************
  254. ***                ***
  255. ***********************************
  256.  SECTION printer,DATA,PUBLIC
  257.  
  258. prntbl:    dc.l    prtok,prtok,prtok,prtok,p_init
  259.     dc.l    p_bgndoc,p_bgnpage,p_bgntile
  260.     dc.l    p_block
  261.     dc.l    p_endtile,p_endpage,p_enddoc
  262.     dc.l    p_break,p_ident
  263.  
  264. xdpi_tbl:    dc.w    120,180,240,360,360,360,360
  265. ydpi_tbl:    dc.w    360,360,360,360,360,360,360
  266. minl_tbl:    dc.w    30,45,60,90,90,90,90
  267. minr_tbl:    dc.w    30,45,60,90,90,90,90
  268. mint_tbl:    dc.w    0,0,0,0,0,0,0
  269. minb_tbl:    dc.w    0,0,0,0,0,0,0
  270. maxw_tbl:    dc.l    960,1440,1920,2880,2880,2880,2880
  271. maxh_tbl:    dc.l    0,0,0,0,0,0,0
  272. xover_tbl:    dc.w    0,0,0,0,0,0,0
  273. yover_tbl:    dc.w    0,0,0,0,0,0,0
  274. rowht_tbl:    dc.w    48,48,48,48,48,48,48
  275. grmode_tbl:    dc.w    13,14,15,16,16,16,16
  276.  
  277.  
  278. driver:        dc.b    "Canon BJ130e v2.0.4 beta",0
  279. setgr:        dc.b    ESC,"[g",0
  280. bgnpage:    dc.b    ESC,"[",BACK,0
  281. linefeed:    dc.b    CR,ESC,"J",24,0
  282.  
  283.  SECTION printer,BSS,PUBLIC
  284. table:        ds.l    1
  285. twidth:        ds.w    1
  286. pixel:        ds.w    1
  287. v_base:        ds.l    1
  288. bytes:        ds.w    1
  289. lineptr:    ds.l    1
  290. width:        ds.w    1
  291. count:        ds.w    1
  292. grmode:        ds.w    1
  293. rowht:        ds.w    1
  294. scroll:        ds.w    1
  295.  
  296. ; v2.0.4 fixed problem of line spacing to far?
  297. ;
  298. ; v2.0.3 was reseting lineptr to top after each byte was sent in a row. fixed
  299. ;
  300. ; v2.0.2 fixed problem of sending length down that was 1/8 what it needed
  301. ;  to be.
  302.