Logo Pending

On Palettes

Recently, a friend who shall remain anonymous said to me he wanted to draw some pixel art and would set Aseprite to use the NES color palette because it didn’t have a SNES one.

I was quite amused by this because there is no such thing. The NES, SNES, and IBM PC-Compatible with a VGA card all have one thing in common in that they have program-specifiable palettes. On the NES, you can pick some 28 colors by my count from a fixed master palette:

This isn’t even necessarily correct because of how these colors are generated but whatever. On the SNES though? You have a 256-color palette space, split in 16 rows of 16 colors each. The first of each row is considered transparent (leaving out mode-specific stuff for simplicity) and the final background color behind all the layers is the top-left one. Also, the bottom half is reserved for sprites.

But what do you assign to them? 256 of these bad boys:

Each entry is a 15-bit RGB value, ignoring the 16th. In other words, you have 32.768 different possible colors to pick and choose roughly 256 from. The palettes in Aseprite, or really any graphics editor that has an “indexed” mode, only go up to 256 entries.

On the venerable VGA graphics card so widely used in IBM PC-compatibles and still emulated by even the latest powerhouses, you get as many colors but this time you can use all of them at once. And they’re not even 15-bit but a whopping 18, for an impressive 262.144 different shades to pick from:

Still, you’d actually have more of a point speaking of “the” VGA palette. When a SNES boots up there’s no telling what’s in the palette RAM, but when a PC boots up, you know the VGA palette will default to this:

For both SNES and PC though, you’d be better off speaking of specific applications, games, or scenes in games. For example, here’s the default from DeluxePaint:

So just like how you can refer to “the” VGA palette, you can have “the” DeluxePaint palette.

Nicole remarked on Twitter that I missed an opportunity to mock the Genesis. Here ya go, ma’am.

Nine bits, 512 possible colors, 64 at once in memory but only 61 effectively because the first one’s transparent like on the SNES. Here’s the SNES again for easy comparison:

Leave a Comment

Menu Slowdown Mystery

Yesterday I had the idea to make a small “game” demonstrating various SCI11+ features, and instead of a main menu screen full of buttons I thought I’d use a proper menu bar. The kind you’d see in the old SCI0 games with the text parser and the low-resolution version of Leisure Suit Larry 6. Which incidentally is the only SCI11 game to have such a menu bar. The high-res SCI2 version’s menu bar is implemented entirely in script but the other one is 100% the same as in SCI0. If you were to copy the interpreter from any other SCI11 game over to LSL6 and run it you’d get an error saying AddMenu is not supported.

If you were to build your own SCI11, you’d find there are four targets; with the built-in debugger, with menu bar support, both, or neither. Most SCI11 games come with a “neither”, except for LSL6.

But this post’s title mentions slowdown. Why?

I defined two menu items, File and Topic. No Sierra logo menu here, not this time. One has About and Quit, the other lists the various features. As you do. But somehow when opening the second menu things would slow down just before it got to the last item, about the support for SCI32-style no-lookup font and color change control codes.

I thought maybe I’d messed something up when I cleaned up the source code, or when I added the thing where the menu bar is drawn in the same colors as the status line.

So I built an SCI11+ with all switchable hacks turned off. No dice, the menu was just black and white now but still slow. So that ruled out the extra features.

A “base” build that’s missing all new features? Nope.

Copy the terp from LSL6 and run that. Same deal so it’s not the cleanup either.

So I tried reorganizing the menu items. And I saw my mistake.

I had used a | to separate the Unicode and SCI32 control code items where it should’ve been :. For added insult, that’s the text formatting control code.

I wonder if AddMenu would work better as a variadic function 🤔

[ ] Leave a Comment