Meneer_Jansen

Part 4. Display modes

Jul 3rd, 2020 (edited)
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.18 KB | None | 0 0
  1. .--------------------------------------.
  2. ( P A R T 4 . D I S P L A Y M O D E S )
  3. `--------------------------------------´
  4.  
  5.  
  6. This used to be part of the text doc about the VIC chip. But that one became to large.
  7.  
  8.  
  9. o==========o
  10. | CONTENTS |
  11. o==========o
  12.  
  13. general contents: https://pastebin.com/hmpJmurr
  14.  
  15. A. Introduction
  16.  
  17. B. Standard text mode
  18.  
  19. C. Bitmap single color
  20.  
  21. D. Bitmap multicolor
  22.  
  23. E. Multicolor text mode
  24.  
  25. F. ECM text mode
  26.  
  27. X. References
  28.  
  29. -<>-<>-<>-<>-<>-<>-<>-
  30.  
  31.  
  32.  
  33. o=================o
  34. | A. Introduction |
  35. o=================o
  36.  
  37. Summary:
  38.  
  39. Border : D020_hex
  40. Background : D021_hex
  41. Two extra bg. clrs.: D022 and D023_hex
  42. BMM/ECM/MCM : D011 and D016_hex
  43.  
  44. 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).
  45.  
  46. There are 3 bits that determine the exact display mode (out of the 8 combo's 3 are not relevant). They are [1]:
  47.  
  48. BMM = BitMap Mode : bit 5 of D011_hex
  49. ECM = Extended Color Mode: bit 6 of D011_hex
  50. MCM = MultiColor Mode : bit 4 of D016_hex
  51.  
  52.  
  53. o=======================o
  54. | B. Standard text mode |
  55. o=======================o
  56.  
  57. BBM/ECM/MCM = 000
  58.  
  59. 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).
  60.  
  61.  
  62. o=========================o
  63. | C. Bitmap standard mode |
  64. o=========================o
  65.  
  66. BBM/ECM/MCM = 100, resolution = 320x200 (sometimes called high res. mode).
  67.  
  68. Handy for drawing lines and graphs.
  69.  
  70. 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.
  71.  
  72. 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*.
  73.  
  74. 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.
  75.  
  76. Restriction per tile: resolution 8x8, 2 colors to be chosen freely (defined in Screen RAM).
  77.  
  78.  
  79. o======================o
  80. | D. Bitmap multicolor |
  81. o======================o
  82.  
  83. BBM/ECM/MCM = 101, resolution = 160x200.
  84.  
  85. 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.
  86.  
  87. Color 00 is always the same and is background color D021_hex.
  88.  
  89. 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].
  90.  
  91. Color 11_bin (the 4th color) for each tile is defined in the 512 B of *Color RAM* (somewhat like in standard text mode).
  92.  
  93. Restriction per tile = resolution 4x8, 4 colors: one global and 3 to be chosen freely: 2 from Screen RAM and 1 from Color RAM.
  94.  
  95.  
  96. o=========================o
  97. | E. Multicolor text mode |
  98. o=========================o
  99.  
  100. BBM/ECM/MCM = 001.
  101.  
  102. 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.
  103.  
  104. 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.
  105.  
  106. 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.
  107.  
  108. 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.
  109.  
  110. Note that both bit combinations "00" and "01" are regarded as "background" for the sprite priority and collision detection [1].
  111.  
  112. 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.
  113.  
  114.  
  115. o==================o
  116. | F. ECM text mode |
  117. o==================o
  118.  
  119. BBM/ECM/MCM = 010. Seldom used [3]. It's used in the game "Hero".
  120.  
  121.  
  122. o===============o
  123. | X. References |
  124. o===============o
  125.  
  126. [1] "The MOS 6567/6569 video controller (VIC-II) and its application in the Commodore 64" by Christian Bauer (1996):
  127. http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt
  128.  
  129. [2] Ghost byte:
  130. Discussion:
  131. https://csdb.dk/forums/?roomid=11&topicid=62074&showallposts=1
  132. Usage to disable border:
  133. https://www.youtube.com/watch?v=zUJ80eLciUU
  134. Best and shortest explanation:
  135. http://www.dbfinteractive.com/forum/index.php?topic=4477.0
  136.  
  137. [3] Screen modes cheaper by the dozen:
  138. https://dustlayer.com/vic-ii/2013/4/26/vic-ii-for-beginners-screen-modes-cheaper-by-the-dozen
  139. By the same author:
  140. https://dustlayer.com/vic-ii/2013/4/22/when-visibility-matters
  141.  
  142. [4] C64 Wiki, multi color character:
  143. https://www.c64-wiki.com/wiki/Character_set#Defining_a_multi-color_character
  144.  
  145. [5] Bug, Kernal writes in shadow RAM:
  146. https://www.lemon64.com/forum/viewtopic.php?t=74763
Add Comment
Please, Sign In to add comment