home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / MISC / TNH_PC.ZIP / MINASI.NL < prev    next >
Encoding:
Text File  |  1987-01-14  |  3.1 KB  |  118 lines

  1. Dumping Graphics Screens from BASIC
  2.  
  3.               Mark Minasi
  4.         Capitol PC Users Group
  5.  
  6. At a graphics seminar held here
  7. recently, a lot of interest was
  8. generated by the discussion of
  9. dumping graphic screens to dot-matrix
  10. printers. In this article, I'll cover
  11. three issues:
  12.  
  13. 1.  Activating the Print Screen
  14.     function from BASIC, so a screen
  15.     can be printed without the user
  16.     having to press the PrtSc key.
  17.  
  18. 2.  Modifying the DOS 2.0
  19.     GRAPHICS.COM program to work on
  20.     Epson-like printers, such as the
  21.     Gemini, COEX, IBM Graphics
  22.     Printer, Mannesman-Tally MT160,
  23.     etc.
  24.  
  25. 3.  Using the GRAPHICS.COM program
  26.     under DOS 1.1.
  27.  
  28. The DOS 2.0 GRAPHICS.COM program
  29. allows you to dump a graphic screen
  30. to the IBM 5152 graphics printer, a
  31. printer similar to the Epson MX80. To
  32. activate it, just type GRAPHICS once
  33. from DOS. From that point on, a
  34. graphic screen can be printed with an
  35. IBM Graphics Printer by just pressing
  36. Shift-PrtSc.
  37.  
  38. Suppose you have an application
  39. program that should dump a screen as
  40. a matter of course. You don't want
  41. the user to have to intervene
  42. manually and press the PrtSc key. The
  43. solution is simple. The code to print
  44. the screen is pointed to by a
  45. software interrupt vector, INT 05.
  46. You need only run a short machine
  47. language program to invoke interrupt
  48. 5. The following code does that:
  49.  
  50. 10 REM program to demonstrate forcing
  51.    a printscreen from BASIC(A).
  52. 20 REM this pokes the following
  53.    program into an array and calls
  54.    it:
  55. 30 REM
  56. 40 REM INT 05
  57. 50 REM RET (far)
  58. 60 REM
  59. 70 REM
  60. 90 DIM A(10)
  61. 100 PRINTSCREEN=VARPTR(A(0))
  62. 110 DEF SEG:FOR J=PRINTSCREEN TO
  63.     PRINTSCREEN +2:READ K:POKE
  64.     J,K:NEXT
  65. 120 DATA &hcd, &h05, &hcb
  66. 130 REM The next line is a sample
  67.     calling sequence..Use all of it..
  68. 140 DEF SEG:PRINTSCREEN=VARPTR(A(0)):
  69.     CALL PRINTSCREEN
  70.  
  71. Line 90 makes room for the two-line
  72. machine language program. Lines
  73. 100-120 load it into memory. (It need
  74. only be done once.) Line 140 is a
  75. sample call. The DEF SEG ensures that
  76. BASIC is looking in the correct
  77. segment for the routine, and the
  78. VARPTR function finds the current
  79. location of the routine The re-use of
  80. VARPTR is essential as the location
  81. of arrays CHANGES each time you use a
  82. new scalar variable.
  83.  
  84. The second item concerns the fact
  85. that GRAPHICS.COM does not work on
  86. some Epson-like printers. The
  87. graphics are dumped, but with extra
  88. bands of blank space throughout the
  89. graphic dump. This is due to a
  90. variation in line feed length for
  91. different printers, and it can be
  92. adjusted by changing one byte of the
  93. program. (If you have an Okidata,
  94. Prowriter, or some printer that does
  95. not even attempt to mimic Epson
  96. codes, this will not work.) Use
  97. DEBUG:
  98.  
  99. A>DEBUG GRAPHICS.COM
  100. -E 0169
  101. xxxx:0169 18.nn
  102.        (xxxx will vary, nn is what
  103.            gets entered)
  104. -W
  105. Writing 0315 bytes
  106. -Q
  107. A>GRAPHICS
  108.  
  109. This should work for any
  110. Epson-compatible printer with a
  111. graphics capability.
  112.  
  113. The third point is of interest to
  114. those using DOS 1.1. GRAPHICS.COM
  115. works under DOS 1.1! Just COPY it
  116. from a 2.0 disk to a 1.1 disk, and it
  117. works fine.
  118.