mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-04 18:43:25 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b91f073c0 | ||
|
|
e7be9e0dfd | ||
|
|
b5f993ad72 | ||
|
|
094c0ccd8f | ||
|
|
8594061b02 |
@@ -6,6 +6,8 @@ NASK = $(TOOLPATH)nask.exe
|
||||
CC1 = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet
|
||||
GAS2NASK = $(TOOLPATH)gas2nask.exe -a
|
||||
OBJ2BIM = $(TOOLPATH)obj2bim.exe
|
||||
MAKEFONT = $(TOOLPATH)makefont.exe
|
||||
BIN2OBJ = $(TOOLPATH)bin2obj.exe
|
||||
BIM2HRB = $(TOOLPATH)bim2hrb.exe
|
||||
RULEFILE = $(TOOLPATH)haribote/haribote.rul
|
||||
EDIMG = $(TOOLPATH)edimg.exe
|
||||
@@ -38,9 +40,15 @@ bootpack.obj : bootpack.nas Makefile
|
||||
naskfunc.obj : naskfunc.nas Makefile
|
||||
$(NASK) naskfunc.nas naskfunc.obj naskfunc.lst
|
||||
|
||||
bootpack.bim : bootpack.obj naskfunc.obj Makefile
|
||||
hankaku.bin : hankaku.txt Makefile
|
||||
$(MAKEFONT) hankaku.txt hankaku.bin
|
||||
|
||||
hankaku.obj : hankaku.bin Makefile
|
||||
$(BIN2OBJ) hankaku.bin hankaku.obj _hankaku
|
||||
|
||||
bootpack.bim : bootpack.obj naskfunc.obj hankaku.obj Makefile
|
||||
$(OBJ2BIM) @$(RULEFILE) out:bootpack.bim stack:3136k map:bootpack.map \
|
||||
bootpack.obj naskfunc.obj
|
||||
bootpack.obj naskfunc.obj hankaku.obj
|
||||
# 3MB+64KB=3136KB
|
||||
|
||||
bootpack.hrb : bootpack.bim Makefile
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void io_hlt(void);
|
||||
void io_cli(void);
|
||||
void io_out8(int port, int data);
|
||||
@@ -8,6 +10,9 @@ 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);
|
||||
void putfonts8_asc(char *vram, int xsize, int x, int y, char c, unsigned char *s);
|
||||
|
||||
|
||||
#define COL8_000000 0
|
||||
#define COL8_FF0000 1
|
||||
@@ -35,10 +40,18 @@ struct BOOTINFO {
|
||||
void HariMain(void)
|
||||
{
|
||||
struct BOOTINFO *binfo = (struct BOOTINFO *) 0x0ff0;
|
||||
char s[40];
|
||||
|
||||
init_palette();
|
||||
init_screen(binfo->vram, binfo->scrnx, binfo->scrny);
|
||||
|
||||
putfonts8_asc(binfo->vram, binfo->scrnx, 8, 8, COL8_FFFFFF, "ABC 123");
|
||||
putfonts8_asc(binfo->vram, binfo->scrnx, 31, 31, COL8_000000, "Haribote OS.");
|
||||
putfonts8_asc(binfo->vram, binfo->scrnx, 30, 30, COL8_FFFFFF, "Haribote OS.");
|
||||
|
||||
sprintf(s, "scrnx = %d", binfo->scrnx);
|
||||
putfonts8_asc(binfo->vram, binfo->scrnx, 16, 64, COL8_FFFFFF, s);
|
||||
|
||||
for (;;) {
|
||||
io_hlt();
|
||||
}
|
||||
@@ -116,3 +129,33 @@ 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;
|
||||
}
|
||||
|
||||
void putfonts8_asc(char *vram, int xsize, int x, int y, char c, unsigned char *s)
|
||||
{
|
||||
extern char hankaku[4096];
|
||||
/* C语言中,字符串都是以0x00结尾 */
|
||||
for (; *s != 0x00; s++) {
|
||||
putfont8(vram, xsize, x, y, c, hankaku + *s * 16);
|
||||
x += 8;
|
||||
}
|
||||
return;
|
||||
}
|
||||
4609
05_day/hankaku.txt
Normal file
4609
05_day/hankaku.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user