1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <stdint.h>
5 /*
6 * The bitmap mapping for the framebuffer is from top left to right, a strip of 8 vertical
7 * bits from each byte, so there is a block of 128 x 8 px on a stride of 128 bytes.
8 *
9 * The 8 bits from the first byte in the fb are the leftmost vertical strip of 8, then the
10 * next byte is the 8 pixels one to the right, until the 127th byte if the vertical strip
11 * of 8 on the rhs.
12 *
13 * +----------------------------------+
14 * |0 |
15 * |1 |
16 * |2 |
17 * |3 |
18 * |4 |
19 * |5 |
20 * |6 |
21 * |7 |
22 *
23 * In this way the fb is more like (8 x vertical (128 x 8))
24 *
25 */
26
27
28 static const uint8_t scan[] = {
29
30 #include "pic.h"
31 };
32
33 /*
34 * input byte 0 is like ABCDEFGH, one bit per horizontal pixel for one line
35 * on an hstride of 16 bytes
36 *
37 * output byte 0 = b0 = byte 0 b0, b1 = byte16 b0, b2 = byte24 b0 etc
38 *
39 * px(0,0) --> byte0 b0
40 * px(0,1) --> byte0 b1
41 */
42
43 int
main(void)44 main(void)
45 {
46 const uint8_t *p = scan;
47 uint8_t r[1024];
48 int x, y, t = 0;
49
50 memset(&r, 0, sizeof(r));
51
52 while (t < 1024) {
53
54 for (x = 0; x < 128; x++) {
55 for (y = 0; y < 8; y++) {
56 if (p[t + (16 * y) + (x / 8)] & (1 << (7 - (x & 7))))
57 r[t + x] |= 1 << y;
58 }
59 }
60
61 t += 128;
62 }
63
64 for (x = 0; x < 1024; x++) {
65 printf("0x%02X, ", r[x]);
66 if ((x & 0xf) == 0xf)
67 printf("\n");
68 }
69 }
70
71