Graphics

STM32F0xx

Calculation of location in image buffer should be quick but on M0 there is no division opcode in hardware.

Better use

3 RSHIFT
7 AND

Instead of

8 /
8 MOD

Then OR the bits into the image buffer, so that you do not “unset” the adjacent pixels.

Pixels

Use CBIS! to write a single pixel in the frame buffer. and CBIC! to clear a single pixel.

not and

is used in cbic! for clearing a bit. xor to toggle it.