Wednesday, April 18, 2007

The ATTR command, Or a pretty good Microware joke

I've been resolved for some time to post more entries about actually, you know, using the CoCo. Then I get distracted with things like building 'em and collecting 'em and writing about 'em and making web sites about 'em. That's great, of course. Sharing is part of the experience. But I still need to make more of an effort to post stuff about using our beloved machine.

So the other night I'm floundering about on the keyboard, as I am wont to do as I am having no particular programming skill to speak of, and I decide I need a snazzy title screen for the game I'm failing to get put together. When you hit a brick wall in the programming department, it's always a good idea to have a backup plan. Like, say, making it purdier. I'm pretty sure all opening/title screens for programs come about this way.

Game Developer: So, um, how do we do that?
Game Programmer: I dunno.
Game Developer: Well, we're getting paid for making games, you know, so we should, um, do something.
Game Programmer: We could make a really pretty title screen and opening graphics?
Game Artist: You should make a spinning 3D logo with lightning bolts shooting out of it.
Game Programmer: Um, yeah, well, that would really be....
Game Developer: There, see, that's perfect! Let's do that!
Game Programmer: But I'm pretty sure it would take longer than....
Game Developer: Great! Now do we start with the logo or the lightning bolts?
Game Artist: [grinning evilly] I'm going to get a soda.
Game Programmer: Bast...

This is also why most games are delayed several months, or even years. The opening title sequences are actually more difficult to do than the game. David Letterman once said, "Sometimes something worth doing is worth overdoing." That's my motto.

All I really wanted to do was have some colored text display the game title, credits, and notices on a black background. To snazz it up a bit, I though the text should be different colors for each line. The game is only in SG6 mode, so we don't want to go overboard.

Okay, yeah we do.

So there's the standard reversed video method, but you don't get different text colors that way. On the other hand, the 40/80 column modes can have different background/foreground colors. That would work. Though I should also look at printing it on the HSCREEN and that way I could add graphics later, if so inclined.

So HSCREEN sucks. The enhanced video modes of the CoCo 3 are great, but accessing them in BASIC is not really practical. I'm sure there's something one could do with it, but mostly it's so slow it blows. Yes, it blows and it sucks. So there.

That left the 40/80 column "hi-res text screen" mode. They have their own suckiness, but they're good enough. (As far as Color BASIC goes, those enhanced modes and screens have a serious "tacked on" feel to them.) Except that now I have to mess about with the ATTR command.

To be fair, using ATTR isn't that tough. The command uses PALETTE slots 8-15 for the foreground and 0-7 for the background. (Why are they backwards? Why not 0-7 for the foreground, which is specified first in the command? I'm sure there's a technical explaination revolving around how the CoCo is setting the bits, but still... sheesh!) Easy enough, but some doofus stuck the weirdest ass default colors in the default foreground selection. They go: black, green, black, buff, black, green, black, orange. Huh? It's like whoever did that part of the code said, "Ha! This'll be funny! Who needs text other than black, green, buff and orange anyhow! Bwahahahaha!" Or maybe it was, "Hurry, dude! The suits from Tandy are here!"

The background colors, by the way, follow the normal generic 8 color scheme. Go figure. To fix it, you have to reload the ATTR foreground pallette slots, 8 through 15, with the correct colors. Thus, one must dig out the old color chart, or make one, and look up each generic code and then load the PALETTE with the correct value. Can you say, Pain In The Ass? I thought you could.

So you do one of these:

100 FOR X=8 TO 15
110 READ C
120 PALETTE X,C
130 NEXT X
140 DATA 0,18,54,9,36,63,31,38

The DATA statements are the colors I selected. Notice that I substituted orange (38 in slot 15) for magenta. Green would normally start at slot 8 (yellow in 9, etc.) and orange would be in slot 15. I wanted black in slot 8 so that black-on-something-text would work as well. Also ATTR 0,0 to get black on black. I have my reasons. :P

While I'm bitching, why blink and underline? The ATTR command has two switches, B and U, that allow these two attributes to be applied to your text. e.g. ATTR 2,2,B would blink. Why? Because other 8-bits at the time could do that? Because no one ever used those features on other 8-bits? Meaning CoCo users would? Italic and bold would have been more handy.

Now, granted, most people are going to change the colors anyway. There are plenty of colors in the CoCo's palette that look great for title screens. Some are very high contrast (which is why you see them in games so often) and look very nice. But there should be a base set, and it seems to me the base set should be the standard colors (green, yellow, blue, red... etc.) I know, I know. Nag, nag, nag.

Anyhoo, now I've got my fancy title and instruction screens, which are probably longer than the actual game program. heh. The title flashes colors by rotating the PALETTE. There's sound, there's dancing girls, there's 3D spinning dervishes, it's a true multimedia experience, let me tell ya. (Editor's Note: Not really.) Still, it took a lot longer and a lot more effort than it should have. Once you get the hang of it, you can make some pretty cool text effects, and some nice looking screens, with ATTR. But it's kind of a pain, anyhow.

At least the title screen is done. Drat, now I actually have to go back to programing the game.

Maybe it needs a save score to disk feature. Hmmm... yeah, that would kill some time and a ton of unnecessary bytes. :)

Angel's Luck,
Capt.

4 comments:

L. Curtis Boyle said...

The reason for the strange colors in the first slots of the ATTR command (from what I remember) is they are for the composite artifact colors, and divided by modes. So, Black, Green (PMODE 4 color set 0), Black, Buff (PMODE 4 color set 1), Black, Green (SCREEN 0,0 text letter colors), Black, Orange (SCREEN 0,1 text letter colors). Why they are reversed into the wrong 8 slots, I don't know. But it's cool doing a PALETTE 12,63:PALETTE 13,0 on the 32x16 screen...

-Curtis-

CaptCPU said...

Thank kind of makes sense, actually. I don't see how one would use that... but I can see it.

I guess the main point of picking on the ATTR command, and I'll get back to this issue eventually, is that Super Extended is tacked on. Which creates some weird stuff when trying to program it. I understand, of course, that Microware couldn't mess with the Microsoft code, and so they did a pretty good job (my spelling checker recognizes Microsoft, but not Microware. sheesh!) And of course, the CoCo 3 was and is an OS-9 machine, not a Color BASIC machine. Still... well, that's whole other rant. Now I've got two new posts to make on the message board. heh.

My start up disk does that PALETTE combination. Looks super sharp on Roy's VGA adapter. Probably switch to something like 12,33 for the GloCo though. :)

Angel's Luck,
Capt.

L. Curtis Boyle said...

On the 40/80 column screens especially, I usually used white foreground/dark blue background (PALETTE 12,63:PALETTE 13,1 for 32 column, and PALETTE 8,63;PALETTE 0,1:CLS1 for 40/80 column. Don't know why, just liked it.

CaptCPU said...

Kinda like that one too, but it reminds me of an Atari 400/800. Makes a good looking screen and easy on the eyes, though, so probably why they picked it. Didn't the Commodore come up with white on blue screen as well?