Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .--------------------------------------.
- ( P A R T 4 . D I S P L A Y M O D E S )
- `--------------------------------------´
- This used to be part of the text doc about the VIC chip. But that one became to large.
- o==========o
- | CONTENTS |
- o==========o
- general contents: https://pastebin.com/hmpJmurr
- A. Introduction
- B. Standard text mode
- C. Bitmap single color
- D. Bitmap multicolor
- E. Multicolor text mode
- F. ECM text mode
- X. References
- -<>-<>-<>-<>-<>-<>-<>-
- o=================o
- | A. Introduction |
- o=================o
- Summary:
- Border : D020_hex
- Background : D021_hex
- Two extra bg. clrs.: D022 and D023_hex
- BMM/ECM/MCM : D011 and D016_hex
- There are roughly two display modes: text and bitmap. One must choose between 'm. In all modes a border color (D020_hex) and a background/frame color (D021_hex) are defined. Standard they are dark blue and light blue respectively. Characters are 8x8 pixel bitmaps and there are (only) 40 columns and 25 rows on screen (= 1,000 characters). All modes resemble text mode in some way. The screen is always divided into 1,000 tiles/cells of 8 lines of 8 pixels. There are limitations to how many colors there may be in such a tile (else: 1,000 chars x (8 x 8 pix) x (4 bits of color/pixel) = 31.25 kB of memory).
- There are 3 bits that determine the exact display mode (out of the 8 combo's 3 are not relevant). They are [1]:
- BMM = BitMap Mode : bit 5 of D011_hex
- ECM = Extended Color Mode: bit 6 of D011_hex
- MCM = MultiColor Mode : bit 4 of D016_hex
- o=======================o
- | B. Standard text mode |
- o=======================o
- BBM/ECM/MCM = 000
- All characters on screen can have a different foreground color (color of the char) from Color RAM. The background color is always the same. There can be 1,000 characters on screen (40 columns x 25 lines).
- o=========================o
- | C. Bitmap standard mode |
- o=========================o
- BBM/ECM/MCM = 100, resolution = 320x200 (sometimes called high res. mode).
- Handy for drawing lines and graphs.
- The bitmap: realize that 320 x 200 pix (1 bit per pixel) = 64,000 pix = 64,000 bits = 8,000 Bytes = approx. 8 kB = 2000_hex. This means that the VIC needs to address 8 kB for every pixel to be set on or off. See chapter 'Memory types' from the other document on how the position of the bitmap in a VIC RAM bank is set.
- Each tile consists of 8x8 pixels (just like a character). Each pixel is represented by a bit. If a bit is 0 then the corresponding pixel is set to the background color for that tile, 1_bin means foreground color. This (again) results in: 1,000 tiles x (8 x 8 bits) = (8 bits is one byte) 1,000 x 8 bytes = approx. 8 kB, which is called *the bitmap*.
- A different background and foreground color can be set for each 8x8 tile in the 1 kB of *Screen RAM* (i.e. NOT *Color RAM* which is only 512 kB). So now it does not contain 8 bit character codes for all 1,000 positions on screen. Instead it holds a background color for each tile in the upper nybble and the foreground color the lower nybble [3]. This means that the term "single color" (sometimes used) is a bit ambiguous because every tile can have 2 different colors from the next one.
- Restriction per tile: resolution 8x8, 2 colors to be chosen freely (defined in Screen RAM).
- o======================o
- | D. Bitmap multicolor |
- o======================o
- BBM/ECM/MCM = 101, resolution = 160x200.
- Handy for drawing pictures. Now, in the 8 kB bitmap, two bytes in a tile define a color resulting in 4 colors: 00, 01, 10 and 11. So a "pixel" is two bits wide and one bit high: 2 times as wide as normal.
- Color 00 is always the same and is background color D021_hex.
- Colors 01 and 10 for each tile are defined in the 1 kB of *Screen RAM* (like in std. bitmap mode). So now it does not contain 8 bit character codes for all 1,000 positions on screen. It holds one color in the upper nybble and a second one in the lower [3]. Color 01 is treated as background for the sprite priority and collision detection [1].
- Color 11_bin (the 4th color) for each tile is defined in the 512 B of *Color RAM* (somewhat like in standard text mode).
- Restriction per tile = resolution 4x8, 4 colors: one global and 3 to be chosen freely: 2 from Screen RAM and 1 from Color RAM.
- o=========================o
- | E. Multicolor text mode |
- o=========================o
- BBM/ECM/MCM = 001.
- This mode is used in combination w/ a custom character ROM to make background graphics on which collisions with sprites can be determined in games.
- Usually every single bit in an 8x8 character bitmap sets a pixel to foreground or background color (i.e. on or off). Now 2 bits set a color. This means that a "pixel" is two bits wide by one bit high (2x1). The 4 combinations of these bits result in "off" (00_bin = background color D021_hex) and 3 extra colors (01, 10 and 11_bin). Use D022 and D023_hex for multicolor 01 and 10_bin.
- For the 4th color (11_bin) use *Color RAM*, as always. This is the foreground/character color. This color can be different for each tile/character. The 3 background colors can not.
- However, there is a catch. If you put a color code from 0-7 into the color RAM location of a character it will be displayed in standard text mode [3]. This means that the screen can display both multicolor chars (low resolution) and high resolution characters side-by-side [4]. Only char colors w/ bit 3 set (i.e. colors 8 to 15) will actually result in a multi color char. Colors 8 to 15 will then, confusingly, (again) result in colors 0 to 7. Colors 0 to 7 are the "basic" colors, i.e. not the "extra colors" like light green, light gray, light blue etc. So use background colors D021 to D023_hex for lighter colors.
- Note that both bit combinations "00" and "01" are regarded as "background" for the sprite priority and collision detection [1].
- Restrictions per char: low resolution = 4x8, 4 colors: 3 global and one to be chosen freely ("free" from 0 to 7). High res. std. 2 color chars (w/ foreground color 0 to 7) can be mixed in.
- o==================o
- | F. ECM text mode |
- o==================o
- BBM/ECM/MCM = 010. Seldom used [3]. It's used in the game "Hero".
- o===============o
- | X. References |
- o===============o
- [1] "The MOS 6567/6569 video controller (VIC-II) and its application in the Commodore 64" by Christian Bauer (1996):
- http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt
- [2] Ghost byte:
- Discussion:
- https://csdb.dk/forums/?roomid=11&topicid=62074&showallposts=1
- Usage to disable border:
- https://www.youtube.com/watch?v=zUJ80eLciUU
- Best and shortest explanation:
- http://www.dbfinteractive.com/forum/index.php?topic=4477.0
- [3] Screen modes cheaper by the dozen:
- https://dustlayer.com/vic-ii/2013/4/26/vic-ii-for-beginners-screen-modes-cheaper-by-the-dozen
- By the same author:
- https://dustlayer.com/vic-ii/2013/4/22/when-visibility-matters
- [4] C64 Wiki, multi color character:
- https://www.c64-wiki.com/wiki/Character_set#Defining_a_multi-color_character
- [5] Bug, Kernal writes in shadow RAM:
- https://www.lemon64.com/forum/viewtopic.php?t=74763
Add Comment
Please, Sign In to add comment