home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / ega / egaprtsc.arc / PRTSC.ASM
Encoding:
Assembly Source File  |  1987-01-27  |  23.9 KB  |  697 lines

  1. ;       ***********************************************************
  2. ;
  3. ;                                   PRTSC.ASM
  4. ;
  5. ;
  6. ;                           Jeffrey William Gillette
  7. ;                          Humanities Computing Center
  8. ;                            104 Languages Building
  9. ;                                Duke University
  10. ;                               Durham, NC  27706
  11. ;
  12. ;
  13. ;       PrtSc is a memory resident program that replaces the normal
  14. ;       IBM PC PrtSc interrupt (int 5).  It correctly replaces IBM
  15. ;       "extended ASCII" European characters with ISO European characters
  16. ;       used by the Toshiba P351 and the Hewlett-Packard LaserJet
  17. ;       printers.
  18. ;
  19. ;       PrtSc supports the following screen attributes: bold, underline
  20. ;       and reverse video (italic).  
  21. ;
  22. ;       PrtSc supports normal text and enhanced graphics modes.  Note
  23. ;       that hooks are in place for low resolution graphics, but these
  24. ;       are not implemented at present.
  25.  
  26. DEBUG   equ     0               ;  run as process (1) or tsr utility (0).
  27.  
  28. TOSHIBA  equ    1
  29. LASERJET equ    0
  30. PRINTER  equ    LASERJET        ;  set to either TOSHIBA or LASERJET
  31.  
  32. _TEXT   segment public byte 'CODE'
  33.         assume cs:_TEXT,ds:_DATA,ss:_STACK
  34.  
  35. sseg    dw      0               ;  stack segment
  36. sst     dw      0               ;  stack pointer
  37. pseg    dw      0               ;  stack segment for prtsc
  38. pst     dw      0               ;  stack segment for prtsc
  39.  
  40. int5    proc    near
  41.         mov     cs:sseg,ss      ;  save stack and stack pointer
  42.         mov     cs:sst,sp
  43.  
  44.         mov     ax,_STACK
  45.         mov     ss,ax
  46.         mov     ax,offset top
  47.         mov     sp,ax
  48.  
  49.         mov     ss,cs:pseg
  50.         mov     sp,cs:pst
  51.  
  52.         push    es
  53.         push    ds
  54.         push    si
  55.         push    di
  56.         push    bp
  57.         push    dx
  58.         push    cx
  59.         push    bx
  60.         push    ax
  61.  
  62.         mov     ax,_DATA
  63.         mov     ds,ax
  64.  
  65.         ;       jump to appropriate procedure
  66.         mov     ah,0fh
  67.         int     10h             ;  get current video mode
  68.         xor     ah,ah
  69.         shl     ax,1            ;    x 2 bytes per word
  70.         mov     bx,modes        ;  offset for base
  71.         add     bx,ax           ;    plus video mode 
  72.         call    [bx]            ;  call procedure
  73.  
  74.         pop     ax
  75.         pop     bx
  76.         pop     cx
  77.         pop     dx
  78.         pop     bp
  79.         pop     di
  80.         pop     si
  81.         pop     ds
  82.         pop     es
  83.         mov     ss,cs:sseg
  84.         mov     sp,cs:sst
  85. IF      DEBUG
  86.         ret
  87. ELSE
  88.         iret
  89. ENDIF
  90. int5    endp
  91.  
  92. ;       set video segment for mono
  93. mono    proc    near
  94.         mov     ax,0b000h
  95.         mov     es,ax
  96.         jmp     text   
  97. mono    endp
  98.  
  99. ;       set video segment for color
  100. color    proc   near
  101.         mov     ax,0b800h
  102.         mov     es,ax
  103.         jmp     text   
  104. color    endp
  105.  
  106.  
  107. ;       ------------------------------------------------------------------
  108. ;
  109. ;                             TEXT MODE ROUTINES
  110. ;
  111. ;       ------------------------------------------------------------------
  112. ;
  113. text    proc    near
  114.         ;       first initialize the printer
  115.         mov     di,offset init
  116.         call    p2
  117.  
  118.         ;       next set up the transfer
  119.         mov     cx,25
  120.         xor     si,si
  121.         xor     bx,bx
  122.  
  123. t0:     push    cx              ;  do one row
  124.         mov     cx,80
  125. t1:     push    cx
  126.         mov     dx,es:[si]
  127.  
  128.         ;       check attribute to see if it has changed
  129.         mov     bl,dh
  130.         and     bl,7fh          ;  mask out high bit
  131.         mov     al,[offset attributes + bx]
  132.         cmp     al,att
  133.         jz      t4
  134.  
  135.         ;       change of attribute
  136.         mov     ah,al           ;  save new attribute
  137.         xor     al,att          ;  al now shows which functions need changing
  138.         mov     att,ah          ;  save new attribute
  139.  
  140.         test    al,8            ;  bold
  141.         jz      t2
  142.         mov     di,prtptr       ;    turn on bold
  143.         test    ah,8
  144.         jnz     t1a
  145.         mov     di,prtptr  + 2  ;    turn off bold
  146. t1a:    push    ax
  147.         push    dx
  148.         call    p2
  149.         pop     dx
  150.         pop     ax
  151.  
  152. t2:     test    al,4            ;  italic (reverse video)
  153.         jz      t3
  154.         mov     di,prtptr  + 4  ;    turn on italic
  155.         test    ah,4
  156.         jnz     t2a
  157.         mov     di,prtptr  + 6  ;    turn off italic
  158. t2a:    push    ax
  159.         push    dx
  160.         call    p2
  161.         pop     dx
  162.         pop     ax
  163.  
  164. t3:     test    al,2            ;  underline
  165.         jz      t4
  166.         mov     di,prtptr  + 8  ;    turn on underline
  167.         test    ah,2
  168.         jnz     t3a
  169.         mov     di,prtptr  + 10 ;    turn off underline
  170. t3a:    push    dx
  171.         call    p2
  172.         pop     dx
  173.  
  174. t4:     ;       print the character
  175.         mov     bl,dl
  176.         mov     al,[ttrans + bx]        ;  get character to print from table
  177.         or      al,al
  178.         jz      t8                      ;  '\0' means go to special table
  179.         xor     ah,ah
  180.         xor     dx,dx
  181.         int     17h
  182.  
  183. t5:     add     si,2
  184.         pop     cx
  185.         loop    t1              ; next character
  186.  
  187.         mov     di,offset crlf  ; end of line
  188.         call    p2
  189.         pop     cx
  190.         loop    t6              ; do next line
  191.  
  192.         ;       finally do an ending init
  193.         mov     di,offset endit
  194.         call    p2
  195.         ret
  196.  
  197. t6:     jmp     t0              ;  kludge to handle long size jump
  198.  
  199. t8:     ;       look up character in special table
  200.         push    si
  201.         mov     si,offset tspec - 4
  202. t8a:    add     si,4
  203.         cmp     word ptr [si],0
  204.         jz      t8b             ;  end of table - return
  205.         cmp     [si],dl
  206.         jnz     t8a             ;  loop till found
  207.  
  208.         add     si,2
  209.         mov     di,[si]         ;  get address of string to send
  210.         call    p2              ;    to the printer.
  211. t8b:    pop     si
  212.         jmp     t5
  213.  
  214. text    endp
  215.  
  216. ;       ------------------------------------------------------------------
  217. ;
  218. ;                          TOSHIBA GRAPHICS ROUTINES
  219. ;
  220. ;       ------------------------------------------------------------------
  221.  
  222. ;       graphics a - 320x200 graphics print
  223. tosgrfa proc    near
  224.         ret
  225. tosgrfa endp
  226.  
  227. ;       graphics b - 640x200 graphics print
  228. tosgrfb proc    near
  229.         ret
  230. tosgrfb endp
  231.  
  232. ;       graphics c - 640x350 graphics print
  233. tosgrfc proc    near
  234.         ;       set video segment to extended graphics
  235.         mov     ax,0a000h
  236.         mov     es,ax
  237.  
  238.         ;       initialize the printer
  239.         mov     di,offset gcinit
  240.         call    p2
  241.  
  242.         ;       setup 30 iterations
  243.         mov     cx,30           ;  cx = count of iterations
  244.         mov     bp,0            ;  bx = base row for iteration
  245.  
  246. gc1:    ;       line loop 
  247.         mov     di,offset gcline
  248.         call    p2
  249.  
  250.         ;       do for 640 columns
  251.         push    cx
  252.         mov     cx,640
  253.         xor     bx,bx
  254.  
  255. gc2:    ;       compute byte offset within memory
  256.         mov     si,bx
  257.         shr     si,1
  258.         shr     si,1
  259.         shr     si,1            ;  column / 8 = byte offset
  260.         add     si,bp           ;  add in row number
  261.  
  262.         ;       compute bit mask
  263.         push    cx
  264.         mov     cl,bl           
  265.         and     cl,7            ;  last three bits is bit offset
  266.         mov     ah,80h
  267.         shr     ah,cl
  268.  
  269.         ;       four bytes per pass
  270.         mov     cx,4
  271.         mov     di, offset gchold       ;  to store bitmaps
  272.  
  273. gc3:    ;       do 12 pixels
  274.         push    cx
  275.         mov     cx,3            ;  do 3 pixels per byte
  276.         xor     dx,dx           ;  blank dx
  277.  
  278. gc4:    shl     dl,1            ;  shift dl left
  279.         mov     al,ah           ;  put copy of bit mask in al
  280.         and     al,es:[si]      ;  check [si]
  281.         jz      gc5             ;  is bit on?
  282.         inc     dl              ;    if yes turn on bit for printer
  283.         shl     dl,1            ;  twice
  284.         inc     dl
  285.         jmp     gc6
  286. gc5:    shl     dl,1
  287. gc6:    add     si,80           ;  next row
  288.         loop    gc4 
  289.  
  290.         ;       end of byte - store in gchold
  291.         mov     [di],dl         ;  store in gchold
  292.         inc     di
  293.         pop     cx
  294.         loop    gc3             ;  do next 3 pixels
  295.  
  296.         ;       end of 12 pixels - send to printer (twice)
  297.         mov     cx,2
  298. gc7:    push    cx
  299. IF      DEBUG
  300.         push    bx
  301.         mov     ah,40h
  302.         mov     bx,handle
  303.         mov     dx,offset gchold
  304.         mov     cx,4
  305.         int     21h
  306.         pop     bx
  307. ELSE
  308.         mov     cx,4
  309.         mov     di,offset gchold
  310. gc8:    mov     al,[di]
  311.         xor     ah,ah
  312.         xor     dx,dx
  313.         push    di
  314.         int     17h
  315.         pop     di
  316.         inc     di
  317.         loop    gc8
  318. ENDIF
  319.         pop     cx
  320.         loop    gc7
  321.  
  322.         inc     bx              ;  move bx to next column
  323.         pop     cx
  324.         loop    gc2             ;  do next column
  325.  
  326.         ;       end of line
  327.         mov     di,offset crlf  ;  print newline
  328.         call    p2
  329.         add     bp,960          ;  add 12 lines to base
  330.         pop     cx
  331.         loop    gc1             ;  do next row
  332.  
  333.         ;       end of screen
  334.         mov     di,offset gcend
  335.         call    p2
  336.         ret
  337. tosgrfc endp
  338.  
  339. ;       ------------------------------------------------------------------
  340. ;
  341. ;                         LASERJET GRAPHICS ROUTINES
  342. ;
  343. ;       ------------------------------------------------------------------
  344.  
  345. ;       graphics a - 320x200 graphics print
  346. ljgrfa  proc    near
  347.         ret
  348. ljgrfa  endp
  349.  
  350. ;       graphics b - 640x200 graphics print
  351. ljgrfb  proc    near
  352.         ret
  353. ljgrfb  endp
  354.  
  355. ;       graphics c - 640x350 graphics print
  356. ljgrfc  proc    near
  357.         ;       set video segment to extended graphics
  358.         mov     ax,0a000h
  359.         mov     es,ax
  360.  
  361.         ;       initialize the printer
  362.         mov     di,offset gcinit
  363.         call    p2
  364.  
  365.         ;       setup 350 iterations
  366.         mov     cx,350          ;  cx = count of iterations
  367.         xor     si,si           ;  si = position on screen
  368.  
  369. lgc1:   ;       line loop
  370.         mov     di,offset gcline
  371.         call    p2
  372.  
  373.         ;       do for 80 bytes (640 columns)
  374.         push    cx
  375.         mov     cx,80
  376.  
  377. lgc2:   ;       get byte and print it
  378.         mov     al,es:[si]              ;  put character in al
  379.         xor     ah,ah
  380.         xor     dx,dx                   ;  printer 0
  381.         int     17h                     ;  print it
  382.         inc     si                      ;  move pointer to next byte
  383.         loop    lgc2
  384.  
  385.         pop     cx
  386.         loop    lgc1                    ;  do next line 
  387.  
  388.         mov     di,offset gcend
  389.         call    p2
  390.         ret
  391. ljgrfc  endp
  392.  
  393.  
  394. ;       null procedure for invalid video modes
  395. null    proc    near
  396.         ret
  397. null    endp
  398.  
  399. ;       Put a string out to the printer.
  400. ;       ds:di points to null terminated string
  401. puts    proc    near
  402. p1:     inc     di
  403.         xor     ah,ah
  404.         xor     dx,dx
  405.         int     17h                     ;  send to printer
  406.  
  407. p2:     mov     al,[di]
  408.         or      al,al
  409.         jnz     p1
  410.         ret
  411. puts    endp
  412.  
  413. main    proc    near
  414.         ;       setup pseg and pst
  415.         mov     cs:pseg,ss
  416.         mov     cs:pst,sp
  417.  
  418. IF      DEBUG
  419.         mov     ax,_DATA
  420.         mov     ds,ax
  421.  
  422.         ;       call int5
  423.         call    int5
  424.  
  425.         ;       quit
  426.         mov     ax,4c00h
  427.         int     21h
  428. ELSE
  429.  
  430.         ;       set int 5 offset
  431.         push    ds
  432.         mov     ax,_TEXT
  433.         mov     ds,ax
  434.         mov     dx,offset int5
  435.         mov     ax,2505h
  436.         int     21h
  437.         pop     ds
  438.  
  439.         ;       terminate and stay resident
  440.         mov     dx,100h
  441.         mov     ax,3100h
  442.         int     21h
  443. ENDIF
  444.  
  445. main    endp
  446. _TEXT   ends
  447.  
  448. _DATA   segment public word 'DATA'
  449. monoseg dw      0B000h  ;  monochrome video ram segment
  450. cgaseg  dw      0B800h  ;  color video ram segment
  451. apaseg  dw      0A000h  ;  APA segment (EGA high res)
  452. scrmode db      0       ;  current video mode
  453.  
  454. att     db      0       ;  current attribute bits represent bold, italic, underline
  455. crlf    db      13,10,0
  456.  
  457. IF      DEBUG
  458. handle  dw      0       ;  for file i/o (only in DEBUG mode)
  459. test    db      "test.123",0 ;  name for test file
  460. ENDIF
  461.  
  462. IF      PRINTER                 ;  set modes to Toshiba or LaserJet
  463. modes   dw      offset tosprocs
  464. ELSE
  465. modes   dw      offset  ljprocs
  466. ENDIF
  467.  
  468. ;       Table of routines for various video modes
  469. tosprocs dw     offset color    ;  mode 0  - 40x25 color/bw
  470.         dw      offset color    ;  mode 1  - 40x25 color
  471.         dw      offset color    ;  mode 2  - 80x25 color/bw
  472.         dw      offset color    ;  mode 3  - 80x25 color
  473.         dw      offset tosgrfa  ;  mode 4  - 320x200 color
  474.         dw      offset tosgrfa  ;  mode 5  - 320x200 color/bw
  475.         dw      offset tosgrfb  ;  mode 6  - 640x200 color/bw
  476.         dw      offset mono     ;  mode 7  - 80x25 mono
  477.         dw      offset null     ;  mode 8  - invalid mode
  478.         dw      offset null     ;  mode 9  - invalid mode
  479.         dw      offset null     ;  mode a  - invalid mode
  480.         dw      offset null     ;  mode b  - invalid mode
  481.         dw      offset null     ;  mode c  - invalid mode
  482.         dw      offset tosgrfa  ;  mode d  - 320x200 color
  483.         dw      offset tosgrfb  ;  mode e  - 640x200 color
  484.         dw      offset tosgrfc  ;  mode f  - 640x350 mono
  485.         dw      offset tosgrfc  ;  mode 10 - 640x350 high res
  486.  
  487. ljprocs dw      offset color    ;  mode 0  - 40x25 color/bw
  488.         dw      offset color    ;  mode 1  - 40x25 color
  489.         dw      offset color    ;  mode 2  - 80x25 color/bw
  490.         dw      offset color    ;  mode 3  - 80x25 color
  491.         dw      offset ljgrfa   ;  mode 4  - 320x200 color
  492.         dw      offset ljgrfa   ;  mode 5  - 320x200 color/bw
  493.         dw      offset ljgrfb   ;  mode 6  - 640x200 color/bw
  494.         dw      offset mono     ;  mode 7  - 80x25 mono
  495.         dw      offset null     ;  mode 8  - invalid mode
  496.         dw      offset null     ;  mode 9  - invalid mode
  497.         dw      offset null     ;  mode a  - invalid mode
  498.         dw      offset null     ;  mode b  - invalid mode
  499.         dw      offset null     ;  mode c  - invalid mode
  500.         dw      offset ljgrfa   ;  mode d  - 320x200 color
  501.         dw      offset ljgrfb   ;  mode e  - 640x200 color
  502.         dw      offset ljgrfc   ;  mode f  - 640x350 mono
  503.         dw      offset ljgrfc   ;  mode 10 - 640x350 high res
  504.  
  505. ;       table of attribute equivalents for possible attribute bytes
  506. ;       0 = normal, 2 = underline, 4 = reverse, 8 = bold, 10 = bold under
  507. attributes db   0,2,0,0,0,0,0,0,0,10,8,8,8,8,8,8,0,2,0,0,0,0,0,0,8,10,8,8,8,8
  508.         db      8,8,0,2,0,0,0,0,0,0,8,10,8,8,8,8,8,8,0,2,0,0,0,0,0,0,8,10,8,8
  509.         db      8,8,8,8,0,2,0,0,0,0,0,0,8,10,8,8,8,8,8,8,0,2,0,0,0,0,0,0,8,10
  510.         db      8,8,8,8,8,8,0,2,0,0,0,0,0,0,8,10,8,8,8,8,8,8,4,2,0,0,0,0,0,0
  511.         db      4,10,8,8,8,8,8,8
  512.  
  513. ;       table of printer escape codes
  514. prtptr  dw      offset boldon , offset boldoff 
  515.         dw      offset revon, offset revoff
  516.         dw      offset unlon, offset unloff
  517.  
  518. ;
  519. ;       Character translation tables
  520. ;
  521. ;       These tables tell PrtSc what to send to the printer for every
  522. ;       character on the screen.  Note that 032 (space) is used for all
  523. ;       non-printable characters.  000 is a special code that means "send
  524. ;       escape sequence" for this character.  Tspec is the lookup table for
  525. ;       escape sequences.
  526. ;
  527. ;       Note that the LaserJet does not really have box graphics chars.
  528. ;       In the ttrans table these are handled by escape sequences which 
  529. ;       shift to a box.lj font developed at Duke.  Others should change
  530. ;       the escape sequences or replace the 000s with 032s.
  531. ;
  532. IF      PRINTER 
  533. ;       TOSHIBA P351 data
  534. ;       Character translation table - handles control and extended ASCII
  535. ttrans  db      032,032,032,032,032,032,032,032,032,032,032,032,032,032,032
  536.         db      032,032,032,032,032,175,169,032,032,032,032,032,032,032,032
  537.         db      032,032,032,033,034,035,036,037,038,039,040,041,042,043,044
  538.         db      045,046,047,048,049,050,051,052,053,054,055,056,057,058,059
  539.         db      060,061,062,063,064,065,066,067,068,069,070,071,072,073,074
  540.         db      075,076,077,078,079,080,081,082,083,084,085,086,087,088,089
  541.         db      090,091,092,093,094,095,096,097,098,099,100,101,102,103,104
  542.         db      105,106,107,108,109,110,111,112,113,114,115,116,117,118,119
  543.         db      120,121,122,123,124,125,126,167,162,184,187,032,182,161,032
  544.         db      162,032,032,189,032,032,032,177,032,032,032,032,032,183,032
  545.         db      032,188,032,178,179,180,163,176,032,191,032,032,032,032,032
  546.         db      032,032,032,032,032,032,174,172,032,032,032,032,032,000,000
  547.         db      000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
  548.         db      000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
  549.         db      000,000,000,000,000,000,000,000,000,000,000,000,000,000,032
  550.         db      185,032,032,032,032,165,032,032,032,032,032,032,032,032,032
  551.         db      032,032,032,032,032,032,032,032,166,032,032,032,032,032,032
  552.         db      032
  553. ELSE                            ;  LaserJet
  554. ;       Character translation table - handles control and extended ASCII
  555. ttrans  db      032,032,032,032,032,032,032,032,032,032,032,032,032,032,032
  556.         db      032,032,032,032,032,175,169,032,032,032,032,032,032,032,032
  557.         db      032,032,032,033,034,035,036,037,038,039,040,041,042,043,044
  558.         db      045,046,047,048,049,050,051,052,053,054,055,056,057,058,059
  559.         db      060,061,062,063,064,065,066,067,068,069,070,071,072,073,074
  560.         db      075,076,077,078,079,080,081,082,083,084,085,086,087,088,089
  561.         db      090,091,092,093,094,095,096,097,098,099,100,101,102,103,104
  562.         db      105,106,107,108,109,110,111,112,113,114,115,116,117,118,119
  563.         db      120,121,122,123,124,125,126,252,180,207,197,192,204,200,212
  564.         db      181,193,205,201,221,209,217,216,208,220,215,211,194,206,202
  565.         db      195,203,239,218,219,191,187,188,032,190,196,213,198,199,183
  566.         db      182,249,250,185,032,032,248,247,184,251,253,032,032,032,000
  567.         db      000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
  568.         db      000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
  569.         db      000,000,000,000,000,000,000,000,000,000,000,000,000,000,032
  570.         db      222,032,032,032,032,032,032,032,032,032,032,032,032,032,032
  571.         db      032,254,032,032,032,032,032,032,179,032,032,032,032,032,252
  572.         db      032
  573. ENDIF
  574.  
  575. ;       Tspec is the lookup table for special characters.  It simply
  576. ;       contains character values and offsets to the beginning of the
  577. ;       escape sequence.  When PrtSc sees 000 in the character table
  578. ;       it will look down the tspec table until it finds an entry for
  579. ;       the character in question.  Note that tspec ends with two
  580. ;       words of 0.
  581. ;
  582. ;       At present only the 'box graphics' characters are included
  583. ;       here, but with downloadable fonts and > 256 character display
  584. ;       modes, the tspec table can be extended almost indefinitely.
  585. ;
  586. tspec   dw      179, offset ts10,       180, offset ts14
  587.         dw      181, offset ts14,       182, offset ts14
  588.         dw      183, offset ts7,        184, offset ts7
  589.         dw      185, offset ts14,       186, offset ts10
  590.         dw      187, offset ts7,        188, offset ts12
  591.         dw      189, offset ts12,       190, offset ts12
  592.         dw      191, offset ts7,        192, offset ts11
  593.         dw      193, offset ts13,       194, offset ts8
  594.         dw      195, offset ts9,        196, offset ts6
  595.         dw      197, offset ts15,       198, offset ts9
  596.         dw      199, offset ts9,        200, offset ts11
  597.         dw      201, offset ts5,        202, offset ts13
  598.         dw      203, offset ts8,        204, offset ts9
  599.         dw      205, offset ts6,        206, offset ts15
  600.         dw      207, offset ts13,       208, offset ts13
  601.         dw      209, offset ts8,        210, offset ts8
  602.         dw      211, offset ts11,       212, offset ts11
  603.         dw      213, offset ts5,        214, offset ts5
  604.         dw      215, offset ts15,       216, offset ts15
  605.         dw      217, offset ts12,       218, offset ts5
  606.         dw      219, offset ts0,        220, offset ts1
  607.         dw      221, offset ts2,        222, offset ts3
  608.         dw      223, offset ts4
  609.         dw      0,0
  610. ;
  611. ;       Escape codes to present box graphics characters.
  612. ;       Note that the LaserJet+ does not really have box
  613. ;       graphics characters.  These escape codes work for the
  614. ;       box.lj font developed at Duke.  Others should change
  615. ;       or delete these codes.  Note that all strings are null
  616. ;       terminated.
  617. ;
  618. IF      PRINTER                 ;  box graphics characters for Toshiba
  619. ts0     db      27,"=o",27,"?",0 ; 219
  620. ts1     db      27,"=h",27,"?",0 ; 220
  621. ts2     db      27,"=i",27,"?",0 ; 221
  622. ts3     db      27,"=j",27,"?",0 ; 222
  623. ts4     db      27,"=g",27,"?",0 ; 223
  624. ts5     db      27,"=p",27,"?",0 ; 218
  625. ts6     db      27,"=q",27,"?",0 ; 196
  626. ts7     db      27,"=r",27,"?",0 ; 191
  627. ts8     db      27,"=s",27,"?",0 ; 194
  628. ts9     db      27,"=t",27,"?",0 ; 195
  629. ts10    db      27,"=u",27,"?",0 ; 179
  630. ts11    db      27,"=v",27,"?",0 ; 192
  631. ts12    db      27,"=w",27,"?",0 ; 217
  632. ts13    db      27,"=x",27,"?",0 ; 293
  633. ts14    db      27,"=y",27,"?",0 ; 180
  634. ts15    db      27,"=z",27,"?",0 ; 197
  635. ELSE                            ;  LaserJet box graphics font
  636. ts0     db      27,41,49,88,14,73,27,41,50,88,15,0 ; 219
  637. ts1     db      27,41,49,88,14,74,15,27,41,50,88,0 ; 220
  638. ts2     db      27,41,49,88,14,75,15,27,41,50,88,0 ; 221
  639. ts3     db      27,41,49,88,14,76,15,27,41,50,88,0 ; 222
  640. ts4     db      27,41,49,88,14,77,15,27,41,50,88,0 ; 223
  641. ts5     db      27,41,49,88,14,72,15,27,41,50,88,0 ; 218
  642. ts6     db      27,41,49,88,14,50,15,27,41,50,88,0 ; 196
  643. ts7     db      27,41,49,88,14,45,15,27,41,50,88,0 ; 191
  644. ts8     db      27,41,49,88,14,48,15,27,41,50,88,0 ; 194
  645. ts9     db      27,41,49,88,14,49,15,27,41,50,88,0 ; 195
  646. ts10    db      27,41,49,88,14,33,15,27,41,50,88,0 ; 179
  647. ts11    db      27,41,49,88,14,46,15,27,41,50,88,0 ; 192
  648. ts12    db      27,41,49,88,14,71,15,27,41,50,88,0 ; 217
  649. ts13    db      27,41,49,88,14,47,15,27,41,50,88,0 ; 293
  650. ts14    db      27,41,49,88,14,34,15,27,41,50,88,0 ; 180
  651. ts15    db      27,41,49,88,14,51,15,27,41,50,88,0 ; 197
  652. ENDIF
  653. ;
  654. ;       Graphics mode codes
  655. IF      PRINTER                 ;   Toshiba
  656. gcinit  db      27,26,"I",27,"L07",0    ;  initialize the printer
  657. gcline  db      27,";1280",0            ;  begin image data transfer
  658. gchold  db      0,0,0,0,0
  659. gcend   db      12,27,26,"I",0          ;  reinitialize printer
  660. ELSE                            ;    LaserJet
  661. gcinit  db      27,"*t100R",27,"*r0A",0 ;  initialize the printer
  662. gcline  db      27,"*b80W",0            ;  begin image data transfer
  663. gchold  db      0,0,0,0,0
  664. gcend   db      27,"*rB",12,0           ;  reinitialize printer
  665. ENDIF
  666.  
  667. ;       Text mode codes
  668. IF      PRINTER                         ;  Toshiba escape sequences
  669. init    db      27,77,27,20,27,74,0
  670. boldon  db      27,"K3",0
  671. boldoff db      27,"M",0
  672. revon   db      27,"",0
  673. revoff  db      27,"",0
  674. unlon   db      27,"I",0
  675. unloff  db      27,"J",0
  676. endit   db      27,77,27,20,27,74,0
  677. ELSE                                    ;  LaserJet escape sequences
  678. init    db      15,27,41,50,88,0
  679. boldon  db      27,40,115,51,66,0
  680. boldoff db      27,40,115,48,66,0
  681. revon   db      27,40,115,48,83,0
  682. revoff  db      27,40,115,49,83,0
  683. unlon   db      27,38,100,68,0
  684. unloff  db      27,38,100,64,0
  685. endit   db      12,0
  686. ENDIF
  687.  
  688. _DATA   ends
  689.  
  690. _STACK  segment stack para 'STACK'
  691.         db      100h dup('TheStack')
  692. top     db      0
  693. _STACK  ends
  694.  
  695. end     main
  696.  
  697.