今天终于画出了A,值得庆幸的一天吧

呵呵 晒晒图显摆显摆

下面是加入的代码:

void putfont8 (int * vram, int xsize, int x, int y, int c, char * font) {
    int i;
    int *p;
    char d;
    for (i = 0; i < 16; i++) {
        d = font[i];
        p = vram + (y + i) * xsize + x;
        if ((d & 0x80) != 0) {*(p + 0) = c;}
        if ((d & 0x40) != 0) {*(p + 1) = c;}
        if ((d & 0x20) != 0) {*(p + 2) = c;}
        if ((d & 0x10) != 0) {*(p + 3) = c;}
        if ((d & 0x08) != 0) {*(p + 4) = c;}
        if ((d & 0x04) != 0) {*(p + 5) = c;}
        if ((d & 0x02) != 0) {*(p + 6) = c;}
        if ((d & 0x01) != 0) {*(p + 7) = c;}
    }
    return;
}

在主函数中加入如下语句:

putfont8 (fb, 1024, 30, 30, 0x000000, font_A);

数组font_A的定义:

static char font_A[16] = {
    0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x24,
    0x24, 0x7e, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00
};

以上这些多是参考川合秀实先生《30天自制操作系统》

猜你喜欢

转载自blog.csdn.net/weixin_39410618/article/details/81462608