| Home CBM ASCII-X BASIC Disk Commands Enter RUN mode Program Format Secret Variables Variable Format Expressions Keywords (divide) (equal) (less) (minus) (more) (multiply) (plus) (power) Abs And Append Asc Atn Auto Backup Bank Begin Bend Bload Boot Box Bsave Bump Catalog Char Chr Circle Close Clr Cmd Collect Collision Color Concat Cont Copy Cos Data Dclear Dclose Dec Def Delete Dim Directory Dispose Dload Do Dopen Draw Ds Ds string Dsave Dverify El Else End Envelope Er Err Exit Exp Fast Fetch Filter Fn For Fre Get Get num Getkey Go Gosub Goto Graphic Gshape Header Help Hex If Input Input num Instr Int Joy Key Left Len Let List Load Locate Log Loop Mid Monitor Movspr New Next Not Off On Open Or Paint Peek Pen Pi Play Pointer Poke Pos Pot Print num Pudef Quit Rclr Rdot Read Record Rem Rename Renumber Restore Resume Return Rgr Right Rlum Rnd Rreg Rspcolor Rsppos Rsprite Run Rwindow Save Scale Scnclr Scratch Sgn Sin Sleep Slow Sound Spc Sprcolor Sprdef Sprite Sprsav Sqr Sshape St Stash Step Stop Str Swap Sys Tab Tan Tempo Then Ti Ti string To Trap Troff Tron Until Using Usr Val Verify Vol Wait While Width Window Xor Syntax Tokens C128 D64plus Disk Escape Codes Hardware PCxface PETSCII Pet2asc Futurama IBM PC-AT Contact Games Glossary Hall of fame Hall of shame Miscellaneous Privacy policy Programming Twisty puzzles |
COLOR colorSource , chipColor [ , chipLuminance ]
* The chipLuminance is only supported by the TED chip (v3.5). In v7.0, any value from 0 to 255 is accepted.
Bitmap graphics state management; primarily set the chipColor to be used when plotting bitmap pixels using a colorSource. Some colorSources refer to a global chip color; changing them has an immediate effect (as opposed to internal state just mentioned).
Although the TED and VIC chips have over a dozen colors, they are both limited to using only 2 colors within a color cell (similar to an MPEG macro block) for high-resolution bitmaps or only 4 colors per cell for a multi-color bitmap (and then one of them is a global/shared color). The main reason for this is to decrease the amount memory required to store a bitmap; For the VIC, which has only 16 colors, this results in a 4-to-1 or 4-to-2 "compression" (high-res or multi-color mode). For the TED, which has over a hundred colors, this jumps to about 7-to-1 or 7-to-2.. Said another way, each pixel in the bitmap is stored primarily as a single bit (high-resolution mode) or as pair of bits (multi-color mode). Each possible bit(pair) value may be assigned any of the colors the chip has to offer, but with only 1 or 2 bits, not much variety is possible (which is why the concept of color cells is used). With color cells, the bitmap pixels are clustered together into rectangular regions (which actually correspond with the area for each character in text mode) and each cell may have its own chipColor (and for TED chipLuminance) assigned to each of the possible bit (pair) values. Well actually one of the 4 multi-color values is shared over the full screen and can not be set for each color cell. Anyway, BASIC uses the colorSource to specify which bit value (or bit-pair value) to be written into the bitmap for each pixel plotted by the bitmap routines. It also looks-up the chipColor assigned to the colorSource that is being plotted and stores that value in the color cell. Now if you define 2 (high-resolution) or 4 (multi-color) chipColors to the 2 (or 4) different colorSources, and you never change those assignments while generating your bitmap image, you have a "static" color map; or you could say all 2 (or 4) chipColors are global... the memory of the color cells isn't even really needed in that case. For nice looking images, you probably do want to change chipColors that are assigned while generating a bitmap image. You just need to space your color changes apart on the bitmap so that a color change in one cell does not affect nearby pixels. Failure to do this will result in distotion of the bitmap image when you plot a new chipColor assignment in a cell that was using a previous chipColor assignment (for the same colorSource). Arrr! Its really hard to describe with words, but once you see it happen a few times while playing with the bitmap commands, I think you will understand! The first parameter, the colorSource specifies what graphic element is to changed by the COLOR command as a shown here:
* The "foreground" is the default colorSource for bitmap commands, although ironically the VIC-II sprites consider such multi-color pixels as background! The chipColor specifies which of the "primary" colors that can be generated by the video chip is assigned to the colorSource. The TED chip has more colors than the VIC-II and these are specified with the optional chipLuminance parameter. If omitted, the chipLuminance defaults to 7; the table below shows the luminance values that correspond to the text mode colors (accessible with {Control + Number} or {C= + Number} key combinations). The table also includes the control code (CHR$ value) that may be used to change text colors with PRINT.
Any floating-point numbers will first be converted to integers (see INT). If any value is out-of-range (see above) an ILLEGAL QUANTITY ERROR is generated. Specifiying a string for any parameter will generate a TYPE MISMATCH ERROR. Examples:
© H2Obsession, 2014 |