應該是在 Hacker News Daily 上看到的,1024 色的 CGA 畫面:「1K colours on CGA: How it's done」。比較容易懂的是「CGA in 1024 Colors - a New Mode: the Illustrated Guide」這篇文章。
用到的技巧其實在先前就已經知道了 (維基百科的「Special effects on composite color monitors」這段提到的技巧),不過原文算是把研究做完。
用的方法是 CGA 的 80x100 文字模式 + AV 端子 (Composite video) NTSC 的效果做到的。
故事從頭講起,最前面帶出最基本的 80x25x16 (每個字是 8x8),以及可以修改 register 變成 80x100x16 (每個字變成只有 8x2,只會顯示最上面兩排 pixel):
Basically, you adjust CRTC registers to get 100 rows of text instead of the usual 25; this gives you a character box of 8x2 pixels, a quarter of the normal 8x8.
然後文章作者解釋這也就是 Macrocom 所發展出來的技巧:
然後再來就是利用 80x100x16 再配合 AV 端子的特殊效果:
這在維基百科上也有提到:
於是就可以利用 0x55 (U
這個字) 湊出 256 色:
然後再加上 0x13 (雙驚嘆號) 就可以湊出 512 色:
最後達到 1024 色的方法是透過暴力更新做到的:
The lowdown on how this is done is all in reenigne's writeup, which is linked to at the top of this post. But this is the basic idea: by starting a new CRTC frame every other scanline and twiddling with the start address, it's possible to lay down our character rows so that the first scanline of each gets duplicated twice!
這個方法對於 8088 的 4.77Mhz 其實不太容易,所以這部份只有實作靜態圖片:
Naturally, there are downsides: having to mess with the CRTC every couple of scanlines is quite taxing for the poor 4.77MHz 8088, so there's not much you can do with this other than static pictures. The 512-color variant, using only ASCII 0x55 and 0x13, doesn't suffer from this – it's basically "set and forget", requiring no more CPU intervention than any 80-column text mode (the familiar overhead of avoiding snow).
然後這是最後的成果,上面是 AV 端子產生出來的結果,下面是 RGBI 的結果:
1981 年的 CGA,在 34 年後居然搞成這樣... XD