add back original C implimentation

This commit is contained in:
Josh Goebel 2017-04-01 14:44:27 -04:00 committed by Scott Allen
parent 554c21f759
commit 6f9056f99c
1 changed files with 9 additions and 2 deletions

View File

@ -284,9 +284,16 @@ void Arduboy2Base::drawPixel(int16_t x, int16_t y, uint8_t color)
}
#endif
uint16_t row_offset; // = (y * WIDTH/8) & ~0b01111111 + (uint8_t)x;
uint8_t bit; // = 1 << (y % 8);
uint16_t row_offset;
uint8_t bit;
// uint8_t row = (uint8_t)y / 8;
// row_offset = (row*WIDTH) + (uint8_t)x;
// bit = _BV((uint8_t)y % 8);
// the above math can also be rewritten more simply as;
// (y * WIDTH/8) & ~0b01111111 + (uint8_t)x;
// which is what the below assembler does
asm volatile(
"mul %[width_offset],%[y]\n"
"movw %[row_offset], r0\n"