Perfect work, Steve! Your code work as expected and with TempodiBasic's string it draw correct brick! How you find values 85 and 170 in your StringToTile16 function? Yes, 170 + 85 is maximum, 255, but how you find value 170? It is with comparation between expected output in QB4.5 and your program, or how?
SCREEN 12
FOR I = 0 TO 15
PRINT I, _BLUE(I), _GREEN(I), _RED(I)
NEXT
Only values that print are 0, 85, 170, and 225.
After studying the values a bit, I noticed that the first 8 colors were all 170 or 0 (red, green, blue flag set, or not). The second 8 values were exactly the same; just 85 higher for the high intensity colors.
Their is one color on the chart which is off pattern, which I can’t help but wonder if it’s a bug in QB64’s default palette, since all the rest follow the rule perfectly. Maybe QB45 had the same “glitch” and we simply work to duplicate it perfectly?
As long as we use _RGB, it doesn’t seem to matter: the color (0, 170, 170) still matches closest to (0, 85, 170), so we don’t need to code an exception to the little rules I created for my tile maker. Still though, I can’t help but wonder, “Why is that one color different from the pattern with all the others??” ;)