News for hackers. Stuff that matters.
Re:Brute Force Colors by JKCalhoun on Saturday December 31, 2022 @07:03PM (#34202088)
The original Macintosh reserved something like 22K of the RAM for screen memory. I remember reading a little tech note about page-flipping: where you can pull in another 22K of RAM for a secondary screen buffer, write to it, and then with a single assignment to a 32-bit memory location, point the screen refresh to your secondary screen buffer. If you did it during the vertical screen blanking interval, pop!, instant "page flip".

I was playing around with 68K assembler to test this out: cleared one screen buffer to white, drew a diagonal black line — cleared the other screen buffer to white and also drew a diagonal black line ... a mirror of the first one though.

Watching it page flip between the two screen buffers for every screen refresh caused me to notice something interesting: you could actually get a pseudo 50% gray where a black pixel and white pixel shared the same row and column on the two buffers.

It might have made an interesting demo, but eating another 22K on a computer that was struggling (not the lower config models) with 128K seemed like a bad design decision. I suspect too, at 30 FPS, the gray would have been a bit "strobish"?

Re:Brute Force Colors by msephton on Saturday December 31, 2022 @09:21PM (#34202934)
This effect was done on Game Boy, Palm OS and maybe more. If the LCD has lot of ghosting it helps the effect. Not sure about a CRT.

I tried it on Playdate but the screen (Sharp Memory LCD) is so good that refresh needs to be 100Hz for the switching to blur into grey.

Re:Brute Force Colors by thristian on Saturday December 31, 2022 @10:16PM (#34203226)
I definitely remember cheap green-phosphor CRTs that took a second or more to fade from full-brightness to zero-brightness. If you tried to strobe a pixel back and forth it would just look full brightness because it didn't have enough time to visibly fade before being turned on again.
Re:Brute Force Colors by IIAOPSW on Saturday December 31, 2022 @09:24PM (#34202953)
Depending on how much you want to stress it, you could do what I call "time dithering". You have a sequence of b/w images in several buffers. The first buffer represents pixels that are meant to be more than 50% black. The next represents 25% black. Then 12.5% black and so on. At each frame refresh you use the least significant digits in the system clock to decide which buffer to point at the screen. A pixel that should be x% black will be rendered black x% of the time. If it refreshes often enough then you've made whatever bit depth of color you were after.

There are many hacks that can be used to improve this method I just outlined. Eg instead of picking a new buffer every frame, you can decide "switch or stay" from the current buffer. Or even just change which ones are displayed in some predetermined repeating sequence.

Re:Brute Force Colors by ecpottinger on Saturday December 31, 2022 @11:38PM (#34203661)
I did that on my PET 2001 after I added 16K of memory, since the screen was only 1K in size it was easy to rewrite the screen in assembler each time. Problem I tried do more than two frames and the fickler was too much to watch.