FASTDUMP.COM Version 1.1 13 May 1990 Peter M. Thompson Systems Technology, Inc. ----------------------- BULLENTIN BOARD MESSAGE ----------------------- Title: General Text and Graphics Screen Dump TSR Keywords: CGA HERCULES EGA VGA EPSON PROPRINTER LASERJET FASTDUMP.COM is a fast, general purpose TSR (7.2 Kbytes) which supports the above screens and printers. Suggested shareware cost is $10 or $20. Output can be landscape (1 to a page) or portrait (1, 2, or 3 to a page). Laserjet times range from 3, yes 3!, to 30 secs. Dot matrix times are slower, but putting 3 screens on a page helps. Source code available by mail. Uploaded by author. ------- SUMMARY ------- FASTDUMP.COM is a TSR (Terminate and Stay Resident) screen dump program which can read from any of the following screens: Text (25 or 43 lines) CGA (320x200 or 640x200) Hercules (720x348) EGA (320x200, 640x200, 640x350, or 640x350/mono) VGA (640x480, 640x480/mono, 320x200) The screen mode can be automatically determined, which is the preferred choice. Hercules graphics, however, must be explicitly chosen. All non-background colors are mapped to black. The output can be sent to any of the following printers (and compatibles): Epson dot matrix (low, medium, or high density) IBM Proprinter dot matrix (low, medium, or high density) HP Laser Jet (75, 100, 150, or 300 DPI) The following orientations and sizes of the printer outputs are possible (from graphics screens): Landscape: full page Portrait: full page Portrait: 2 to a page Portrait: 3 to a page The printers can be connected to either parallel or serial ports, and there are several different ways to access these ports. Alternatively, the output can be directed to a file: Parallel ports LPT1, LPT2, LPT3 (direct write to output ports) Parallel ports LPT1, LPT2, LPT3 (use ROM BIOS level interrupts) Serial ports COM1, COM2 (use ROM BIOS level interrupts) Standard DOS output to LPT1 (use DOS level interrupt) Alternatively, the output can be directed to a file. The filename is FD.nnn, where nnn is the next available number, and the file is located on the current directory. Copy the file to the printer using the DOS copy command, for example "copy FD.1 LPT1:/b". Use the /b switch to indicate a binary file transfer. Fast speed is obtained by direct memory fetches and by writing directly to the output ports. Optionally, though slower, DOS calls can be made to fetch from the screen and write to the printer. In order to track the progress of the screen dump, a small bar moves either down the screen or across the bottom. ------------------ SETUP INSTRUCTIONS ------------------ Type FASTDUMP, and then the following options are available: p = answer prompts for the above options q = quit s = share ware information c = current status ? = instructions for command line parameters Enter "p" and then follow the prompts. Default options are available by entering just a return. Command line parameters, separated by blanks, are suggested at the end of the prompt session. The memory resident portion of the TSR is 7.2 Kbytes. ---------------------- OPERATING INSTRUCTIONS ---------------------- After installing FASTDUMP, the screen dump is activated by using Shift-PrtSc. Any former use of Shift-PrtSc is lost. The parameters can be changed by re-installing the program. Re-installation changes data parameters in the memory resident portion and does not use up any more memory. The 2 and 3 to a page portrait outputs send a form feed respectively after the 2nd and 3rd output. If you wish to start again at the top of the page: manually form feed, and then re-install FASTDUMP. ---------------------- SHARE WARE INFORMATION ---------------------- Please send $10 if you use FASTDUMP, or $20 if you think it is really neat. The cost is per CPU. Give yourself a quantity break if you or your group has many CPU's. Send to: Program FASTDUMP Systems Technology, Inc. 13766 So. Hawthorne, Blvd. Hawthorne, CA 90250 Systems Technology, Inc. (STI) will mail you source code on a diskette for $50. If you are adept at assembly language you can carve out a smaller version for a particular screen and printer. Probably the best use for the source code is to make an assembly language subroutine callable from a BASIC or C program. FASTDUMP is copyrighted by myself, Peter M. Thompson, and STI; and we do place some restrictions on the use of the source code. Derivative programs are meant for your personal use or for use within a small group. Use of the screen dump code in a commercial program whose primary purpose is screen dumps is not allowed. If the screen dump code is included in any other type of commercial program then a one-time license fee of $100 should be mailed to the above address. Our copyright does not have to appear. ------------- THE ALGORITHM ------------- Algorithm? Give me a break. Set the screen segment offset, loop through the rows and columns, convert the screen bytes to printer bytes, and then send the bytes to the printer. This is basically what FASTDUMP does, and the fact that there are 10 screens, 3 printers, 2 orientations, and 4 sizes just means that there are more than the usual number of choices to make at each step. It is of course not that simple, with the main problem being that the number of screen pixels do not usually map in a nice way to the number of printer pixels. The core algorithm in FASTDUMP maps ANY rectangular block of screen pixels to ANY rectangular block of printer pixels. A two dimensional generalization of the famous Bresenham integer line mapping algorithm is used to do this (for the 1 dimensional version see J.E. Bresenham, IBM Systems Journal 4 (1) 1965, pp. 25-30; or almost any computer graphics book). The advantage of this type of algorithm is that the number of screen and printer pixels do not have to be integer ratios, and therefore you have the ability to set visually pleasing printer aspect ratios. The integer mapping algorithm, besides being fast, insures that the printer result is "optimally" smooth. This general area mapping algorithm is initialized depending on your choice of one landscape and three portrait outputs. Only these options, and not the full generality, are available to TSR users. The subroutine version of FASTDUMP, available by mail, allows the full generality, and makes it possible, for example, to enlarge the upper left hand corner of the screen to a full printer, or a full screen to a 300 DPI postage stamp. ------ PORTS ------ A gruesome amount of output port options are available. Here is all that you probably have to know: 1 = parallel printer 0 = serial printer To initialize the serial port for a HP LaserJet at 9600 Baud use the following DOS commands: MODE COM1:9600,n,8,1,p MODE LPT1:=COM1: Now if you want to know more, read on, otherwise skip to the next section. The output port options are divided into four groups: (1) The lowest level options (1,2,3) write directly to the parallel ports LPT1,2,3. The locations of the ports are obtained from the respective memory locations at segment 40, offsets 8,10,12. (2) The next lowest level of options (4,5,6) access the parallel ports LPT1,2,3 via the ROM BIOS interrupt 17h. Function 0 is used to send a byte, followed by function 2 to check for errors. The attempts is repeated until the error condition is cleared. These options are the same speed as options 1,2,3. (3) The same level of options (7,8) can be used to access the serial ports COM1,2. The ROM BIOS Int 14h, function 1 is used to send one byte. This function returns with an error code, and if an error has occured the call is repeated until the error condition is cleared. (4) The highest level option (0) accesses the parallel port LPT1 using the DOS Int 21h, function 5. You would not ordinarily use this option for parallel printers because it takes 2 to 3 times longer. If LPT1 is redirected to a serial port then this option takes the same length of time as 7 or 8. If you are using an HP Laser Jet with a serial port, then use the printer control panel to set 9600 Baud, XON=ON, and PTR=HI. The HP Laserjet uses no parity, has 8 data bits, and 1 stop bit. Setup the serial port with the DOS command MODE COM1:9600,n,8,1,p. If the standard DOS output is used to access the serial port, which results in the same times as above, then use the same MODE command as above and redirect the LPT1 port with a 2nd mode command MODE LPT1:=COM1:. -------------- PRINT SPOOLERS -------------- Before using a print spooler, ask yourself if you really want to. The files for graphic screen dumps can be quite large, anywhere from 60 Kbytes to 360 Kbytes. Check to make sure that your print spooler can efficiently handle large files. It may take almost as long to go to the spooler as going to the printer. The spooler, if it is to be used, must be able to capture the output stream. The direct writes to the output port (options 1,2,3) almost certainly will not be captured. On the other hand, the ROM BIOS interrupts (options 4-8) probably will be captured. The DOS interrupt (option 0) is the most likely to be captured. ------------------------------------ EPSON AND IBM PROPRINTER PERFORMANCE ------------------------------------ The speed of the screen dump program depends on the screen resolution, the CPU clock speed, the communications channel, the printer resolution, and the printer hardware time. The limiting factor, i.e. the bottleneck, depends on the type of hardware which you have. Its not easy to predict the times, so I'll settle for using my equipment as a test case (a 20 Mhz CPU, an Epson compatible printer, and a HP LaserJet Series II): If dot matrix printers are used then the printer hardware speed is the limiting factor. Faster CPUs won't help. Here are the times for my dot matrix printer: landscape: full page 160 seconds portrait: full page 80 seconds portrait: 1/2 page 80 seconds each time portrait: 1/3 page 40 seconds each time FASTDUMP does not have any special claim to being a speed demon when using a dot matrix printer. If you don't need full size plots, however, you'll find the 1/2 and 1/3 page options to be quite nice. The following bit image sizes are used on Epson and IBM proprinter printers: landscape: full page 800x640 portrait: full page 840x300 portrait: 1/2 page 840x300 portrait: 1/3 page 640x200 The 1st number is the number of horizontal bits, at the medium resolution of 120 DPI. For low resolution divide by 2, and for high resolution multiply by 2. High resolution is not recommended, because only 1 pass per line is used, and the printer head, at least on my printer, skips every other bit. The 2nd number in the above table is the number of vertical bits, at 72 DPI, which is independent of the chosen resolution. ------------------------------ LASERJET PERFORMANCE, PARALLEL ------------------------------ FASTDUMP does much better when connected to a laser printer. When set at 150 DPI resolution and connected via a parallel port: landscape: full page 8 seconds portrait: full page 12 seconds portrait: 1/2 page 12 seconds each time portrait: 1/3 page 8 seconds each time The above times assume that FASTDUMP is set up to go directly to the parallel port (any of port options 1 thru 6). If the standard DOS output is used (port option 0) then multiply the above times by 2. When the laser printer is set at 300 DPI and is connected by a parallel port, multiply the portrait times by 3, and for 75 DPI divide the portrait times by 3. Why 3 (as opposed to 4) I'm not sure, but that's what I measured. The landscape times are discussed in the next paragraph. If your CPU operates at 10 Mhz (as opposed to 20) add 2 to 4 seconds to the above times. Just as for dot matrix printers, it is not the CPU speed which is the limiting factor. If the parallel port is used, then the limiting factor for laser printer speed is the response time of the printer. The landscape times on the HP LaserJet remain the same no matter what resolution you choose, but that is because the program ignores your choice and uses either 75 or 100 DPI. It turns out that for landscape plots it is possible to get good screen to printer mappings with either one or two printer pixels per screen pixel. If you have an integer ratio like this then there is nothing to be gained by going to a higher printer resolution, so FASTDUMP doesn't let you make this mistake. The printer aspect ratio is adjusted by backing up from 0 to 3 decipoints (0 to 3/720 inches) between each line. The printer bit image sizes (for laserjets) are listed below: landscape: (from CGA, 75 DPI) 640x400 landscape: (from Hercules, 75 DPI) 720x348 landscape: (from EGA, 75 DPI) 640x350 landscape: (from VGA, 100 DPI) 640x480 portrait: full page (150 DPI) 1080x650 portrait: 1/2 page (150 DPI) 1080x650 portrait: 1/3 page (150 DPI) 800x460 The portrait resolutions can be adjusted to 75, 100, 150, or 300 DPI, which changes the above numbers appropriately. For landscape images, the resolutions entered by the user are ignored, and the resolutions listed above are used. ---------------------------- LASERJET PERFORMANCE, SERIAL ---------------------------- If the laser printer is set at 150 DPI resolution and is connected by a 9600 Baud serial port, then: landscape: full page 29 seconds portrait: full page 91 seconds portrait: 1/2 page 91 seconds each time portrait: 1/3 page 47 seconds each time There is a lesson to be learned here: don't use the serial port for graphics screen dumps. The only excuse I can think of is if you are connected via a network. In any case, the limiting factor is the communications time. For the full page and half page portrait outputs, then printer pixel image (at 150 DPI) contains 1080x650 = 702,000 bits. Add 2 bits per byte for serial overhead to make a total of 1080x650x1.25 = 877,500 bits. At 9600 baud (bits/sec, including overhead bits) it takes 877,500/9600 = 91 seconds to transmit. All of the above times (dot matrix and laser jet) were recorded using an EGA screen mode. The times will be virtually identical for CGA, Hercules, and VGA screens. The only exception to this is if you use the standard DOS screen, because only in this case does the time it takes to read the screen become important. The times for the standard DOS screen are much slower, up to 10 times slower, than the above times. By "standard DOS screen" it is meant that the graphics image is read using interrupts (Int 10h). ----------- HP DESKJETS ----------- Fastdump can be used with HP Deskjet printers. The Deskjet extends the Laserjet Series II printer command language to include data compression commands, but these newer commands are not used by Fastdump. The potential time savings with these commands will have to wait until a later day. ------------------------ GRAPHICS SCREEN SEGMENTS ------------------------ The following segment locations are assumed for the graphics screens: CGA b800h Hercules b000h EGA a000h VGA a000h The CGA screens have two interleaves, and the Hercules screen has four interleaves. Paging schemes which store multiple images at different locations may not be read properly. Also, EGA screens with only 64 Kbytes of memory may not be read properly. ------------ TEXT SCREENS ------------ Text screens are read using interrupts (Int 10h), but since the number of characters on a text screen is small compared to the number of pixels on a graphics screen, the time it takes to read the screen is not oppressive. The advantage of using the interrupts is that different screen pages are easier to keep track of. If you use landscape output (on a laserjet), then the text screens are printed in the landscape mode. Form feeds are not used for text screen dumps, and therefore must be manually entered. ------- HISTORY ------- FASTDUMP.COM started life as an assembly language subroutine for a computer-aided-design package: Program CC, which is used for systems and control theory analysis and design. I am the author of Program CC, and Systems Technology Inc. (STI) distributes and supports the program. STI is mainly a systems and control consulting outfit, but befitting the times we live in, a small part of the company is devoted to software sales. The lack of good screen dump facilities has been a constant problem. The screen dump programs that I'm are aware of, either of the commercial, share-ware, or free-ware variety, all suffer from being either too slow or too limited. Maybe I'm just too picky, but out of frustration I just wrote my own. I have recently made a TSR version of the screen dump program, and STI has agreed to distribute it via the share-ware market as an experiment. Hopefully, and with your help, this experiment will be profitable. FASTDUMP.COM is quite general, and to laser printers with parallel ports at least, quite fast. I have some ideas (paging, buffering, and print spooling) for making it even more general and even faster, but I'll wait and judge the Version 1.00 response.