Thank you Ivant, you helped me a lot.
Since we handle all lines in a word, XXXXXX, in its own we only need 15 bit mask. And I precompute it in Screen.init.
The fourth case is by AND, the first and the second case.
And now my program draws fast. But the output is not as expected.
Like drawing from 0 to 18 px is not correct.
do Screen.drawLine(0,0, 18,0);
This program should set the first word all 1 and in the second word the first 3 bits. And my program handles those cases.
And I even print memory locations at
16384[0] = -1,
16384[1] = -8192 and 16384[2] = 0;
-1 = 1111111111111111
-8192 = 1110000000000000
And this seems correct, but screen draws not correctly.