Microsoft KB Archive/71794

= Why Graphics Screen Printing Is Usually In Landscape Mode =

Article ID: 71794

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b

-



This article was previously published under Q71794



SUMMARY
Elsewhere in this Knowledge Base, Microsoft provides sample programs for printing a Basic graphics screen to an Epson printer. These sample programs all use the landscape mode of printing. Landscape mode means that the screen image is turned sideways on the printer output. Below is an explanation of why the sample programs use landscape mode instead of portrait mode.



MORE INFORMATION
For code examples of printing the various Basic graphics SCREEN modes to an Epson printer, search for the following words:

Epson and print and screen and QuickBasic

The landscape format is used in these sample programs for two main reasons:

 Basic graphics SCREEN modes are wider (more pixels across the screen) than they are tall (less pixels from the top to the bottom of the screen). A printer in landscape mode uses the paper in an orientation similar to the physical screen; the paper page is longer than it is wide. The physical printer pins on an Epson-style dot matrix printer are arranged vertically, as follows:

Pin number:

8

7

6

5

4

3

2

1

0



When you pass a byte of graphics data to the printer, each bit in that byte corresponds to one of the first eight printer pins (0-7). If the bit in the data byte is set, the printer pin fires.

Because video memory is laid out in horizontal scan lines, it has to be &quot;turned sideways&quot; so that the scan-line data can be sent directly to the printer; thus, the data from a horizontal scan line in video memory corresponds correctly to the vertical orientation of the printer pins.

How to Print with Portrait Mode Instead of Landscape Mode
To print video memory in portrait mode on a dot matrix printer, you have to examine video memory &quot;sideways,&quot; taking into account the actual layout of video memory for the chosen screen mode, and taking the nth bit from each of a group of eight scan lines to form a data byte that could be sent to the printer. Bitwise operations in Basic can be performed with the AND and OR operators, for example IF AND 2 ^ n THEN = OR 2 ^ n will check the nth bit in and set the corresponding bit in if that bit is set in.

The layout of a given SCREEN mode in video memory can be found in several reference books, including:


 * 1) &quot;Programmer's Guide to PC and PS/2 Video Systems&quot; by Richard Wilton, published by Microsoft Press.
 * 2) &quot;PC Programmer's Source Book&quot; by Thom Hogan, published by Microsoft Press.

Additional query words: QuickBas BasicCom

Keywords: KB71794

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.