home *** CD-ROM | disk | FTP | other *** search
- On the PCjr, Graphics is GOLD!
-
- John Schnell
- New York IBM PC Users Group
-
- For the past two weeks I have had the
- opportunity to experiment with and
- write code for the PCjr, specifically
- in the area of graphics. The PCjr
- shapes up to be a first class
- graphics machine.
-
- Here are some of the special things I
- found.
-
- New commands: PALETTE
- PALETTE USING
- PCOPY
- SCREENS (3 through 6)
- CLEAR ,,,(video memory)
-
- The most exciting command is PALETTE.
- With this command you gain palette
- color independence in ALL modes. To
- understand the impact of the PALETTE
- command we have to look at what the
- IBM PC currently provides.
-
- The PC gives three normal SCREEN
- modes: 0 for text, 1 for medium
- resolution graphics and 2 for hi
- resolution graphics. The color
- choices are sixteen foreground colors
- and eight background colors when
- using text mode, four colors in
- medium res graphics, and two colors
- in hi resolution mode.
-
- Medium resolution graphics on the PC
- lets you assign any of sixteen colors
- for background. Two palettes contain
- standard foreground colors: palette 0
- gives colors green, red and yellow;
- palette 1 gives cyan, magenta and
- white. They come as sets and no
- substitutions are allowed. The hi
- resolution graphics contains only
- white pixels against a black
- background.
-
- Playing with the PC's mode and color
- registers will give you new intensity
- combinations for foreground and
- background in medium res, and any of
- sixteen colors for foreground against
- a black background in hi res mode.
- And that's it, unless you go to
- programming beyond standard BASIC.
-
- The IBM PCjr, however, has four new
- screen options, 3 thru 6, and here is
- what they provide:
-
- o Screen 3 -- Low resolution
- graphics, 160 by 200 pixels, with
- 16 colors and 20 characters per
- line for 25 lines. All graphics
- commands work in this mode, and
- you use 16K of RAM memory per
- screen.
-
- o Screen 4 -- Same as the PC
- screen 1, medium resolution
- limited to four colors, but
- PAGING is permitted. This means
- that you can display one screen
- while constructing another, which
- is handy for games or drawing
- programs. At 16K per screen you
- must set aside double the screen
- memory using a new parameter in
- CLEAR command.
-
- o Screen 5 -- Medium resolution
- with SIXTEEN colors! This is the
- capability we have been waiting
- for. Now drawings, diagrams and
- graphs can have the richness
- we've always wanted. To store
- that much color information means
- we must devote four bits to
- defining each pixel. That adds up
- to double the amount of memory
- devoted to screen display, 32K,
- and again, this must be CLEARed
- first.
-
- o Screen 6 -- Hi resolution (640
- by 200) with any four colors for
- more precise drawings and
- diagrams, including 80 characters
- across, same as PC screen 2. 32K
- per screen is also required in
- this mode.
-
- By past PC convention, each of the
- sixteen colors has been assigned a
- number. 0 is black, 1 is blue, etc.
- The PALETTE command lets you
- re-assign NEW colors to each of these
- numbers. Now when working in medium
- resolution under screen 1, you can
- use ANY FOUR of the sixteen colors in
- your graphics, or use ANY TWO colors
- in screen 2 hi res. PALETTE lets the
- colors be changed at any time. This
- opens up all kinds of opportunities
- for animation, games and dynamic
- charts and graphs.
-
- Animation, for example, might be done
- this way: Using the PALETTE command,
- assign blue to color numbers 0,1,2
- and 3. This lets you draw three
- steps of an animated figure, all blue
- on blue, across the screen without
- any of the drawings showing. To
- animate, you simply cycle through the
- drawings like this. Assign white to
- 1, making the first drawing visible;
- then assign white to 2, making the
- second drawing visible;assign blue to
- 1; assign white to 3 and blue to 2;
- then assign white to 1 again and blue
- to 3, and so forth. The effect will
- be a white figure snapping through
- three positions across the screen,
- creating rapid animation. When
- combined with several screen pages,
- this can be quite effective.
-
- This manipulation with the PALETTE
- command is sometimes known as "Color
- Lookup Table Animation". The PALETTE
- USING command lets you re-assign all
- SIXTEEN colors in one command through
- the values stored in a
- sixteen-element integer array.
-
- The other new command which utilizes
- the expanded paging capability is
- PCOPY, which lets you copy from a
- SOURCE page to a DESTINATION page.
- This is a necessary tool when you are
- doing "page animation" or preserving
- a complex working drawing before
- trying a tricky paint process.
-
- I would like to mention that on the
- PCjr the upper 128 extended ASCII
- characters are available under the
- graphics modes as well. They are
- stored along with the lower 128 ASCII
- characters in the BIOS ROM.
- (Attention PC GRAPHICS PROGRAMMERS:
- For those who have not defined their
- own versions of the extended sets,
- you can now just copy them out of
- PCjr ROM onto a disk file, then load
- them into the PC and set up the
- alternate character set pointers.
- This makes it possible to get quality
- screen dumps of those special
- characters using screens 1 and 2.)