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

  1.  
  2.  Include "pdlequ.h"
  3.  
  4. *
  5. * Tektronix 4693D Color Image Printer Device
  6. *
  7. CR    equ    $d
  8. LF    equ    $a
  9. FF    equ    $c
  10. ESC    equ    $1b
  11. DC2    equ    $12
  12.  
  13. *
  14. *
  15.  SECTION tek4693,CODE,PUBLIC
  16. *
  17. ***************************************************************
  18. ***************************************************************
  19. ***************************************************************
  20. dumbentry:
  21.     clr.l    d0
  22.     rts
  23.  
  24.     dc.l    "PRNT"
  25.     dc.w    200
  26.  
  27. *
  28. *
  29. * distribute the calls the the appropriate routines
  30. *
  31. tek4693:
  32.     move.l    a0,table
  33.     lsl.w    #2,d0
  34.     lea    prntbl,a1
  35.     move.l    0(a1,d0.w),a1
  36.     jmp    (a1)
  37.  
  38. *
  39. * identify who I am, and set up who I like to speak to.
  40. *
  41. p_ident:
  42.     move.l    #driver,pdrvrnm(a0)    ;pointer to string for driver name
  43.     move.w    #$4000+ASCENDING+PARALLEL,device(a0)
  44. prtok:    moveq    #1,d0
  45. rrts:    rts
  46.  
  47. *
  48. * initialize the table of printer specific routines
  49. *
  50. p_init:
  51.     clr.b    pdl(a0)            ;no page description language
  52.     move.b    #0,pmult(a0)        ;automatically print mulitiple copies?
  53.     move.b    #0,pman(a0)        ;handle manual feed?
  54.     move.b    #PRT_CMYK,ptype(a0)    ;printer type?
  55.     move.l    sendout(a0),send+2    ;self-modifing code, tisk, tisk!
  56.  
  57. *
  58. * pminlft(?) and pmaxw must be evenly divisible by 16
  59. * this is the part that should be worked out
  60. *
  61.  
  62.     move.w    pdensity(a0),d0
  63.     cmp.w    #7,d0
  64.     bcs    pint1
  65.     moveq    #6,d0
  66. pint1:    lsl.w    #1,d0
  67.  
  68.     lea    xdpi_tbl,a1
  69.     move.w    0(a1,d0.w),pxdpi(a0)    ;x resolution
  70.     lea    ydpi_tbl,a1
  71.     move.w    0(a1,d0.w),pydpi(a0)    ;y resolution
  72.     lea    minl_tbl,a1
  73.     move.w    0(a1,d0.w),pminlft(a0)    ;pixels from the left
  74.     lea    minr_tbl,a1
  75.     move.w    0(a1,d0.w),pminrht(a0)    ;pixels from the right
  76.     lea    mint_tbl,a1
  77.     move.w    0(a1,d0.w),pmintop(a0)    ;pixels down from top
  78.     lea    minb_tbl,a1
  79.     move.w    0(a1,d0.w),pminbot(a0)    ;pixels up from bottom
  80.     lea    xover_tbl,a1
  81.     move.w    0(a1,d0.w),pxover(a0)    ;percentage of x overlap of dots
  82.     lea    yover_tbl,a1
  83.     move.w    0(a1,d0.w),pyover(a0)    ;percentage of y overlap of dots
  84.     lea    rowht_tbl,a1
  85.     move.w    0(a1,d0.w),prowht(a0)    ;rows height modula
  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.     bra    prtok
  93.  
  94. *
  95. * going to begin printing a document
  96. *
  97. p_bgndoc:
  98.     move.b    #$3,d0
  99.     bsr    dsend
  100.     move.b    #$5,d0
  101.     bra    dsend
  102.  
  103.  
  104. *
  105. * about to start printing of a page
  106. *
  107. p_bgnpage:
  108.     bra    prtok
  109.  
  110. *
  111. * about to print a new tile for the page
  112.  
  113. *    $14        BCMY
  114. *    $d4 length of header  (20)
  115. *     11010100
  116. *    $xxxx width in pixels
  117. *     11xxxxxx high order
  118. *     10xxxxxx low order
  119. *    $xxxx height in pixels
  120. *     11xxxxxx high order
  121. *     10xxxxxx low order
  122. *    $c1 communication method (Handshaking)
  123. *    $c1 ($c1=1 copy) copies
  124. *    $c1 pixel shape (rectangular)
  125. *    $a0 width to height
  126. *    $da pixel format (BCMY)
  127. *    $c1 pixel ordering (left to right scan)
  128. *    $c1 image sizing (do not change size)
  129. *    $c1 image rendering (use closest eight colors)
  130. *    $c1 color conversion (do no corrections)
  131. *    $c1 image color manipulation (do no adjustments)
  132. *    $c1 black&white inversion (do no color exchange)
  133. *    $c3 hard copy orientation (portrait centered)
  134. *    $c080 output media (use printer defaults)
  135. *    $xx checksum ($80 + 7 bit checksum)
  136. *    $02 eol
  137. *
  138. p_bgntile:
  139.     clr.b    chksum
  140.  
  141.     move.b    #$14,d0
  142.     bsr    csend
  143.     move.b    #$d4,d0
  144.     bsr    csend
  145.  
  146.     move.l    table,a0
  147.     move.l    PPageWidth(a0),d0
  148.     and.w    #%111111000000,d0
  149.     lsr.w    #6,d0
  150.     or.w    #%11000000,d0
  151.     bsr    csend
  152.     move.l    table,a0
  153.     move.l    PPageWidth(a0),d0
  154.     and.w    #%111111,d0
  155.     or.w    #%10000000,d0
  156.     bsr    csend
  157.  
  158.     move.l    table,a0
  159.     move.l    PPageHeight(a0),d0
  160.     and.w    #%111111000000,d0
  161.     lsr.w    #6,d0
  162.     or.w    #%11000000,d0
  163.     bsr    csend
  164.     move.l    table,a0
  165.     move.l    PPageHeight(a0),d0
  166.     and.w    #%111111,d0
  167.     or.w    #%10000000,d0
  168.     bsr    csend
  169.  
  170.     move.b    #$c1,d0
  171.     bsr    csend
  172.     move.l    table,a0
  173.     move.w    pcopies(a0),d0
  174.     or.b    #$c0,d0
  175.     bsr    csend
  176.     move.b    #$c1,d0
  177.     bsr    csend
  178.     move.b    #$a0,d0
  179.     bsr    csend
  180.     move.b    #$da,d0
  181.     bsr    csend
  182.     move.b    #$c1,d0
  183.     bsr    csend
  184.     move.b    #$c1,d0
  185.     bsr    csend
  186.     move.b    #$c1,d0
  187.     bsr    csend
  188.     move.b    #$c1,d0
  189.     bsr    csend
  190.     move.b    #$c1,d0
  191.     bsr    csend
  192.     move.b    #$c1,d0
  193.     bsr    csend
  194.     move.b    #$c3,d0
  195.     bsr    csend
  196.     move.b    #$c0,d0
  197.     bsr    csend
  198.     move.b    #$80,d0
  199.     bsr    csend
  200.     move.b    chksum,d0
  201.     or.b    #$80,d0
  202.     bsr    dsend
  203.     move.b    #$02,d0
  204.     bra    dsend
  205.  
  206. csend:    add.b    d0,chksum
  207. dsend:    bsr    send
  208.     move.l    d0,-(sp)
  209.     move.w    #30,d1
  210. ds0:    move.w    #10000,d0
  211. ds1:    mulu    #10,d0
  212.     divu    #10,d0
  213.     dbf    d0,ds1
  214.     dbf    d1,ds0
  215.     move.l    (sp)+,d0
  216.     rts
  217.  
  218. *
  219. * send a line to the printer
  220. *
  221. p_block:
  222.     move.l    table,a0
  223.     move.l    pblockh(a0),d0
  224.     lea    string,a0
  225.     jsr    itoa
  226.     lea    string,a0
  227.     jsr    putmessage
  228.  
  229.     move.l    table,a0
  230.     move.l    pblockw(a0),d0
  231.     move.w    d0,width
  232.     move.l    pblockplane(a0),pplane
  233.     move.l    pblockptr(a0),a1
  234.     move.l    (a1),a1
  235.     add.l    pblockoff(a0),a1
  236.     move.l    a1,v_base
  237. *
  238. *    move.w    width,d0
  239. *    move.l    v_base,a0
  240. *n1:    tst.b    -1(a0,d0.w)
  241. *    bne    putln2
  242. *    subq.w    #1,d0
  243. *    bne    putln1
  244. *    moveq    #1,d0
  245. *n2:    move.w    d0,twidth
  246.  
  247. * pixel  1   0
  248. * bit  76543210
  249. *      BCMYBCMY
  250.  
  251.     move.w    width,d1
  252.     lsl.w    #3,d1
  253.     move.l    v_base,a0
  254.     moveq    #7,d2
  255. putln3:    moveq    #0,d0
  256.  
  257.     move.l    a0,a1
  258.  
  259.     btst    d2,(a1)        ;cyan pixel 0
  260.     beq    ptln10
  261.     bset    #2,d0
  262. ptln10:    add.l    pplane,a1
  263.     btst    d2,(a1)        ;magenta pixel 0
  264.     beq    ptln11
  265.     bset    #1,d0
  266. ptln11:    add.l    pplane,a1
  267.     btst    d2,(a1)        ;yellow pixel 0
  268.     beq    ptln12
  269.     bset    #0,d0
  270. ptln12:    add.l    pplane,a1
  271.     btst    d2,(a1)        ;black pixel 0
  272.     beq    ptln13
  273.     bset    #3,d0
  274. ptln13:
  275.  
  276.     dbf    d2,ptln1
  277.     addq.l    #1,a0
  278.     moveq    #7,d2
  279. ptln1:    move.l    a0,a1
  280.  
  281.     btst    d2,(a1)        ;cyan pixel 1
  282.     beq    ptln20
  283.     bset    #6,d0
  284. ptln20:    add.l    pplane,a1
  285.     btst    d2,(a1)        ;magenta pixel 1
  286.     beq    ptln21
  287.     bset    #5,d0
  288. ptln21:    add.l    pplane,a1
  289.     btst    d2,(a1)        ;yellow pixel 1
  290.     beq    ptln22
  291.     bset    #4,d0
  292. ptln22:    add.l    pplane,a1
  293.     btst    d2,(a1)        ;black pixel 1
  294.     beq    ptln23
  295.     bset    #7,d0
  296. ptln23:    dbf    d2,ptln2
  297.     addq.l    #1,a0
  298.     moveq    #7,d2
  299. ptln2:    move.l    a0,-(sp)
  300.     move.w    d1,-(sp)
  301.     move.w    d2,-(sp)
  302.     bsr    send
  303.     move.w    (sp)+,d2
  304.     move.w    (sp)+,d1
  305.     move.l    (sp)+,a0
  306.     subq.w    #2,d1
  307.     bhi    putln3
  308.  
  309.     move.b    #$02,d0        ;eol
  310.     bsr    send
  311.     bra    prtok
  312.  
  313. *
  314. * just finished describing current tile
  315. *
  316. p_endtile:
  317.     move.b    #$01,d0        ;eot
  318.     bra    dsend
  319.  
  320. *
  321. * just finished describing all tiles for this page
  322. *
  323. p_endpage:
  324.     bra    prtok
  325.  
  326. *
  327. * finished printing the document
  328. *
  329. p_enddoc:
  330.     move.b    #$03,d0
  331.     bra    send
  332.  
  333.  
  334.  
  335.  
  336. itoa:    bsr    itoa1
  337.     clr.b    (a0)
  338.     rts
  339.  
  340. itoa1:    and.l    #$ffff,d0
  341.     cmp.l    #10,d0
  342.     bcs    itoa2
  343.     divu    #10,d0
  344.     swap    d0
  345.     move.w    d0,-(sp)
  346.     swap    d0
  347.     bsr    itoa1
  348.     move.w    (sp)+,d0
  349.  
  350. itoa2:    or.b    #"0",d0
  351.     move.b    d0,(a0)+
  352.     rts
  353.  
  354.  
  355. putmessage:
  356.     move.l    table,a1        ;put string a0 up in dialogbox
  357.     move.l    printstat(a1),a1
  358.     jmp    (a1)
  359.  
  360.  
  361. ***************************************************
  362. ***    these are the send routines for the    ***
  363. ***    dot matrix driver.            ***
  364. ***************************************************
  365. *
  366. sendline:
  367.     move.b    (a0)+,d0
  368.     beq    prtok
  369.     move.l    a0,-(sp)
  370.     bsr    send
  371.     move.l    (sp)+,a0
  372.     bra    sendline
  373. *
  374. *
  375. sendn:    cmp.w    #10,d0
  376.     bcs    sdn1
  377.     and.l    #$ffff,d0
  378.     divu    #10,d0
  379.     swap    d0
  380.     move.w    d0,-(sp)
  381.     swap    d0
  382.     bsr    sendn
  383.     move.w    (sp)+,d0
  384. sdn1:    or.b    #"0",d0
  385. *
  386. *    bra    send
  387. *
  388. *
  389. send:    jmp    $ffffff
  390.  
  391.  
  392. ***********************************
  393. ***                ***
  394. ***********************************
  395.  SECTION tek4693,DATA,PUBLIC
  396.  
  397. prntbl:    dc.l    prtok,prtok,prtok,prtok,p_init
  398.     dc.l    p_bgndoc,p_bgnpage,p_bgntile
  399.     dc.l    p_block
  400.     dc.l    p_endtile,p_endpage,p_enddoc
  401.     dc.l    prtok,p_ident
  402.  
  403.  
  404. xdpi_tbl:    dc.w    300,300,300,300,300,300,300
  405. ydpi_tbl:    dc.w    300,300,300,300,300,300,300
  406. minl_tbl:    dc.w    55,55,55,55,55,55,55
  407. minr_tbl:    dc.w    55,55,55,55,55,55,55
  408. maxw_tbl:    dc.w    2432,2432,2432,2432,2432,2432,2432
  409. maxh_tbl:    dc.w    0,0,0,0,0,0,0
  410. mint_tbl:    dc.w    0,0,0,0,0,0,0
  411. minb_tbl:    dc.w    0,0,0,0,0,0,0
  412. xover_tbl:    dc.w    0,0,0,0,0,0,0
  413. yover_tbl:    dc.w    0,0,0,0,0,0,0
  414. rowht_tbl:    dc.w    1,1,1,1,1,1,1
  415.  
  416.  
  417. driver:        dc.b    "Tektronix 4693D v2.1.0 beta",0
  418.  
  419.  SECTION tek4693,BSS,PUBLIC
  420.  
  421. table:        ds.l    1
  422.  
  423. v_base:        ds.l    1
  424. width:        ds.w    1
  425. pplane:        ds.l    1
  426. chksum:        ds.w    1
  427. count:        ds.w    1
  428. string:        ds.b    100
  429.