From 6f9056f99c8658499a8a800d8f0bc851645670f0 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Sat, 1 Apr 2017 14:44:27 -0400 Subject: [PATCH] add back original C implimentation --- src/Arduboy2.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Arduboy2.cpp b/src/Arduboy2.cpp index 6eb4f0c..ae7444b 100644 --- a/src/Arduboy2.cpp +++ b/src/Arduboy2.cpp @@ -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"