# how can you please represent letters with different colors?

## Recommended Posts

how can you please represent letters with different colors?

program is "fastbasic".

Thank you.

greeting

gr. 17
color 1

for k=0 to 50
x=rand(400)
next

Edited by funkheld

take a look here

##### Share on other sites

thanks for teh help.

the color " red - yellow - green ?

greeting

Edited by funkheld

##### Share on other sites

Lines 15 to 30 are setting those, background was already black (which would be POKE 712,0)

The values are derived from the hue (color) and luminance (brightness) - e.g. a byte made of with a high nibble of hue and low nibble of lum. So hex \$CA for light green in decimal is (12 * 16) + 10

##### Share on other sites

hello thanks.

greeting.

why are the colors the same here?
Thank you.
greeting
gr. 17

a=peek(88)+256*peek(89)

setcolor 708,11,15
poke a+1,32
setcolor 709,7,8
poke a+2,32

do
loop

Edited by funkheld

##### Share on other sites

You are poking the same character value '32'.

In the post I referenced, it states "a char value of 0-63 and the top two high bits control the colour of 0-3."

So 32 in hex is \$20 or in binary 00100000 - the top 2 bits are 00 and so Color 0 is being used.

Therefore if you wanted color 1, you add 64, color 2, add 128 and color 3, add 192.

\$20 = 00100000 = 32

\$60 = 01100000 = 96

\$A0 = 10100000 = 160

\$E0 = 11100000 = 224
Maybe a word of warning, setting a colour before outputting a byte is not how the Atari functions.
The colour is determined by the value of the byte output.
If the colour was changed then if would change the colour of all characters associated with that register.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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