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

  1. On the PCjr, Graphics is GOLD!
  2.  
  3.              John Schnell
  4.       New York IBM PC Users Group
  5.  
  6. For the past two weeks I have had the
  7. opportunity to experiment with and
  8. write code for the PCjr, specifically
  9. in the area of graphics.  The PCjr
  10. shapes up to be a first class
  11. graphics machine.
  12.  
  13. Here are some of the special things I
  14. found.
  15.  
  16. New commands: PALETTE
  17.       PALETTE USING
  18.       PCOPY
  19.       SCREENS (3 through 6)
  20.       CLEAR ,,,(video memory)
  21.  
  22. The most exciting command is PALETTE.
  23. With this command you gain palette
  24. color independence in ALL modes.  To
  25. understand the impact of the PALETTE
  26. command we have to look at what the
  27. IBM PC currently provides.
  28.  
  29. The PC gives three normal SCREEN
  30. modes: 0 for text, 1 for medium
  31. resolution graphics and 2 for hi
  32. resolution graphics.  The color
  33. choices are sixteen foreground colors
  34. and eight background colors when
  35. using text mode, four colors in
  36. medium res graphics, and two colors
  37. in hi resolution mode.
  38.  
  39. Medium resolution graphics on the PC
  40. lets you assign any of sixteen colors
  41. for background.  Two palettes contain
  42. standard foreground colors: palette 0
  43. gives colors green, red and yellow;
  44. palette 1 gives cyan, magenta and
  45. white.  They come as sets and no
  46. substitutions are allowed.  The hi
  47. resolution graphics contains only
  48. white pixels against a black
  49. background.
  50.  
  51. Playing with the PC's mode and color
  52. registers will give you new intensity
  53. combinations for foreground and
  54. background in medium res, and any of
  55. sixteen colors for foreground against
  56. a black background in hi res mode.
  57. And that's it, unless you go to
  58. programming beyond standard BASIC.
  59.  
  60. The IBM PCjr, however, has four new
  61. screen options, 3 thru 6, and here is
  62. what they provide:
  63.  
  64. o   Screen 3  --  Low resolution
  65.     graphics, 160 by 200 pixels, with
  66.     16 colors and 20 characters per
  67.     line for 25 lines.  All graphics
  68.     commands work in this mode, and
  69.     you use 16K of RAM memory per
  70.     screen.
  71.  
  72. o   Screen 4  --  Same as the PC
  73.     screen 1, medium resolution
  74.     limited to four colors, but
  75.     PAGING is permitted.  This means
  76.     that you can display one screen
  77.     while constructing another, which
  78.     is handy for games or drawing
  79.     programs.  At 16K per screen you
  80.     must set aside double the screen
  81.     memory using a new parameter in
  82.     CLEAR command.
  83.  
  84. o   Screen 5  --  Medium resolution
  85.     with SIXTEEN colors!  This is the
  86.     capability we have been waiting
  87.     for.  Now drawings, diagrams and
  88.     graphs can have the richness
  89.     we've always wanted.  To store
  90.     that much color information means
  91.     we must devote four bits to
  92.     defining each pixel. That adds up
  93.     to double the amount of memory
  94.     devoted to screen display, 32K,
  95.     and again, this must be CLEARed
  96.     first.
  97.  
  98. o   Screen 6  --  Hi resolution (640
  99.     by 200) with any four colors for
  100.     more precise drawings and
  101.     diagrams, including 80 characters
  102.     across, same as PC screen 2.  32K
  103.     per screen is also required in
  104.     this mode.
  105.  
  106. By past PC convention, each of the
  107. sixteen colors has been assigned a
  108. number.  0 is black, 1 is blue, etc.
  109. The PALETTE command lets you
  110. re-assign NEW colors to each of these
  111. numbers.  Now when working in medium
  112. resolution under screen 1, you can
  113. use ANY FOUR of the sixteen colors in
  114. your graphics, or use ANY TWO colors
  115. in screen 2 hi res. PALETTE lets the
  116. colors be changed at any time.  This
  117. opens up all kinds of opportunities
  118. for animation, games and dynamic
  119. charts and graphs.
  120.  
  121. Animation, for example, might be done
  122. this way:  Using the PALETTE command,
  123. assign blue to color numbers 0,1,2
  124. and 3.  This lets you draw three
  125. steps of an animated figure, all blue
  126. on blue, across the screen without
  127. any of the drawings showing.  To
  128. animate, you simply cycle through the
  129. drawings like this.  Assign white to
  130. 1, making the first drawing visible;
  131. then assign white to 2, making the
  132. second drawing visible;assign blue to
  133. 1; assign white to 3 and blue to 2;
  134. then assign white to 1 again and blue
  135. to 3, and so forth.  The effect will
  136. be a white figure snapping through
  137. three positions across the screen,
  138. creating rapid animation.  When
  139. combined with several screen pages,
  140. this can be quite effective.
  141.  
  142. This manipulation with the PALETTE
  143. command is sometimes known as "Color
  144. Lookup Table Animation".  The PALETTE
  145. USING command lets you re-assign all
  146. SIXTEEN colors in one command through
  147. the values stored in a
  148. sixteen-element integer array.
  149.  
  150. The other new command which utilizes
  151. the expanded paging capability is
  152. PCOPY, which lets you copy from a
  153. SOURCE page to a DESTINATION page.
  154. This is a necessary tool when you are
  155. doing "page animation" or preserving
  156. a complex working drawing before
  157. trying a tricky paint process.
  158.  
  159. I would like to mention that on the
  160. PCjr the upper 128 extended ASCII
  161. characters are available under the
  162. graphics modes as well.  They are
  163. stored along with the lower 128 ASCII
  164. characters in the BIOS ROM.
  165. (Attention PC GRAPHICS PROGRAMMERS:
  166. For those who have not defined their
  167. own versions of the extended sets,
  168. you can now just copy them out of
  169. PCjr  ROM onto a disk file, then load
  170. them into the PC and set up the
  171. alternate character set pointers.
  172. This makes it possible to get quality
  173. screen dumps of those special
  174. characters using screens 1 and 2.)
  175.