From c65ca780b37fed714e9cd0e79e882473f6eb65ed Mon Sep 17 00:00:00 2001 From: Yourtion Date: Wed, 18 May 2016 10:25:37 +0800 Subject: [PATCH] Add 28 day code --- 28_day/!cons_9x.bat | 1 + 28_day/!cons_nt.bat | 1 + 28_day/Makefile | 142 ++ 28_day/a/!cons_9x.bat | 1 + 28_day/a/!cons_nt.bat | 1 + 28_day/a/Makefile | 5 + 28_day/a/a.c | 7 + 28_day/a/make.bat | 1 + 28_day/apilib.h | 20 + 28_day/apilib/!cons_9x.bat | 1 + 28_day/apilib/!cons_nt.bat | 1 + 28_day/apilib/Makefile | 47 + 28_day/apilib/api001.nas | 14 + 28_day/apilib/api002.nas | 16 + 28_day/apilib/api003.nas | 17 + 28_day/apilib/api004.nas | 12 + 28_day/apilib/api005.nas | 24 + 28_day/apilib/api006.nas | 27 + 28_day/apilib/api007.nas | 27 + 28_day/apilib/api008.nas | 20 + 28_day/apilib/api009.nas | 17 + 28_day/apilib/api010.nas | 18 + 28_day/apilib/api011.nas | 23 + 28_day/apilib/api012.nas | 24 + 28_day/apilib/api013.nas | 27 + 28_day/apilib/api014.nas | 16 + 28_day/apilib/api015.nas | 14 + 28_day/apilib/api016.nas | 13 + 28_day/apilib/api017.nas | 17 + 28_day/apilib/api018.nas | 17 + 28_day/apilib/api019.nas | 16 + 28_day/apilib/api020.nas | 14 + 28_day/apilib/apilib.lib | Bin 0 -> 8966 bytes 28_day/apilib/make.bat | 1 + 28_day/app_make.txt | 79 + 28_day/beepdown/!cons_9x.bat | 1 + 28_day/beepdown/!cons_nt.bat | 1 + 28_day/beepdown/Makefile | 5 + 28_day/beepdown/beepdown.c | 19 + 28_day/beepdown/make.bat | 1 + 28_day/color/!cons_9x.bat | 1 + 28_day/color/!cons_nt.bat | 1 + 28_day/color/Makefile | 5 + 28_day/color/color.c | 21 + 28_day/color/make.bat | 1 + 28_day/color2/!cons_9x.bat | 1 + 28_day/color2/!cons_nt.bat | 1 + 28_day/color2/Makefile | 5 + 28_day/color2/color2.c | 36 + 28_day/color2/make.bat | 1 + 28_day/haribote.rul | 10 + 28_day/haribote/!cons_9x.bat | 1 + 28_day/haribote/!cons_nt.bat | 1 + 28_day/haribote/Makefile | 79 + 28_day/haribote/asmhead.nas | 202 ++ 28_day/haribote/bootpack.c | 387 +++ 28_day/haribote/bootpack.h | 283 +++ 28_day/haribote/console.c | 604 +++++ 28_day/haribote/dsctbl.c | 59 + 28_day/haribote/fifo.c | 63 + 28_day/haribote/file.c | 74 + 28_day/haribote/graphic.c | 167 ++ 28_day/haribote/hankaku.txt | 4609 ++++++++++++++++++++++++++++++++++ 28_day/haribote/haribote.sys | Bin 0 -> 33331 bytes 28_day/haribote/int.c | 26 + 28_day/haribote/ipl10.bin | Bin 0 -> 512 bytes 28_day/haribote/ipl10.nas | 109 + 28_day/haribote/keyboard.c | 44 + 28_day/haribote/make.bat | 1 + 28_day/haribote/memory.c | 162 ++ 28_day/haribote/mouse.c | 76 + 28_day/haribote/mtask.c | 203 ++ 28_day/haribote/naskfunc.nas | 291 +++ 28_day/haribote/sheet.c | 294 +++ 28_day/haribote/timer.c | 169 ++ 28_day/haribote/window.c | 118 + 28_day/hello3/!cons_9x.bat | 1 + 28_day/hello3/!cons_nt.bat | 1 + 28_day/hello3/Makefile | 5 + 28_day/hello3/hello3.c | 11 + 28_day/hello3/make.bat | 1 + 28_day/hello4/!cons_9x.bat | 1 + 28_day/hello4/!cons_nt.bat | 1 + 28_day/hello4/Makefile | 5 + 28_day/hello4/hello4.c | 7 + 28_day/hello4/make.bat | 1 + 28_day/hello5/!cons_9x.bat | 1 + 28_day/hello5/!cons_nt.bat | 1 + 28_day/hello5/Makefile | 5 + 28_day/hello5/hello5.nas | 20 + 28_day/hello5/make.bat | 1 + 28_day/lines/!cons_9x.bat | 1 + 28_day/lines/!cons_nt.bat | 1 + 28_day/lines/Makefile | 5 + 28_day/lines/lines.c | 22 + 28_day/lines/make.bat | 1 + 28_day/make.bat | 1 + 28_day/noodle/!cons_9x.bat | 1 + 28_day/noodle/!cons_nt.bat | 1 + 28_day/noodle/Makefile | 5 + 28_day/noodle/make.bat | 1 + 28_day/noodle/noodle.c | 32 + 28_day/star1/!cons_9x.bat | 1 + 28_day/star1/!cons_nt.bat | 1 + 28_day/star1/Makefile | 5 + 28_day/star1/make.bat | 1 + 28_day/star1/star1.c | 18 + 28_day/stars/!cons_9x.bat | 1 + 28_day/stars/!cons_nt.bat | 1 + 28_day/stars/Makefile | 5 + 28_day/stars/make.bat | 1 + 28_day/stars/stars.c | 24 + 28_day/stars2/!cons_9x.bat | 1 + 28_day/stars2/!cons_nt.bat | 1 + 28_day/stars2/Makefile | 5 + 28_day/stars2/make.bat | 1 + 28_day/stars2/stars2.c | 25 + 28_day/walk/!cons_9x.bat | 1 + 28_day/walk/!cons_nt.bat | 1 + 28_day/walk/Makefile | 5 + 28_day/walk/make.bat | 1 + 28_day/walk/walk.c | 26 + 28_day/winhelo/!cons_9x.bat | 1 + 28_day/winhelo/!cons_nt.bat | 1 + 28_day/winhelo/Makefile | 5 + 28_day/winhelo/make.bat | 1 + 28_day/winhelo/winhelo.c | 15 + 28_day/winhelo2/!cons_9x.bat | 1 + 28_day/winhelo2/!cons_nt.bat | 1 + 28_day/winhelo2/Makefile | 5 + 28_day/winhelo2/make.bat | 1 + 28_day/winhelo2/winhelo2.c | 17 + 28_day/winhelo3/!cons_9x.bat | 1 + 28_day/winhelo3/!cons_nt.bat | 1 + 28_day/winhelo3/Makefile | 5 + 28_day/winhelo3/make.bat | 1 + 28_day/winhelo3/winhelo3.c | 19 + 137 files changed, 9146 insertions(+) create mode 100644 28_day/!cons_9x.bat create mode 100644 28_day/!cons_nt.bat create mode 100644 28_day/Makefile create mode 100644 28_day/a/!cons_9x.bat create mode 100644 28_day/a/!cons_nt.bat create mode 100644 28_day/a/Makefile create mode 100644 28_day/a/a.c create mode 100644 28_day/a/make.bat create mode 100644 28_day/apilib.h create mode 100644 28_day/apilib/!cons_9x.bat create mode 100644 28_day/apilib/!cons_nt.bat create mode 100644 28_day/apilib/Makefile create mode 100644 28_day/apilib/api001.nas create mode 100644 28_day/apilib/api002.nas create mode 100644 28_day/apilib/api003.nas create mode 100644 28_day/apilib/api004.nas create mode 100644 28_day/apilib/api005.nas create mode 100644 28_day/apilib/api006.nas create mode 100644 28_day/apilib/api007.nas create mode 100644 28_day/apilib/api008.nas create mode 100644 28_day/apilib/api009.nas create mode 100644 28_day/apilib/api010.nas create mode 100644 28_day/apilib/api011.nas create mode 100644 28_day/apilib/api012.nas create mode 100644 28_day/apilib/api013.nas create mode 100644 28_day/apilib/api014.nas create mode 100644 28_day/apilib/api015.nas create mode 100644 28_day/apilib/api016.nas create mode 100644 28_day/apilib/api017.nas create mode 100644 28_day/apilib/api018.nas create mode 100644 28_day/apilib/api019.nas create mode 100644 28_day/apilib/api020.nas create mode 100644 28_day/apilib/apilib.lib create mode 100644 28_day/apilib/make.bat create mode 100644 28_day/app_make.txt create mode 100644 28_day/beepdown/!cons_9x.bat create mode 100644 28_day/beepdown/!cons_nt.bat create mode 100644 28_day/beepdown/Makefile create mode 100644 28_day/beepdown/beepdown.c create mode 100644 28_day/beepdown/make.bat create mode 100644 28_day/color/!cons_9x.bat create mode 100644 28_day/color/!cons_nt.bat create mode 100644 28_day/color/Makefile create mode 100644 28_day/color/color.c create mode 100644 28_day/color/make.bat create mode 100644 28_day/color2/!cons_9x.bat create mode 100644 28_day/color2/!cons_nt.bat create mode 100644 28_day/color2/Makefile create mode 100644 28_day/color2/color2.c create mode 100644 28_day/color2/make.bat create mode 100644 28_day/haribote.rul create mode 100644 28_day/haribote/!cons_9x.bat create mode 100644 28_day/haribote/!cons_nt.bat create mode 100644 28_day/haribote/Makefile create mode 100644 28_day/haribote/asmhead.nas create mode 100644 28_day/haribote/bootpack.c create mode 100644 28_day/haribote/bootpack.h create mode 100644 28_day/haribote/console.c create mode 100644 28_day/haribote/dsctbl.c create mode 100644 28_day/haribote/fifo.c create mode 100644 28_day/haribote/file.c create mode 100644 28_day/haribote/graphic.c create mode 100644 28_day/haribote/hankaku.txt create mode 100644 28_day/haribote/haribote.sys create mode 100644 28_day/haribote/int.c create mode 100644 28_day/haribote/ipl10.bin create mode 100644 28_day/haribote/ipl10.nas create mode 100644 28_day/haribote/keyboard.c create mode 100644 28_day/haribote/make.bat create mode 100644 28_day/haribote/memory.c create mode 100644 28_day/haribote/mouse.c create mode 100644 28_day/haribote/mtask.c create mode 100644 28_day/haribote/naskfunc.nas create mode 100644 28_day/haribote/sheet.c create mode 100644 28_day/haribote/timer.c create mode 100644 28_day/haribote/window.c create mode 100644 28_day/hello3/!cons_9x.bat create mode 100644 28_day/hello3/!cons_nt.bat create mode 100644 28_day/hello3/Makefile create mode 100644 28_day/hello3/hello3.c create mode 100644 28_day/hello3/make.bat create mode 100644 28_day/hello4/!cons_9x.bat create mode 100644 28_day/hello4/!cons_nt.bat create mode 100644 28_day/hello4/Makefile create mode 100644 28_day/hello4/hello4.c create mode 100644 28_day/hello4/make.bat create mode 100644 28_day/hello5/!cons_9x.bat create mode 100644 28_day/hello5/!cons_nt.bat create mode 100644 28_day/hello5/Makefile create mode 100644 28_day/hello5/hello5.nas create mode 100644 28_day/hello5/make.bat create mode 100644 28_day/lines/!cons_9x.bat create mode 100644 28_day/lines/!cons_nt.bat create mode 100644 28_day/lines/Makefile create mode 100644 28_day/lines/lines.c create mode 100644 28_day/lines/make.bat create mode 100644 28_day/make.bat create mode 100644 28_day/noodle/!cons_9x.bat create mode 100644 28_day/noodle/!cons_nt.bat create mode 100644 28_day/noodle/Makefile create mode 100644 28_day/noodle/make.bat create mode 100644 28_day/noodle/noodle.c create mode 100644 28_day/star1/!cons_9x.bat create mode 100644 28_day/star1/!cons_nt.bat create mode 100644 28_day/star1/Makefile create mode 100644 28_day/star1/make.bat create mode 100644 28_day/star1/star1.c create mode 100644 28_day/stars/!cons_9x.bat create mode 100644 28_day/stars/!cons_nt.bat create mode 100644 28_day/stars/Makefile create mode 100644 28_day/stars/make.bat create mode 100644 28_day/stars/stars.c create mode 100644 28_day/stars2/!cons_9x.bat create mode 100644 28_day/stars2/!cons_nt.bat create mode 100644 28_day/stars2/Makefile create mode 100644 28_day/stars2/make.bat create mode 100644 28_day/stars2/stars2.c create mode 100644 28_day/walk/!cons_9x.bat create mode 100644 28_day/walk/!cons_nt.bat create mode 100644 28_day/walk/Makefile create mode 100644 28_day/walk/make.bat create mode 100644 28_day/walk/walk.c create mode 100644 28_day/winhelo/!cons_9x.bat create mode 100644 28_day/winhelo/!cons_nt.bat create mode 100644 28_day/winhelo/Makefile create mode 100644 28_day/winhelo/make.bat create mode 100644 28_day/winhelo/winhelo.c create mode 100644 28_day/winhelo2/!cons_9x.bat create mode 100644 28_day/winhelo2/!cons_nt.bat create mode 100644 28_day/winhelo2/Makefile create mode 100644 28_day/winhelo2/make.bat create mode 100644 28_day/winhelo2/winhelo2.c create mode 100644 28_day/winhelo3/!cons_9x.bat create mode 100644 28_day/winhelo3/!cons_nt.bat create mode 100644 28_day/winhelo3/Makefile create mode 100644 28_day/winhelo3/make.bat create mode 100644 28_day/winhelo3/winhelo3.c diff --git a/28_day/!cons_9x.bat b/28_day/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/!cons_nt.bat b/28_day/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/Makefile b/28_day/Makefile new file mode 100644 index 0000000..23e155c --- /dev/null +++ b/28_day/Makefile @@ -0,0 +1,142 @@ +TOOLPATH = ../z_tools/ +INCPATH = ../z_tools/haribote/ + +MAKE = $(TOOLPATH)make.exe -r +EDIMG = $(TOOLPATH)edimg.exe +IMGTOL = $(TOOLPATH)imgtol.com +COPY = copy +DEL = del + +#默认动作 + +default : + $(MAKE) haribote.img + +#文件生成规则 + +haribote.img : haribote/ipl10.bin haribote/haribote.sys Makefile \ + a/a.hrb hello3/hello3.hrb hello4/hello4.hrb hello5/hello5.hrb \ + winhelo/winhelo.hrb winhelo2/winhelo2.hrb winhelo3/winhelo3.hrb \ + star1/star1.hrb stars/stars.hrb stars2/stars2.hrb \ + lines/lines.hrb walk/walk.hrb noodle/noodle.hrb \ + beepdown/beepdown.hrb color/color.hrb color2/color2.hrb + $(EDIMG) imgin:../z_tools/fdimg0at.tek \ + wbinimg src:haribote/ipl10.bin len:512 from:0 to:0 \ + copy from:haribote/haribote.sys to:@: \ + copy from:haribote/ipl10.nas to:@: \ + copy from:make.bat to:@: \ + copy from:a/a.hrb to:@: \ + copy from:hello3/hello3.hrb to:@: \ + copy from:hello4/hello4.hrb to:@: \ + copy from:hello5/hello5.hrb to:@: \ + copy from:winhelo/winhelo.hrb to:@: \ + copy from:winhelo2/winhelo2.hrb to:@: \ + copy from:winhelo3/winhelo3.hrb to:@: \ + copy from:star1/star1.hrb to:@: \ + copy from:stars/stars.hrb to:@: \ + copy from:stars2/stars2.hrb to:@: \ + copy from:lines/lines.hrb to:@: \ + copy from:walk/walk.hrb to:@: \ + copy from:noodle/noodle.hrb to:@: \ + copy from:beepdown/beepdown.hrb to:@: \ + copy from:color/color.hrb to:@: \ + copy from:color2/color2.hrb to:@: \ + imgout:haribote.img + +#命令 + +run : + $(MAKE) haribote.img + $(COPY) haribote.img ..\z_tools\qemu\fdimage0.bin + $(MAKE) -C ../z_tools/qemu + +install : + $(MAKE) haribote.img + $(IMGTOL) w a: haribote.img + +full : + $(MAKE) -C haribote + $(MAKE) -C apilib + $(MAKE) -C a + $(MAKE) -C hello3 + $(MAKE) -C hello4 + $(MAKE) -C hello5 + $(MAKE) -C winhelo + $(MAKE) -C winhelo2 + $(MAKE) -C winhelo3 + $(MAKE) -C star1 + $(MAKE) -C stars + $(MAKE) -C stars2 + $(MAKE) -C lines + $(MAKE) -C walk + $(MAKE) -C noodle + $(MAKE) -C beepdown + $(MAKE) -C color + $(MAKE) -C color2 + $(MAKE) haribote.img + +run_full : + $(MAKE) full + $(COPY) haribote.img ..\z_tools\qemu\fdimage0.bin + $(MAKE) -C ../z_tools/qemu + +install_full : + $(MAKE) full + $(IMGTOL) w a: haribote.img + +run_os : + $(MAKE) -C haribote + $(MAKE) run + +clean : +#不执行任何操作 + +src_only : + $(MAKE) clean + -$(DEL) haribote.img + +clean_full : + $(MAKE) -C haribote clean + $(MAKE) -C apilib clean + $(MAKE) -C a clean + $(MAKE) -C hello3 clean + $(MAKE) -C hello4 clean + $(MAKE) -C hello5 clean + $(MAKE) -C winhelo clean + $(MAKE) -C winhelo2 clean + $(MAKE) -C winhelo3 clean + $(MAKE) -C star1 clean + $(MAKE) -C stars clean + $(MAKE) -C stars2 clean + $(MAKE) -C lines clean + $(MAKE) -C walk clean + $(MAKE) -C noodle clean + $(MAKE) -C beepdown clean + $(MAKE) -C color clean + $(MAKE) -C color2 clean + +src_only_full : + $(MAKE) -C haribote src_only + $(MAKE) -C apilib src_only + $(MAKE) -C a src_only + $(MAKE) -C hello3 src_only + $(MAKE) -C hello4 src_only + $(MAKE) -C hello5 src_only + $(MAKE) -C winhelo src_only + $(MAKE) -C winhelo2 src_only + $(MAKE) -C winhelo3 src_only + $(MAKE) -C star1 src_only + $(MAKE) -C stars src_only + $(MAKE) -C stars2 src_only + $(MAKE) -C lines src_only + $(MAKE) -C walk src_only + $(MAKE) -C noodle src_only + $(MAKE) -C beepdown src_only + $(MAKE) -C color src_only + $(MAKE) -C color2 src_only + -$(DEL) haribote.img + +refresh : + $(MAKE) full + $(MAKE) clean_full + -$(DEL) haribote.img diff --git a/28_day/a/!cons_9x.bat b/28_day/a/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/a/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/a/!cons_nt.bat b/28_day/a/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/a/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/a/Makefile b/28_day/a/Makefile new file mode 100644 index 0000000..674a683 --- /dev/null +++ b/28_day/a/Makefile @@ -0,0 +1,5 @@ +APP = a +STACK = 1k +MALLOC = 0k + +include ../app_make.txt diff --git a/28_day/a/a.c b/28_day/a/a.c new file mode 100644 index 0000000..3df81f5 --- /dev/null +++ b/28_day/a/a.c @@ -0,0 +1,7 @@ +#include "apilib.h" + +void HariMain(void) +{ + api_putchar('A'); + api_end(); +} diff --git a/28_day/a/make.bat b/28_day/a/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/a/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/apilib.h b/28_day/apilib.h new file mode 100644 index 0000000..80ec6e0 --- /dev/null +++ b/28_day/apilib.h @@ -0,0 +1,20 @@ +void api_putchar(int c); +void api_putstr0(char *s); +void api_putstr1(char *s, int l); +void api_end(void); +int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title); +void api_putstrwin(int win, int x, int y, int col, int len, char *str); +void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col); +void api_initmalloc(void); +char *api_malloc(int size); +void api_free(char *addr, int size); +void api_point(int win, int x, int y, int col); +void api_refreshwin(int win, int x0, int y0, int x1, int y1); +void api_linewin(int win, int x0, int y0, int x1, int y1, int col); +void api_closewin(int win); +int api_getkey(int mode); +int api_alloctimer(void); +void api_inittimer(int timer, int data); +void api_settimer(int timer, int time); +void api_freetimer(int timer); +void api_beep(int tone); diff --git a/28_day/apilib/!cons_9x.bat b/28_day/apilib/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/apilib/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/apilib/!cons_nt.bat b/28_day/apilib/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/apilib/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/apilib/Makefile b/28_day/apilib/Makefile new file mode 100644 index 0000000..e93248b --- /dev/null +++ b/28_day/apilib/Makefile @@ -0,0 +1,47 @@ +OBJS_API = api001.obj api002.obj api003.obj api004.obj api005.obj api006.obj \ + api007.obj api008.obj api009.obj api010.obj api011.obj api012.obj \ + api013.obj api014.obj api015.obj api016.obj api017.obj api018.obj \ + api019.obj api020.obj + +TOOLPATH = ../../z_tools/ +INCPATH = ../../z_tools/haribote/ + +MAKE = $(TOOLPATH)make.exe -r +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 = ../haribote.rul +EDIMG = $(TOOLPATH)edimg.exe +IMGTOL = $(TOOLPATH)imgtol.com +GOLIB = $(TOOLPATH)golib00.exe +COPY = copy +DEL = del + +# ftHg + +default : + $(MAKE) apilib.lib + +# t@CK + +apilib.lib : Makefile $(OBJS_API) + $(GOLIB) $(OBJS_API) out:apilib.lib + +# ʋK + +%.obj : %.nas Makefile + $(NASK) $*.nas $*.obj $*.lst + +# R}h + +clean : + -$(DEL) *.lst + -$(DEL) *.obj + +src_only : + $(MAKE) clean + -$(DEL) apilib.lib diff --git a/28_day/apilib/api001.nas b/28_day/apilib/api001.nas new file mode 100644 index 0000000..2f893a9 --- /dev/null +++ b/28_day/apilib/api001.nas @@ -0,0 +1,14 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api001.nas"] + + GLOBAL _api_putchar + +[SECTION .text] + +_api_putchar: ; void api_putchar(int c); + MOV EDX,1 + MOV AL,[ESP+4] ; c + INT 0x40 + RET diff --git a/28_day/apilib/api002.nas b/28_day/apilib/api002.nas new file mode 100644 index 0000000..6ac9cc7 --- /dev/null +++ b/28_day/apilib/api002.nas @@ -0,0 +1,16 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api002.nas"] + + GLOBAL _api_putstr0 + +[SECTION .text] + +_api_putstr0: ; void api_putstr0(char *s); + PUSH EBX + MOV EDX,2 + MOV EBX,[ESP+8] ; s + INT 0x40 + POP EBX + RET diff --git a/28_day/apilib/api003.nas b/28_day/apilib/api003.nas new file mode 100644 index 0000000..6c2d0fd --- /dev/null +++ b/28_day/apilib/api003.nas @@ -0,0 +1,17 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api003.nas"] + + GLOBAL _api_putstr1 + +[SECTION .text] + +_api_putstr1: ; void api_putstr1(char *s, int l); + PUSH EBX + MOV EDX,3 + MOV EBX,[ESP+ 8] ; s + MOV ECX,[ESP+12] ; l + INT 0x40 + POP EBX + RET diff --git a/28_day/apilib/api004.nas b/28_day/apilib/api004.nas new file mode 100644 index 0000000..3c738a3 --- /dev/null +++ b/28_day/apilib/api004.nas @@ -0,0 +1,12 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api004.nas"] + + GLOBAL _api_end + +[SECTION .text] + +_api_end: ; void api_end(void); + MOV EDX,4 + INT 0x40 diff --git a/28_day/apilib/api005.nas b/28_day/apilib/api005.nas new file mode 100644 index 0000000..2157c61 --- /dev/null +++ b/28_day/apilib/api005.nas @@ -0,0 +1,24 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api005.nas"] + + GLOBAL _api_openwin + +[SECTION .text] + +_api_openwin: ; int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title); + PUSH EDI + PUSH ESI + PUSH EBX + MOV EDX,5 + MOV EBX,[ESP+16] ; buf + MOV ESI,[ESP+20] ; xsiz + MOV EDI,[ESP+24] ; ysiz + MOV EAX,[ESP+28] ; col_inv + MOV ECX,[ESP+32] ; title + INT 0x40 + POP EBX + POP ESI + POP EDI + RET diff --git a/28_day/apilib/api006.nas b/28_day/apilib/api006.nas new file mode 100644 index 0000000..94cbb2d --- /dev/null +++ b/28_day/apilib/api006.nas @@ -0,0 +1,27 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api006.nas"] + + GLOBAL _api_putstrwin + +[SECTION .text] + +_api_putstrwin: ; void api_putstrwin(int win, int x, int y, int col, int len, char *str); + PUSH EDI + PUSH ESI + PUSH EBP + PUSH EBX + MOV EDX,6 + MOV EBX,[ESP+20] ; win + MOV ESI,[ESP+24] ; x + MOV EDI,[ESP+28] ; y + MOV EAX,[ESP+32] ; col + MOV ECX,[ESP+36] ; len + MOV EBP,[ESP+40] ; str + INT 0x40 + POP EBX + POP EBP + POP ESI + POP EDI + RET diff --git a/28_day/apilib/api007.nas b/28_day/apilib/api007.nas new file mode 100644 index 0000000..57be736 --- /dev/null +++ b/28_day/apilib/api007.nas @@ -0,0 +1,27 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api007.nas"] + + GLOBAL _api_boxfilwin + +[SECTION .text] + +_api_boxfilwin: ; void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col); + PUSH EDI + PUSH ESI + PUSH EBP + PUSH EBX + MOV EDX,7 + MOV EBX,[ESP+20] ; win + MOV EAX,[ESP+24] ; x0 + MOV ECX,[ESP+28] ; y0 + MOV ESI,[ESP+32] ; x1 + MOV EDI,[ESP+36] ; y1 + MOV EBP,[ESP+40] ; col + INT 0x40 + POP EBX + POP EBP + POP ESI + POP EDI + RET diff --git a/28_day/apilib/api008.nas b/28_day/apilib/api008.nas new file mode 100644 index 0000000..d1ed6c7 --- /dev/null +++ b/28_day/apilib/api008.nas @@ -0,0 +1,20 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api008.nas"] + + GLOBAL _api_initmalloc + +[SECTION .text] + +_api_initmalloc: ; void api_initmalloc(void); + PUSH EBX + MOV EDX,8 + MOV EBX,[CS:0x0020] ; malloc内存空间的地址 + MOV EAX,EBX + ADD EAX,32*1024 ; 加上32KB + MOV ECX,[CS:0x0000] ; 数据段的大小 + SUB ECX,EAX + INT 0x40 + POP EBX + RET diff --git a/28_day/apilib/api009.nas b/28_day/apilib/api009.nas new file mode 100644 index 0000000..bcd5307 --- /dev/null +++ b/28_day/apilib/api009.nas @@ -0,0 +1,17 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api009.nas"] + + GLOBAL _api_malloc + +[SECTION .text] + +_api_malloc: ; char *api_malloc(int size); + PUSH EBX + MOV EDX,9 + MOV EBX,[CS:0x0020] + MOV ECX,[ESP+8] ; size + INT 0x40 + POP EBX + RET diff --git a/28_day/apilib/api010.nas b/28_day/apilib/api010.nas new file mode 100644 index 0000000..63a4ea5 --- /dev/null +++ b/28_day/apilib/api010.nas @@ -0,0 +1,18 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api010.nas"] + + GLOBAL _api_free + +[SECTION .text] + +_api_free: ; void api_free(char *addr, int size); + PUSH EBX + MOV EDX,10 + MOV EBX,[CS:0x0020] + MOV EAX,[ESP+ 8] ; addr + MOV ECX,[ESP+12] ; size + INT 0x40 + POP EBX + RET diff --git a/28_day/apilib/api011.nas b/28_day/apilib/api011.nas new file mode 100644 index 0000000..f5994b9 --- /dev/null +++ b/28_day/apilib/api011.nas @@ -0,0 +1,23 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api011.nas"] + + GLOBAL _api_point + +[SECTION .text] + +_api_point: ; void api_point(int win, int x, int y, int col); + PUSH EDI + PUSH ESI + PUSH EBX + MOV EDX,11 + MOV EBX,[ESP+16] ; win + MOV ESI,[ESP+20] ; x + MOV EDI,[ESP+24] ; y + MOV EAX,[ESP+28] ; col + INT 0x40 + POP EBX + POP ESI + POP EDI + RET diff --git a/28_day/apilib/api012.nas b/28_day/apilib/api012.nas new file mode 100644 index 0000000..9e9386f --- /dev/null +++ b/28_day/apilib/api012.nas @@ -0,0 +1,24 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api012.nas"] + + GLOBAL _api_refreshwin + +[SECTION .text] + +_api_refreshwin: ; void api_refreshwin(int win, int x0, int y0, int x1, int y1); + PUSH EDI + PUSH ESI + PUSH EBX + MOV EDX,12 + MOV EBX,[ESP+16] ; win + MOV EAX,[ESP+20] ; x0 + MOV ECX,[ESP+24] ; y0 + MOV ESI,[ESP+28] ; x1 + MOV EDI,[ESP+32] ; y1 + INT 0x40 + POP EBX + POP ESI + POP EDI + RET diff --git a/28_day/apilib/api013.nas b/28_day/apilib/api013.nas new file mode 100644 index 0000000..017f1ea --- /dev/null +++ b/28_day/apilib/api013.nas @@ -0,0 +1,27 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api013.nas"] + + GLOBAL _api_linewin + +[SECTION .text] + +_api_linewin: ; void api_linewin(int win, int x0, int y0, int x1, int y1, int col); + PUSH EDI + PUSH ESI + PUSH EBP + PUSH EBX + MOV EDX,13 + MOV EBX,[ESP+20] ; win + MOV EAX,[ESP+24] ; x0 + MOV ECX,[ESP+28] ; y0 + MOV ESI,[ESP+32] ; x1 + MOV EDI,[ESP+36] ; y1 + MOV EBP,[ESP+40] ; col + INT 0x40 + POP EBX + POP EBP + POP ESI + POP EDI + RET diff --git a/28_day/apilib/api014.nas b/28_day/apilib/api014.nas new file mode 100644 index 0000000..363db51 --- /dev/null +++ b/28_day/apilib/api014.nas @@ -0,0 +1,16 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api014.nas"] + + GLOBAL _api_closewin + +[SECTION .text] + +_api_closewin: ; void api_closewin(int win); + PUSH EBX + MOV EDX,14 + MOV EBX,[ESP+8] ; win + INT 0x40 + POP EBX + RET diff --git a/28_day/apilib/api015.nas b/28_day/apilib/api015.nas new file mode 100644 index 0000000..bd27ec7 --- /dev/null +++ b/28_day/apilib/api015.nas @@ -0,0 +1,14 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api015.nas"] + + GLOBAL _api_getkey + +[SECTION .text] + +_api_getkey: ; int api_getkey(int mode); + MOV EDX,15 + MOV EAX,[ESP+4] ; mode + INT 0x40 + RET diff --git a/28_day/apilib/api016.nas b/28_day/apilib/api016.nas new file mode 100644 index 0000000..e232412 --- /dev/null +++ b/28_day/apilib/api016.nas @@ -0,0 +1,13 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api016.nas"] + + GLOBAL _api_alloctimer + +[SECTION .text] + +_api_alloctimer: ; int api_alloctimer(void); + MOV EDX,16 + INT 0x40 + RET diff --git a/28_day/apilib/api017.nas b/28_day/apilib/api017.nas new file mode 100644 index 0000000..9e6a3cd --- /dev/null +++ b/28_day/apilib/api017.nas @@ -0,0 +1,17 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api017.nas"] + + GLOBAL _api_inittimer + +[SECTION .text] + +_api_inittimer: ; void api_inittimer(int timer, int data); + PUSH EBX + MOV EDX,17 + MOV EBX,[ESP+ 8] ; timer + MOV EAX,[ESP+12] ; data + INT 0x40 + POP EBX + RET diff --git a/28_day/apilib/api018.nas b/28_day/apilib/api018.nas new file mode 100644 index 0000000..a91d6f1 --- /dev/null +++ b/28_day/apilib/api018.nas @@ -0,0 +1,17 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api018.nas"] + + GLOBAL _api_settimer + +[SECTION .text] + +_api_settimer: ; void api_settimer(int timer, int time); + PUSH EBX + MOV EDX,18 + MOV EBX,[ESP+ 8] ; timer + MOV EAX,[ESP+12] ; time + INT 0x40 + POP EBX + RET diff --git a/28_day/apilib/api019.nas b/28_day/apilib/api019.nas new file mode 100644 index 0000000..d1c11e2 --- /dev/null +++ b/28_day/apilib/api019.nas @@ -0,0 +1,16 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api019.nas"] + + GLOBAL _api_freetimer + +[SECTION .text] + +_api_freetimer: ; void api_freetimer(int timer); + PUSH EBX + MOV EDX,19 + MOV EBX,[ESP+ 8] ; timer + INT 0x40 + POP EBX + RET diff --git a/28_day/apilib/api020.nas b/28_day/apilib/api020.nas new file mode 100644 index 0000000..166bcda --- /dev/null +++ b/28_day/apilib/api020.nas @@ -0,0 +1,14 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "api020.nas"] + + GLOBAL _api_beep + +[SECTION .text] + +_api_beep: ; void api_beep(int tone); + MOV EDX,20 + MOV EAX,[ESP+4] ; tone + INT 0x40 + RET diff --git a/28_day/apilib/apilib.lib b/28_day/apilib/apilib.lib new file mode 100644 index 0000000000000000000000000000000000000000..29a8eeebd154eb753bb6d0e59a2125dff5d57df1 GIT binary patch literal 8966 zcmeI2&uv5w%5XY3zgzHW)jywS}zIi{^ zs~^`oyY){J*V10ed5ca-)fYK*TCxI?b?20d;e=|w_fW&6}na@=PnqsV7Bha zllH#Z`liuxcX5h4?T34frc-RR8rFkav)SI2z1`<~9n-YOXg6AxJnfiN-K{$VG#f3` zDeN}e-9hQDY27!!m6wTISd9m!{SkCHS})$E;`RZ|rK z#|@ljv<` zk{TKXJq@0(S4Kv|fTU3jLBsIt#Z#JokY1dkHm1RSlte+J&l|wuM!?oo)Fa?YdgWaq z5Jr@J91^)TiH%C^Mx_v|Uh=Q{?=)o4s((anyz1OXNffL8`Da^wa!*(bQavlP)H}#5 z_bQnc(ug!^#8=xvJ5)&zgy-*-cLjt;4X_o;1C=^a4ne2vx7mNteS+v*rZ%R-eUwB) z=hLk|d5(-{iSR5Fo)yBACOny5Gjo{`-413{)-&R#@Je)y7U@RHA0;cozPqG!{eMD< zcOXHjLX}Af!2ca!tG6Ds^wv0udn73()F@y8O#*o;b z_d>5k$H8&G?9V=eLYT<^1PVXU?+X7jr?#AXi()kkTw9nBbg=@*)j4->8D{hBcrR-3nB Wt<|Qd)cUcbwAxHvcu(R_7XJe03V>?> literal 0 HcmV?d00001 diff --git a/28_day/apilib/make.bat b/28_day/apilib/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/apilib/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/app_make.txt b/28_day/app_make.txt new file mode 100644 index 0000000..2bca4bc --- /dev/null +++ b/28_day/app_make.txt @@ -0,0 +1,79 @@ +TOOLPATH = ../../z_tools/ +INCPATH = ../../z_tools/haribote/ +APILIBPATH = ../apilib/ +HARIBOTEPATH = ../haribote/ + +MAKE = $(TOOLPATH)make.exe -r +NASK = $(TOOLPATH)nask.exe +CC1 = $(TOOLPATH)cc1.exe -I$(INCPATH) -I../ -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 = ../haribote.rul +EDIMG = $(TOOLPATH)edimg.exe +IMGTOL = $(TOOLPATH)imgtol.com +GOLIB = $(TOOLPATH)golib00.exe +COPY = copy +DEL = del + +#默认动作 + +default : + $(MAKE) $(APP).hrb + +#文件生成规则 + +$(APP).bim : $(APP).obj $(APILIBPATH)apilib.lib Makefile ../app_make.txt + $(OBJ2BIM) @$(RULEFILE) out:$(APP).bim map:$(APP).map stack:$(STACK) \ + $(APP).obj $(APILIBPATH)apilib.lib + +$(APP).hrb : $(APP).bim Makefile ../app_make.txt + $(BIM2HRB) $(APP).bim $(APP).hrb $(MALLOC) + +haribote.img : ../haribote/ipl10.bin ../haribote/haribote.sys $(APP).hrb \ + Makefile ../app_make.txt + $(EDIMG) imgin:../../z_tools/fdimg0at.tek \ + wbinimg src:../haribote/ipl10.bin len:512 from:0 to:0 \ + copy from:../haribote/haribote.sys to:@: \ + copy from:$(APP).hrb to:@: \ + imgout:haribote.img + +#一般规则 + +%.gas : %.c ../apilib.h Makefile ../app_make.txt + $(CC1) -o $*.gas $*.c + +%.nas : %.gas Makefile ../app_make.txt + $(GAS2NASK) $*.gas $*.nas + +%.obj : %.nas Makefile ../app_make.txt + $(NASK) $*.nas $*.obj $*.lst + +#命令 + +run : + $(MAKE) haribote.img + $(COPY) haribote.img ..\..\z_tools\qemu\fdimage0.bin + $(MAKE) -C ../../z_tools/qemu + +full : + $(MAKE) -C $(APILIBPATH) + $(MAKE) $(APP).hrb + +run_full : + $(MAKE) -C $(APILIBPATH) + $(MAKE) -C ../haribote + $(MAKE) run + +clean : + -$(DEL) *.lst + -$(DEL) *.obj + -$(DEL) *.map + -$(DEL) *.bim + -$(DEL) haribote.img + +src_only : + $(MAKE) clean + -$(DEL) $(APP).hrb diff --git a/28_day/beepdown/!cons_9x.bat b/28_day/beepdown/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/beepdown/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/beepdown/!cons_nt.bat b/28_day/beepdown/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/beepdown/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/beepdown/Makefile b/28_day/beepdown/Makefile new file mode 100644 index 0000000..ffd14fa --- /dev/null +++ b/28_day/beepdown/Makefile @@ -0,0 +1,5 @@ +APP = beepdown +STACK = 1k +MALLOC = 40k + +include ../app_make.txt diff --git a/28_day/beepdown/beepdown.c b/28_day/beepdown/beepdown.c new file mode 100644 index 0000000..d08962c --- /dev/null +++ b/28_day/beepdown/beepdown.c @@ -0,0 +1,19 @@ +#include "apilib.h" + +void HariMain(void) +{ + int i, timer; + timer = api_alloctimer(); + api_inittimer(timer, 128); + for (i = 20000000; i >= 20000; i -= i / 100) { + /* 20KHz~20Hz,即人类可以听到的声音范围*/ + /* i以1%的速度递减*/ + api_beep(i); + api_settimer(timer, 1); /* 0.01秒*/ + if (api_getkey(1) != 128) { + break; + } + } + api_beep(0); + api_end(); +} diff --git a/28_day/beepdown/make.bat b/28_day/beepdown/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/beepdown/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/color/!cons_9x.bat b/28_day/color/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/color/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/color/!cons_nt.bat b/28_day/color/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/color/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/color/Makefile b/28_day/color/Makefile new file mode 100644 index 0000000..614dac9 --- /dev/null +++ b/28_day/color/Makefile @@ -0,0 +1,5 @@ +APP = color +STACK = 1k +MALLOC = 56k + +include ../app_make.txt diff --git a/28_day/color/color.c b/28_day/color/color.c new file mode 100644 index 0000000..ce228e2 --- /dev/null +++ b/28_day/color/color.c @@ -0,0 +1,21 @@ +#include "apilib.h" + +void HariMain(void) +{ + char *buf; + int win, x, y, r, g, b; + api_initmalloc(); + buf = api_malloc(144 * 164); + win = api_openwin(buf, 144, 164, -1, "color"); + for (y = 0; y < 128; y++) { + for (x = 0; x < 128; x++) { + r = x * 2; + g = y * 2; + b = 0; + buf[(x + 8) + (y + 28) * 144] = 16 + (r / 43) + (g / 43) * 6 + (b / 43) * 36; + } + } + api_refreshwin(win, 8, 28, 136, 156); + api_getkey(1); /*等待按下任意键*/ + api_end(); +} diff --git a/28_day/color/make.bat b/28_day/color/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/color/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/color2/!cons_9x.bat b/28_day/color2/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/color2/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/color2/!cons_nt.bat b/28_day/color2/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/color2/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/color2/Makefile b/28_day/color2/Makefile new file mode 100644 index 0000000..93b5f23 --- /dev/null +++ b/28_day/color2/Makefile @@ -0,0 +1,5 @@ +APP = color2 +STACK = 1k +MALLOC = 56k + +include ../app_make.txt diff --git a/28_day/color2/color2.c b/28_day/color2/color2.c new file mode 100644 index 0000000..82e3f6a --- /dev/null +++ b/28_day/color2/color2.c @@ -0,0 +1,36 @@ +#include "apilib.h" + +unsigned char rgb2pal(int r, int g, int b, int x, int y); + +void HariMain(void) +{ + char *buf; + int win, x, y; + api_initmalloc(); + buf = api_malloc(144 * 164); + win = api_openwin(buf, 144, 164, -1, "color2"); + for (y = 0; y < 128; y++) { + for (x = 0; x < 128; x++) { + buf[(x + 8) + (y + 28) * 144] = rgb2pal(x * 2, y * 2, 0, x, y); + } + } + api_refreshwin(win, 8, 28, 136, 156); + api_getkey(1); /* �Ă��Ƃ��ȃL�[���͂�҂� */ + api_end(); +} + +unsigned char rgb2pal(int r, int g, int b, int x, int y) +{ + static int table[4] = { 3, 1, 0, 2 }; + int i; + x &= 1; /*判断是偶数还是奇数*/ + y &= 1; + i = table[x + y * 2]; /*用来生成中间色的常量*/ + r = (r * 21) / 256; /* r为0~20*/ + g = (g * 21) / 256; + b = (b * 21) / 256; + r = (r + i) / 4; /* r为0~5*/ + g = (g + i) / 4; + b = (b + i) / 4; + return 16 + r + g * 6 + b * 36; +} diff --git a/28_day/color2/make.bat b/28_day/color2/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/color2/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/haribote.rul b/28_day/haribote.rul new file mode 100644 index 0000000..ee8f67b --- /dev/null +++ b/28_day/haribote.rul @@ -0,0 +1,10 @@ +format: + code(align:1, logic:0x24, file:0x24); + data(align:4, logic:stack_end, file:code_end); + +file: + ../../z_tools/haribote/harilibc.lib; + ../../z_tools/haribote/golibc.lib; + +label: + _HariStartup; diff --git a/28_day/haribote/!cons_9x.bat b/28_day/haribote/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/haribote/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/haribote/!cons_nt.bat b/28_day/haribote/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/haribote/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/haribote/Makefile b/28_day/haribote/Makefile new file mode 100644 index 0000000..b0ce461 --- /dev/null +++ b/28_day/haribote/Makefile @@ -0,0 +1,79 @@ +OBJS_BOOTPACK = bootpack.obj naskfunc.obj hankaku.obj graphic.obj dsctbl.obj \ + int.obj fifo.obj keyboard.obj mouse.obj memory.obj sheet.obj timer.obj \ + mtask.obj window.obj console.obj file.obj + +TOOLPATH = ../../z_tools/ +INCPATH = ../../z_tools/haribote/ + +MAKE = $(TOOLPATH)make.exe -r +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 = ../haribote.rul +EDIMG = $(TOOLPATH)edimg.exe +IMGTOL = $(TOOLPATH)imgtol.com +GOLIB = $(TOOLPATH)golib00.exe +COPY = copy +DEL = del + +#默认动作 + +default : + $(MAKE) ipl10.bin + $(MAKE) haribote.sys + +# 镜像文件生成 + +ipl10.bin : ipl10.nas Makefile + $(NASK) ipl10.nas ipl10.bin ipl10.lst + +asmhead.bin : asmhead.nas Makefile + $(NASK) asmhead.nas asmhead.bin asmhead.lst + +hankaku.bin : hankaku.txt Makefile + $(MAKEFONT) hankaku.txt hankaku.bin + +hankaku.obj : hankaku.bin Makefile + $(BIN2OBJ) hankaku.bin hankaku.obj _hankaku + +bootpack.bim : $(OBJS_BOOTPACK) Makefile + $(OBJ2BIM) @$(RULEFILE) out:bootpack.bim stack:3136k map:bootpack.map \ + $(OBJS_BOOTPACK) +# 3MB+64KB=3136KB + +bootpack.hrb : bootpack.bim Makefile + $(BIM2HRB) bootpack.bim bootpack.hrb 0 + +haribote.sys : asmhead.bin bootpack.hrb Makefile + copy /B asmhead.bin+bootpack.hrb haribote.sys + +# 其他指令 + +%.gas : %.c bootpack.h Makefile + $(CC1) -o $*.gas $*.c + +%.nas : %.gas Makefile + $(GAS2NASK) $*.gas $*.nas + +%.obj : %.nas Makefile + $(NASK) $*.nas $*.obj $*.lst + +# 运行程序 + +clean : + -$(DEL) asmhead.bin + -$(DEL) hankaku.bin + -$(DEL) *.lst + -$(DEL) *.obj + -$(DEL) *.map + -$(DEL) *.bim + -$(DEL) *.hrb + +src_only : + $(MAKE) clean + -$(DEL) ipl10.bin + -$(DEL) haribote.sys diff --git a/28_day/haribote/asmhead.nas b/28_day/haribote/asmhead.nas new file mode 100644 index 0000000..ad35d76 --- /dev/null +++ b/28_day/haribote/asmhead.nas @@ -0,0 +1,202 @@ +; haribote-os boot asm +; TAB=4 + +[INSTRSET "i486p"] + +VBEMODE EQU 0x105 ; 1024 x 768 x 8bit 彩色 +; 显示模式 +; 0x100 : 640 x 400 x 8bit 彩色 +; 0x101 : 640 x 480 x 8bit 彩色 +; 0x103 : 800 x 600 x 8bit 彩色 +; 0x105 : 1024 x 768 x 8bit 彩色 +; 0x107 : 1280 x 1024 x 8bit 彩色 + +BOTPAK EQU 0x00280000 ; 加载bootpack +DSKCAC EQU 0x00100000 ; 磁盘缓存的位置 +DSKCAC0 EQU 0x00008000 ; 磁盘缓存的位置(实模式) + +; BOOT_INFO 相关 +CYLS EQU 0x0ff0 ; 引导扇区设置 +LEDS EQU 0x0ff1 +VMODE EQU 0x0ff2 ; 关于颜色的信息 +SCRNX EQU 0x0ff4 ; 分辨率X +SCRNY EQU 0x0ff6 ; 分辨率Y +VRAM EQU 0x0ff8 ; 图像缓冲区的起始地址 + + ORG 0xc200 ; 这个的程序要被装载的内存地址 + +; 确认VBE是否存在 + + MOV AX,0x9000 + MOV ES,AX + MOV DI,0 + MOV AX,0x4f00 + INT 0x10 + CMP AX,0x004f + JNE scrn320 + +; 检查VBE的版本 + + MOV AX,[ES:DI+4] + CMP AX,0x0200 + JB scrn320 ; if (AX < 0x0200) goto scrn320 + +; 取得画面模式信息 + + MOV CX,VBEMODE + MOV AX,0x4f01 + INT 0x10 + CMP AX,0x004f + JNE scrn320 + +; 画面模式信息的确认 + CMP BYTE [ES:DI+0x19],8 ;颜色数必须为8 + JNE scrn320 + CMP BYTE [ES:DI+0x1b],4 ;颜色的指定方法必须为4(4是调色板模式) + JNE scrn320 + MOV AX,[ES:DI+0x00] ;模式属性bit7不是1就不能加上0x4000 + AND AX,0x0080 + JZ scrn320 ; 模式属性的bit7是0,所以放弃 + +; 画面设置 + + MOV BX,VBEMODE+0x4000 + MOV AX,0x4f02 + INT 0x10 + MOV BYTE [VMODE],8 ; 屏幕的模式(参考C语言的引用) + MOV AX,[ES:DI+0x12] + MOV [SCRNX],AX + MOV AX,[ES:DI+0x14] + MOV [SCRNY],AX + MOV EAX,[ES:DI+0x28] ;VRAM的地址 + MOV [VRAM],EAX + JMP keystatus + +scrn320: + MOV AL,0x13 ; VGA图、320x200x8bit彩色 + MOV AH,0x00 + INT 0x10 + MOV BYTE [VMODE],8 ; 记下画面模式(参考C语言) + MOV WORD [SCRNX],320 + MOV WORD [SCRNY],200 + MOV DWORD [VRAM],0x000a0000 + +; 通过 BIOS 获取指示灯状态 + +keystatus: + MOV AH,0x02 + INT 0x16 ; keyboard BIOS + MOV [LEDS],AL + +; PIC关闭一切中断 +; 根据AT兼容机的规格,如果要初始化PIC, +; 必须在CLI之前进行,否则有时会挂起。 +; 随后进行PIC的初始化。 + + MOV AL,0xff + OUT 0x21,AL + NOP ; 如果连续执行OUT指令,有些机种会无法正常运行 + OUT 0xa1,AL + + CLI ; 禁止CPU级别的中断 + +; 为了让CPU能够访问1MB以上的内存空间,设定A20GATE + + CALL waitkbdout + MOV AL,0xd1 + OUT 0x64,AL + CALL waitkbdout + MOV AL,0xdf ; enable A20 + OUT 0x60,AL + CALL waitkbdout + +; 切换到保护模式 + +[INSTRSET "i486p"] ; 说明使用486指令 + + LGDT [GDTR0] ; 设置临时GDT + MOV EAX,CR0 + AND EAX,0x7fffffff ; 设bit31为0(禁用分页) + OR EAX,0x00000001 ; bit0到1转换(保护模式过渡) + MOV CR0,EAX + JMP pipelineflush +pipelineflush: + MOV AX,1*8 ; 可读写的段 32bit + MOV DS,AX + MOV ES,AX + MOV FS,AX + MOV GS,AX + MOV SS,AX + +; bootpack传递 + + MOV ESI,bootpack ; 转送源 + MOV EDI,BOTPAK ; 转送目标 + MOV ECX,512*1024/4 + CALL memcpy + +; 磁盘数据最终转送到它本来的位置去 +; 首先从启动扇区开始 + + MOV ESI,0x7c00 ; 转送源 + MOV EDI,DSKCAC ; 转送目标 + MOV ECX,512/4 + CALL memcpy + +; 剩余的全部 + + MOV ESI,DSKCAC0+512 ; 转送源 + MOV EDI,DSKCAC+512 ; 转送源目标 + MOV ECX,0 + MOV CL,BYTE [CYLS] + IMUL ECX,512*18*2/4 ; 从柱面数变换为字节数/4 + SUB ECX,512/4 ; 减去 IPL 偏移量 + CALL memcpy + +; 必须由asmhead来完成的工作,至此全部完毕 +; 以后就交由bootpack来完成 + +; bootpack启动 + + MOV EBX,BOTPAK + MOV ECX,[EBX+16] + ADD ECX,3 ; ECX += 3; + SHR ECX,2 ; ECX /= 4; + JZ skip ; 没有要转送的东西时 + MOV ESI,[EBX+20] ; 转送源 + ADD ESI,EBX + MOV EDI,[EBX+12] ; 转送目标 + CALL memcpy +skip: + MOV ESP,[EBX+12] ; 堆栈的初始化 + JMP DWORD 2*8:0x0000001b + +waitkbdout: + IN AL,0x64 + AND AL,0x02 + JNZ waitkbdout ; AND的结果如果不是0,就跳到waitkbdout + RET + +memcpy: + MOV EAX,[ESI] + ADD ESI,4 + MOV [EDI],EAX + ADD EDI,4 + SUB ECX,1 + JNZ memcpy ; 减法运算的结果如果不是0,就跳转到memcpy + RET +; memcpy地址前缀大小 + + ALIGNB 16 +GDT0: + RESB 8 ; 初始值 + DW 0xffff,0x0000,0x9200,0x00cf ; 可以读写的段(segment)32bit + DW 0xffff,0x0000,0x9a28,0x0047 ; 可执行的文件的32bit寄存器(bootpack用) + + DW 0 +GDTR0: + DW 8*3-1 + DD GDT0 + + ALIGNB 16 +bootpack: diff --git a/28_day/haribote/bootpack.c b/28_day/haribote/bootpack.c new file mode 100644 index 0000000..d4f821a --- /dev/null +++ b/28_day/haribote/bootpack.c @@ -0,0 +1,387 @@ +/* bootpack */ + +#include "bootpack.h" +#include + +#define KEYCMD_LED 0xed + +void keywin_off(struct SHEET *key_win); +void keywin_on(struct SHEET *key_win); +void close_console(struct SHEET *sht); +void close_constask(struct TASK *task); + +void HariMain(void) +{ + struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO; + struct SHTCTL *shtctl; + char s[40]; + struct FIFO32 fifo, keycmd; + int fifobuf[128], keycmd_buf[32]; + int mx, my, i, new_mx = -1, new_my = 0, new_wx = 0x7fffffff, new_wy = 0; + unsigned int memtotal; + struct MOUSE_DEC mdec; + struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; + unsigned char *buf_back, buf_mouse[256]; + struct SHEET *sht_back, *sht_mouse; + struct TASK *task_a, *task; + static char keytable0[0x80] = { + 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0x08, 0, + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '@', '[', 0x0a, 0, 'A', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', ':', 0, 0, ']', 'Z', 'X', 'C', 'V', + 'B', 'N', 'M', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', + '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x5c, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x5c, 0, 0 + }; + static char keytable1[0x80] = { + 0, 0, '!', 0x22, '#', '$', '%', '&', 0x27, '(', ')', '~', '=', '~', 0x08, 0, + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '`', '{', 0x0a, 0, 'A', 'S', + 'D', 'F', 'G', 'H', 'J', 'K', 'L', '+', '*', 0, 0, '}', 'Z', 'X', 'C', 'V', + 'B', 'N', 'M', '<', '>', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', + '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, '_', 0, 0, 0, 0, 0, 0, 0, 0, 0, '|', 0, 0 + }; + int key_shift = 0, key_leds = (binfo->leds >> 4) & 7, keycmd_wait = -1; + int j, x, y, mmx = -1, mmy = -1, mmx2 = 0; + struct SHEET *sht = 0, *key_win, *sht2; + + init_gdtidt(); + init_pic(); + io_sti(); /* IDT/PIC的初始化已经完成,于是开放CPU的中断 */ + fifo32_init(&fifo, 128, fifobuf, 0); + *((int *) 0x0fec) = (int) &fifo; + init_pit(); + init_keyboard(&fifo, 256); + enable_mouse(&fifo, 512, &mdec); + io_out8(PIC0_IMR, 0xf8); /* 设定PIT和PIC1以及键盘为许可(11111000) */ + io_out8(PIC1_IMR, 0xef); /* 开放鼠标中断(11101111) */ + fifo32_init(&keycmd, 32, keycmd_buf, 0); + + memtotal = memtest(0x00400000, 0xbfffffff); + memman_init(memman); + memman_free(memman, 0x00001000, 0x0009e000); /* 0x00001000 - 0x0009efff */ + memman_free(memman, 0x00400000, memtotal - 0x00400000); + + init_palette(); + shtctl = shtctl_init(memman, binfo->vram, binfo->scrnx, binfo->scrny); + task_a = task_init(memman); + fifo.task = task_a; + task_run(task_a, 1, 2); + *((int *) 0x0fe4) = (int) shtctl; + + /* sht_back */ + sht_back = sheet_alloc(shtctl); + buf_back = (unsigned char *) memman_alloc_4k(memman, binfo->scrnx * binfo->scrny); + sheet_setbuf(sht_back, buf_back, binfo->scrnx, binfo->scrny, -1); /* 无透明色 */ + init_screen8(buf_back, binfo->scrnx, binfo->scrny); + + /* sht_cons */ + key_win = open_console(shtctl, memtotal); + + /* sht_mouse */ + sht_mouse = sheet_alloc(shtctl); + sheet_setbuf(sht_mouse, buf_mouse, 16, 16, 99); + init_mouse_cursor8(buf_mouse, 99); + mx = (binfo->scrnx - 16) / 2; /* 计算坐标使其位于画面中央 */ + my = (binfo->scrny - 28 - 16) / 2; + + sheet_slide(sht_back, 0, 0); + sheet_slide(key_win, 32, 4); + sheet_slide(sht_mouse, mx, my); + sheet_updown(sht_back, 0); + sheet_updown(key_win, 1); + sheet_updown(sht_mouse, 2); + keywin_on(key_win); + + /*为了避免和键盘当前状态冲突,在一开始先进行设置*/ + fifo32_put(&keycmd, KEYCMD_LED); + fifo32_put(&keycmd, key_leds); + + for (;;) { + if (fifo32_status(&keycmd) > 0 && keycmd_wait < 0) { + /* 如果存在向键盘控制器发送的数据,则发送它 */ + keycmd_wait = fifo32_get(&keycmd); + wait_KBC_sendready(); + io_out8(PORT_KEYDAT, keycmd_wait); + } + io_cli(); + if (fifo32_status(&fifo) == 0) { + /* FIFO为空,当存在搁置的绘图操作时立即执行*/ + if (new_mx >= 0) { + io_sti(); + sheet_slide(sht_mouse, new_mx, new_my); + new_mx = -1; + } else if (new_wx != 0x7fffffff) { + io_sti(); + sheet_slide(sht, new_wx, new_wy); + new_wx = 0x7fffffff; + } else { + task_sleep(task_a); + io_sti(); + } + } else { + i = fifo32_get(&fifo); + io_sti(); + if (key_win != 0 && key_win->flags == 0) { /*窗口被关闭*/ + if (shtctl->top == 1) { /*当画面上只剩鼠标和背景时*/ + key_win = 0; + } else { + key_win = shtctl->sheets[shtctl->top - 1]; + keywin_on(key_win); + } + } + if (256 <= i && i <= 511) { /* 键盘数据*/ + if (i < 0x80 + 256) { /*将按键编码转换为字符编码*/ + if (key_shift == 0) { + s[0] = keytable0[i - 256]; + } else { + s[0] = keytable1[i - 256]; + } + } else { + s[0] = 0; + } + if ('A' <= s[0] && s[0] <= 'Z') { /*当输入字符为英文字母时*/ + if (((key_leds & 4) == 0 && key_shift == 0) || + ((key_leds & 4) != 0 && key_shift != 0)) { + s[0] += 0x20; /*将大写字母转换为小写字母*/ + } + } + if (s[0] != 0 && key_win != 0) { /*一般字符、退格键、回车键*/ + fifo32_put(&key_win->task->fifo, s[0] + 256); + } + if (i == 256 + 0x0f && key_win != 0) { /* Tab键 */ + keywin_off(key_win); + j = key_win->height - 1; + if (j == 0) { + j = shtctl->top - 1; + } + key_win = shtctl->sheets[j]; + keywin_on(key_win); + } + if (i == 256 + 0x2a) { /*左Shift ON */ + key_shift |= 1; + } + if (i == 256 + 0x36) { /*右Shift ON */ + key_shift |= 2; + } + if (i == 256 + 0xaa) { /*左Shift OFF */ + key_shift &= ~1; + } + if (i == 256 + 0xb6) { /*右Shift OFF */ + key_shift &= ~2; + } + if (i == 256 + 0x3a) { /* CapsLock */ + key_leds ^= 4; + fifo32_put(&keycmd, KEYCMD_LED); + fifo32_put(&keycmd, key_leds); + } + if (i == 256 + 0x45) { /* NumLock */ + key_leds ^= 2; + fifo32_put(&keycmd, KEYCMD_LED); + fifo32_put(&keycmd, key_leds); + } + if (i == 256 + 0x46) { /* ScrollLock */ + key_leds ^= 1; + fifo32_put(&keycmd, KEYCMD_LED); + fifo32_put(&keycmd, key_leds); + } + if (i == 256 + 0x3b && key_shift != 0 && key_win != 0) { /* Shift+F1 */ + task = key_win->task; + if (task != 0 && task->tss.ss0 != 0) { + cons_putstr0(task->cons, "\nBreak(key) :\n"); + io_cli(); /*强制结束处理时禁止任务切换*/ + task->tss.eax = (int) &(task->tss.esp0); + task->tss.eip = (int) asm_end_app; + io_sti(); + task_run(task, -1, 0); /*为了确实执行结束处理,如果处于休眠状态则唤醒*/ + } + } + if (i == 256 + 0x3c && key_shift != 0) { /* Shift+F2 */ + if (key_win != 0) { + keywin_off(key_win); + } + key_win = open_console(shtctl, memtotal); + sheet_slide(key_win, 32, 4); + sheet_updown(key_win, shtctl->top); + keywin_on(key_win); + } + if (i == 256 + 0x57) { /* F11 */ + sheet_updown(shtctl->sheets[1], shtctl->top - 1); + } + if (i == 256 + 0xfa) { /*键盘成功接收到数据*/ + keycmd_wait = -1; + } + if (i == 256 + 0xfe) { /*键盘没有成功接收到数据*/ + wait_KBC_sendready(); + io_out8(PORT_KEYDAT, keycmd_wait); + } + } else if (512 <= i && i <= 767) { /* 鼠标数据*/ + if (mouse_decode(&mdec, i - 512) != 0) { + /* 已经收集了3字节的数据,移动光标 */ + mx += mdec.x; + my += mdec.y; + if (mx < 0) { + mx = 0; + } + if (my < 0) { + my = 0; + } + if (mx > binfo->scrnx - 1) { + mx = binfo->scrnx - 1; + } + if (my > binfo->scrny - 1) { + my = binfo->scrny - 1; + } + new_mx = mx; + new_my = my; + if ((mdec.btn & 0x01) != 0) { /* 按下左键 */ + if (mmx < 0) { + /*如果处于通常模式*/ + /*按照从上到下的顺序寻找鼠标所指向的图层*/ + for (j = shtctl->top - 1; j > 0; j--) { + sht = shtctl->sheets[j]; + x = mx - sht->vx0; + y = my - sht->vy0; + if (0 <= x && x < sht->bxsize && 0 <= y && y < sht->bysize) { + if (sht->buf[y * sht->bxsize + x] != sht->col_inv) { + sheet_updown(sht, shtctl->top - 1); + if (sht != key_win) { + keywin_off(key_win); + key_win = sht; + keywin_on(key_win); + } + if (3 <= x && x < sht->bxsize - 3 && 3 <= y && y < 21) { + mmx = mx; /*进入窗口移动模式*/ + mmy = my; + mmx2 = sht->vx0; + new_wy = sht->vy0; + } + if (sht->bxsize - 21 <= x && x < sht->bxsize - 5 && 5 <= y && y < 19) { + /*点击“×”按钮*/ + if ((sht->flags & 0x10) != 0) { /*该窗口是否为应用程序窗口?*/ + task = sht->task; + cons_putstr0(task->cons, "\nBreak(mouse) :\n"); + io_cli(); /*强制结束处理时禁止任务切换*/ + task->tss.eax = (int) &(task->tss.esp0); + task->tss.eip = (int) asm_end_app; + io_sti(); + task_run(task, -1, 0); + } else { /*命令行窗口*/ + task = sht->task; + sheet_updown(sht, -1); /*暂且隐藏该图层*/ + keywin_off(key_win); + key_win = shtctl->sheets[shtctl->top - 1]; + keywin_on(key_win); + io_cli(); + fifo32_put(&task->fifo, 4); + io_sti(); + } + } + break; + } + } + } + } else { + /*如果处于窗口移动模式*/ + x = mx - mmx; /*计算鼠标指针移动量*/ + y = my - mmy; + new_wx = (mmx2 + x + 2) & ~3; + new_wy = new_wy + y; + mmy = my; + } + } else { + /*没有按下左键*/ + mmx = -1; /*切换到一般模式*/ + if (new_wx != 0x7fffffff) { + sheet_slide(sht, new_wx, new_wy); /*固定图层位置*/ + new_wx = 0x7fffffff; + } + } + } + } else if (768 <= i && i <= 1023) { /*命令行窗口关闭处理*/ + close_console(shtctl->sheets0 + (i - 768)); + } else if (1024 <= i && i <= 2023) { + close_constask(taskctl->tasks0 + (i - 1024)); + } else if (2024 <= i && i <= 2279) { /*只关闭命令行窗口*/ + sht2 = shtctl->sheets0 + (i - 2024); + memman_free_4k(memman, (int) sht2->buf, 256 * 165); + sheet_free(sht2); + } + } + } +} + +void keywin_off(struct SHEET *key_win) +{ + change_wtitle8(key_win, 0); + if ((key_win->flags & 0x20) != 0) { + fifo32_put(&key_win->task->fifo, 3); /*命令行窗口光标OFF */ + } + return; +} + +void keywin_on(struct SHEET *key_win) +{ + change_wtitle8(key_win, 1); + if ((key_win->flags & 0x20) != 0) { + fifo32_put(&key_win->task->fifo, 2); /*命令行窗口光标ON */ + } + return; +} + +struct TASK *open_constask(struct SHEET *sht, unsigned int memtotal) +{ + struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; + struct TASK *task = task_alloc(); + int *cons_fifo = (int *) memman_alloc_4k(memman, 128 * 4); + task->cons_stack = memman_alloc_4k(memman, 64 * 1024); + task->tss.esp = task->cons_stack + 64 * 1024 - 12; + task->tss.eip = (int) &console_task; + task->tss.es = 1 * 8; + task->tss.cs = 2 * 8; + task->tss.ss = 1 * 8; + task->tss.ds = 1 * 8; + task->tss.fs = 1 * 8; + task->tss.gs = 1 * 8; + *((int *) (task->tss.esp + 4)) = (int) sht; + *((int *) (task->tss.esp + 8)) = memtotal; + task_run(task, 2, 2); /* level=2, priority=2 */ + fifo32_init(&task->fifo, 128, cons_fifo, task); + return task; +} + +struct SHEET *open_console(struct SHTCTL *shtctl, unsigned int memtotal) +{ + struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; + struct SHEET *sht = sheet_alloc(shtctl); + unsigned char *buf = (unsigned char *) memman_alloc_4k(memman, 256 * 165); + sheet_setbuf(sht, buf, 256, 165, -1); /*无透明色*/ + make_window8(buf, 256, 165, "console", 0); + make_textbox8(sht, 8, 28, 240, 128, COL8_000000); + sht->task = open_constask(sht, memtotal); + sht->flags |= 0x20; /*有光标*/ + return sht; +} + +void close_constask(struct TASK *task) +{ + struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; + task_sleep(task); + memman_free_4k(memman, task->cons_stack, 64 * 1024); + memman_free_4k(memman, (int) task->fifo.buf, 128 * 4); + task->flags = 0; /*用来替代task_free(task); */ + return; +} + +void close_console(struct SHEET *sht) +{ + struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; + struct TASK *task = sht->task; + memman_free_4k(memman, (int) sht->buf, 256 * 165); + sheet_free(sht); + close_constask(task); + return; +} diff --git a/28_day/haribote/bootpack.h b/28_day/haribote/bootpack.h new file mode 100644 index 0000000..f4ec328 --- /dev/null +++ b/28_day/haribote/bootpack.h @@ -0,0 +1,283 @@ +/* asmhead.nas */ +struct BOOTINFO { /* 0x0ff0-0x0fff */ + char cyls; /* 启动区读磁盘读到此为止 */ + char leds; /* 启动时键盘的LED的状态 */ + char vmode; /* 显卡模式为多少位彩色 */ + char reserve; + short scrnx, scrny; /* 画面分辨率 */ + char *vram; +}; +#define ADR_BOOTINFO 0x00000ff0 +#define ADR_DISKIMG 0x00100000 + +/* naskfunc.nas */ +void io_hlt(void); +void io_cli(void); +void io_sti(void); +void io_stihlt(void); +int io_in8(int port); +void io_out8(int port, int data); +int io_load_eflags(void); +void io_store_eflags(int eflags); +void load_gdtr(int limit, int addr); +void load_idtr(int limit, int addr); +int load_cr0(void); +void store_cr0(int cr0); +void load_tr(int tr); +void asm_inthandler0c(void); +void asm_inthandler0d(void); +void asm_inthandler20(void); +void asm_inthandler21(void); +void asm_inthandler2c(void); +unsigned int memtest_sub(unsigned int start, unsigned int end); +void farjmp(int eip, int cs); +void farcall(int eip, int cs); +void asm_hrb_api(void); +void start_app(int eip, int cs, int esp, int ds, int *tss_esp0); +void asm_end_app(void); + +/* fifo.c */ +struct FIFO32 { + int *buf; + int p, q, size, free, flags; + struct TASK *task; +}; +void fifo32_init(struct FIFO32 *fifo, int size, int *buf, struct TASK *task); +int fifo32_put(struct FIFO32 *fifo, int data); +int fifo32_get(struct FIFO32 *fifo); +int fifo32_status(struct FIFO32 *fifo); + +/* graphic.c */ +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_screen8(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); +void init_mouse_cursor8(char *mouse, char bc); +void putblock8_8(char *vram, int vxsize, int pxsize, + int pysize, int px0, int py0, char *buf, int bxsize); +#define COL8_000000 0 +#define COL8_FF0000 1 +#define COL8_00FF00 2 +#define COL8_FFFF00 3 +#define COL8_0000FF 4 +#define COL8_FF00FF 5 +#define COL8_00FFFF 6 +#define COL8_FFFFFF 7 +#define COL8_C6C6C6 8 +#define COL8_840000 9 +#define COL8_008400 10 +#define COL8_848400 11 +#define COL8_000084 12 +#define COL8_840084 13 +#define COL8_008484 14 +#define COL8_848484 15 + +/* dsctbl.c */ +struct SEGMENT_DESCRIPTOR { + short limit_low, base_low; + char base_mid, access_right; + char limit_high, base_high; +}; +struct GATE_DESCRIPTOR { + short offset_low, selector; + char dw_count, access_right; + short offset_high; +}; +void init_gdtidt(void); +void set_segmdesc(struct SEGMENT_DESCRIPTOR *sd, unsigned int limit, int base, int ar); +void set_gatedesc(struct GATE_DESCRIPTOR *gd, int offset, int selector, int ar); +#define ADR_IDT 0x0026f800 +#define LIMIT_IDT 0x000007ff +#define ADR_GDT 0x00270000 +#define LIMIT_GDT 0x0000ffff +#define ADR_BOTPAK 0x00280000 +#define LIMIT_BOTPAK 0x0007ffff +#define AR_DATA32_RW 0x4092 +#define AR_CODE32_ER 0x409a +#define AR_LDT 0x0082 +#define AR_TSS32 0x0089 +#define AR_INTGATE32 0x008e + +/* int.c */ +void init_pic(void); +#define PIC0_ICW1 0x0020 +#define PIC0_OCW2 0x0020 +#define PIC0_IMR 0x0021 +#define PIC0_ICW2 0x0021 +#define PIC0_ICW3 0x0021 +#define PIC0_ICW4 0x0021 +#define PIC1_ICW1 0x00a0 +#define PIC1_OCW2 0x00a0 +#define PIC1_IMR 0x00a1 +#define PIC1_ICW2 0x00a1 +#define PIC1_ICW3 0x00a1 +#define PIC1_ICW4 0x00a1 + +/* keyboard.c */ +void inthandler21(int *esp); +void wait_KBC_sendready(void); +void init_keyboard(struct FIFO32 *fifo, int data0); +#define PORT_KEYDAT 0x0060 +#define PORT_KEYCMD 0x0064 + +/* mouse.c */ +struct MOUSE_DEC { + unsigned char buf[3], phase; + int x, y, btn; +}; +void inthandler2c(int *esp); +void enable_mouse(struct FIFO32 *fifo, int data0, struct MOUSE_DEC *mdec); +int mouse_decode(struct MOUSE_DEC *mdec, unsigned char dat); + +/* memory.c */ +#define MEMMAN_FREES 4090 /* ����Ŗ�32KB */ +#define MEMMAN_ADDR 0x003c0000 +struct FREEINFO { /* ������� */ + unsigned int addr, size; +}; +struct MEMMAN { /* �������Ǘ� */ + int frees, maxfrees, lostsize, losts; + struct FREEINFO free[MEMMAN_FREES]; +}; +unsigned int memtest(unsigned int start, unsigned int end); +void memman_init(struct MEMMAN *man); +unsigned int memman_total(struct MEMMAN *man); +unsigned int memman_alloc(struct MEMMAN *man, unsigned int size); +int memman_free(struct MEMMAN *man, unsigned int addr, unsigned int size); +unsigned int memman_alloc_4k(struct MEMMAN *man, unsigned int size); +int memman_free_4k(struct MEMMAN *man, unsigned int addr, unsigned int size); + +/* sheet.c */ +#define MAX_SHEETS 256 +struct SHEET { + unsigned char *buf; + int bxsize, bysize, vx0, vy0, col_inv, height, flags; + struct SHTCTL *ctl; + struct TASK *task; +}; +struct SHTCTL { + unsigned char *vram, *map; + int xsize, ysize, top; + struct SHEET *sheets[MAX_SHEETS]; + struct SHEET sheets0[MAX_SHEETS]; +}; +struct SHTCTL *shtctl_init(struct MEMMAN *memman, unsigned char *vram, int xsize, int ysize); +struct SHEET *sheet_alloc(struct SHTCTL *ctl); +void sheet_setbuf(struct SHEET *sht, unsigned char *buf, int xsize, int ysize, int col_inv); +void sheet_updown(struct SHEET *sht, int height); +void sheet_refresh(struct SHEET *sht, int bx0, int by0, int bx1, int by1); +void sheet_slide(struct SHEET *sht, int vx0, int vy0); +void sheet_free(struct SHEET *sht); + +/* timer.c */ +#define MAX_TIMER 500 +struct TIMER { + struct TIMER *next; + unsigned int timeout; + char flags, flags2; + struct FIFO32 *fifo; + int data; +}; +struct TIMERCTL { + unsigned int count, next; + struct TIMER *t0; + struct TIMER timers0[MAX_TIMER]; +}; +extern struct TIMERCTL timerctl; +void init_pit(void); +struct TIMER *timer_alloc(void); +void timer_free(struct TIMER *timer); +void timer_init(struct TIMER *timer, struct FIFO32 *fifo, int data); +void timer_settime(struct TIMER *timer, unsigned int timeout); +void inthandler20(int *esp); +int timer_cancel(struct TIMER *timer); +void timer_cancelall(struct FIFO32 *fifo); + +/* mtask.c */ +#define MAX_TASKS 1000 /*最大任务数量*/ +#define TASK_GDT0 3 /*定义从GDT的几号开始分配给TSS */ +#define MAX_TASKS_LV 100 +#define MAX_TASKLEVELS 10 +struct TSS32 { + int backlink, esp0, ss0, esp1, ss1, esp2, ss2, cr3; + int eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi; + int es, cs, ss, ds, fs, gs; + int ldtr, iomap; +}; +struct TASK { + int sel, flags; /* sel用来存放GDT的编号*/ + int level, priority; /* 优先级 */ + struct FIFO32 fifo; + struct TSS32 tss; + struct SEGMENT_DESCRIPTOR ldt[2]; + struct CONSOLE *cons; + int ds_base, cons_stack; +}; +struct TASKLEVEL { + int running; /*正在运行的任务数量*/ + int now; /*这个变量用来记录当前正在运行的是哪个任务*/ + struct TASK *tasks[MAX_TASKS_LV]; +}; +struct TASKCTL { + int now_lv; /*现在活动中的LEVEL */ + char lv_change; /*在下次任务切换时是否需要改变LEVEL */ + struct TASKLEVEL level[MAX_TASKLEVELS]; + struct TASK tasks0[MAX_TASKS]; +}; +extern struct TASKCTL *taskctl; +extern struct TIMER *task_timer; +struct TASK *task_now(void); +struct TASK *task_init(struct MEMMAN *memman); +struct TASK *task_alloc(void); +void task_run(struct TASK *task, int level, int priority); +void task_switch(void); +void task_sleep(struct TASK *task); + +/* window.c */ +void make_window8(unsigned char *buf, int xsize, int ysize, char *title, char act); +void putfonts8_asc_sht(struct SHEET *sht, int x, int y, int c, int b, char *s, int l); +void make_textbox8(struct SHEET *sht, int x0, int y0, int sx, int sy, int c); +void make_wtitle8(unsigned char *buf, int xsize, char *title, char act); +void change_wtitle8(struct SHEET *sht, char act); + +/* console.c */ +struct CONSOLE { + struct SHEET *sht; + int cur_x, cur_y, cur_c; + struct TIMER *timer; +}; +void console_task(struct SHEET *sheet, int memtotal); +void cons_putchar(struct CONSOLE *cons, int chr, char move); +void cons_newline(struct CONSOLE *cons); +void cons_putstr0(struct CONSOLE *cons, char *s); +void cons_putstr1(struct CONSOLE *cons, char *s, int l); +void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal); +void cmd_mem(struct CONSOLE *cons, int memtotal); +void cmd_cls(struct CONSOLE *cons); +void cmd_dir(struct CONSOLE *cons); +void cmd_type(struct CONSOLE *cons, int *fat, char *cmdline); +void cmd_exit(struct CONSOLE *cons, int *fat); +void cmd_start(struct CONSOLE *cons, char *cmdline, int memtotal); +void cmd_ncst(struct CONSOLE *cons, char *cmdline, int memtotal); +int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline); +int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax); +int *inthandler0d(int *esp); +int *inthandler0c(int *esp); +void hrb_api_linewin(struct SHEET *sht, int x0, int y0, int x1, int y1, int col); + +/* file.c */ +struct FILEINFO { + unsigned char name[8], ext[3], type; + char reserve[10]; + unsigned short time, date, clustno; + unsigned int size; +}; +void file_readfat(int *fat, unsigned char *img); +void file_loadfile(int clustno, int size, char *buf, int *fat, char *img); +struct FILEINFO *file_search(char *name, struct FILEINFO *finfo, int max); + +/* bootpack.c */ +struct TASK *open_constask(struct SHEET *sht, unsigned int memtotal); +struct SHEET *open_console(struct SHTCTL *shtctl, unsigned int memtotal); diff --git a/28_day/haribote/console.c b/28_day/haribote/console.c new file mode 100644 index 0000000..6ce8fdc --- /dev/null +++ b/28_day/haribote/console.c @@ -0,0 +1,604 @@ +/* 命令行窗口相关 */ + +#include "bootpack.h" +#include +#include + +void console_task(struct SHEET *sheet, int memtotal) +{ + struct TASK *task = task_now(); + struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; + int i, *fat = (int *) memman_alloc_4k(memman, 4 * 2880); + struct CONSOLE cons; + char cmdline[30]; + cons.sht = sheet; + cons.cur_x = 8; + cons.cur_y = 28; + cons.cur_c = -1; + task->cons = &cons; + + if (cons.sht != 0) { + cons.timer = timer_alloc(); + timer_init(cons.timer, &task->fifo, 1); + timer_settime(cons.timer, 50); + } + file_readfat(fat, (unsigned char *) (ADR_DISKIMG + 0x000200)); + + /*显示提示符*/ + cons_putchar(&cons, '>', 1); + + for (;;) { + io_cli(); + if (fifo32_status(&task->fifo) == 0) { + task_sleep(task); + io_sti(); + } else { + i = fifo32_get(&task->fifo); + io_sti(); + if (i <= 1 && cons.sht != 0) { /*光标用定时器*/ + if (i != 0) { + timer_init(cons.timer, &task->fifo, 0); /*下次置0 */ + if (cons.cur_c >= 0) { + cons.cur_c = COL8_FFFFFF; + } + } else { + timer_init(cons.timer, &task->fifo, 1); /*下次置1 */ + if (cons.cur_c >= 0) { + cons.cur_c = COL8_000000; + } + } + timer_settime(cons.timer, 50); + } + if (i == 2) { /*光标ON */ + cons.cur_c = COL8_FFFFFF; + } + if (i == 3) { /*光标OFF */ + if (cons.sht != 0) { + boxfill8(cons.sht->buf, cons.sht->bxsize, COL8_000000, + cons.cur_x, cons.cur_y, cons.cur_x + 7, cons.cur_y + 15); + } + cons.cur_c = -1; + } + if (i == 4) { /*点击命令行窗口的“×”按钮*/ + cmd_exit(&cons, fat); + } + if (256 <= i && i <= 511) { /*键盘数据(通过任务A)*/ + if (i == 8 + 256) { + /*退格键*/ + if (cons.cur_x > 16) { + /*用空格擦除光标后将光标前移一位*/ + cons_putchar(&cons, ' ', 0); + cons.cur_x -= 8; + } + } else if (i == 10 + 256) { + /*回车键*/ + /*将光标用空格擦除后换行 */ + cons_putchar(&cons, ' ', 0); + cmdline[cons.cur_x / 8 - 2] = 0; + cons_newline(&cons); + cons_runcmd(cmdline, &cons, fat, memtotal); /*运行命令*/ + if (cons.sht == 0) { + cmd_exit(&cons, fat); + } + /*显示提示符*/ + cons_putchar(&cons, '>', 1); + } else { + /*一般字符*/ + if (cons.cur_x < 240) { + /*显示一个字符之后将光标后移一位*/ + cmdline[cons.cur_x / 8 - 2] = i - 256; + cons_putchar(&cons, i - 256, 1); + } + } + } + /*重新显示光标*/ + if (cons.sht != 0) { + if (cons.cur_c >= 0) { + boxfill8(cons.sht->buf, cons.sht->bxsize, cons.cur_c, + cons.cur_x, cons.cur_y, cons.cur_x + 7, cons.cur_y + 15); + } + sheet_refresh(cons.sht, cons.cur_x, cons.cur_y, cons.cur_x + 8, cons.cur_y + 16); + } + } + } +} + +void cons_putchar(struct CONSOLE *cons, int chr, char move) +{ + char s[2]; + s[0] = chr; + s[1] = 0; + if (s[0] == 0x09) { /*制表符*/ + for (;;) { + if (cons->sht != 0) { + putfonts8_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, " ", 1); + } + cons->cur_x += 8; + if (cons->cur_x == 8 + 240) { + cons_newline(cons); + } + if (((cons->cur_x - 8) & 0x1f) == 0) { + break; /*被32整除则break*/ + } + } + } else if (s[0] == 0x0a) { /*换行*/ + cons_newline(cons); + } else if (s[0] == 0x0d) { /*回车*/ + /*先不做任何操作*/ + } else { /*一般字符*/ + if (cons->sht != 0) { + putfonts8_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, s, 1); + } + if (move != 0) { + /* move为0时光标不后移*/ + cons->cur_x += 8; + if (cons->cur_x == 8 + 240) { + cons_newline(cons); + } + } + } + return; +} + +void cons_newline(struct CONSOLE *cons) +{ + int x, y; + struct SHEET *sheet = cons->sht; + if (cons->cur_y < 28 + 112) { + cons->cur_y += 16; /*到下一行*/ + } else { + /*滚动*/ + if (sheet != 0) { + for (y = 28; y < 28 + 112; y++) { + for (x = 8; x < 8 + 240; x++) { + sheet->buf[x + y * sheet->bxsize] = sheet->buf[x + (y + 16) * sheet->bxsize]; + } + } + for (y = 28 + 112; y < 28 + 128; y++) { + for (x = 8; x < 8 + 240; x++) { + sheet->buf[x + y * sheet->bxsize] = COL8_000000; + } + } + sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128); + } + } + cons->cur_x = 8; + return; +} + +void cons_putstr0(struct CONSOLE *cons, char *s) +{ + for (; *s != 0; s++) { + cons_putchar(cons, *s, 1); + } + return; +} + +void cons_putstr1(struct CONSOLE *cons, char *s, int l) +{ + int i; + for (i = 0; i < l; i++) { + cons_putchar(cons, s[i], 1); + } + return; +} + +void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal) +{ + if (strcmp(cmdline, "mem") == 0 && cons->sht != 0) { + cmd_mem(cons, memtotal); + } else if (strcmp(cmdline, "cls") == 0 && cons->sht != 0) { + cmd_cls(cons); + } else if ((strcmp(cmdline, "dir") == 0 || strcmp(cmdline, "ls") == 0) && cons->sht != 0) { + cmd_dir(cons); + } else if (strncmp(cmdline, "type ", 5) == 0 && cons->sht != 0) { + cmd_type(cons, fat, cmdline); + } else if (strcmp(cmdline, "exit") == 0) { + cmd_exit(cons, fat); + } else if (strncmp(cmdline, "start ", 6) == 0) { + cmd_start(cons, cmdline, memtotal); + } else if (strncmp(cmdline, "ncst ", 5) == 0) { + cmd_ncst(cons, cmdline, memtotal); + } else if (cmdline[0] != 0) { + if (cmd_app(cons, fat, cmdline) == 0) { + /*不是命令,不是应用程序,也不是空行*/ + cons_putstr0(cons, "Bad command.\n\n"); + } + } + return; +} + +void cmd_mem(struct CONSOLE *cons, int memtotal) +{ + struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; + char s[60]; + sprintf(s, "total %dMB\nfree %dKB\n\n", memtotal / (1024 * 1024), memman_total(memman) / 1024); + cons_putstr0(cons, s); + return; +} + +void cmd_cls(struct CONSOLE *cons) +{ + int x, y; + struct SHEET *sheet = cons->sht; + for (y = 28; y < 28 + 128; y++) { + for (x = 8; x < 8 + 240; x++) { + sheet->buf[x + y * sheet->bxsize] = COL8_000000; + } + } + sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128); + cons->cur_y = 28; + return; +} + +void cmd_dir(struct CONSOLE *cons) +{ + struct FILEINFO *finfo = (struct FILEINFO *) (ADR_DISKIMG + 0x002600); + int i, j; + char s[30]; + for (i = 0; i < 224; i++) { + if (finfo[i].name[0] == 0x00) { + break; + } + if (finfo[i].name[0] != 0xe5) { + if ((finfo[i].type & 0x18) == 0) { + sprintf(s, "filename.ext %7d\n", finfo[i].size); + for (j = 0; j < 8; j++) { + s[j] = finfo[i].name[j]; + } + s[ 9] = finfo[i].ext[0]; + s[10] = finfo[i].ext[1]; + s[11] = finfo[i].ext[2]; + cons_putstr0(cons, s); + } + } + } + cons_newline(cons); + return; +} + +void cmd_type(struct CONSOLE *cons, int *fat, char *cmdline) +{ + struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; + struct FILEINFO *finfo = file_search(cmdline + 5, (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224); + char *p; + if (finfo != 0) { + /*找到文件的情况*/ + p = (char *) memman_alloc_4k(memman, finfo->size); + file_loadfile(finfo->clustno, finfo->size, p, fat, (char *) (ADR_DISKIMG + 0x003e00)); + cons_putstr1(cons, p, finfo->size); + memman_free_4k(memman, (int) p, finfo->size); + } else { + /*没有找到文件的情况*/ + cons_putstr0(cons, "File not found.\n"); + } + cons_newline(cons); + return; +} + +void cmd_exit(struct CONSOLE *cons, int *fat) +{ + struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; + struct TASK *task = task_now(); + struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4); + struct FIFO32 *fifo = (struct FIFO32 *) *((int *) 0x0fec); + if (cons->sht != 0) { + timer_cancel(cons->timer); + } + memman_free_4k(memman, (int) fat, 4 * 2880); + io_cli(); + if (cons->sht != 0) { + fifo32_put(fifo, cons->sht - shtctl->sheets0 + 768); /* 768〜1023 */ + } else { + fifo32_put(fifo, task - taskctl->tasks0 + 1024); /*1024~2023*/ + } + io_sti(); + for (;;) { + task_sleep(task); + } +} + +void cmd_start(struct CONSOLE *cons, char *cmdline, int memtotal) +{ + struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4); + struct SHEET *sht = open_console(shtctl, memtotal); + struct FIFO32 *fifo = &sht->task->fifo; + int i; + sheet_slide(sht, 32, 4); + sheet_updown(sht, shtctl->top); + /*将命令行输入的字符串逐字复制到新的命令行窗口中*/ + for (i = 6; cmdline[i] != 0; i++) { + fifo32_put(fifo, cmdline[i] + 256); + } + fifo32_put(fifo, 10 + 256); /*回车键*/ + cons_newline(cons); + return; +} + +void cmd_ncst(struct CONSOLE *cons, char *cmdline, int memtotal) +{ + struct TASK *task = open_constask(0, memtotal); + struct FIFO32 *fifo = &task->fifo; + int i; + + /*将命令行输入的字符串逐字复制到新的命令行窗口中*/ + for (i = 5; cmdline[i] != 0; i++) { + fifo32_put(fifo, cmdline[i] + 256); + } + fifo32_put(fifo, 10 + 256); /*回车键*/ + cons_newline(cons); + return; +} + +int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline) +{ + struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; + struct FILEINFO *finfo; + struct SEGMENT_DESCRIPTOR *gdt = (struct SEGMENT_DESCRIPTOR *) ADR_GDT; + char name[18], *p, *q; + struct TASK *task = task_now(); + int i, segsiz, datsiz, esp, dathrb; + struct SHTCTL *shtctl; + struct SHEET *sht; + + /*根据命令行生成文件名*/ + for (i = 0; i < 13; i++) { + if (cmdline[i] <= ' ') { + break; + } + name[i] = cmdline[i]; + } + name[i] = 0; /*暂且将文件名的后面置为0*/ + + /*寻找文件 */ + finfo = file_search(name, (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224); + if (finfo == 0 && name[i - 1] != '.') { + /*由于找不到文件,故在文件名后面加上“.hrb”后重新寻找*/ + name[i ] = '.'; + name[i + 1] = 'H'; + name[i + 2] = 'R'; + name[i + 3] = 'B'; + name[i + 4] = 0; + finfo = file_search(name, (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224); + } + + if (finfo != 0) { + /*找到文件的情况*/ + p = (char *) memman_alloc_4k(memman, finfo->size); + file_loadfile(finfo->clustno, finfo->size, p, fat, (char *) (ADR_DISKIMG + 0x003e00)); + if (finfo->size >= 36 && strncmp(p + 4, "Hari", 4) == 0 && *p == 0x00) { + segsiz = *((int *) (p + 0x0000)); + esp = *((int *) (p + 0x000c)); + datsiz = *((int *) (p + 0x0010)); + dathrb = *((int *) (p + 0x0014)); + q = (char *) memman_alloc_4k(memman, segsiz); + task->ds_base = (int) q; + set_segmdesc(task->ldt + 0, finfo->size - 1, (int) p, AR_CODE32_ER + 0x60); + set_segmdesc(task->ldt + 1, segsiz - 1, (int) q, AR_DATA32_RW + 0x60); + for (i = 0; i < datsiz; i++) { + q[esp + i] = p[dathrb + i]; + } + start_app(0x1b, 0 * 8 + 4, esp, 1 * 8 + 4, &(task->tss.esp0)); + shtctl = (struct SHTCTL *) *((int *) 0x0fe4); + for (i = 0; i < MAX_SHEETS; i++) { + sht = &(shtctl->sheets0[i]); + if ((sht->flags & 0x11) == 0x11 && sht->task == task) { + /*找到被应用程序遗留的窗口*/ + sheet_free(sht); /*关闭*/ + } + } + timer_cancelall(&task->fifo); + memman_free_4k(memman, (int) q, segsiz); + } else { + cons_putstr0(cons, ".hrb file format error.\n"); + } + memman_free_4k(memman, (int) p, finfo->size); + cons_newline(cons); + return 1; + } + /*没有找到文件的情况*/ + return 0; +} + +int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax) +{ + struct TASK *task = task_now(); + int ds_base = task->ds_base; + struct CONSOLE *cons = task->cons; + struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4); + struct SHEET *sht; + struct FIFO32 *sys_fifo = (struct FIFO32 *) *((int *) 0x0fec); + int *reg = &eax + 1; /* eax后面的地址*/ + /*强行改写通过PUSHAD保存的值*/ + /* reg[0] : EDI, reg[1] : ESI, reg[2] : EBP, reg[3] : ESP */ + /* reg[4] : EBX, reg[5] : EDX, reg[6] : ECX, reg[7] : EAX */ + int i; + + if (edx == 1) { + cons_putchar(cons, eax & 0xff, 1); + } else if (edx == 2) { + cons_putstr0(cons, (char *) ebx + ds_base); + } else if (edx == 3) { + cons_putstr1(cons, (char *) ebx + ds_base, ecx); + } else if (edx == 4) { + return &(task->tss.esp0); + } else if (edx == 5) { + sht = sheet_alloc(shtctl); + sht->task = task; + sht->flags |= 0x10; + sheet_setbuf(sht, (char *) ebx + ds_base, esi, edi, eax); + make_window8((char *) ebx + ds_base, esi, edi, (char *) ecx + ds_base, 0); + sheet_slide(sht, ((shtctl->xsize - esi) / 2) & ~3, (shtctl->ysize - edi) / 2); + sheet_updown(sht, shtctl->top); /*将窗口图层高度指定为当前鼠标所在图层的高度,鼠标移到上层*/ + reg[7] = (int) sht; + } else if (edx == 6) { + sht = (struct SHEET *) (ebx & 0xfffffffe); + putfonts8_asc(sht->buf, sht->bxsize, esi, edi, eax, (char *) ebp + ds_base); + if ((ebx & 1) == 0) { + sheet_refresh(sht, esi, edi, esi + ecx * 8, edi + 16); + } + } else if (edx == 7) { + sht = (struct SHEET *) (ebx & 0xfffffffe); + boxfill8(sht->buf, sht->bxsize, ebp, eax, ecx, esi, edi); + if ((ebx & 1) == 0) { + sheet_refresh(sht, eax, ecx, esi + 1, edi + 1); + } + } else if (edx == 8) { + memman_init((struct MEMMAN *) (ebx + ds_base)); + ecx &= 0xfffffff0; /*以16字节为单位*/ + memman_free((struct MEMMAN *) (ebx + ds_base), eax, ecx); + } else if (edx == 9) { + ecx = (ecx + 0x0f) & 0xfffffff0; /*以16字节为单位进位取整*/ + reg[7] = memman_alloc((struct MEMMAN *) (ebx + ds_base), ecx); + } else if (edx == 10) { + ecx = (ecx + 0x0f) & 0xfffffff0; /*以16字节为单位进位取整*/ + memman_free((struct MEMMAN *) (ebx + ds_base), eax, ecx); + } else if (edx == 11) { + sht = (struct SHEET *) (ebx & 0xfffffffe); + sht->buf[sht->bxsize * edi + esi] = eax; + if ((ebx & 1) == 0) { + sheet_refresh(sht, esi, edi, esi + 1, edi + 1); + } + } else if (edx == 12) { + sht = (struct SHEET *) ebx; + sheet_refresh(sht, eax, ecx, esi, edi); + } else if (edx == 13) { + sht = (struct SHEET *) (ebx & 0xfffffffe); + hrb_api_linewin(sht, eax, ecx, esi, edi, ebp); + if ((ebx & 1) == 0) { + sheet_refresh(sht, eax, ecx, esi + 1, edi + 1); + } + } else if (edx == 14) { + sheet_free((struct SHEET *) ebx); + } else if (edx == 15) { + for (;;) { + io_cli(); + if (fifo32_status(&task->fifo) == 0) { + if (eax != 0) { + task_sleep(task); /* FIFO为空,休眠并等待*/ + } else { + io_sti(); + reg[7] = -1; + return 0; + } + } + i = fifo32_get(&task->fifo); + io_sti(); + if (i <= 1) { /*光标用定时器*/ + /*应用程序运行时不需要显示光标,因此总是将下次显示用的值置为1*/ + timer_init(cons->timer, &task->fifo, 1); /*下次置为1*/ + timer_settime(cons->timer, 50); + } + if (i == 2) { /*光标ON */ + cons->cur_c = COL8_FFFFFF; + } + if (i == 3) { /*光标OFF */ + cons->cur_c = -1; + } + if (i == 4) { /*只关闭命令行窗口*/ + timer_cancel(cons->timer); + io_cli(); + fifo32_put(sys_fifo, cons->sht - shtctl->sheets0 + 2024); /*2024~2279*/ + cons->sht = 0; + io_sti(); + } + if (i >= 256) { /*键盘数据(通过任务A)等*/ + reg[7] = i - 256; + return 0; + } + } + } else if (edx == 16) { + reg[7] = (int) timer_alloc(); + ((struct TIMER *) reg[7])->flags2 = 1; /*允许自动取消*/ + } else if (edx == 17) { + timer_init((struct TIMER *) ebx, &task->fifo, eax + 256); + } else if (edx == 18) { + timer_settime((struct TIMER *) ebx, eax); + } else if (edx == 19) { + timer_free((struct TIMER *) ebx); + } else if (edx == 20) { + if (eax == 0) { + i = io_in8(0x61); + io_out8(0x61, i & 0x0d); + } else { + i = 1193180000 / eax; + io_out8(0x43, 0xb6); + io_out8(0x42, i & 0xff); + io_out8(0x42, i >> 8); + i = io_in8(0x61); + io_out8(0x61, (i | 0x03) & 0x0f); + } + } + return 0; +} + +int *inthandler0c(int *esp) +{ + struct TASK *task = task_now(); + struct CONSOLE *cons = task->cons; + char s[30]; + cons_putstr0(cons, "\nINT 0C :\n Stack Exception.\n"); + sprintf(s, "EIP = %08X\n", esp[11]); + cons_putstr0(cons, s); + return &(task->tss.esp0); /*强制结束程序*/ +} + +int *inthandler0d(int *esp) +{ + struct TASK *task = task_now(); + struct CONSOLE *cons = task->cons; + char s[30]; + cons_putstr0(cons, "\nINT 0D :\n General Protected Exception.\n"); + sprintf(s, "EIP = %08X\n", esp[11]); + cons_putstr0(cons, s); + return &(task->tss.esp0); /*强制结束程序*/ +} + +void hrb_api_linewin(struct SHEET *sht, int x0, int y0, int x1, int y1, int col) +{ + int i, x, y, len, dx, dy; + + dx = x1 - x0; + dy = y1 - y0; + x = x0 << 10; + y = y0 << 10; + if (dx < 0) { + dx = - dx; + } + if (dy < 0) { + dy = - dy; + } + if (dx >= dy) { + len = dx + 1; + if (x0 > x1) { + dx = -1024; + } else { + dx = 1024; + } + if (y0 <= y1) { + dy = ((y1 - y0 + 1) << 10) / len; + } else { + dy = ((y1 - y0 - 1) << 10) / len; + } + } else { + len = dy + 1; + if (y0 > y1) { + dy = -1024; + } else { + dy = 1024; + } + if (x0 <= x1) { + dx = ((x1 - x0 + 1) << 10) / len; + } else { + dx = ((x1 - x0 - 1) << 10) / len; + } + } + + for (i = 0; i < len; i++) { + sht->buf[(y >> 10) * sht->bxsize + (x >> 10)] = col; + x += dx; + y += dy; + } + + return; +} diff --git a/28_day/haribote/dsctbl.c b/28_day/haribote/dsctbl.c new file mode 100644 index 0000000..9ff2c67 --- /dev/null +++ b/28_day/haribote/dsctbl.c @@ -0,0 +1,59 @@ +/* GDT、IDT、descriptor table 关系处理 */ + +#include "bootpack.h" + +void init_gdtidt(void) +{ + struct SEGMENT_DESCRIPTOR *gdt = (struct SEGMENT_DESCRIPTOR *) ADR_GDT; + struct GATE_DESCRIPTOR *idt = (struct GATE_DESCRIPTOR *) ADR_IDT; + int i; + + /* GDT初始化 */ + for (i = 0; i <= LIMIT_GDT / 8; i++) { + set_segmdesc(gdt + i, 0, 0, 0); + } + set_segmdesc(gdt + 1, 0xffffffff, 0x00000000, AR_DATA32_RW); + set_segmdesc(gdt + 2, LIMIT_BOTPAK, ADR_BOTPAK, AR_CODE32_ER); + load_gdtr(LIMIT_GDT, ADR_GDT); + + /* IDT初始化 */ + for (i = 0; i <= LIMIT_IDT / 8; i++) { + set_gatedesc(idt + i, 0, 0, 0); + } + load_idtr(LIMIT_IDT, ADR_IDT); + + /* IDT设置*/ + set_gatedesc(idt + 0x0c, (int) asm_inthandler0c, 2 * 8, AR_INTGATE32); + set_gatedesc(idt + 0x0d, (int) asm_inthandler0d, 2 * 8, AR_INTGATE32); + set_gatedesc(idt + 0x20, (int) asm_inthandler20, 2 * 8, AR_INTGATE32); + set_gatedesc(idt + 0x21, (int) asm_inthandler21, 2 * 8, AR_INTGATE32); + set_gatedesc(idt + 0x2c, (int) asm_inthandler2c, 2 * 8, AR_INTGATE32); + set_gatedesc(idt + 0x40, (int) asm_hrb_api, 2 * 8, AR_INTGATE32 + 0x60); + + return; +} + +void set_segmdesc(struct SEGMENT_DESCRIPTOR *sd, unsigned int limit, int base, int ar) +{ + if (limit > 0xfffff) { + ar |= 0x8000; /* G_bit = 1 */ + limit /= 0x1000; + } + sd->limit_low = limit & 0xffff; + sd->base_low = base & 0xffff; + sd->base_mid = (base >> 16) & 0xff; + sd->access_right = ar & 0xff; + sd->limit_high = ((limit >> 16) & 0x0f) | ((ar >> 8) & 0xf0); + sd->base_high = (base >> 24) & 0xff; + return; +} + +void set_gatedesc(struct GATE_DESCRIPTOR *gd, int offset, int selector, int ar) +{ + gd->offset_low = offset & 0xffff; + gd->selector = selector; + gd->dw_count = (ar >> 8) & 0xff; + gd->access_right = ar & 0xff; + gd->offset_high = (offset >> 16) & 0xffff; + return; +} diff --git a/28_day/haribote/fifo.c b/28_day/haribote/fifo.c new file mode 100644 index 0000000..8f28f4b --- /dev/null +++ b/28_day/haribote/fifo.c @@ -0,0 +1,63 @@ +/* FIFO */ + +#include "bootpack.h" + +#define FLAGS_OVERRUN 0x0001 + +void fifo32_init(struct FIFO32 *fifo, int size, int *buf, struct TASK *task) +/* FIFO缓冲区的初始化*/ +{ + fifo->size = size; + fifo->buf = buf; + fifo->free = size; /*空*/ + fifo->flags = 0; + fifo->p = 0; /*写入位置*/ + fifo->q = 0; /*读取位置*/ + fifo->task = task; /*有数据写入时需要唤醒的任务*/ + return; +} + +int fifo32_put(struct FIFO32 *fifo, int data) +/*向FIFO写入数据并累积起来*/ +{ + if (fifo->free == 0) { + /*没有空余空间,溢出*/ + fifo->flags |= FLAGS_OVERRUN; + return -1; + } + fifo->buf[fifo->p] = data; + fifo->p++; + if (fifo->p == fifo->size) { + fifo->p = 0; + } + fifo->free--; + if (fifo->task != 0) { + if (fifo->task->flags != 2) { /*如果任务处于休眠状态*/ + task_run(fifo->task, -1, 0); /*将任务唤醒*/ + } + } + return 0; +} + +int fifo32_get(struct FIFO32 *fifo) +/*从FIFO取得一个数据*/ +{ + int data; + if (fifo->free == fifo->size) { + /*当缓冲区为空的情况下返回-1*/ + return -1; + } + data = fifo->buf[fifo->q]; + fifo->q++; + if (fifo->q == fifo->size) { + fifo->q = 0; + } + fifo->free++; + return data; +} + +int fifo32_status(struct FIFO32 *fifo) +/*报告已经存储了多少数据*/ +{ + return fifo->size - fifo->free; +} diff --git a/28_day/haribote/file.c b/28_day/haribote/file.c new file mode 100644 index 0000000..bf9d063 --- /dev/null +++ b/28_day/haribote/file.c @@ -0,0 +1,74 @@ +/* 文件相关函数 */ + +#include "bootpack.h" + +void file_readfat(int *fat, unsigned char *img) +/*将磁盘映像中的FAT解压缩 */ +{ + int i, j = 0; + for (i = 0; i < 2880; i += 2) { + fat[i + 0] = (img[j + 0] | img[j + 1] << 8) & 0xfff; + fat[i + 1] = (img[j + 1] >> 4 | img[j + 2] << 4) & 0xfff; + j += 3; + } + return; +} + +void file_loadfile(int clustno, int size, char *buf, int *fat, char *img) +{ + int i; + for (;;) { + if (size <= 512) { + for (i = 0; i < size; i++) { + buf[i] = img[clustno * 512 + i]; + } + break; + } + for (i = 0; i < 512; i++) { + buf[i] = img[clustno * 512 + i]; + } + size -= 512; + buf += 512; + clustno = fat[clustno]; + } + return; +} + +struct FILEINFO *file_search(char *name, struct FILEINFO *finfo, int max) +{ + int i, j; + char s[12]; + for (j = 0; j < 11; j++) { + s[j] = ' '; + } + j = 0; + for (i = 0; name[i] != 0; i++) { + if (j >= 11) { return 0; /*没有找到*/ } + if (name[i] == '.' && j <= 8) { + j = 8; + } else { + s[j] = name[i]; + if ('a' <= s[j] && s[j] <= 'z') { + /*将小写字母转换为大写字母*/ + s[j] -= 0x20; + } + j++; + } + } + for (i = 0; i < max; ) { + if (finfo->name[0] == 0x00) { + break; + } + if ((finfo[i].type & 0x18) == 0) { + for (j = 0; j < 11; j++) { + if (finfo[i].name[j] != s[j]) { + goto next; + } + } + return finfo + i; /*找到文件*/ + } +next: + i++; + } + return 0; /*没有找到*/ +} diff --git a/28_day/haribote/graphic.c b/28_day/haribote/graphic.c new file mode 100644 index 0000000..4bd6979 --- /dev/null +++ b/28_day/haribote/graphic.c @@ -0,0 +1,167 @@ +/* 关于绘图部分的处理 */ + +#include "bootpack.h" + +void init_palette(void) +{ + static unsigned char table_rgb[16 * 3] = { + 0x00, 0x00, 0x00, /* 0:黑 */ + 0xff, 0x00, 0x00, /* 1:梁红 */ + 0x00, 0xff, 0x00, /* 2:亮绿 */ + 0xff, 0xff, 0x00, /* 3:亮黄 */ + 0x00, 0x00, 0xff, /* 4:亮蓝 */ + 0xff, 0x00, 0xff, /* 5:亮紫 */ + 0x00, 0xff, 0xff, /* 6:浅亮蓝 */ + 0xff, 0xff, 0xff, /* 7:白 */ + 0xc6, 0xc6, 0xc6, /* 8:亮灰 */ + 0x84, 0x00, 0x00, /* 9:暗红 */ + 0x00, 0x84, 0x00, /* 10:暗绿 */ + 0x84, 0x84, 0x00, /* 11:暗黄 */ + 0x00, 0x00, 0x84, /* 12:暗青 */ + 0x84, 0x00, 0x84, /* 13:暗紫 */ + 0x00, 0x84, 0x84, /* 14:浅暗蓝 */ + 0x84, 0x84, 0x84 /* 15:暗灰 */ + }; + unsigned char table2[216 * 3]; + int r, g, b; + set_palette(0, 15, table_rgb); + for (b = 0; b < 6; b++) { + for (g = 0; g < 6; g++) { + for (r = 0; r < 6; r++) { + table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51; + table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51; + table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51; + } + } + } + set_palette(16, 231, table2); + return; +} + +void set_palette(int start, int end, unsigned char *rgb) +{ + int i, eflags; + eflags = io_load_eflags(); /* 记录中断许可标志的值 */ + io_cli(); /* 将中断许可标志置为0,禁止中断 */ + io_out8(0x03c8, start); + for (i = start; i <= end; i++) { + io_out8(0x03c9, rgb[0] / 4); + io_out8(0x03c9, rgb[1] / 4); + io_out8(0x03c9, rgb[2] / 4); + rgb += 3; + } + io_store_eflags(eflags); /* 复原中断许可标志 */ + return; +} + +void boxfill8(unsigned char *vram, int xsize, unsigned char c, int x0, int y0, int x1, int y1) +{ + int x, y; + for (y = y0; y <= y1; y++) { + for (x = x0; x <= x1; x++) + vram[y * xsize + x] = c; + } + return; +} + +void init_screen8(char *vram, int x, int y) +{ + boxfill8(vram, x, COL8_008484, 0, 0, x - 1, y - 29); + boxfill8(vram, x, COL8_C6C6C6, 0, y - 28, x - 1, y - 28); + boxfill8(vram, x, COL8_FFFFFF, 0, y - 27, x - 1, y - 27); + boxfill8(vram, x, COL8_C6C6C6, 0, y - 26, x - 1, y - 1); + + boxfill8(vram, x, COL8_FFFFFF, 3, y - 24, 59, y - 24); + boxfill8(vram, x, COL8_FFFFFF, 2, y - 24, 2, y - 4); + boxfill8(vram, x, COL8_848484, 3, y - 4, 59, y - 4); + boxfill8(vram, x, COL8_848484, 59, y - 23, 59, y - 5); + boxfill8(vram, x, COL8_000000, 2, y - 3, 59, y - 3); + boxfill8(vram, x, COL8_000000, 60, y - 24, 60, y - 3); + + boxfill8(vram, x, COL8_848484, x - 47, y - 24, x - 4, y - 24); + boxfill8(vram, x, COL8_848484, x - 47, y - 23, x - 47, y - 4); + boxfill8(vram, x, COL8_FFFFFF, x - 47, y - 3, x - 4, y - 3); + 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; +} + +void init_mouse_cursor8(char *mouse, char bc) +/* 鼠标的数据准备(16x16) */ +{ + static char cursor[16][16] = { + "**************..", + "*OOOOOOOOOOO*...", + "*OOOOOOOOOO*....", + "*OOOOOOOOO*.....", + "*OOOOOOOO*......", + "*OOOOOOO*.......", + "*OOOOOOO*.......", + "*OOOOOOOO*......", + "*OOOO**OOO*.....", + "*OOO*..*OOO*....", + "*OO*....*OOO*...", + "*O*......*OOO*..", + "**........*OOO*.", + "*..........*OOO*", + "............*OO*", + ".............***" + }; + int x, y; + + for (y = 0; y < 16; y++) { + for (x = 0; x < 16; x++) { + if (cursor[y][x] == '*') { + mouse[y * 16 + x] = COL8_000000; + } + if (cursor[y][x] == 'O') { + mouse[y * 16 + x] = COL8_FFFFFF; + } + if (cursor[y][x] == '.') { + mouse[y * 16 + x] = bc; + } + } + } + return; +} + +void putblock8_8(char *vram, int vxsize, int pxsize, + int pysize, int px0, int py0, char *buf, int bxsize) +{ + int x, y; + for (y = 0; y < pysize; y++) { + for (x = 0; x < pxsize; x++) { + vram[(py0 + y) * vxsize + (px0 + x)] = buf[y * bxsize + x]; + } + } + return; +} diff --git a/28_day/haribote/hankaku.txt b/28_day/haribote/hankaku.txt new file mode 100644 index 0000000..62d56f9 --- /dev/null +++ b/28_day/haribote/hankaku.txt @@ -0,0 +1,4609 @@ +OSASK̔ptHg𗬗p + +char 0x00 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0x01 +........ +........ +..***... +.*...*.. +*.....*. +*.*.*.*. +*.*.*.*. +*.....*. +*.....*. +*.*.*.*. +*..*..*. +.*...*.. +..***... +........ +........ +........ + +char 0x02 +........ +........ +..***... +.*****.. +*******. +**.*.**. +**.*.**. +*******. +*******. +**.*.**. +***.***. +.*****.. +..***... +........ +........ +........ + +char 0x03 +........ +........ +........ +........ +.**.**.. +*******. +*******. +*******. +.*****.. +..***... +...*.... +........ +........ +........ +........ +........ + +char 0x04 +........ +........ +........ +........ +...*.... +..***... +.*****.. +*******. +.*****.. +..***... +...*.... +........ +........ +........ +........ +........ + +char 0x05 +........ +........ +........ +........ +...*.... +..***... +.*.*.*.. +*******. +.*.*.*.. +...*.... +..***... +........ +........ +........ +........ +........ + +char 0x06 +........ +........ +........ +........ +...*.... +..***... +.*****.. +*******. +**.*.**. +...*.... +..***... +........ +........ +........ +........ +........ + +char 0x07 +........ +........ +........ +........ +........ +........ +...**... +..****.. +..****.. +...**... +........ +........ +........ +........ +........ +........ + +char 0x08 +******** +******** +******** +******** +******** +******** +***..*** +**....** +**....** +***..*** +******** +******** +******** +******** +******** +******** + +char 0x09 +........ +........ +........ +........ +........ +..****.. +.**..**. +.*....*. +.*....*. +.**..**. +..****.. +........ +........ +........ +........ +........ + +char 0x0a +******** +******** +******** +******** +******** +**....** +*..**..* +*.****.* +*.****.* +*..**..* +**....** +******** +******** +******** +******** +******** + +char 0x0b +........ +...*.... +..***... +.*.*.*.. +*..*..*. +...*.... +...*.... +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +........ + +char 0x0c +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +...*.... +...*.... +*******. +...*.... +...*.... +...*.... +........ +........ + +char 0x0d +........ +........ +....**.. +....***. +....*.** +....*.** +....*.*. +....*... +....*... +...**... +.****... +*****... +.***.... +........ +........ +........ + +char 0x0e +........ +........ +...***** +...***** +...*...* +...*...* +...*...* +...*...* +...*...* +...*...* +.***.*** +******** +.**..**. +........ +........ +........ + +char 0x0f +........ +........ +........ +........ +...*.... +.*.*.*.. +..***... +..*.*... +..***... +.*.*.*.. +...*.... +........ +........ +........ +........ +........ + +char 0x10 +........ +*....... +**...... +***..... +****.... +*****... +******.. +*******. +******.. +*****... +****.... +***..... +**...... +*....... +........ +........ + +char 0x11 +........ +......*. +.....**. +....***. +...****. +..*****. +.******. +*******. +.******. +..*****. +...****. +....***. +.....**. +......*. +........ +........ + +char 0x12 +........ +........ +...*.... +..***... +.*.*.*.. +*..*..*. +...*.... +...*.... +...*.... +*..*..*. +.*.*.*.. +..***... +...*.... +........ +........ +........ + +char 0x13 +........ +........ +.*...*.. +.*...*.. +.*...*.. +.*...*.. +.*...*.. +.*...*.. +.*...*.. +.*...*.. +........ +........ +.*...*.. +.*...*.. +........ +........ + +char 0x14 +........ +..*****. +.*..*.*. +*...*.*. +*...*.*. +*...*.*. +*...*.*. +.*..*.*. +..***.*. +....*.*. +....*.*. +....*.*. +....*.*. +....*.*. +........ +........ + +char 0x15 +.*****.. +*.....*. +.*...... +..*..... +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +....*... +.....*.. +*.....*. +.*****.. +........ + +char 0x16 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +*******. +*******. +*******. +........ +........ + +char 0x17 +........ +........ +...*.... +..***... +.*.*.*.. +*..*..*. +...*.... +...*.... +...*.... +*..*..*. +.*.*.*.. +..***... +...*.... +.*****.. +........ +........ + +char 0x18 +........ +...*.... +..***... +.*.*.*.. +*..*..*. +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +........ +........ + +char 0x19 +........ +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +*..*..*. +.*.*.*.. +..***... +...*.... +........ +........ + +char 0x1a +........ +........ +........ +........ +...*.... +....*... +.....*.. +*******. +.....*.. +....*... +...*.... +........ +........ +........ +........ +........ + +char 0x1b +........ +........ +........ +........ +...*.... +..*..... +.*...... +*******. +.*...... +..*..... +...*.... +........ +........ +........ +........ +........ + +char 0x1c +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +*....... +*....... +*******. +........ +........ + +char 0x1d +........ +........ +........ +........ +........ +..*.*... +.*...*.. +*******. +.*...*.. +..*.*... +........ +........ +........ +........ +........ +........ + +char 0x1e +........ +........ +........ +........ +...*.... +...*.... +..***... +..***... +.*****.. +.*****.. +*******. +*******. +........ +........ +........ +........ + +char 0x1f +........ +........ +........ +........ +*******. +*******. +.*****.. +.*****.. +..***... +..***... +...*.... +...*.... +........ +........ +........ +........ + +char 0x20 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0x21 +........ +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +........ +........ +...*.... +...*.... +........ +........ + +char 0x22 +..*.*... +..*.*... +..*.*... +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0x23 +........ +.*...*.. +.*...*.. +.*...*.. +*******. +.*...*.. +.*...*.. +.*...*.. +.*...*.. +.*...*.. +*******. +.*...*.. +.*...*.. +.*...*.. +........ +........ + +char 0x24 +...*.... +..***.*. +.*.*.**. +*..*..*. +*..*..*. +*..*.... +.*.*.... +..***... +...*.*.. +...*..*. +*..*..*. +*..*..*. +**.*.*.. +*.***... +...*.... +...*.... + +char 0x25 +.**...*. +*..*..*. +*..*.*.. +*..*.*.. +.**.*... +....*... +...*.... +...*.... +..*..... +..*.**.. +.*.*..*. +.*.*..*. +*..*..*. +*...**.. +........ +........ + +char 0x26 +........ +.***.... +*...*... +*...*... +*...*... +*..*.... +.**..... +.*...*** +*.*...*. +*..*..*. +*...*.*. +*....*.. +.*...**. +..***..* +........ +........ + +char 0x27 +.....*.. +....*... +...*.... +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0x28 +......*. +.....*.. +....*... +....*... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +....*... +....*... +.....*.. +......*. +........ + +char 0x29 +*....... +.*...... +..*..... +..*..... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +..*..... +..*..... +.*...... +*....... +........ + +char 0x2a +........ +........ +........ +........ +........ +...*.... +*..*..*. +.*.*.*.. +..***... +.*.*.*.. +*..*..*. +...*.... +........ +........ +........ +........ + +char 0x2b +........ +........ +........ +........ +........ +...*.... +...*.... +...*.... +*******. +...*.... +...*.... +...*.... +........ +........ +........ +........ + +char 0x2c +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +...**... +...**... +....*... +....*... +...*.... + +char 0x2d +........ +........ +........ +........ +........ +........ +........ +........ +*******. +........ +........ +........ +........ +........ +........ +........ + +char 0x2e +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +...**... +...**... +........ +........ + +char 0x2f +......*. +......*. +.....*.. +.....*.. +....*... +....*... +....*... +...*.... +...*.... +..*..... +..*..... +.*...... +.*...... +.*...... +*....... +*....... + +char 0x30 +........ +...**... +..*..*.. +..*..*.. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +..*..*.. +..*..*.. +...**... +........ +........ + +char 0x31 +........ +....*... +...**... +..*.*... +....*... +....*... +....*... +....*... +....*... +....*... +....*... +....*... +....*... +..*****. +........ +........ + +char 0x32 +........ +...**... +..*..*.. +.*....*. +.*....*. +......*. +.....*.. +....*... +...*.... +..*..... +..*..... +.*...... +.*...... +.******. +........ +........ + +char 0x33 +........ +...**... +..*..*.. +.*....*. +......*. +......*. +.....*.. +...**... +.....*.. +......*. +......*. +.*....*. +..*..*.. +...**... +........ +........ + +char 0x34 +........ +....**.. +....**.. +....**.. +...*.*.. +...*.*.. +...*.*.. +..*..*.. +..*..*.. +.*...*.. +.******. +.....*.. +.....*.. +...****. +........ +........ + +char 0x35 +........ +.*****.. +.*...... +.*...... +.*...... +.*.**... +.**..*.. +......*. +......*. +......*. +......*. +.*....*. +..*..*.. +...**... +........ +........ + +char 0x36 +........ +...**... +..*..*.. +.*....*. +.*...... +.*.**... +.**..*.. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +..*..*.. +...**... +........ +........ + +char 0x37 +........ +.******. +.*....*. +.*....*. +.....*.. +.....*.. +....*... +....*... +....*... +...*.... +...*.... +...*.... +...*.... +..***... +........ +........ + +char 0x38 +........ +...**... +..*..*.. +.*....*. +.*....*. +.*....*. +..*..*.. +...**... +..*..*.. +.*....*. +.*....*. +.*....*. +..*..*.. +...**... +........ +........ + +char 0x39 +........ +...**... +..*..*.. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +..*..**. +...**.*. +......*. +.*....*. +..*..*.. +...**... +........ +........ + +char 0x3a +........ +........ +........ +........ +........ +...**... +...**... +........ +........ +........ +........ +........ +...**... +...**... +........ +........ + +char 0x3b +........ +........ +........ +........ +........ +...**... +...**... +........ +........ +........ +........ +...**... +...**... +....*... +....*... +...*.... + +char 0x3c +........ +......*. +.....*.. +....*... +...*.... +..*..... +.*...... +*....... +*....... +.*...... +..*..... +...*.... +....*... +.....*.. +......*. +........ + +char 0x3d +........ +........ +........ +........ +........ +........ +*******. +........ +........ +*******. +........ +........ +........ +........ +........ +........ + +char 0x3e +........ +*....... +.*...... +..*..... +...*.... +....*... +.....*.. +......*. +......*. +.....*.. +....*... +...*.... +..*..... +.*...... +*....... +........ + +char 0x3f +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +.....*.. +....*... +...*.... +...*.... +........ +........ +...**... +...**... +........ +........ + +char 0x40 +........ +..***... +.*...*.. +*.....*. +*..**.*. +*.*.*.*. +*.*.*.*. +*.*.*.*. +*.*.*.*. +*.*.*.*. +*..***.. +*....... +.*...**. +..***... +........ +........ + +char 0x41 +........ +...**... +...**... +...**... +...**... +..*..*.. +..*..*.. +..*..*.. +..*..*.. +.******. +.*....*. +.*....*. +.*....*. +***..*** +........ +........ + +char 0x42 +........ +****.... +.*..*... +.*...*.. +.*...*.. +.*...*.. +.*..*... +.****... +.*...*.. +.*....*. +.*....*. +.*....*. +.*...*.. +*****... +........ +........ + +char 0x43 +........ +..***.*. +.*...**. +.*....*. +*.....*. +*....... +*....... +*....... +*....... +*....... +*.....*. +.*....*. +.*...*.. +..***... +........ +........ + +char 0x44 +........ +*****... +.*...*.. +.*...*.. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*...*.. +.*...*.. +*****... +........ +........ + +char 0x45 +........ +*******. +.*....*. +.*....*. +.*...... +.*...... +.*...*.. +.*****.. +.*...*.. +.*...... +.*...... +.*....*. +.*....*. +*******. +........ +........ + +char 0x46 +........ +*******. +.*....*. +.*....*. +.*...... +.*...... +.*...*.. +.*****.. +.*...*.. +.*...*.. +.*...... +.*...... +.*...... +****.... +........ +........ + +char 0x47 +........ +..***.*. +.*...**. +.*....*. +*.....*. +*....... +*....... +*..****. +*.....*. +*.....*. +*.....*. +.*....*. +.*...**. +..***... +........ +........ + +char 0x48 +........ +***..*** +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.******. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +***..*** +........ +........ + +char 0x49 +........ +.*****.. +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +.*****.. +........ +........ + +char 0x4a +........ +...***** +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +*....*.. +.*..*... +..**.... +........ + +char 0x4b +........ +***..*** +.*....*. +.*...*.. +.*..*... +.*.*.... +.*.*.... +.**..... +.*.*.... +.*.*.... +.*..*... +.*...*.. +.*....*. +***..*** +........ +........ + +char 0x4c +........ +****.... +.*...... +.*...... +.*...... +.*...... +.*...... +.*...... +.*...... +.*...... +.*...... +.*....*. +.*....*. +*******. +........ +........ + +char 0x4d +........ +**....** +.*....*. +.**..**. +.**..**. +.**..**. +.*.**.*. +.*.**.*. +.*.**.*. +.*....*. +.*....*. +.*....*. +.*....*. +***..*** +........ +........ + +char 0x4e +........ +**...*** +.*....*. +.**...*. +.**...*. +.*.*..*. +.*.*..*. +.*.*..*. +.*..*.*. +.*..*.*. +.*..*.*. +.*...**. +.*...**. +***...*. +........ +........ + +char 0x4f +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +........ + +char 0x50 +........ +*****... +.*...*.. +.*....*. +.*....*. +.*....*. +.*...*.. +.****... +.*...... +.*...... +.*...... +.*...... +.*...... +****.... +........ +........ + +char 0x51 +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*..*..*. +*...*.*. +.*...*.. +..***.*. +........ +........ + +char 0x52 +........ +******.. +.*....*. +.*....*. +.*....*. +.*....*. +.*****.. +.*...*.. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +***..*** +........ +........ + +char 0x53 +........ +..***.*. +.*...**. +*.....*. +*.....*. +*....... +.*...... +..***... +.....*.. +......*. +*.....*. +*.....*. +**...*.. +*.***... +........ +........ + +char 0x54 +........ +*******. +*..*..*. +*..*..*. +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +.*****.. +........ +........ + +char 0x55 +........ +***..*** +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +..*..*.. +..****.. +........ +........ + +char 0x56 +........ +***..*** +.*....*. +.*....*. +.*....*. +.*....*. +..*..*.. +..*..*.. +..*..*.. +..*..*.. +...**... +...**... +...**... +...**... +........ +........ + +char 0x57 +........ +***..*** +.*....*. +.*....*. +.*....*. +.*.**.*. +.*.**.*. +.*.**.*. +.*.**.*. +..*..*.. +..*..*.. +..*..*.. +..*..*.. +..*..*.. +........ +........ + +char 0x58 +........ +***..*** +.*....*. +.*....*. +..*..*.. +..*..*.. +..*..*.. +...**... +..*..*.. +..*..*.. +..*..*.. +.*....*. +.*....*. +***..*** +........ +........ + +char 0x59 +........ +***.***. +.*...*.. +.*...*.. +.*...*.. +..*.*... +..*.*... +..*.*... +...*.... +...*.... +...*.... +...*.... +...*.... +.*****.. +........ +........ + +char 0x5a +........ +*******. +*....*.. +*....*.. +....*... +....*... +...*.... +...*.... +..*..... +..*..... +.*...... +.*....*. +*.....*. +*******. +........ +........ + +char 0x5b +........ +..*****. +..*..... +..*..... +..*..... +..*..... +..*..... +..*..... +..*..... +..*..... +..*..... +..*..... +..*..... +..*..... +..*****. +........ + +char 0x5c +*....... +*....... +.*...... +.*...... +..*..... +..*..... +..*..... +...*.... +...*.... +....*... +....*... +.....*.. +.....*.. +.....*.. +......*. +......*. + +char 0x5d +........ +.*****.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.*****.. +........ + +char 0x5e +........ +...*.... +..*.*... +.*...*.. +*.....*. +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0x5f +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +*******. +........ + +char 0x60 +...*.... +....*... +.....*.. +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0x61 +........ +........ +........ +........ +........ +.***.... +....*... +.....*.. +..****.. +.*...*.. +*....*.. +*....*.. +*...**.. +.***.**. +........ +........ + +char 0x62 +**...... +.*...... +.*...... +.*...... +.*...... +.*.**... +.**..*.. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.**..*.. +.*.**... +........ +........ + +char 0x63 +........ +........ +........ +........ +........ +..**.... +.*..**.. +*....*.. +*....*.. +*....... +*....... +*.....*. +.*...*.. +..***... +........ +........ + +char 0x64 +....**.. +.....*.. +.....*.. +.....*.. +.....*.. +..**.*.. +.*..**.. +*....*.. +*....*.. +*....*.. +*....*.. +*....*.. +.*..**.. +..**.**. +........ +........ + +char 0x65 +........ +........ +........ +........ +........ +..***... +.*...*.. +*.....*. +*.....*. +******.. +*....... +*.....*. +.*....*. +..****.. +........ +........ + +char 0x66 +....***. +...*.... +...*.... +...*.... +...*.... +.*****.. +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +.*****.. +........ +........ + +char 0x67 +........ +........ +........ +........ +........ +..**.**. +.*..**.. +*....*.. +*....*.. +*....*.. +*....*.. +.*..**.. +..**.*.. +.....*.. +.....*.. +.****... + +char 0x68 +**...... +.*...... +.*...... +.*...... +.*...... +.*.**... +.**..*.. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +***...** +........ +........ + +char 0x69 +........ +...*.... +...*.... +........ +........ +..**.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +..***... +........ +........ + +char 0x6a +........ +.....*.. +.....*.. +........ +........ +....**.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +.....*.. +....*... +....*... +..**.... + +char 0x6b +**...... +.*...... +.*...... +.*...... +.*...... +.*..***. +.*...*.. +.*..*... +.*.*.... +.**..... +.*.*.... +.*..*... +.*...*.. +***..**. +........ +........ + +char 0x6c +..**.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +..***... +........ +........ + +char 0x6d +........ +........ +........ +........ +........ +****.**. +.*..*..* +.*..*..* +.*..*..* +.*..*..* +.*..*..* +.*..*..* +.*..*..* +**.**.** +........ +........ + +char 0x6e +........ +........ +........ +........ +........ +**.**... +.**..*.. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +***...** +........ +........ + +char 0x6f +........ +........ +........ +........ +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +........ + +char 0x70 +........ +........ +........ +........ +........ +**.**... +.**..*.. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.**..*.. +.*.**... +.*...... +***..... + +char 0x71 +........ +........ +........ +........ +........ +..**.*.. +.*..**.. +*....*.. +*....*.. +*....*.. +*....*.. +*....*.. +.*..**.. +..**.*.. +.....*.. +....***. + +char 0x72 +........ +........ +........ +........ +........ +**.***.. +.**...*. +.*....*. +.*...... +.*...... +.*...... +.*...... +.*...... +***..... +........ +........ + +char 0x73 +........ +........ +........ +........ +........ +.****.*. +*....**. +*.....*. +**...... +..***... +.....**. +*.....*. +**....*. +*.****.. +........ +........ + +char 0x74 +........ +........ +...*.... +...*.... +...*.... +.*****.. +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +....***. +........ +........ + +char 0x75 +........ +........ +........ +........ +........ +**...**. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*....*. +.*...**. +..***.** +........ +........ + +char 0x76 +........ +........ +........ +........ +........ +***..*** +.*....*. +.*....*. +.*....*. +..*..*.. +..*..*.. +..*..*.. +...**... +...**... +........ +........ + +char 0x77 +........ +........ +........ +........ +........ +***..*** +.*....*. +.*....*. +.*.**.*. +.*.**.*. +.*.**.*. +..*..*.. +..*..*.. +..*..*.. +........ +........ + +char 0x78 +........ +........ +........ +........ +........ +**...**. +.*...*.. +..*.*... +..*.*... +...*.... +..*.*... +..*.*... +.*...*.. +**...**. +........ +........ + +char 0x79 +........ +........ +........ +........ +........ +***..*** +.*....*. +.*....*. +..*..*.. +..*..*.. +..*..*.. +...**... +...**... +...*.... +...*.... +.**..... + +char 0x7a +........ +........ +........ +........ +........ +*******. +*.....*. +*....*.. +....*... +...*.... +..*..... +.*....*. +*.....*. +*******. +........ +........ + +char 0x7b +........ +.....**. +....*... +...*.... +...*.... +...*.... +...*.... +.**..... +...*.... +...*.... +...*.... +...*.... +....*... +.....**. +........ +........ + +char 0x7c +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0x7d +........ +.**..... +...*.... +....*... +....*... +....*... +....*... +.....**. +....*... +....*... +....*... +....*... +...*.... +.**..... +........ +........ + +char 0x7e +........ +.***..*. +*...**.. +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0x7f +........ +........ +........ +........ +...*.... +..*.*... +.*...*.. +*.....*. +*******. +*.....*. +*******. +........ +........ +........ +........ +........ + +char 0x80 +........ +..***... +.*...*.. +*.....*. +*....... +*....... +*....... +*....... +*....... +*....... +*....... +*.....*. +.*...*.. +..***... +...*.... +..*..... + +char 0x81 +........ +........ +..*..*.. +..*..*.. +........ +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*....*. +..*****. +........ +........ + +char 0x82 +....**.. +....*... +...*.... +........ +........ +..***... +.*...*.. +*.....*. +*.....*. +*******. +*....... +*.....*. +.*...*.. +..***... +........ +........ + +char 0x83 +........ +...*.... +..*.*... +.*...*.. +........ +.****... +.....*.. +.....*.. +..****.. +.*...*.. +*....*.. +*....*.. +.*...*.. +..*****. +........ +........ + +char 0x84 +........ +........ +..*..*.. +..*..*.. +........ +.****... +.....*.. +.....*.. +..****.. +.*...*.. +*....*.. +*....*.. +.*...*.. +..*****. +........ +........ + +char 0x85 +...*.... +....*... +.....*.. +........ +........ +.****... +.....*.. +.....*.. +..****.. +.*...*.. +*....*.. +*....*.. +.*...*.. +..*****. +........ +........ + +char 0x86 +........ +...**... +..*..*.. +...**... +........ +.****... +.....*.. +.....*.. +..****.. +.*...*.. +*....*.. +*....*.. +.*...*.. +..*****. +........ +........ + +char 0x87 +........ +........ +........ +........ +........ +..****.. +.*....*. +*....... +*....... +*....... +*....... +*....... +.*....*. +..****.. +....*... +...*.... + +char 0x88 +........ +...*.... +..*.*... +.*...*.. +........ +..***... +.*...*.. +*.....*. +*.....*. +*******. +*....... +*.....*. +.*...*.. +..***... +........ +........ + +char 0x89 +........ +........ +..*..*.. +..*..*.. +........ +..***... +.*...*.. +*.....*. +*.....*. +*******. +*....... +*.....*. +.*...*.. +..***... +........ +........ + +char 0x8a +...*.... +....*... +.....*.. +........ +........ +..***... +.*...*.. +*.....*. +*.....*. +*******. +*....... +*.....*. +.*...*.. +..***... +........ +........ + +char 0x8b +........ +........ +..*..*.. +..*..*.. +........ +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +........ +........ + +char 0x8c +........ +...*.... +..*.*... +.*...*.. +........ +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +........ +........ + +char 0x8d +...*.... +....*... +.....*.. +........ +........ +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +........ +........ + +char 0x8e +..*..*.. +..*..*.. +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*******. +*.....*. +*.....*. +*.....*. +*.....*. +........ +........ + +char 0x8f +........ +..***... +.*...*.. +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*******. +*.....*. +*.....*. +*.....*. +*.....*. +........ +........ + +char 0x90 +....**.. +....*... +...*.... +*******. +*....... +*....... +*....... +*....... +*****... +*....... +*....... +*....... +*....... +*******. +........ +........ + +char 0x91 +........ +........ +........ +........ +........ +.**..... +...***.. +...*..*. +.***..*. +*..****. +*..*.... +*..*.... +*..*..*. +.**.**.. +........ +........ + +char 0x92 +....**.. +...*.... +..*..... +..*.*... +..*.*... +..*.*... +*******. +..*.*... +..*.*... +..*.*... +..*.*... +..*.*... +..*.*... +..*.*... +........ +........ + +char 0x93 +........ +...*.... +..*.*... +.*...*.. +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +........ + +char 0x94 +........ +........ +..*..*.. +..*..*.. +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +........ + +char 0x95 +...*.... +....*... +.....*.. +........ +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +........ + +char 0x96 +........ +...*.... +..*.*... +.*...*.. +........ +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*....*. +..*****. +........ +........ + +char 0x97 +...*.... +....*... +.....*.. +........ +........ +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*....*. +..*****. +........ +........ + +char 0x98 +........ +........ +..*..*.. +..*..*.. +........ +*.....*. +*.....*. +.*...*.. +.*...*.. +..*.*... +..*.*... +...*.... +...*.... +..*..... +..*..... +.*...... + +char 0x99 +..*..*.. +..*..*.. +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +........ + +char 0x9a +..*..*.. +..*..*.. +........ +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +........ + +char 0x9b +........ +..*.*... +..*.*... +..*.*... +..****.. +.**.*.*. +*.*.*... +*.*.*... +*.*.*... +*.*.*... +*.*.*... +.**.*.*. +..****.. +..*.*... +..*.*... +..*.*... + +char 0x9c +........ +....**.. +...*..*. +..*..... +..*..... +..*..... +******.. +..*..... +..*..... +..*..... +.**..... +*.*..... +*.**..*. +.*..**.. +........ +........ + +char 0x9d +........ +*.....*. +*.....*. +.*...*.. +..*.*... +...*.... +*******. +...*.... +...*.... +*******. +...*.... +...*.... +...*.... +...*.... +........ +........ + +char 0x9e +........ +***..... +*..*.... +*...*... +*...*... +*...*... +*..*.*.. +***..*.. +*..***** +*....*.. +*....*.. +*....*.. +*....*.. +*....*.. +........ +........ + +char 0x9f +........ +....**.. +...*..*. +...*.... +...*.... +...*.... +*******. +...*.... +...*.... +...*.... +...*.... +...*.... +*..*.... +.**..... +........ +........ + +char 0xa0 +....**.. +....*... +...*.... +........ +........ +.****... +.....*.. +.....*.. +..****.. +.*...*.. +*....*.. +*....*.. +.*...*.. +..*****. +........ +........ + +char 0xa1 +....**.. +....*... +...*.... +........ +........ +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +........ +........ + +char 0xa2 +....**.. +....*... +...*.... +........ +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +........ + +char 0xa3 +....**.. +....*... +...*.... +........ +........ +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*....*. +..*****. +........ +........ + +char 0xa4 +........ +...*..*. +..*.*.*. +..*..*.. +........ +*****... +*....*.. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +........ +........ + +char 0xa5 +...*..*. +..*.*.*. +..*..*.. +........ +*.....*. +**....*. +**....*. +*.*...*. +*..*..*. +*..*..*. +*...*.*. +*....**. +*....**. +*.....*. +........ +........ + +char 0xa6 +........ +........ +........ +.****... +.....*.. +.....*.. +..****.. +.*...*.. +*....*.. +*....*.. +.*...*.. +..*****. +........ +*******. +........ +........ + +char 0xa7 +........ +........ +........ +..***... +.*...*.. +*.....*. +*.....*. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +*******. +........ +........ + +char 0xa8 +........ +...*.... +...*.... +........ +........ +...*.... +...*.... +..*..... +.*...*.. +*.....*. +*.....*. +*.....*. +.*...*.. +..***... +........ +........ + +char 0xa9 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +*******. +*....... +*....... +*....... +........ +........ + +char 0xaa +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +*******. +......*. +......*. +......*. +........ +........ + +char 0xab +........ +...*.... +..**.... +...*.... +...*.... +...*.... +........ +*******. +........ +.****... +.....*.. +..***... +.*...... +.*****.. +........ +........ + +char 0xac +........ +...*.... +..**.... +...*.... +...*.... +...*.... +........ +*******. +........ +...**... +..*.*... +.*..*... +.*****.. +....*... +........ +........ + +char 0xad +........ +...*.... +...*.... +........ +........ +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +........ +........ + +char 0xae +........ +........ +........ +........ +...*..*. +..*..*.. +.*..*... +*..*.... +*..*.... +.*..*... +..*..*.. +...*..*. +........ +........ +........ +........ + +char 0xaf +........ +........ +........ +........ +*..*.... +.*..*... +..*..*.. +...*..*. +...*..*. +..*..*.. +.*..*... +*..*.... +........ +........ +........ +........ + +char 0xb0 +...*...* +.*...*.. +...*...* +.*...*.. +...*...* +.*...*.. +...*...* +.*...*.. +...*...* +.*...*.. +...*...* +.*...*.. +...*...* +.*...*.. +...*...* +.*...*.. + +char 0xb1 +.*.*.*.* +*.*.*.*. +.*.*.*.* +*.*.*.*. +.*.*.*.* +*.*.*.*. +.*.*.*.* +*.*.*.*. +.*.*.*.* +*.*.*.*. +.*.*.*.* +*.*.*.*. +.*.*.*.* +*.*.*.*. +.*.*.*.* +*.*.*.*. + +char 0xb2 +.***.*** +**.***.* +.***.*** +**.***.* +.***.*** +**.***.* +.***.*** +**.***.* +.***.*** +**.***.* +.***.*** +**.***.* +.***.*** +**.***.* +.***.*** +**.***.* + +char 0xb3 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xb4 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +****.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xb5 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +****.... +...*.... +****.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xb6 +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +****.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xb7 +........ +........ +........ +........ +........ +........ +........ +******.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xb8 +........ +........ +........ +........ +........ +........ +........ +****.... +...*.... +****.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xb9 +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +****.*.. +.....*.. +****.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xba +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xbb +........ +........ +........ +........ +........ +........ +........ +******.. +.....*.. +****.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xbc +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +****.*.. +.....*.. +******.. +........ +........ +........ +........ +........ +........ + +char 0xbd +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +******.. +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xbe +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +****.... +...*.... +****.... +........ +........ +........ +........ +........ +........ + +char 0xbf +........ +........ +........ +........ +........ +........ +........ +****.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xc0 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...***** +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xc1 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +******** +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xc2 +........ +........ +........ +........ +........ +........ +........ +******** +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xc3 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...***** +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xc4 +........ +........ +........ +........ +........ +........ +........ +******** +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xc5 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +******** +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xc6 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...***** +...*.... +...***** +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xc7 +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*** +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xc8 +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*** +...*.... +...***** +........ +........ +........ +........ +........ +........ + +char 0xc9 +........ +........ +........ +........ +........ +........ +........ +...***** +...*.... +...*.*** +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xca +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +****.*** +........ +******** +........ +........ +........ +........ +........ +........ + +char 0xcb +........ +........ +........ +........ +........ +........ +........ +******** +........ +****.*** +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xcc +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*** +...*.... +...*.*** +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xcd +........ +........ +........ +........ +........ +........ +........ +******** +........ +******** +........ +........ +........ +........ +........ +........ + +char 0xce +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +****.*** +........ +****.*** +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xcf +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +******** +........ +******** +........ +........ +........ +........ +........ +........ + +char 0xd0 +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +******** +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xd1 +........ +........ +........ +........ +........ +........ +........ +******** +........ +******** +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xd2 +........ +........ +........ +........ +........ +........ +........ +******** +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xd3 +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...***** +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xd4 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...***** +...*.... +...***** +........ +........ +........ +........ +........ +........ + +char 0xd5 +........ +........ +........ +........ +........ +........ +........ +...***** +...*.... +...***** +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xd6 +........ +........ +........ +........ +........ +........ +........ +...***** +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xd7 +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +****.*** +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. +...*.*.. + +char 0xd8 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +******** +...*.... +******** +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xd9 +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +****.... +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xda +........ +........ +........ +........ +........ +........ +........ +...***** +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... +...*.... + +char 0xdb +******** +******** +******** +******** +******** +******** +******** +******** +******** +******** +******** +******** +******** +******** +******** +******** + +char 0xdc +........ +........ +........ +........ +........ +........ +........ +........ +******** +******** +******** +******** +******** +******** +******** +******** + +char 0xdd +****.... +****.... +****.... +****.... +****.... +****.... +****.... +****.... +****.... +****.... +****.... +****.... +****.... +****.... +****.... +****.... + +char 0xde +....**** +....**** +....**** +....**** +....**** +....**** +....**** +....**** +....**** +....**** +....**** +....**** +....**** +....**** +....**** +....**** + +char 0xdf +******** +******** +******** +******** +******** +******** +******** +******** +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xe0 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xe1 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xe2 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xe3 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xe4 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xe5 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xe6 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xe7 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xe8 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xe9 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xea +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xeb +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xec +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xed +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xee +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xef +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xf0 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xf1 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xf2 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xf3 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xf4 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xf5 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xf6 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xf7 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xf8 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xf9 +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xfa +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xfb +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xfc +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xfd +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xfe +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ + +char 0xff +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ +........ diff --git a/28_day/haribote/haribote.sys b/28_day/haribote/haribote.sys new file mode 100644 index 0000000000000000000000000000000000000000..e098d2b2dc72ce95ff296ef38e8f320f59a0abbd GIT binary patch literal 33331 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 + +void init_pic(void) +/* PIC初始化 */ +{ + io_out8(PIC0_IMR, 0xff ); /* 禁止所有中断 */ + io_out8(PIC1_IMR, 0xff ); /* 禁止所有中断 */ + + io_out8(PIC0_ICW1, 0x11 ); /* 边缘触发模式(edge trigger mode) */ + io_out8(PIC0_ICW2, 0x20 ); /* IRQ0-7由INT20-27接收 */ + io_out8(PIC0_ICW3, 1 << 2); /* PIC1由IRQ2相连 */ + io_out8(PIC0_ICW4, 0x01 ); /* 无缓冲区模式 */ + + io_out8(PIC1_ICW1, 0x11 ); /* 边缘触发模式(edge trigger mode) */ + io_out8(PIC1_ICW2, 0x28 ); /* IRQ8-15由INT28-2f接收 */ + io_out8(PIC1_ICW3, 2 ); /* PIC1由IRQ2连接 */ + io_out8(PIC1_ICW4, 0x01 ); /* 无缓冲区模式 */ + + io_out8(PIC0_IMR, 0xfb ); /* 11111011 PIC1以外全部禁止 */ + io_out8(PIC1_IMR, 0xff ); /* 11111111 禁止所有中断 */ + + return; +} diff --git a/28_day/haribote/ipl10.bin b/28_day/haribote/ipl10.bin new file mode 100644 index 0000000000000000000000000000000000000000..9ac675e6579d9ff288934f5c4a7cbf633f1e7076 GIT binary patch literal 512 zcmaFuH^IX($kWL`#Fc@Gk&%Jv0fPhg2Tled1||j&aNq`!n*V_Srp`ZD!Obzm&`3c+ z0VIbCb}%sXUD(4=(|2Qs0!QD0tqj{3HZtvFVA#U6fpIqj!zPBa!o>p3#~7Rcu@)O` z0rOu!?m57!z|eP~;UHtfPoc7l8yOppF*f{TDmuQ6q2VZF!(XnVy&ZZV_+JLPf{Z_~ y?@Ub>3(yQ3h7!&#e7pG>&I-JK_vQ6pF0P#X#1w_pqN4mFE>vfY^00= 5 跳转到error + MOV AH,0x00 + MOV DL,0x00 ; A驱动器 + INT 0x13 ; 重置驱动器 + JMP retry +next: + MOV AX,ES ; 把内存地址后移0x200(512/16十六进制转换) + ADD AX,0x0020 + MOV ES,AX ; ADD ES,0x020因为没有ADD ES,只能通过AX进行 + ADD CL,1 ; 往CL里面加1 + CMP CL,18 ; 比较CL与18 + JBE readloop ; CL <= 18 跳转到readloop + MOV CL,1 + ADD DH,1 + CMP DH,2 + JB readloop ; DH < 2 跳转到readloop + MOV DH,0 + ADD CH,1 + CMP CH,CYLS + JB readloop ; CH < CYLS 跳转到readloop + +; 读取完毕,跳转到haribote.sys执行! + MOV [0x0ff0],CH ; IPLがどこまで読んだのかをメモ + JMP 0xc200 + +error: + MOV SI,msg + +putloop: + MOV AL,[SI] + ADD SI,1 ; 给SI加1 + CMP AL,0 + JE fin + MOV AH,0x0e ; 显示一个文字 + MOV BX,15 ; 指定字符颜色 + INT 0x10 ; 调用显卡BIOS + JMP putloop + +fin: + HLT ; 让CPU停止,等待指令 + JMP fin ; 无限循环 + +msg: + DB 0x0a, 0x0a ; 换行两次 + DB "load error" + DB 0x0a ; 换行 + DB 0 + + RESB 0x7dfe-$ ; 填写0x00直到0x001fe + + DB 0x55, 0xaa diff --git a/28_day/haribote/keyboard.c b/28_day/haribote/keyboard.c new file mode 100644 index 0000000..eb5140a --- /dev/null +++ b/28_day/haribote/keyboard.c @@ -0,0 +1,44 @@ +/* 键盘控制代码 */ + +#include "bootpack.h" + +struct FIFO32 *keyfifo; +int keydata0; + +void inthandler21(int *esp) +{ + int data; + io_out8(PIC0_OCW2, 0x61); /* 把IRQ-01接收信号结束的信息通知给PIC */ + data = io_in8(PORT_KEYDAT); + fifo32_put(keyfifo, data + keydata0); + return; +} + +#define PORT_KEYSTA 0x0064 +#define KEYSTA_SEND_NOTREADY 0x02 +#define KEYCMD_WRITE_MODE 0x60 +#define KBC_MODE 0x47 + +void wait_KBC_sendready(void) +{ + /* 等待键盘控制电路准备完毕 */ + for (;;) { + if ((io_in8(PORT_KEYSTA) & KEYSTA_SEND_NOTREADY) == 0) { + break; + } + } + return; +} + +void init_keyboard(struct FIFO32 *fifo, int data0) +{ + /* 将FIFO缓冲区的信息保存到全局变量里 */ + keyfifo = fifo; + keydata0 = data0; + /* 键盘控制器的初始化 */ + wait_KBC_sendready(); + io_out8(PORT_KEYCMD, KEYCMD_WRITE_MODE); + wait_KBC_sendready(); + io_out8(PORT_KEYDAT, KBC_MODE); + return; +} diff --git a/28_day/haribote/make.bat b/28_day/haribote/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/haribote/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/haribote/memory.c b/28_day/haribote/memory.c new file mode 100644 index 0000000..54a447a --- /dev/null +++ b/28_day/haribote/memory.c @@ -0,0 +1,162 @@ +/* �������֌W */ + +#include "bootpack.h" + +#define EFLAGS_AC_BIT 0x00040000 +#define CR0_CACHE_DISABLE 0x60000000 + +unsigned int memtest(unsigned int start, unsigned int end) +{ + char flg486 = 0; + unsigned int eflg, cr0, i; + + /* 确认CPU是386还是486以上的 */ + eflg = io_load_eflags(); + eflg |= EFLAGS_AC_BIT; /* AC-bit = 1 */ + io_store_eflags(eflg); + eflg = io_load_eflags(); + if ((eflg & EFLAGS_AC_BIT) != 0) { + /* 如果是386,即使设定AC=1,AC的值还会自动回到0 */ + flg486 = 1; + } + + eflg &= ~EFLAGS_AC_BIT; /* AC-bit = 0 */ + io_store_eflags(eflg); + + if (flg486 != 0) { + cr0 = load_cr0(); + cr0 |= CR0_CACHE_DISABLE; /* 禁止缓存 */ + store_cr0(cr0); + } + + i = memtest_sub(start, end); + + if (flg486 != 0) { + cr0 = load_cr0(); + cr0 &= ~CR0_CACHE_DISABLE; /* 允许缓存 */ + store_cr0(cr0); + } + + return i; +} + +void memman_init(struct MEMMAN *man) +{ + man->frees = 0; /* 可用信息数目 */ + man->maxfrees = 0; /* 用于观察可用状况:frees的最大值 */ + man->lostsize = 0; /* 释放失败的内存的大小总和 */ + man->losts = 0; /* 释放失败次数 */ + return; +} + +unsigned int memman_total(struct MEMMAN *man) +/* 报告空余内存大小的合计 */ +{ + unsigned int i, t = 0; + for (i = 0; i < man->frees; i++) { + t += man->free[i].size; + } + return t; +} + +unsigned int memman_alloc(struct MEMMAN *man, unsigned int size) +/* 分配 */ +{ + unsigned int i, a; + for (i = 0; i < man->frees; i++) { + if (man->free[i].size >= size) { + /* 找到了足够大的内存 */ + a = man->free[i].addr; + man->free[i].addr += size; + man->free[i].size -= size; + if (man->free[i].size == 0) { + /* 如果free[i]变成了0,就减掉一条可用信息 */ + man->frees--; + for (; i < man->frees; i++) { + man->free[i] = man->free[i + 1]; /* 代入结构体 */ + } + } + return a; + } + } + return 0; /* 没有可用空间 */ +} + +int memman_free(struct MEMMAN *man, unsigned int addr, unsigned int size) +/* 释放 */ +{ + int i, j; + /* 为便于归纳内存,将free[]按照addr的顺序排列 */ + /* 所以,先决定应该放在哪里 */ + for (i = 0; i < man->frees; i++) { + if (man->free[i].addr > addr) { + break; + } + } + /* free[i - 1].addr < addr < free[i].addr */ + if (i > 0) { + /* 前面有可用内存 */ + if (man->free[i - 1].addr + man->free[i - 1].size == addr) { + /* 可以与前面的可用内存归纳到一起 */ + man->free[i - 1].size += size; + if (i < man->frees) { + /* 后面也有 */ + if (addr + size == man->free[i].addr) { + /* 也可以与后面的可用内存归纳到一起 */ + man->free[i - 1].size += man->free[i].size; + /* man->free[i]删除 */ + /* free[i]变成0后归纳到前面去 */ + man->frees--; + for (; i < man->frees; i++) { + man->free[i] = man->free[i + 1]; /* 结构体赋值 */ + } + } + } + return 0; /* 成功完成 */ + } + } + /* 不能与前面的可用空间归纳到一起 */ + if (i < man->frees) { + /* 后面还有 */ + if (addr + size == man->free[i].addr) { + /* 可以与后面的内容归纳到一起 */ + man->free[i].addr = addr; + man->free[i].size += size; + return 0; /* 成功完成 */ + } + } + /* 既不能与前面归纳到一起,也不能与后面归纳到一起 */ + if (man->frees < MEMMAN_FREES) { + /* free[i]之后的,向后移动,腾出一点可用空间 */ + for (j = man->frees; j > i; j--) { + man->free[j] = man->free[j - 1]; + } + man->frees++; + if (man->maxfrees < man->frees) { + man->maxfrees = man->frees; /* 更新最大值 */ + } + man->free[i].addr = addr; + man->free[i].size = size; + return 0; /* 成功完成 */ + } + /* 不能往后移动 */ + man->losts++; + man->lostsize += size; + return -1; /* 失败 */ +} + +unsigned int memman_alloc_4k(struct MEMMAN *man, unsigned int size) +{ + unsigned int a; + size = (size + 0xfff) & 0xfffff000; + a = memman_alloc(man, size); + return a; +} + +int memman_free_4k(struct MEMMAN *man, unsigned int addr, unsigned int size) +{ + int i; + size = (size + 0xfff) & 0xfffff000; + i = memman_free(man, addr, size); + return i; +} diff --git a/28_day/haribote/mouse.c b/28_day/haribote/mouse.c new file mode 100644 index 0000000..0c6403e --- /dev/null +++ b/28_day/haribote/mouse.c @@ -0,0 +1,76 @@ +/* 鼠标控制代码 */ + +#include "bootpack.h" + +struct FIFO32 *mousefifo; +int mousedata0; + +void inthandler2c(int *esp) +/* 来自PS/2鼠标的中断 */ +{ + int data; + io_out8(PIC1_OCW2, 0x64); /* 把IRQ-12接收信号结束的信息通知给PIC1 */ + io_out8(PIC0_OCW2, 0x62); /* 把IRQ-02接收信号结束的信息通知给PIC0 */ + data = io_in8(PORT_KEYDAT); + fifo32_put(mousefifo, data + mousedata0); + return; +} + +#define KEYCMD_SENDTO_MOUSE 0xd4 +#define MOUSECMD_ENABLE 0xf4 + +void enable_mouse(struct FIFO32 *fifo, int data0, struct MOUSE_DEC *mdec) +{ + /* 将FIFO缓冲区的信息保存到全局变量里 */ + mousefifo = fifo; + mousedata0 = data0; + /* 鼠标有效 */ + wait_KBC_sendready(); + io_out8(PORT_KEYCMD, KEYCMD_SENDTO_MOUSE); + wait_KBC_sendready(); + io_out8(PORT_KEYDAT, MOUSECMD_ENABLE); + /* 顺利的话,ACK(0xfa)会被发送*/ + mdec->phase = 0; /* 等待鼠标的0xfa的阶段*/ +return; +} + +int mouse_decode(struct MOUSE_DEC *mdec, unsigned char dat) +{ + if (mdec->phase == 0) { + /* 等待鼠标的0xfa的阶段 */ + if (dat == 0xfa) { + mdec->phase = 1; + } + return 0; + } + if (mdec->phase == 1) { + /* 等待鼠标第一字节的阶段 */ + mdec->buf[0] = dat; + mdec->phase = 2; + return 0; + } + if (mdec->phase == 2) { + /* 等待鼠标第二字节的阶段 */ + mdec->buf[1] = dat; + mdec->phase = 3; + return 0; + } + if (mdec->phase == 3) { + /* 等待鼠标第二字节的阶段 */ + mdec->buf[2] = dat; + mdec->phase = 1; + mdec->btn = mdec->buf[0] & 0x07; + mdec->x = mdec->buf[1]; + mdec->y = mdec->buf[2]; + if ((mdec->buf[0] & 0x10) != 0) { + mdec->x |= 0xffffff00; + } + if ((mdec->buf[0] & 0x20) != 0) { + mdec->y |= 0xffffff00; + } + mdec->y = - mdec->y; /* 鼠标的y方向与画面符号相反 */ + return 1; + } + /* 应该不可能到这里来 */ + return -1; +} diff --git a/28_day/haribote/mtask.c b/28_day/haribote/mtask.c new file mode 100644 index 0000000..f67b935 --- /dev/null +++ b/28_day/haribote/mtask.c @@ -0,0 +1,203 @@ +/* 多任务管理 */ + +#include "bootpack.h" + +struct TASKCTL *taskctl; +struct TIMER *task_timer; + +struct TASK *task_now(void) +{ + struct TASKLEVEL *tl = &taskctl->level[taskctl->now_lv]; + return tl->tasks[tl->now]; +} + +void task_add(struct TASK *task) +{ + struct TASKLEVEL *tl = &taskctl->level[task->level]; + tl->tasks[tl->running] = task; + tl->running++; + task->flags = 2; /*活动中*/ + return; +} + +void task_remove(struct TASK *task) +{ + int i; + struct TASKLEVEL *tl = &taskctl->level[task->level]; + + /*寻找task所在的位置*/ + for (i = 0; i < tl->running; i++) { + if (tl->tasks[i] == task) { + /*在这里 */ + break; + } + } + + tl->running--; + if (i < tl->now) { + tl->now--; /*需要移动成员,要相应地处理 */ + } + if (tl->now >= tl->running) { + /*如果now的值出现异常,则进行修正*/ + tl->now = 0; + } + task->flags = 1; /* 休眠中 */ + + /* 移动 */ + for (; i < tl->running; i++) { + tl->tasks[i] = tl->tasks[i + 1]; + } + return; +} + +void task_switchsub(void) +{ + int i; + /*寻找最上层的LEVEL */ + for (i = 0; i < MAX_TASKLEVELS; i++) { + if (taskctl->level[i].running > 0) { + break; /*找到了*/ + } + } + taskctl->now_lv = i; + taskctl->lv_change = 0; + return; +} + +void task_idle(void) +{ + for (;;) { + io_hlt(); + } +} + +struct TASK *task_init(struct MEMMAN *memman) +{ + int i; + struct TASK *task, *idle; + struct SEGMENT_DESCRIPTOR *gdt = (struct SEGMENT_DESCRIPTOR *) ADR_GDT; + + + taskctl = (struct TASKCTL *) memman_alloc_4k(memman, sizeof (struct TASKCTL)); + for (i = 0; i < MAX_TASKS; i++) { + taskctl->tasks0[i].flags = 0; + taskctl->tasks0[i].sel = (TASK_GDT0 + i) * 8; + taskctl->tasks0[i].tss.ldtr = (TASK_GDT0 + MAX_TASKS + i) * 8; + set_segmdesc(gdt + TASK_GDT0 + i, 103, (int) &taskctl->tasks0[i].tss, AR_TSS32); + set_segmdesc(gdt + TASK_GDT0 + MAX_TASKS + i, 15, (int) taskctl->tasks0[i].ldt, AR_LDT); + } + for (i = 0; i < MAX_TASKLEVELS; i++) { + taskctl->level[i].running = 0; + taskctl->level[i].now = 0; + } + + task = task_alloc(); + task->flags = 2; /*活动中标志*/ + task->priority = 2; /* 0.02秒*/ + task->level = 0; /*最高LEVEL */ + task_add(task); + task_switchsub(); /* LEVEL 设置*/ + load_tr(task->sel); + task_timer = timer_alloc(); + timer_settime(task_timer, task->priority); + + idle = task_alloc(); + idle->tss.esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024; + idle->tss.eip = (int) &task_idle; + idle->tss.es = 1 * 8; + idle->tss.cs = 2 * 8; + idle->tss.ss = 1 * 8; + idle->tss.ds = 1 * 8; + idle->tss.fs = 1 * 8; + idle->tss.gs = 1 * 8; + task_run(idle, MAX_TASKLEVELS - 1, 1); + + return task; +} + +struct TASK *task_alloc(void) +{ + int i; + struct TASK *task; + for (i = 0; i < MAX_TASKS; i++) { + if (taskctl->tasks0[i].flags == 0) { + task = &taskctl->tasks0[i]; + task->flags = 1; /*正在使用的标志*/ + task->tss.eflags = 0x00000202; /* IF = 1; */ + task->tss.eax = 0; /*这里先置为0*/ + task->tss.ecx = 0; + task->tss.edx = 0; + task->tss.ebx = 0; + task->tss.ebp = 0; + task->tss.esi = 0; + task->tss.edi = 0; + task->tss.es = 0; + task->tss.ds = 0; + task->tss.fs = 0; + task->tss.gs = 0; + task->tss.iomap = 0x40000000; + task->tss.ss0 = 0; + return task; + } + } + return 0; /*全部正在使用*/ +} + +void task_run(struct TASK *task, int level, int priority) +{ + if (level < 0) { + level = task->level; /*不改变LEVEL */ + } + if (priority > 0) { + task->priority = priority; + } + if (task->flags == 2 && task->level != level) { + /*改变活动中的LEVEL */ + task_remove(task); /*这里执行之后flag的值会变为1,于是下面的if语句块也会被执行*/ + } + if (task->flags != 2) { + /*从休眠状态唤醒的情形*/ + task->level = level; + task_add(task); + } + taskctl->lv_change = 1; /*下次任务切换时检查LEVEL */ + return; +} + +void task_sleep(struct TASK *task) +{ + struct TASK *now_task; + if (task->flags == 2) { + /*如果处于活动状态*/ + now_task = task_now(); + task_remove(task); /*执行此语句的话flags将变为1 */ + if (task == now_task) { + /*如果是让自己休眠,则需要进行任务切换*/ + task_switchsub(); + now_task = task_now(); /*在设定后获取当前任务的值*/ + farjmp(0, now_task->sel); + } + } + return; +} + + +void task_switch(void) +{ + struct TASKLEVEL *tl = &taskctl->level[taskctl->now_lv]; + struct TASK *new_task, *now_task = tl->tasks[tl->now]; + tl->now++; + if (tl->now == tl->running) { + tl->now = 0; + } + if (taskctl->lv_change != 0) { + task_switchsub(); + tl = &taskctl->level[taskctl->now_lv]; + } + new_task = tl->tasks[tl->now]; + timer_settime(task_timer, new_task->priority); + if (new_task != now_task) { + farjmp(0, new_task->sel); + } + return; +} diff --git a/28_day/haribote/naskfunc.nas b/28_day/haribote/naskfunc.nas new file mode 100644 index 0000000..a45775d --- /dev/null +++ b/28_day/haribote/naskfunc.nas @@ -0,0 +1,291 @@ +; naskfunc +; TAB=4 + +[FORMAT "WCOFF"] ; 制作目标文件的模式 +[INSTRSET "i486p"] ; 使用到486为止的指令 +[BITS 32] ; 3制作32位模式用的机器语言 +[FILE "naskfunc.nas"] ; 文件名 + + GLOBAL _io_hlt, _io_cli, _io_sti, _io_stihlt + GLOBAL _io_in8, _io_in16, _io_in32 + GLOBAL _io_out8, _io_out16, _io_out32 + GLOBAL _io_load_eflags, _io_store_eflags + GLOBAL _load_gdtr, _load_idtr + GLOBAL _load_cr0, _store_cr0 + GLOBAL _load_tr + GLOBAL _asm_inthandler20, _asm_inthandler21 + GLOBAL _asm_inthandler2c, _asm_inthandler0c + GLOBAL _asm_inthandler0d, _asm_end_app + GLOBAL _memtest_sub + GLOBAL _farjmp, _farcall + GLOBAL _asm_hrb_api, _start_app + EXTERN _inthandler20, _inthandler21 + EXTERN _inthandler2c, _inthandler0d + EXTERN _inthandler0c + EXTERN _hrb_api + +[SECTION .text] + +_io_hlt: ; void io_hlt(void); + HLT + RET + +_io_cli: ; void io_cli(void); + CLI + RET + +_io_sti: ; void io_sti(void); + STI + RET + +_io_stihlt: ; void io_stihlt(void); + STI + HLT + RET + +_io_in8: ; int io_in8(int port); + MOV EDX,[ESP+4] ; port + MOV EAX,0 + IN AL,DX + RET + +_io_in16: ; int io_in16(int port); + MOV EDX,[ESP+4] ; port + MOV EAX,0 + IN AX,DX + RET + +_io_in32: ; int io_in32(int port); + MOV EDX,[ESP+4] ; port + IN EAX,DX + RET + +_io_out8: ; void io_out8(int port, int data); + MOV EDX,[ESP+4] ; port + MOV AL,[ESP+8] ; data + OUT DX,AL + RET + +_io_out16: ; void io_out16(int port, int data); + MOV EDX,[ESP+4] ; port + MOV EAX,[ESP+8] ; data + OUT DX,AX + RET + +_io_out32: ; void io_out32(int port, int data); + MOV EDX,[ESP+4] ; port + MOV EAX,[ESP+8] ; data + OUT DX,EAX + RET + +_io_load_eflags: ; int io_load_eflags(void); + PUSHFD ; PUSH EFLAGS + POP EAX + RET + +_io_store_eflags: ; void io_store_eflags(int eflags); + MOV EAX,[ESP+4] + PUSH EAX + POPFD ; POP EFLAGS + RET + +_load_gdtr: ; void load_gdtr(int limit, int addr); + MOV AX,[ESP+4] ; limit + MOV [ESP+6],AX + LGDT [ESP+6] + RET + +_load_idtr: ; void load_idtr(int limit, int addr); + MOV AX,[ESP+4] ; limit + MOV [ESP+6],AX + LIDT [ESP+6] + RET + +_load_cr0: ; int load_cr0(void); + MOV EAX,CR0 + RET + +_store_cr0: ; void store_cr0(int cr0); + MOV EAX,[ESP+4] + MOV CR0,EAX + RET + +_load_tr: ; void load_tr(int tr); + LTR [ESP+4] ; tr + RET + +_asm_inthandler20: + PUSH ES + PUSH DS + PUSHAD + MOV EAX,ESP + PUSH EAX + MOV AX,SS + MOV DS,AX + MOV ES,AX + CALL _inthandler20 + POP EAX + POPAD + POP DS + POP ES + IRETD + +_asm_inthandler21: + PUSH ES + PUSH DS + PUSHAD + MOV EAX,ESP + PUSH EAX + MOV AX,SS + MOV DS,AX + MOV ES,AX + CALL _inthandler21 + POP EAX + POPAD + POP DS + POP ES + IRETD + +_asm_inthandler2c: + PUSH ES + PUSH DS + PUSHAD + MOV EAX,ESP + PUSH EAX + MOV AX,SS + MOV DS,AX + MOV ES,AX + CALL _inthandler2c + POP EAX + POPAD + POP DS + POP ES + IRETD + +_asm_inthandler0c: + STI + PUSH ES + PUSH DS + PUSHAD + MOV EAX,ESP + PUSH EAX + MOV AX,SS + MOV DS,AX + MOV ES,AX + CALL _inthandler0c + CMP EAX,0 + JNE _asm_end_app + POP EAX + POPAD + POP DS + POP ES + ADD ESP,4 ; 在INT 0x0c中也需要这句 + IRETD + +_asm_inthandler0d: + STI + PUSH ES + PUSH DS + PUSHAD + MOV EAX,ESP + PUSH EAX + MOV AX,SS + MOV DS,AX + MOV ES,AX + CALL _inthandler0d + CMP EAX,0 + JNE _asm_end_app + POP EAX + POPAD + POP DS + POP ES + ADD ESP,4 ; INT 0x0d需要这句 + IRETD + +_memtest_sub: ; unsigned int memtest_sub(unsigned int start, unsigned int end) + PUSH EDI ; (由于还要使用EBX, ESI, EDI) + PUSH ESI + PUSH EBX + MOV ESI,0xaa55aa55 ; pat0 = 0xaa55aa55; + MOV EDI,0x55aa55aa ; pat1 = 0x55aa55aa; + MOV EAX,[ESP+12+4] ; i = start; +mts_loop: + MOV EBX,EAX + ADD EBX,0xffc ; p = i + 0xffc; + MOV EDX,[EBX] ; old = *p; + MOV [EBX],ESI ; *p = pat0; + XOR DWORD [EBX],0xffffffff ; *p ^= 0xffffffff; + CMP EDI,[EBX] ; if (*p != pat1) goto fin; + JNE mts_fin + XOR DWORD [EBX],0xffffffff ; *p ^= 0xffffffff; + CMP ESI,[EBX] ; if (*p != pat0) goto fin; + JNE mts_fin + MOV [EBX],EDX ; *p = old; + ADD EAX,0x1000 ; i += 0x1000; + CMP EAX,[ESP+12+8] ; if (i <= end) goto mts_loop; + JBE mts_loop + POP EBX + POP ESI + POP EDI + RET +mts_fin: + MOV [EBX],EDX ; *p = old; + POP EBX + POP ESI + POP EDI + RET + +_farjmp: ; void farjmp(int eip, int cs); + JMP FAR [ESP+4] ; eip, cs + RET + +_farcall: ; void farcall(int eip, int cs); + CALL FAR [ESP+4] ; eip, cs + RET + +_asm_hrb_api: + STI + PUSH DS + PUSH ES + PUSHAD ; 用于保存的PUSH + PUSHAD ; 用于向hrb_api传值的PUSH + MOV AX,SS + MOV DS,AX ; 将操作系统用段地址存入DS和ES + MOV ES,AX + CALL _hrb_api + CMP EAX,0 ; 当EAX不为0时程序结束 + JNE _asm_end_app + ADD ESP,32 + POPAD + POP ES + POP DS + IRETD +_asm_end_app: +; EAX为tss.esp0的地址 + MOV ESP,[EAX] + MOV DWORD [EAX+4],0 + POPAD + RET ; 返回cmd_app + +_start_app: ; void start_app(int eip, int cs, int esp, int ds, int *tss_esp0); + PUSHAD ; 将32位寄存器的值全部保存起来 + MOV EAX,[ESP+36] ; 应用程序用EIP + MOV ECX,[ESP+40] ; 应用程序用CS + MOV EDX,[ESP+44] ; 应用程序用ESP + MOV EBX,[ESP+48] ; 应用程序用DS/SS + MOV EBP,[ESP+52] ; tss.esp0的地址 + MOV [EBP ],ESP ; 保存操作系统用ESP + MOV [EBP+4],SS ; 保存操作系统用SS + MOV ES,BX + MOV DS,BX + MOV FS,BX + MOV GS,BX +; 下面调整栈,以免用RETF跳转到应用程序 + OR ECX,3 ; 将应用程序用段号和3进行OR运算 + OR EBX,3 ; 将应用程序用段号和3进行OR运算 + PUSH EBX ; 应用程序的SS + PUSH EDX ; 应用程序的ESP + PUSH ECX ; 应用程序的CS + PUSH EAX ; 应用程序的EIP + RETF +; 应用程序结束后不会回到这里 diff --git a/28_day/haribote/sheet.c b/28_day/haribote/sheet.c new file mode 100644 index 0000000..14aa0ea --- /dev/null +++ b/28_day/haribote/sheet.c @@ -0,0 +1,294 @@ +/* sheet */ + +#include "bootpack.h" + +#define SHEET_USE 1 + +struct SHTCTL *shtctl_init(struct MEMMAN *memman, unsigned char *vram, int xsize, int ysize) +{ + struct SHTCTL *ctl; + int i; + ctl = (struct SHTCTL *) memman_alloc_4k(memman, sizeof (struct SHTCTL)); + if (ctl == 0) { + goto err; + } + ctl->map = (unsigned char *) memman_alloc_4k(memman, xsize * ysize); + if (ctl->map == 0) { + memman_free_4k(memman, (int) ctl, sizeof (struct SHTCTL)); + goto err; + } + ctl->vram = vram; + ctl->xsize = xsize; + ctl->ysize = ysize; + ctl->top = -1; /* 没有一张SHEET */ + for (i = 0; i < MAX_SHEETS; i++) { + ctl->sheets0[i].flags = 0; /* 标记为未使用 */ + ctl->sheets0[i].ctl = ctl; /* 记录所属*/ + } +err: + return ctl; +} + +struct SHEET *sheet_alloc(struct SHTCTL *ctl) +{ + struct SHEET *sht; + int i; + for (i = 0; i < MAX_SHEETS; i++) { + if (ctl->sheets0[i].flags == 0) { + sht = &ctl->sheets0[i]; + sht->flags = SHEET_USE; /* 标记为正在使用*/ + sht->height = -1; /* 隐藏 */ + sht->task = 0; /*不使用自动关闭功能*/ + return sht; + } + } + return 0; /* 所有的SHEET都处于正在使用状态*/ +} + +void sheet_setbuf(struct SHEET *sht, unsigned char *buf, int xsize, int ysize, int col_inv) +{ + sht->buf = buf; + sht->bxsize = xsize; + sht->bysize = ysize; + sht->col_inv = col_inv; + return; +} + +void sheet_refreshmap(struct SHTCTL *ctl, int vx0, int vy0, int vx1, int vy1, int h0) +{ + int h, bx, by, vx, vy, bx0, by0, bx1, by1, sid4, *p;; + unsigned char *buf, sid, *map = ctl->map; + struct SHEET *sht; + if (vx0 < 0) { vx0 = 0; } + if (vy0 < 0) { vy0 = 0; } + if (vx1 > ctl->xsize) { vx1 = ctl->xsize; } + if (vy1 > ctl->ysize) { vy1 = ctl->ysize; } + for (h = h0; h <= ctl->top; h++) { + sht = ctl->sheets[h]; + sid = sht - ctl->sheets0; /* 将进行了减法计算的地址作为图层号码使用 */ + buf = sht->buf; + bx0 = vx0 - sht->vx0; + by0 = vy0 - sht->vy0; + bx1 = vx1 - sht->vx0; + by1 = vy1 - sht->vy0; + if (bx0 < 0) { bx0 = 0; } + if (by0 < 0) { by0 = 0; } + if (bx1 > sht->bxsize) { bx1 = sht->bxsize; } + if (by1 > sht->bysize) { by1 = sht->bysize; } + if (sht->col_inv == -1) { + if ((sht->vx0 & 3) == 0 && (bx0 & 3) == 0 && (bx1 & 3) == 0) { + /*无透明色图层专用的高速版(4字节型)*/ + bx1 = (bx1 - bx0) / 4; /* MOV次数*/ + sid4 = sid | sid << 8 | sid << 16 | sid << 24; + for (by = by0; by < by1; by++) { + vy = sht->vy0 + by; + vx = sht->vx0 + bx0; + p = (int *) &map[vy * ctl->xsize + vx]; + for (bx = 0; bx < bx1; bx++) { + p[bx] = sid4; + } + } + } else { + /*无透明色图层专用的高速版(1字节型)*/ + for (by = by0; by < by1; by++) { + vy = sht->vy0 + by; + for (bx = bx0; bx < bx1; bx++) { + vx = sht->vx0 + bx; + map[vy * ctl->xsize + vx] = sid; + } + } + } + } else { + /*有透明色图层用的普通版*/ + for (by = by0; by < by1; by++) { + vy = sht->vy0 + by; + for (bx = bx0; bx < bx1; bx++) { + vx = sht->vx0 + bx; + if (buf[by * sht->bxsize + bx] != sht->col_inv) { + map[vy * ctl->xsize + vx] = sid; + } + } + } + } + } + return; +} + +void sheet_refreshsub(struct SHTCTL *ctl, int vx0, int vy0, int vx1, int vy1, int h0, int h1) +{ + int h, bx, by, vx, vy, bx0, by0, bx1, by1, bx2, sid4, i, i1, *p, *q, *r; + unsigned char *buf, *vram = ctl->vram, *map = ctl->map, sid; + struct SHEET *sht; + + /* 如果refresh的范围超出了画面则修正 */ + if (vx0 < 0) { vx0 = 0; } + if (vy0 < 0) { vy0 = 0; } + if (vx1 > ctl->xsize) { vx1 = ctl->xsize; } + if (vy1 > ctl->ysize) { vy1 = ctl->ysize; } + for (h = h0; h <= h1; h++) { + sht = ctl->sheets[h]; + buf = sht->buf; + sid = sht - ctl->sheets0; + + /* 使用vx0~vy1,对bx0~by1进行倒推 */ + bx0 = vx0 - sht->vx0; + by0 = vy0 - sht->vy0; + bx1 = vx1 - sht->vx0; + by1 = vy1 - sht->vy0; + if (bx0 < 0) { bx0 = 0; } /* 处理刷新范围在图层外侧 */ + if (by0 < 0) { by0 = 0; } + if (bx1 > sht->bxsize) { bx1 = sht->bxsize; } /* 应对不同的重叠方式 */ + if (by1 > sht->bysize) { by1 = sht->bysize; } + if ((sht->vx0 & 3) == 0) { + /* 4字节型*/ + i = (bx0 + 3) / 4; /* bx0除以4(小数进位)*/ + i1 = bx1 / 4; /* bx1除以4(小数舍去)*/ + i1 = i1 - i; + sid4 = sid | sid << 8 | sid << 16 | sid << 24; + for (by = by0; by < by1; by++) { + vy = sht->vy0 + by; + for (bx = bx0; bx < bx1 && (bx & 3) != 0; bx++) { + /*前面被4除多余的部分逐个字节写入*/ + vx = sht->vx0 + bx; + if (map[vy * ctl->xsize + vx] == sid) { + vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx]; + } + } + vx = sht->vx0 + bx; + p = (int *) &map[vy * ctl->xsize + vx]; + q = (int *) &vram[vy * ctl->xsize + vx]; + r = (int *) &buf[by * sht->bxsize + bx]; + for (i = 0; i < i1; i++) { + /* 4的倍数部分*/ + if (p[i] == sid4) { + q[i] = r[i]; /*估计大多数会是这种情况,因此速度会变快*/ + } else { + bx2 = bx + i * 4; + vx = sht->vx0 + bx2; + if (map[vy * ctl->xsize + vx + 0] == sid) { + vram[vy * ctl->xsize + vx + 0] = buf[by * sht->bxsize + bx2 + 0]; + } + if (map[vy * ctl->xsize + vx + 1] == sid) { + vram[vy * ctl->xsize + vx + 1] = buf[by * sht->bxsize + bx2 + 1]; + } + if (map[vy * ctl->xsize + vx + 2] == sid) { + vram[vy * ctl->xsize + vx + 2] = buf[by * sht->bxsize + bx2 + 2]; + } + if (map[vy * ctl->xsize + vx + 3] == sid) { + vram[vy * ctl->xsize + vx + 3] = buf[by * sht->bxsize + bx2 + 3]; + } + } + } + for (bx += i1 * 4; bx < bx1; bx++) { + /*后面被4除多余的部分逐个字节写入*/ + vx = sht->vx0 + bx; + if (map[vy * ctl->xsize + vx] == sid) { + vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx]; + } + } + } + } else { + /* 1字节型*/ + for (by = by0; by < by1; by++) { + vy = sht->vy0 + by; + for (bx = bx0; bx < bx1; bx++) { + vx = sht->vx0 + bx; + if (map[vy * ctl->xsize + vx] == sid) { + vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx]; + } + } + } + } + } + return; +} + +void sheet_updown(struct SHEET *sht, int height) +{ + struct SHTCTL *ctl = sht->ctl; + int h, old = sht->height; /* 存储设置前的高度信息 */ + if (height > ctl->top + 1) { + height = ctl->top + 1; + } + if (height < -1) { + height = -1; + } + sht->height = height;/* 设定高度 */ + + /* 下面主要是进行sheets[]的重新排列 */ + if (old > height) { /* 比以前低 */ + if (height >= 0) { + /* 把中间的往上提 */ + for (h = old; h > height; h--) { + ctl->sheets[h] = ctl->sheets[h - 1]; + ctl->sheets[h]->height = h; + } + ctl->sheets[height] = sht; + sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1); + sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1, old); + } else { /* 隐藏 */ + if (ctl->top > old) { + /* 把上面的降下来 */ + for (h = old; h < ctl->top; h++) { + ctl->sheets[h] = ctl->sheets[h + 1]; + ctl->sheets[h]->height = h; + } + } + ctl->top--; /* 由于显示中的图层减少了一个,所以最上面的图层高度下降 */ + sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0); + sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1); + } + } else if (old < height) { /* 比以前高 */ + if (old >= 0) { + /* 把中间的拉下去 */ + for (h = old; h < height; h++) { + ctl->sheets[h] = ctl->sheets[h + 1]; + ctl->sheets[h]->height = h; + } + ctl->sheets[height] = sht; + } else { /* 由隐藏状态转为显示状态 */ + /* 将已在上面的提上来 */ + for (h = ctl->top; h >= height; h--) { + ctl->sheets[h + 1] = ctl->sheets[h]; + ctl->sheets[h + 1]->height = h + 1; + } + ctl->sheets[height] = sht; + ctl->top++; /* 由于已显示的图层增加了1个,所以最上面的图层高度增加 */ + } + sheet_refreshmap(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height); + sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height); /* 按新图层信息重新绘制画面 */ + } + return; +} + +void sheet_refresh(struct SHEET *sht, int bx0, int by0, int bx1, int by1) +{ + if (sht->height >= 0) { /* 如果正在显示,则按新图层的信息刷新画面*/ + sheet_refreshsub(sht->ctl, sht->vx0 + bx0, sht->vy0 + by0, sht->vx0 + bx1, sht->vy0 + by1, sht->height, sht->height); + } + return; +} + +void sheet_slide(struct SHEET *sht, int vx0, int vy0) +{ + struct SHTCTL *ctl = sht->ctl; + int old_vx0 = sht->vx0, old_vy0 = sht->vy0; + sht->vx0 = vx0; + sht->vy0 = vy0; + if (sht->height >= 0) { /* 如果正在显示,则按新图层的信息刷新画面 */ + sheet_refreshmap(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0); + sheet_refreshmap(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height); + sheet_refreshsub(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0, sht->height - 1); + sheet_refreshsub(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height, sht->height); + } + return; +} + +void sheet_free(struct SHEET *sht) +{ + if (sht->height >= 0) { + sheet_updown(sht, -1); /* 如果处于显示状态,则先设定为隐藏 */ + } + sht->flags = 0; /* "未使用"标志 */ + return; +} diff --git a/28_day/haribote/timer.c b/28_day/haribote/timer.c new file mode 100644 index 0000000..9018ac8 --- /dev/null +++ b/28_day/haribote/timer.c @@ -0,0 +1,169 @@ +/* 定时器 */ + +#include "bootpack.h" + +#define PIT_CTRL 0x0043 +#define PIT_CNT0 0x0040 + +struct TIMERCTL timerctl; + +#define TIMER_FLAGS_ALLOC 1 /* 已配置状态 */ +#define TIMER_FLAGS_USING 2 /* 定时器运行中 */ + +void init_pit(void) +{ + int i; + struct TIMER *t; + io_out8(PIT_CTRL, 0x34); + io_out8(PIT_CNT0, 0x9c); + io_out8(PIT_CNT0, 0x2e); + timerctl.count = 0; + for (i = 0; i < MAX_TIMER; i++) { + timerctl.timers0[i].flags = 0; /* 没有使用 */ + } + t = timer_alloc(); /* 取得一个 */ + t->timeout = 0xffffffff; + t->flags = TIMER_FLAGS_USING; + t->next = 0; /* 末尾 */ + timerctl.t0 = t; /* 因为现在只有哨兵,所以他就在最前面*/ + timerctl.next = 0xffffffff; /* 因为只有哨兵,所以下一个超时时刻就是哨兵的时刻 */ + return; +} + +struct TIMER *timer_alloc(void) +{ + int i; + for (i = 0; i < MAX_TIMER; i++) { + if (timerctl.timers0[i].flags == 0) { + timerctl.timers0[i].flags = TIMER_FLAGS_ALLOC; + timerctl.timers0[i].flags2 = 0; + return &timerctl.timers0[i]; + } + } + return 0; /* 没找到 */ +} + +void timer_free(struct TIMER *timer) +{ + timer->flags = 0; /* 未使用 */ + return; +} + +void timer_init(struct TIMER *timer, struct FIFO32 *fifo, int data) +{ + timer->fifo = fifo; + timer->data = data; + return; +} + +void timer_settime(struct TIMER *timer, unsigned int timeout) +{ + int e; + struct TIMER *t, *s; + timer->timeout = timeout + timerctl.count; + timer->flags = TIMER_FLAGS_USING; + e = io_load_eflags(); + io_cli(); + t = timerctl.t0; + if (timer->timeout <= t->timeout) { + /* 插入最前面的情况 */ + timerctl.t0 = timer; + timer->next = t; /* 下面是设定t */ + timerctl.next = timer->timeout; + io_store_eflags(e); + return; + } + for (;;) { + s = t; + t = t->next; + if (timer->timeout <= t->timeout) { + /* 插入s和t之间的情况 */ + s->next = timer; /* s下一个是timer */ + timer->next = t; /* timer的下一个是t */ + io_store_eflags(e); + return; + } + } +} + +void inthandler20(int *esp) +{ + struct TIMER *timer; + char ts = 0; + io_out8(PIC0_OCW2, 0x60); /* 把IRQ-00接收信号结束的信息通知给PIC */ + timerctl.count++; + if (timerctl.next > timerctl.count) { + return; + } + timer = timerctl.t0; /* 首先把最前面的地址赋给timer */ + for (;;) { + /* 因为timers的定时器都处于运行状态,所以不确认flags */ + if (timer->timeout > timerctl.count) { + break; + } + /* 超时 */ + timer->flags = TIMER_FLAGS_ALLOC; + if (timer != task_timer) { + fifo32_put(timer->fifo, timer->data); + } else { + ts = 1; /* mt_timer超时*/ + } + timer = timer->next; /* 将下一个定时器的地址赋给timer*/ + } + timerctl.t0 = timer; + timerctl.next = timer->timeout; + if (ts != 0) { + task_switch(); + } + return; +} + +int timer_cancel(struct TIMER *timer) +{ + int e; + struct TIMER *t; + e = io_load_eflags(); + io_cli(); /*在设置过程中禁止改变定时器状态*/ + if (timer->flags == TIMER_FLAGS_USING) { /*是否需要取消?*/ + if (timer == timerctl.t0) { + /*第一个定时器的取消处理*/ + t = timer->next; + timerctl.t0 = t; + timerctl.next = t->timeout; + } else { + /*非第一个定时器的取消处理*/ + /*找到timer前一个定时器*/ + t = timerctl.t0; + for (;;) { + if (t->next == timer) { + break; + } + t = t->next; + } + t->next = timer->next; + /*将之前“timer的下一个”指向“timer的下一个”*/ + } + timer->flags = TIMER_FLAGS_ALLOC; + io_store_eflags(e); + return 1; /*取消处理成功*/ + } + io_store_eflags(e); + return 0; /*不需要取消处理*/ +} + +void timer_cancelall(struct FIFO32 *fifo) +{ + int e, i; + struct TIMER *t; + e = io_load_eflags(); + io_cli(); /*在设置过程中禁止改变定时器状态*/ + for (i = 0; i < MAX_TIMER; i++) { + t = &timerctl.timers0[i]; + if (t->flags != 0 && t->flags2 != 0 && t->fifo == fifo) { + timer_cancel(t); + timer_free(t); + } + } + io_store_eflags(e); + return; +} diff --git a/28_day/haribote/window.c b/28_day/haribote/window.c new file mode 100644 index 0000000..4d70578 --- /dev/null +++ b/28_day/haribote/window.c @@ -0,0 +1,118 @@ +/* 窗口相关函数 */ + +#include "bootpack.h" + +void make_window8(unsigned char *buf, int xsize, int ysize, char *title, char act) +{ + boxfill8(buf, xsize, COL8_C6C6C6, 0, 0, xsize - 1, 0 ); + boxfill8(buf, xsize, COL8_FFFFFF, 1, 1, xsize - 2, 1 ); + boxfill8(buf, xsize, COL8_C6C6C6, 0, 0, 0, ysize - 1); + boxfill8(buf, xsize, COL8_FFFFFF, 1, 1, 1, ysize - 2); + boxfill8(buf, xsize, COL8_848484, xsize - 2, 1, xsize - 2, ysize - 2); + boxfill8(buf, xsize, COL8_000000, xsize - 1, 0, xsize - 1, ysize - 1); + boxfill8(buf, xsize, COL8_C6C6C6, 2, 2, xsize - 3, ysize - 3); + boxfill8(buf, xsize, COL8_848484, 1, ysize - 2, xsize - 2, ysize - 2); + boxfill8(buf, xsize, COL8_000000, 0, ysize - 1, xsize - 1, ysize - 1); + make_wtitle8(buf, xsize, title, act); + return; +} + +void make_wtitle8(unsigned char *buf, int xsize, char *title, char act) +{ + static char closebtn[14][16] = { + "OOOOOOOOOOOOOOO@", + "OQQQQQQQQQQQQQ$@", + "OQQQQQQQQQQQQQ$@", + "OQQQ@@QQQQ@@QQ$@", + "OQQQQ@@QQ@@QQQ$@", + "OQQQQQ@@@@QQQQ$@", + "OQQQQQQ@@QQQQQ$@", + "OQQQQQ@@@@QQQQ$@", + "OQQQQ@@QQ@@QQQ$@", + "OQQQ@@QQQQ@@QQ$@", + "OQQQQQQQQQQQQQ$@", + "OQQQQQQQQQQQQQ$@", + "O$$$$$$$$$$$$$$@", + "@@@@@@@@@@@@@@@@" + }; + int x, y; + char c, tc, tbc; + if (act != 0) { + tc = COL8_FFFFFF; + tbc = COL8_000084; + } else { + tc = COL8_C6C6C6; + tbc = COL8_848484; + } + boxfill8(buf, xsize, tbc, 3, 3, xsize - 4, 20); + putfonts8_asc(buf, xsize, 24, 4, tc, title); + for (y = 0; y < 14; y++) { + for (x = 0; x < 16; x++) { + c = closebtn[y][x]; + if (c == '@') { + c = COL8_000000; + } else if (c == '$') { + c = COL8_848484; + } else if (c == 'Q') { + c = COL8_C6C6C6; + } else { + c = COL8_FFFFFF; + } + buf[(5 + y) * xsize + (xsize - 21 + x)] = c; + } + } + return; +} + +void putfonts8_asc_sht(struct SHEET *sht, int x, int y, int c, int b, char *s, int l) +{ + boxfill8(sht->buf, sht->bxsize, b, x, y, x + l * 8 - 1, y + 15); + putfonts8_asc(sht->buf, sht->bxsize, x, y, c, s); + sheet_refresh(sht, x, y, x + l * 8, y + 16); + return; +} + +void make_textbox8(struct SHEET *sht, int x0, int y0, int sx, int sy, int c) +{ + int x1 = x0 + sx, y1 = y0 + sy; + boxfill8(sht->buf, sht->bxsize, COL8_848484, x0 - 2, y0 - 3, x1 + 1, y0 - 3); + boxfill8(sht->buf, sht->bxsize, COL8_848484, x0 - 3, y0 - 3, x0 - 3, y1 + 1); + boxfill8(sht->buf, sht->bxsize, COL8_FFFFFF, x0 - 3, y1 + 2, x1 + 1, y1 + 2); + boxfill8(sht->buf, sht->bxsize, COL8_FFFFFF, x1 + 2, y0 - 3, x1 + 2, y1 + 2); + boxfill8(sht->buf, sht->bxsize, COL8_000000, x0 - 1, y0 - 2, x1 + 0, y0 - 2); + boxfill8(sht->buf, sht->bxsize, COL8_000000, x0 - 2, y0 - 2, x0 - 2, y1 + 0); + boxfill8(sht->buf, sht->bxsize, COL8_C6C6C6, x0 - 2, y1 + 1, x1 + 0, y1 + 1); + boxfill8(sht->buf, sht->bxsize, COL8_C6C6C6, x1 + 1, y0 - 2, x1 + 1, y1 + 1); + boxfill8(sht->buf, sht->bxsize, c, x0 - 1, y0 - 1, x1 + 0, y1 + 0); + return; +} + +void change_wtitle8(struct SHEET *sht, char act) +{ + int x, y, xsize = sht->bxsize; + char c, tc_new, tbc_new, tc_old, tbc_old, *buf = sht->buf; + if (act != 0) { + tc_new = COL8_FFFFFF; + tbc_new = COL8_000084; + tc_old = COL8_C6C6C6; + tbc_old = COL8_848484; + } else { + tc_new = COL8_C6C6C6; + tbc_new = COL8_848484; + tc_old = COL8_FFFFFF; + tbc_old = COL8_000084; + } + for (y = 3; y <= 20; y++) { + for (x = 3; x <= xsize - 4; x++) { + c = buf[y * xsize + x]; + if (c == tc_old && x <= xsize - 22) { + c = tc_new; + } else if (c == tbc_old) { + c = tbc_new; + } + buf[y * xsize + x] = c; + } + } + sheet_refresh(sht, 3, 3, xsize, 21); + return; +} diff --git a/28_day/hello3/!cons_9x.bat b/28_day/hello3/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/hello3/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/hello3/!cons_nt.bat b/28_day/hello3/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/hello3/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/hello3/Makefile b/28_day/hello3/Makefile new file mode 100644 index 0000000..436f686 --- /dev/null +++ b/28_day/hello3/Makefile @@ -0,0 +1,5 @@ +APP = hello3 +STACK = 1k +MALLOC = 0k + +include ../app_make.txt diff --git a/28_day/hello3/hello3.c b/28_day/hello3/hello3.c new file mode 100644 index 0000000..f71cedf --- /dev/null +++ b/28_day/hello3/hello3.c @@ -0,0 +1,11 @@ +#include "apilib.h" + +void HariMain(void) +{ + api_putchar('h'); + api_putchar('e'); + api_putchar('l'); + api_putchar('l'); + api_putchar('o'); + api_end(); +} diff --git a/28_day/hello3/make.bat b/28_day/hello3/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/hello3/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/hello4/!cons_9x.bat b/28_day/hello4/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/hello4/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/hello4/!cons_nt.bat b/28_day/hello4/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/hello4/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/hello4/Makefile b/28_day/hello4/Makefile new file mode 100644 index 0000000..f4cb8d2 --- /dev/null +++ b/28_day/hello4/Makefile @@ -0,0 +1,5 @@ +APP = hello4 +STACK = 1k +MALLOC = 0k + +include ../app_make.txt diff --git a/28_day/hello4/hello4.c b/28_day/hello4/hello4.c new file mode 100644 index 0000000..ec04384 --- /dev/null +++ b/28_day/hello4/hello4.c @@ -0,0 +1,7 @@ +#include "apilib.h" + +void HariMain(void) +{ + api_putstr0("hello, world\n"); + api_end(); +} diff --git a/28_day/hello4/make.bat b/28_day/hello4/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/hello4/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/hello5/!cons_9x.bat b/28_day/hello5/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/hello5/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/hello5/!cons_nt.bat b/28_day/hello5/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/hello5/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/hello5/Makefile b/28_day/hello5/Makefile new file mode 100644 index 0000000..366ff9d --- /dev/null +++ b/28_day/hello5/Makefile @@ -0,0 +1,5 @@ +APP = hello5 +STACK = 1k +MALLOC = 0k + +include ../app_make.txt diff --git a/28_day/hello5/hello5.nas b/28_day/hello5/hello5.nas new file mode 100644 index 0000000..ee62330 --- /dev/null +++ b/28_day/hello5/hello5.nas @@ -0,0 +1,20 @@ +[FORMAT "WCOFF"] +[INSTRSET "i486p"] +[BITS 32] +[FILE "hello5.nas"] + + GLOBAL _HariMain + +[SECTION .text] + +_HariMain: + MOV EDX,2 + MOV EBX,msg + INT 0x40 + MOV EDX,4 + INT 0x40 + +[SECTION .data] + +msg: + DB "hello, world", 0x0a, 0 diff --git a/28_day/hello5/make.bat b/28_day/hello5/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/hello5/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/lines/!cons_9x.bat b/28_day/lines/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/lines/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/lines/!cons_nt.bat b/28_day/lines/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/lines/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/lines/Makefile b/28_day/lines/Makefile new file mode 100644 index 0000000..45a6aad --- /dev/null +++ b/28_day/lines/Makefile @@ -0,0 +1,5 @@ +APP = lines +STACK = 1k +MALLOC = 48k + +include ../app_make.txt diff --git a/28_day/lines/lines.c b/28_day/lines/lines.c new file mode 100644 index 0000000..5217faa --- /dev/null +++ b/28_day/lines/lines.c @@ -0,0 +1,22 @@ +#include "apilib.h" + +void HariMain(void) +{ + char *buf; + int win, i; + api_initmalloc(); + buf = api_malloc(160 * 100); + win = api_openwin(buf, 160, 100, -1, "lines"); + for (i = 0; i < 8; i++) { + api_linewin(win + 1, 8, 26, 77, i * 9 + 26, i); + api_linewin(win + 1, 88, 26, i * 9 + 88, 89, i); + } + api_refreshwin(win, 6, 26, 154, 90); + for (;;) { + if (api_getkey(1) == 0x0a) { + break; /*按下回车键则break; */ + } + } + api_closewin(win); + api_end(); +} diff --git a/28_day/lines/make.bat b/28_day/lines/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/lines/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/make.bat b/28_day/make.bat new file mode 100644 index 0000000..e489766 --- /dev/null +++ b/28_day/make.bat @@ -0,0 +1 @@ +..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/noodle/!cons_9x.bat b/28_day/noodle/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/noodle/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/noodle/!cons_nt.bat b/28_day/noodle/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/noodle/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/noodle/Makefile b/28_day/noodle/Makefile new file mode 100644 index 0000000..6ec85b8 --- /dev/null +++ b/28_day/noodle/Makefile @@ -0,0 +1,5 @@ +APP = noodle +STACK = 1k +MALLOC = 40k + +include ../app_make.txt diff --git a/28_day/noodle/make.bat b/28_day/noodle/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/noodle/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/noodle/noodle.c b/28_day/noodle/noodle.c new file mode 100644 index 0000000..108d148 --- /dev/null +++ b/28_day/noodle/noodle.c @@ -0,0 +1,32 @@ +#include +#include "apilib.h" + +void HariMain(void) +{ + char *buf, s[12]; + int win, timer, sec = 0, min = 0, hou = 0; + api_initmalloc(); + buf = api_malloc(150 * 50); + win = api_openwin(buf, 150, 50, -1, "noodle"); + timer = api_alloctimer(); + api_inittimer(timer, 128); + for (;;) { + sprintf(s, "%5d:%02d:%02d", hou, min, sec); + api_boxfilwin(win, 28, 27, 115, 41, 7);/*白色*/ + api_putstrwin(win, 28, 27, 0, 11, s); /*黑色*/ + api_settimer(timer, 100); /* 1秒 */ + if (api_getkey(1) != 128) { + break; + } + sec++; + if (sec == 60) { + sec = 0; + min++; + if (min == 60) { + min = 0; + hou++; + } + } + } + api_end(); +} diff --git a/28_day/star1/!cons_9x.bat b/28_day/star1/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/star1/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/star1/!cons_nt.bat b/28_day/star1/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/star1/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/star1/Makefile b/28_day/star1/Makefile new file mode 100644 index 0000000..ae4cd72 --- /dev/null +++ b/28_day/star1/Makefile @@ -0,0 +1,5 @@ +APP = star1 +STACK = 1k +MALLOC = 47k + +include ../app_make.txt diff --git a/28_day/star1/make.bat b/28_day/star1/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/star1/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/star1/star1.c b/28_day/star1/star1.c new file mode 100644 index 0000000..93241a8 --- /dev/null +++ b/28_day/star1/star1.c @@ -0,0 +1,18 @@ +#include "apilib.h" + +void HariMain(void) +{ + char *buf; + int win; + api_initmalloc(); + buf = api_malloc(150 * 100); + win = api_openwin(buf, 150, 100, -1, "star1"); + api_boxfilwin(win, 6, 26, 143, 93, 0);/*黑色*/ + api_point(win, 75, 59, 3);/*黄色*/ + for (;;) { + if (api_getkey(1) == 0x0a) { + break; /*按下回车键则break; */ + } + } + api_end(); +} diff --git a/28_day/stars/!cons_9x.bat b/28_day/stars/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/stars/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/stars/!cons_nt.bat b/28_day/stars/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/stars/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/stars/Makefile b/28_day/stars/Makefile new file mode 100644 index 0000000..899cc8f --- /dev/null +++ b/28_day/stars/Makefile @@ -0,0 +1,5 @@ +APP = stars +STACK = 1k +MALLOC = 47k + +include ../app_make.txt diff --git a/28_day/stars/make.bat b/28_day/stars/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/stars/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/stars/stars.c b/28_day/stars/stars.c new file mode 100644 index 0000000..19c54e5 --- /dev/null +++ b/28_day/stars/stars.c @@ -0,0 +1,24 @@ +#include "apilib.h" + +int rand(void); /*产生0~32767之间的随机数*/ + +void HariMain(void) +{ + char *buf; + int win, i, x, y; + api_initmalloc(); + buf = api_malloc(150 * 100); + win = api_openwin(buf, 150, 100, -1, "stars"); + api_boxfilwin(win, 6, 26, 143, 93, 0);/*黑色*/ + for (i = 0; i < 50; i++) { + x = (rand() % 137) + 6; + y = (rand() % 67) + 26; + api_point(win, x, y, 3);/*黄色*/ + } + for (;;) { + if (api_getkey(1) == 0x0a) { + break; /*按下回车键则break; */ + } + } + api_end(); +} diff --git a/28_day/stars2/!cons_9x.bat b/28_day/stars2/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/stars2/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/stars2/!cons_nt.bat b/28_day/stars2/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/stars2/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/stars2/Makefile b/28_day/stars2/Makefile new file mode 100644 index 0000000..77c18cd --- /dev/null +++ b/28_day/stars2/Makefile @@ -0,0 +1,5 @@ +APP = stars2 +STACK = 1k +MALLOC = 47k + +include ../app_make.txt diff --git a/28_day/stars2/make.bat b/28_day/stars2/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/stars2/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/stars2/stars2.c b/28_day/stars2/stars2.c new file mode 100644 index 0000000..6c63c19 --- /dev/null +++ b/28_day/stars2/stars2.c @@ -0,0 +1,25 @@ +#include "apilib.h" + +int rand(void); /*产生0~32767的随机数*/ + +void HariMain(void) +{ + char *buf; + int win, i, x, y; + api_initmalloc(); + buf = api_malloc(150 * 100); + win = api_openwin(buf, 150, 100, -1, "stars2"); + api_boxfilwin(win + 1, 6, 26, 143, 93, 0);/*黑色*/ + for (i = 0; i < 50; i++) { + x = (rand() % 137) + 6; + y = (rand() % 67) + 26; + api_point(win + 1, x, y, 3);/*黄色*/ + } + api_refreshwin(win, 6, 26, 144, 94); + for (;;) { + if (api_getkey(1) == 0x0a) { + break; /*按下回车键则break; */ + } + } + api_end(); +} diff --git a/28_day/walk/!cons_9x.bat b/28_day/walk/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/walk/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/walk/!cons_nt.bat b/28_day/walk/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/walk/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/walk/Makefile b/28_day/walk/Makefile new file mode 100644 index 0000000..641c368 --- /dev/null +++ b/28_day/walk/Makefile @@ -0,0 +1,5 @@ +APP = walk +STACK = 1k +MALLOC = 48k + +include ../app_make.txt diff --git a/28_day/walk/make.bat b/28_day/walk/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/walk/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/walk/walk.c b/28_day/walk/walk.c new file mode 100644 index 0000000..4772f8a --- /dev/null +++ b/28_day/walk/walk.c @@ -0,0 +1,26 @@ +#include "apilib.h" + +void HariMain(void) +{ + char *buf; + int win, i, x, y; + api_initmalloc(); + buf = api_malloc(160 * 100); + win = api_openwin(buf, 160, 100, -1, "walk"); + api_boxfilwin(win, 4, 24, 155, 95, 0);/*黑色*/ + x = 76; + y = 56; + api_putstrwin(win, x, y, 3, 1, "*");/*黄色*/ + for (;;) { + i = api_getkey(1); + api_putstrwin(win, x, y, 0 , 1, "*"); /*用黑色擦除*/ + if (i == '4' && x > 4) { x -= 8; } + if (i == '6' && x < 148) { x += 8; } + if (i == '8' && y > 24) { y -= 8; } + if (i == '2' && y < 80) { y += 8; } + if (i == 0x0a) { break; } /*按回车键结束*/ + api_putstrwin(win, x, y, 3 , 1, "*");/*黄色*/ + } + api_closewin(win); + api_end(); +} diff --git a/28_day/winhelo/!cons_9x.bat b/28_day/winhelo/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/winhelo/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/winhelo/!cons_nt.bat b/28_day/winhelo/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/winhelo/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/winhelo/Makefile b/28_day/winhelo/Makefile new file mode 100644 index 0000000..fe2c669 --- /dev/null +++ b/28_day/winhelo/Makefile @@ -0,0 +1,5 @@ +APP = winhelo +STACK = 1k +MALLOC = 0k + +include ../app_make.txt diff --git a/28_day/winhelo/make.bat b/28_day/winhelo/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/winhelo/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/winhelo/winhelo.c b/28_day/winhelo/winhelo.c new file mode 100644 index 0000000..8059d36 --- /dev/null +++ b/28_day/winhelo/winhelo.c @@ -0,0 +1,15 @@ +#include "apilib.h" + +char buf[150 * 50]; + +void HariMain(void) +{ + int win; + win = api_openwin(buf, 150, 50, -1, "hello"); + for (;;) { + if (api_getkey(1) == 0x0a) { + break; /*按下回车键则break; */ + } + } + api_end(); +} diff --git a/28_day/winhelo2/!cons_9x.bat b/28_day/winhelo2/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/winhelo2/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/winhelo2/!cons_nt.bat b/28_day/winhelo2/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/winhelo2/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/winhelo2/Makefile b/28_day/winhelo2/Makefile new file mode 100644 index 0000000..df62c78 --- /dev/null +++ b/28_day/winhelo2/Makefile @@ -0,0 +1,5 @@ +APP = winhelo2 +STACK = 1k +MALLOC = 0k + +include ../app_make.txt diff --git a/28_day/winhelo2/make.bat b/28_day/winhelo2/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/winhelo2/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/winhelo2/winhelo2.c b/28_day/winhelo2/winhelo2.c new file mode 100644 index 0000000..2937402 --- /dev/null +++ b/28_day/winhelo2/winhelo2.c @@ -0,0 +1,17 @@ +#include "apilib.h" + +char buf[150 * 50]; + +void HariMain(void) +{ + int win; + win = api_openwin(buf, 150, 50, -1, "hello"); + api_boxfilwin(win, 8, 36, 141, 43, 3); /*黄色*/ + api_putstrwin(win, 28, 28, 0 /*黑色*/, 12, "hello, world"); + for (;;) { + if (api_getkey(1) == 0x0a) { + break; /*按下回车键则break; */ + } + } + api_end(); +} diff --git a/28_day/winhelo3/!cons_9x.bat b/28_day/winhelo3/!cons_9x.bat new file mode 100644 index 0000000..e42252a --- /dev/null +++ b/28_day/winhelo3/!cons_9x.bat @@ -0,0 +1 @@ +command \ No newline at end of file diff --git a/28_day/winhelo3/!cons_nt.bat b/28_day/winhelo3/!cons_nt.bat new file mode 100644 index 0000000..6e07473 --- /dev/null +++ b/28_day/winhelo3/!cons_nt.bat @@ -0,0 +1 @@ +cmd.exe \ No newline at end of file diff --git a/28_day/winhelo3/Makefile b/28_day/winhelo3/Makefile new file mode 100644 index 0000000..719b23a --- /dev/null +++ b/28_day/winhelo3/Makefile @@ -0,0 +1,5 @@ +APP = winhelo3 +STACK = 1k +MALLOC = 40k + +include ../app_make.txt diff --git a/28_day/winhelo3/make.bat b/28_day/winhelo3/make.bat new file mode 100644 index 0000000..6b0dbfc --- /dev/null +++ b/28_day/winhelo3/make.bat @@ -0,0 +1 @@ +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 \ No newline at end of file diff --git a/28_day/winhelo3/winhelo3.c b/28_day/winhelo3/winhelo3.c new file mode 100644 index 0000000..a1529e5 --- /dev/null +++ b/28_day/winhelo3/winhelo3.c @@ -0,0 +1,19 @@ +#include "apilib.h" + +void HariMain(void) +{ + char *buf; + int win; + + api_initmalloc(); + buf = api_malloc(150 * 50); + win = api_openwin(buf, 150, 50, -1, "hello"); + api_boxfilwin(win, 8, 36, 141, 43, 6); /*浅蓝色*/ + api_putstrwin(win, 28, 28, 0 , 12, "hello, world");/*黑色*/ + for (;;) { + if (api_getkey(1) == 0x0a) { + break; /*按下回车键则break; */ + } + } + api_end(); +}