mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-05 19:13:21 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8594061b02 | ||
|
|
6d4706d26c | ||
|
|
94fa9878d6 |
@@ -8,6 +8,7 @@ void init_palette(void);
|
||||
void set_palette(int start, int end, unsigned char *rgb);
|
||||
void boxfill8(unsigned char *vram, int xsize, unsigned char c, int x0, int y0, int x1, int y1);
|
||||
void init_screen(char *vram, int x, int y);
|
||||
void putfont8(char *vram, int xsize, int x, int y, char c, char *font);
|
||||
|
||||
#define COL8_000000 0
|
||||
#define COL8_FF0000 1
|
||||
@@ -26,22 +27,23 @@ void init_screen(char *vram, int x, int y);
|
||||
#define COL8_008484 14
|
||||
#define COL8_848484 15
|
||||
|
||||
struct BOOTINFO {
|
||||
char cyls, leds, vmode, reserve;
|
||||
short scrnx, scrny;
|
||||
char *vram;
|
||||
};
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
char *vram;/* 声明变量vram、用于BYTE [...]地址 */
|
||||
int xsize, ysize;
|
||||
short *binfo_scrnx, *binfo_scrny;
|
||||
int *binfo_vram;
|
||||
struct BOOTINFO *binfo = (struct BOOTINFO *) 0x0ff0;
|
||||
static char font_A[16] = {
|
||||
0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x24,
|
||||
0x24, 0x7e, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00
|
||||
};
|
||||
|
||||
init_palette();
|
||||
binfo_scrnx = (short *) 0x0ff4;
|
||||
binfo_scrny = (short *) 0x0ff6;
|
||||
binfo_vram = (int *) 0x0ff8;
|
||||
xsize = *binfo_scrnx;
|
||||
ysize = *binfo_scrny;
|
||||
vram = (char *) *binfo_vram;
|
||||
|
||||
init_screen(vram, xsize, ysize);
|
||||
init_screen(binfo->vram, binfo->scrnx, binfo->scrny);
|
||||
putfont8(binfo->vram, binfo->scrnx, 10, 10, COL8_FFFFFF, font_A);
|
||||
|
||||
for (;;) {
|
||||
io_hlt();
|
||||
@@ -120,3 +122,22 @@ void init_screen(char *vram, int x, int y)
|
||||
boxfill8(vram, x, COL8_FFFFFF, x - 3, y - 24, x - 3, y - 3);
|
||||
return;
|
||||
}
|
||||
|
||||
void putfont8(char *vram, int xsize, int x, int y, char c, char *font)
|
||||
{
|
||||
int i;
|
||||
char *p, d /* data */;
|
||||
for (i = 0; i < 16; i++) {
|
||||
p = vram + (y + i) * xsize + x;
|
||||
d = font[i];
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user