home *** CD-ROM | disk | FTP | other *** search
- Dumping Graphics Screens from BASIC
-
- Mark Minasi
- Capitol PC Users Group
-
- At a graphics seminar held here
- recently, a lot of interest was
- generated by the discussion of
- dumping graphic screens to dot-matrix
- printers. In this article, I'll cover
- three issues:
-
- 1. Activating the Print Screen
- function from BASIC, so a screen
- can be printed without the user
- having to press the PrtSc key.
-
- 2. Modifying the DOS 2.0
- GRAPHICS.COM program to work on
- Epson-like printers, such as the
- Gemini, COEX, IBM Graphics
- Printer, Mannesman-Tally MT160,
- etc.
-
- 3. Using the GRAPHICS.COM program
- under DOS 1.1.
-
- The DOS 2.0 GRAPHICS.COM program
- allows you to dump a graphic screen
- to the IBM 5152 graphics printer, a
- printer similar to the Epson MX80. To
- activate it, just type GRAPHICS once
- from DOS. From that point on, a
- graphic screen can be printed with an
- IBM Graphics Printer by just pressing
- Shift-PrtSc.
-
- Suppose you have an application
- program that should dump a screen as
- a matter of course. You don't want
- the user to have to intervene
- manually and press the PrtSc key. The
- solution is simple. The code to print
- the screen is pointed to by a
- software interrupt vector, INT 05.
- You need only run a short machine
- language program to invoke interrupt
- 5. The following code does that:
-
- 10 REM program to demonstrate forcing
- a printscreen from BASIC(A).
- 20 REM this pokes the following
- program into an array and calls
- it:
- 30 REM
- 40 REM INT 05
- 50 REM RET (far)
- 60 REM
- 70 REM
- 90 DIM A(10)
- 100 PRINTSCREEN=VARPTR(A(0))
- 110 DEF SEG:FOR J=PRINTSCREEN TO
- PRINTSCREEN +2:READ K:POKE
- J,K:NEXT
- 120 DATA &hcd, &h05, &hcb
- 130 REM The next line is a sample
- calling sequence..Use all of it..
- 140 DEF SEG:PRINTSCREEN=VARPTR(A(0)):
- CALL PRINTSCREEN
-
- Line 90 makes room for the two-line
- machine language program. Lines
- 100-120 load it into memory. (It need
- only be done once.) Line 140 is a
- sample call. The DEF SEG ensures that
- BASIC is looking in the correct
- segment for the routine, and the
- VARPTR function finds the current
- location of the routine The re-use of
- VARPTR is essential as the location
- of arrays CHANGES each time you use a
- new scalar variable.
-
- The second item concerns the fact
- that GRAPHICS.COM does not work on
- some Epson-like printers. The
- graphics are dumped, but with extra
- bands of blank space throughout the
- graphic dump. This is due to a
- variation in line feed length for
- different printers, and it can be
- adjusted by changing one byte of the
- program. (If you have an Okidata,
- Prowriter, or some printer that does
- not even attempt to mimic Epson
- codes, this will not work.) Use
- DEBUG:
-
- A>DEBUG GRAPHICS.COM
- -E 0169
- xxxx:0169 18.nn
- (xxxx will vary, nn is what
- gets entered)
- -W
- Writing 0315 bytes
- -Q
- A>GRAPHICS
-
- This should work for any
- Epson-compatible printer with a
- graphics capability.
-
- The third point is of interest to
- those using DOS 1.1. GRAPHICS.COM
- works under DOS 1.1! Just COPY it
- from a 2.0 disk to a 1.1 disk, and it
- works fine.