Jump to content
IGNORED

fixit? xb colour-changing


GratedTopping

Recommended Posts

I can't get this to work properly in "Classic99". I haven't tried it in any other emulator. It allows you to chose a border and screen color that will remain in programming mode, even through a NEW command. I found it in November 1985's "MICROpendium". For me, the border color changes properly to my choice, but the screen color is off.

 

Note that I did edit this a bit (including an ON WARNING NEXT, for example), but certainly didn't change any of the CALL LOAD statements. I've gone over it a lot in the mag and can't figure it out.

 

Does anybody have a working copy or know what's wrong? Maybe a correction was published in a later MICROpendium...or "Classic99" just messes-up with it?

 

1 !

2 ! XB SCREEN COLOURS

3 !

4 ! (CHANGES YOUR SCREEN DISPLAY TO YOUR CHOICE OF COLOURS WHILE IN COMMAND MODE)

5 !

6 CALL CLEAR :: ON WARNING NEXT

7 INPUT "BORDER COLOR? (1-16): ":A

8 IF A<1 OR A>16 THEN 7

9 INPUT "SCREEN COLOUR? (1-16): ":B

10 IF B<1 OR A>16 THEN 9

11 CALL CLEAR

12 C=(B-1)+(A-1)

13 CALL INIT :: CALL LOAD(9984,C,C,C,C,C,C,C,C,2,0,7,15+A,4,32,32)

14 CALL LOAD(9999,48,2,0,8,0,2,1,39,0,2,2,0,8,4,32,32,36,2,0,8,8,4)

15 CALL LOAD(10021,32,32,36,2,0,8,16,4,32,32,36,2,0,8,24,4,32,32,36,4,91)

16 CALL LOAD(-31804,39, 8) :: CALL LOAD(-31952,255,231,255,231)

 

NOTE: in line 16, that's an 8 in the first CALL LOAD, but I see it's turning up as a smiley face. . .

Edited by GratedTopping
Link to comment
Share on other sites

Does anybody have a working copy or know what's wrong? Maybe a correction was published in a later MICROpendium...or "Classic99" just messes-up with it?

 

My guess is that one of the colors (probably the screen color B) needs to be shifted to the high nybble. You can do this by multiplying by 16:

 

12 C=(B-1)*16+(A-1)

 

...lee

Link to comment
Share on other sites

With that change, it did make it interesting and a bit different.

 

Choosing the 'border color' results in the entire screen being the color of choice.

Choosing the 'screen color' makes the text the color of choice.

 

I remember there being a different program somewhere in one of the magazine's issues where it had this purpose specifically.

Link to comment
Share on other sites

On my first try, I did a little change and it worked to my surprise:

 

12 C=(B-1)+16*(A-1)

 

Of course, I don't understand why, but now the program does as was intended. Your border and screen colours are different.

 

Thanks, Lee, for your assistance. I like your modification, too, and I figure I'll alter the program to allow a person to choose any option. With your change, the text can be a different color; with mine/the original program, the text is the color of the border.

Link to comment
Share on other sites

Of course, I don't understand why, but now the program does as was intended.

 

Do you understand how the colors are specified for the tile groups? You need to understand a few key concepts to realize what is going on and take the guessing out of getting the colors you want:

 

* A byte is 8-bits and has a *range* of values from 0-255, and 256 total *number* of values.

 

* 4-bits is a nybble (or nibble), and that 4-bits can store a value *range* from 0 to 15 (or >0 to >F hex), and 16 total *number* values.

 

* That there are two nybbles in a byte.

 

* That the 99/4A has 16 possible colors, so each nybble in a byte can store a color value.

 

* That the 99/4A has 256 tiles, and for specifying color the tiles are grouped into 32 groups of 8 tiles.

 

There is a color table in the VRAM that uses 1-byte per group of tiles, and the high-nybble in the byte specifies the foreground color for the tile group, and the low-nybble specifies the background color for the tile group.

 

The foreground color will be displayed if the tile's pattern has a '1', and the background color will be displayed if the tile's pattern has a '0'. This is a very important concept, because a '0' pattern bit DOES NOT mean the pixel is transparent! The '0' bit means "show the background color", which *could be* set to transparent, but typically not.

 

For example, tile 32, the 'space' character, has all a pattern of all '0' bits, so the space tile will always show the background color set for the 4th tile group. However, the border (and screen background) color is set with a separate register in the VDP. So now you have two "layers" to think about.

 

If you set the "screen background" color to green, then the border will be green. If you fill the screen with a tile, say the 'space' character, then the display area of the screen will be whatever color is set as the *background* color for the 4th tile-group (which is the group that contains tiles 32-39). If the background color for the 4th tile group is red, then you will have a green border with a red center. If you want to see the screen background through the tiles, you have to set the tile group's background color to *transparent*. Then the foreground color (pattern bits set to '1') will show, and the '0' bits will show the screen background color.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...