troubles with bitmap parsing
Posted: Wed Nov 18, 2020 12:11 pm
I've put together a dysfunctional bitmap parser that's confusing the **** out of me.
I have a proper bitmap but it keeps parsing incorrectly...
Code:
What the bitmap should look like:
What I get from serial:
What I see consistently is the top half of the bitmap not being parsed/shown.
Anyone notice anything wrong here?
I have a proper bitmap but it keeps parsing incorrectly...
Code:
Code: Select all
static inline uint8_t get_bit(uint64_t source, uint8_t bit)
{
return (source & ( 1 << bit )) >> bit;
}
. . .
void Terminal::put_entry_at(char c, uint8_t color, size_t x, size_t y)
{
uint64_t font_selector = 0x1824427E42424200; // hardcoded (temp), 'A'
uint8_t byts[64];
for (uint8_t i = 1; i <= 64; i++)
{
byts[i] = get_bit(font_selector, i);
}
for (int i = 63; i >= 0; i--)
{
if ((i + 1) % 8 == 0)
serial_msg('\n');
serial_msg(byts[i] + 48); // 48, ASCII code '0'
}
}
Code: Select all
00011000
00100100
01000010
01111110
01000010
01000010
01000010
00000000
Code: Select all
00000000
00000000
00000000
00000000
,1000010
01000010
01000010
00000000
Anyone notice anything wrong here?