home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / cpm68k / msutils.lbr / LQ.SQ / LQ.S
Encoding:
Text File  |  1988-02-18  |  11.0 KB  |  353 lines

  1. *#######################################################################
  2. *              Program LQ...Epson LQ-1500 Setup Utility
  3. *        ==================================================
  4. *                 Configured for an EPSON LQ-1500:
  5. *           This program chains to either DFONT or LFONT
  6. *           to implement a user defined font in draft or
  7. *               letter quality mode, respectively.
  8. *        ==================================================
  9. *
  10. *                       Dr. David C. Wilcox
  11. *                       DCW Industries, Inc.
  12. *               5354 Palm Drive, La Canada, CA  91011
  13. *                          818/790-3844
  14. *
  15. *                         March 26, 1986
  16. *#######################################################################
  17. boot    equ    00        *warm boot
  18. conin    equ    01        *console input
  19. list    equ    05        *output to LST: device
  20. pstring    equ    09        *display string on console
  21. chain    equ    47        *chain to program
  22. bell    equ    07        *ascii bel
  23. tab    equ    09        *horizontal tab
  24. lf    equ    10        *line feed
  25. cr    equ    13        *carriage return
  26. si    equ    15        *ascii shift in
  27. dc2    equ    18        *ascii dc2
  28. esc    equ    27        *ascii escape
  29. space    equ    32        *space
  30. upmask    equ    $5f        *upper case mask
  31. bdos    equ    $0002        *BDOS entry point
  32. *#######################################################################
  33. * Special registers:
  34. *
  35. *    a5 = address of dma buffer
  36. *    a6 = address of 1st parsed file name
  37. *    d5 = font flag
  38. *    d6 = command string character count
  39. *    d7 = cancel flag
  40. *#######################################################################
  41. *
  42. * Locate FCB and DMA (for portability)
  43. *
  44.     link    a6,#0        *mark stack frame
  45.     move.l    8(a6),a0    *get base page address
  46.     lea    $80(a0),a5    *get address of DMA buffer
  47.     lea    $5c(a0),a6    *get address of 1st parsed fcb
  48.     clr.l    d0        *make sure d0 is clear
  49.     clr.l    d1        *make sure d1 is clear
  50.     clr.l    d5        *make sure d5 is clear
  51.     clr.l    d7        *make sure d7 is clear
  52. *
  53. * See if any options have been specified
  54. *
  55.     movea.l    a5,a4        *make a4 the working buffer
  56.     move.b    (a4)+,d6    *parse the dma...d6 is character count
  57.     cmpi.b    #0,d6
  58.     beq    options        *no options...display options available
  59. strip:    move.b    (a4)+,d0    *strip all leading spaces
  60.     subq    #1,d6
  61.     blt    options
  62.     cmpi.b    #space,d0
  63.     beq    strip
  64.     cmpi.b    #'-',d0        *is it a cancel?
  65.     bne    opta        *if not...check option specified
  66.     move.b    #1,d7        *otherwise set d7 as on/off flag
  67.     move.b    (a4)+,d0    *get next character
  68.     subq    #1,d6
  69.     blt    options
  70. *
  71. * Options specified...process them
  72. *
  73. opta:    cmpi.b    #'A',d0        *is it alternate pitch?
  74.     bne    optb
  75.     cmpi.b    #1,d7        *yes...get on/off flag
  76.     beq    optaoff
  77.     move.l    #aon,a1        *point to option A on
  78.     bra    send
  79. optaoff:move.l    #aoff,a1    *point to option A off
  80.     bra    send
  81. optb:    cmpi.b    #'B',d0        *is it boldface?
  82.     bne    optc
  83.     cmpi.b    #1,d7        *yes...get on/off flag
  84.     beq    optboff
  85.     move.l    #bon,a1        *point to option B on
  86.     bra    send
  87. optboff:move.l    #boff,a1    *point to option B off
  88.     bra    send
  89. optc:    cmpi.b    #'C',d0        *is it 80-column print?
  90.     bne    optd
  91.     cmpi.b    #1,d7        *yes...get on/off flag
  92.     beq    optcoff
  93.     move.l    #con,a1        *point to option C on
  94.     bra    send
  95. optcoff:move.l    #coff,a1    *point to option C off
  96.     bra    send
  97. optd:    cmpi.b    #'D',d0        *is it disable paper-out indicator?
  98.     bne    opte
  99.     cmpi.b    #1,d7        *yes...get on/off flag
  100.     beq    optdoff
  101.     move.l    #don,a1        *point to option D on
  102.     bra    send
  103. optdoff:move.l    #doff,a1    *point to option D off
  104.     bra    send
  105. opte:    cmpi.b    #'E',d0        *is it expanded width characters?
  106.     bne    optf
  107.     cmpi.b    #1,d7        *yes...get on/off flag
  108.     beq    opteoff
  109.     move.l    #eon,a1        *point to option E on
  110.     bra    send
  111. opteoff:move.l    #eoff,a1    *point to option E off
  112.     bra    send
  113. optf:    cmpi.b    #'F',d0        *is it select user defined font?
  114.     bne    opti
  115.     move.b    #1,d5        *if so, save it for last
  116.     move.b    (a4)+,d0    *get next option
  117.     subq    #1,d6
  118.     blt    quit        *if no more options, load font
  119.     bra    opta        *otherwise exhaust options first
  120. opti:    cmpi.b    #'I',d0        *is it italic print?
  121.     bne    optl
  122.     cmpi.b    #1,d7        *yes...get on/off flag
  123.     beq    optioff
  124.     move.l    #ion,a1        *point to option I on
  125.     bra    send
  126. optioff:move.l    #ioff,a1    *point to option I off
  127.     bra    send
  128. optl:    cmpi.b    #'L',d0        *is it letter quality mode?
  129.     bne    optp
  130.     cmpi.b    #1,d7        *yes...get on/off flag
  131.     beq    optloff
  132.     move.l    #lon,a1        *point to option L on
  133.     bra    send
  134. optloff:move.l    #loff,a1    *point to option L off
  135.     bra    send
  136. optp:    cmpi.b    #'P',d0        *is it proportional characters?
  137.     bne    optr
  138.     cmpi.b    #1,d7        *yes...get on/off flag
  139.     beq    optpoff
  140.     move.l    #pon,a1        *point to option P on
  141.     bra    send
  142. optpoff:move.l    #poff,a1    *point to option P off
  143.     bra    send
  144. optr:    cmpi.b    #'R',d0        *is it reset all but font?
  145.     bne    opts
  146.     move.l    #reset,a1    *point to reset option
  147.     bra    send
  148. opts:    cmpi.b    #'S',d0        *is it small (condensed) characters?
  149.     bne    optu
  150.     cmpi.b    #1,d7        *yes...get on/off flag
  151.     beq    optsoff
  152.     move.l    #son,a1        *point to option S on
  153.     bra    send
  154. optsoff:move.l    #soff,a1    *point to option S off
  155.     bra    send
  156. optu:    cmpi.b    #'U',d0        *is it underline mode?
  157.     bne    optv
  158.     cmpi.b    #1,d7        *yes...get on/off flag
  159.     beq    optuoff
  160.     move.l    #uon,a1        *point to option U on
  161.     bra    send
  162. optuoff:move.l    #uoff,a1    *point to option U off
  163.     bra    send
  164. optv:    cmpi.b    #'V',d0        *is it 1/8" vertical spacing?
  165.     bne    optz
  166.     cmpi.b    #1,d7        *yes...get on/off flag
  167.     beq    optvoff
  168.     move.l    #von,a1        *point to option V on
  169.     bra    send
  170. optvoff:move.l    #voff,a1    *point to option V off
  171.     bra    send
  172. optz:    cmpi.b    #'Z',d0        *is it reset to original state?
  173.     bne    error
  174.     move.l    #zap,a1        *point to zap option
  175. *
  176. * Send appropriate strings to printer and console
  177. *
  178. send:
  179.     jsr    lpsend
  180.     move.w    #pstring,d0
  181.     trap    #bdos        *display message on console
  182.     move.b    (a4)+,d0    *get next character
  183.     subq    #1,d6
  184.     blt    quit        *all done if no more characters
  185.     bra    opta        *otherwise, loop for additional options
  186. *
  187. * Send string terminated by a '$' to LST:
  188. *
  189. lpsend:
  190.     move.b    (a1)+,d1
  191.     cmpi.b    #'$',d1
  192.     bne    sendit
  193.     move.l    a1,d1
  194.     rts
  195. sendit:    move.w    #list,d0
  196.     trap    #bdos
  197.     bra    lpsend
  198. *
  199. * Display error message, usage menu, and return to CP/M
  200. *
  201. error:
  202.     move.l    #errmsg,d1
  203.     move.w    #pstring,d0
  204.     trap    #bdos
  205.     move.l    #menu,d1
  206.     move.w    #pstring,d0
  207.     trap    #bdos
  208.     bra    quit1
  209. *
  210. * Display user font menu and chain to appropriate font utility
  211. *
  212. font:
  213.     move.l    #fontmsg,d1    *display font menu
  214.     move.w    #pstring,d0    *and prompt for font desired
  215.     trap    #bdos
  216.     move.w    #conin,d0    *get response from keyboard
  217.     trap    #bdos
  218.     move.b    d0,d4        *save response in d4
  219.     move.l    #crlf,d1    *send a cr, lf to console
  220.     move.w    #pstring,d0
  221.     trap    #bdos
  222.     cmpi.b    #3,d4        *is it a ^C?
  223.     beq    quit1        *yes...so return to CP/M
  224.     andi.b    #upmask,d4    *make it upper case
  225.     cmpi.b    #'E',d4        *is it an exit request?
  226.     beq    quit1        *yes...so return to CP/M
  227.     cmpi.b    #'L',d4        *is it letter quality font?
  228.     beq    lqmode        *yes...prepare to run lfont
  229.     cmpi.b    #'D',d4        *is it draft mode font?
  230.     beq    dmode        *yes...prepare to run dfont
  231.     move.l    #errmsg,d1    *none of the above
  232.     move.w    #pstring,d0    *so...print error message
  233.     trap    #bdos        *repeat the menu
  234.     bra    font        *and prompt for another response
  235. lqmode:    movea.l    #slctlq,a1    *point to lfont command string
  236.     bra    go
  237. dmode:    movea.l    #slctd,a1    *point to dfont command string
  238. go:    move.l    #9,d2
  239.     movea.l    a5,a0        *point to dma
  240.     jsr    movmem        *copy command string to dma
  241.     move.w    #chain,d0    *and chain to the selected
  242.     trap    #bdos        *font program
  243. *
  244. * Move d2 bytes from a1 to a0
  245. *
  246. movmem:
  247.     move.b    (a1)+,(a0)+
  248.     subq    #1,d2
  249.     bne    movmem
  250.     rts
  251. *
  252. * Display options available
  253. *
  254. options:
  255.     move.l    #menu,d1
  256.     move.w    #pstring,d0
  257.     trap    #bdos
  258. *
  259. * return to cp/m via the bdos
  260. *
  261. quit:
  262.     cmpi.b    #1,d5        *check the font flag
  263.     beq    font        *set => process request
  264. quit1:    move.w    #boot,d0    *otherwise, return to CP/M
  265.     trap    #bdos
  266. *#######################################################################
  267. crlf:    dc.b    cr,lf,'$'
  268. slctlq:    dc.b    7,'A:LFONT',0
  269. slctd:    dc.b    7,'A:DFONT',0
  270. errmsg:    dc.b    cr,lf
  271.     dc.b    ' Invalid option specified ',cr,lf,lf,'$'
  272. menu:    dc.b    'Correct usage:     LQ {-} {option list}',cr,lf,lf
  273.     dc.b    'Including "-" turns the option list off',cr,lf,lf
  274.     dc.b    'Options available for Epson LQ-1500:',cr,lf
  275.     dc.b    '----------------------------------'
  276.     dc.b    '---------------------------------------',cr,lf
  277.     dc.b    'A...Alternate pitch (elite)       '
  278.     dc.b    'L...Letter quality mode',cr,lf
  279.     dc.b    'B...Boldface print mode           '
  280.     dc.b    'P...Proportional characters',cr,lf
  281.     dc.b    'C...80-Column print mode          '
  282.     dc.b    'R...Reset all options except user font',cr,lf
  283.     dc.b    'D...Disable paper-out indicator   '
  284.     dc.b    'S...Small width characters',cr,lf
  285.     dc.b    'E...Expanded width characters     '
  286.     dc.b    'U...Underline mode',cr,lf
  287.     dc.b    'F...Font load/user definition     '
  288.     dc.b    'V...1/8" Vertical spacing',cr,lf
  289.     dc.b    'I...Italic print mode             '
  290.     dc.b    'Z...Zap all options including user font',cr,lf
  291.     dc.b    '----------------------------------'
  292.     dc.b    '---------------------------------------'
  293.     dc.b    cr,lf,lf,'$'
  294. fontmsg:dc.b    'User defined fonts/options available:',cr,lf,lf
  295.     dc.b    tab
  296.     dc.b    'E...Exit without loading user defined font',cr,lf
  297.     dc.b    tab
  298.     dc.b    'D...Draft mode scientific font',cr,lf
  299.     dc.b    tab
  300.     dc.b    'L...Letter quality scientific font',cr,lf,lf
  301.     dc.b    'Specify option desired...$'
  302. aon:    dc.b    esc,'M',bell,'$'
  303.     dc.b    'Pitch selected is now ELITE',cr,lf,'$'
  304. aoff:    dc.b    esc,'P',bell,'$'
  305.     dc.b    'Pitch selected is now PICA',cr,lf,'$'
  306. bon:    dc.b    esc,'E',bell,'$'
  307.     dc.b    'Boldface print is now ON',cr,lf,'$'
  308. boff:    dc.b    esc,'F',bell,'$'
  309.     dc.b    'Boldface print is now OFF',cr,lf,'$'
  310. con:    dc.b    esc,'Q',80,bell,'$'
  311.     dc.b    'Page width is now 80 columns',cr,lf,'$'
  312. coff:    dc.b    esc,'Q',132,bell,'$'
  313.     dc.b    'Page width is now 132 columns',cr,lf,'$'
  314. don:    dc.b    esc,'8',bell,'$'
  315.     dc.b    'Paper-out indicator is now DISABLED',cr,lf,'$'
  316. doff:    dc.b    esc,'9',bell,'$'
  317.     dc.b    'Paper-out indicator is now ENABLED',cr,lf,'$'
  318. eon:    dc.b    esc,'W',1,bell,'$'
  319.     dc.b    'Expanded width character mode is now ON',cr,lf,'$'
  320. eoff:    dc.b    esc,'W',0,bell,'$'
  321.     dc.b    'Expanded width character mode is now OFF',cr,lf,'$'
  322. ion:    dc.b    esc,'4',bell,'$'
  323.     dc.b    'Italics mode is now ON',cr,lf,'$'
  324. ioff:    dc.b    esc,'5',bell,'$'
  325.     dc.b    'Italics mode is now OFF',cr,lf,'$'
  326. lon:    dc.b    esc,'x',1,bell,'$'
  327.     dc.b    'Print mode selected is now LETTER QUALITY',cr,lf,'$'
  328. loff:    dc.b    esc,'x',0,bell,'$'
  329.     dc.b    'Print mode selected is now DRAFT QUALITY',cr,lf,'$'
  330. pon:    dc.b    esc,'p',1,bell,'$'
  331.     dc.b    'Proportional character mode is now ON',cr,lf,'$'
  332. poff:    dc.b    esc,'p',0,bell,'$'
  333.     dc.b    'Proportional character mode is now OFF',cr,lf,'$'
  334. reset:    dc.b    esc,'P',esc,'F',esc,'Q',132,esc,'9',esc,'W',0,esc,'5'
  335.     dc.b    esc,'x',0,esc,'p',0,dc2,esc,'-',0,esc,'2',bell,'$'
  336.     dc.b    'Printer is now RESET...User font unaffected',cr,lf,'$'
  337. son:    dc.b    si,bell,'$'
  338.     dc.b    'Small width character mode is now ON',cr,lf,'$'
  339. soff:    dc.b    dc2,bell,'$'
  340.     dc.b    'Small width character mode is now OFF',cr,lf,'$'
  341. uon:    dc.b    esc,'-',1,bell,'$'
  342.     dc.b    'Underline mode is now ON',cr,lf,'$'
  343. uoff:    dc.b    esc,'-',0,bell,'$'
  344.     dc.b    'Underline mode is now OFF',cr,lf,'$'
  345. von:    dc.b    esc,'0',bell,'$'
  346.     dc.b    'Vertical line spacing is now 1/8"',cr,lf,'$'
  347. voff:    dc.b    esc,'2',bell,'$'
  348.     dc.b    'Vertical line spacing is now 1/6"',cr,lf,'$'
  349. zap:    dc.b    esc,'@',bell,'$'
  350.     dc.b    'Printer is now RESET...User font erased',cr,lf,'$'
  351. *#######################################################################
  352.     end
  353.