# how can you please represent letters with different colors?

5 replies to this topic

### #1 funkheld OFFLINE

funkheld

Moonsweeper

• 375 posts

Posted Fri Mar 8, 2019 1:49 AM

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
```

#### Attached Thumbnails

Edited by funkheld, Fri Mar 8, 2019 1:49 AM.

### #2 Wrathchild ONLINE

Wrathchild

River Patroller

• 2,189 posts

Posted Fri Mar 8, 2019 2:04 AM

take a look here

### #3 funkheld OFFLINE

funkheld

Moonsweeper

• Topic Starter
• 375 posts

Posted Fri Mar 8, 2019 2:06 AM

thanks for teh help.

the color " red - yellow -  green ?

greeting

Edited by funkheld, Fri Mar 8, 2019 2:06 AM.

### #4 Wrathchild ONLINE

Wrathchild

River Patroller

• 2,189 posts

Posted Fri Mar 8, 2019 2:12 AM

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

### #5 funkheld OFFLINE

funkheld

Moonsweeper

• Topic Starter
• 375 posts

Posted Fri Mar 8, 2019 2:18 AM

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
```

#### Attached Thumbnails

Edited by funkheld, Fri Mar 8, 2019 2:47 AM.

### #6 Wrathchild ONLINE

Wrathchild

River Patroller

• 2,189 posts

Posted Fri Mar 8, 2019 3:56 AM

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.

• Stephen likes this

#### 0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users