home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / BEEHIVE / UTILITYS / PRNTEP06.ARK / DPX.MAC < prev    next >
Text File  |  1989-09-27  |  3KB  |  123 lines

  1. ;This module for MicroBee DP80/DP100 dot matrix printers
  2.  
  3.     .z80
  4.     .comment    ~
  5.  
  6. This is an example printing module. It prints the contents of the line buffer
  7. to the printer, using an <esc>K<n2><n1> sequence to set up the graphics.
  8. Things to know about when writing the routine:
  9.  
  10. print_bufr##    The line buffer in the program. Immediately before it is an
  11.         0ffh
  12. wrlst##        a routine to print the character in A on the printer
  13. prlincnt##    8 bit counter of the lines printed so far
  14. lpstr##        prints a '$' terminated string pointed to by de on the printer
  15.     ~
  16.  
  17. true    equ    -1
  18. false    equ    0
  19.  
  20. ;    Some equates that should take care of most printer variations!
  21. ;    If your printer expects ascii strings to tell it how long a
  22. ;    bitmapped line is, then you'll have to write such a routine yourself! 
  23.  
  24.     dseg
  25. grafixon:    db    'K$'    ;the character (string) to send to the printer
  26.                 ;to turn on bit-image mode 
  27.  
  28. hib4low        equ    false    ;Look in your printer manual to determine how
  29.                 ;to set this. If true, then the high byte
  30.                 ;of the line length is sent first
  31.  
  32.  
  33. prset2::        ;<--- DO NOT CHANGE THIS
  34.  
  35. ;    Set line spacing to 8/72", set condensed type.
  36. ;[Setting condensed type is a damn good idea since the header line tends
  37. ; to be on the long side!!]
  38.  
  39.     db    27,'A',8,15    ;string to set the spacing for the printer
  40.     db    '$'
  41.  
  42. preset::        ;<--- DO NOT CHANGE THIS
  43.  
  44. ;    Line spacing at 12/72" (1/6"), condensed type off
  45.  
  46.     db    12,27,"A",12,18
  47.     db    '$'        ;reset string
  48.  
  49. prtype::        ;<--- DO NOT CHANGE THIS
  50.  
  51.     db    'Microbee DP100'
  52.     db    13,10,'$'
  53.  
  54.     cseg
  55.  
  56. pline::            ;<--- DO NOT CHANGE THIS. This symbol is the entry
  57.             ;                         point to the routine
  58.  
  59.     ld    hl,print_bufr##    ;find first thing to print to
  60.     ld    de,575
  61.     add    hl,de
  62.  
  63. ploop2:    ld    a,(hl)
  64.     or    a
  65.     jr    nz,found_end
  66.     dec    hl
  67.     jr    ploop2
  68. found_end:
  69.     ld    de,print_bufr##    ;tell printer how many things to print
  70.     and    a        ;trash carry
  71.     sbc    hl,de
  72.     inc    hl        ;this since the value in hl was an offset from
  73.                 ;the start of the buffer
  74.     ld    a,h
  75.     or    l
  76.     jr    z,pnewline    ;nothing, so skip the line
  77.     ld    a,27
  78.     call    wrlst##
  79.     ld    de,grafixon
  80.     call    lpstr##
  81.  
  82.     if hib4low
  83.     ld    a,h
  84.     else
  85.     ld    a,l
  86.     endif
  87.     call    wrlst##
  88.  
  89.     if hib4low
  90.     ld    a,l
  91.     else
  92.     ld    a,h
  93.     endif
  94.     call    wrlst##
  95.  
  96.  
  97.     ld    c,l
  98.     ld    b,h        ;transfer to bc
  99.     ld    hl,print_bufr##
  100. prit:    ld    a,(hl)
  101.     call    wrlst##
  102.     inc    hl
  103.     dec    bc
  104.     ld    a,c
  105.     or    b
  106.     jr    nz,prit        ;do a line
  107. pnewline:
  108.     ld    a,13
  109.     call    wrlst##
  110.     ld    a,10
  111.     call    wrlst##
  112.     ld    hl,prlincnt##
  113.  
  114. ;    The main program uses prlincnt## to determine when it reaches the
  115. ;    end of the file, hence it is essential to increment it if you want
  116. ;    to avoid grabage after your picture. [note this doesn't happen very
  117. ;    often, but better safe than sorry, eh?]
  118.  
  119.     inc    (hl)
  120.     ret            ;done!
  121.  
  122.     end
  123.