OSDN Git Service

svn rev.329より移動。
authorhikarupsp <hikarupsp@users.sourceforge.jp>
Sun, 24 Feb 2013 13:45:41 +0000 (22:45 +0900)
committerhikarupsp <hikarupsp@users.sourceforge.jp>
Sun, 24 Feb 2013 13:45:41 +0000 (22:45 +0900)
510 files changed:
CHNOSProject/chnos/tolset_chn_000/chnos_008/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/!comment.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/a/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/a/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/a/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/a/a.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/a/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/a_nask.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000001_api_putchar.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000002_api_putstr.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000004_api_end.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000005_api_openwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000006_api_putstrwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000007_api_boxfilwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000008_api_initmalloc.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000009_api_malloc.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000010_api_free.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000011_api_point.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000012_api_refreshwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000013_api_linewin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000014_api_closewin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000015_api_getkey.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/apilist.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/app_make.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/bug1.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/bug2.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/bug3.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/api.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/asmhead.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/bootpack.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/chnipl.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/console.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/core.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/fifo.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/file.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/gdtidt.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/grap_08.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/grap_16.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/grap_32.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/graphic.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/hankaku.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/init.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/intrpt.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/io.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/keyboard.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/memory.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/mouse.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/mtask.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/naskfunc.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/paging.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/sheet.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/timer.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/uuid.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/window.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/crack1.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/crack2.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/crack3.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/crack4.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/hello.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/lines.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/star1.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/stars.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/walk.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/winhelo.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/winhelo2.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/winhelo3.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/!comment.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/asmtest.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/bug1.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000001_api_putchar.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000002_api_putstr.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000004_api_end.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000005_api_openwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000006_api_putstrwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000007_api_boxfilwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000008_api_initmalloc.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000009_api_malloc.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000010_api_free.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000011_api_point.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000012_api_refreshwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000013_api_linewin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000014_api_closewin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000015_api_getkey.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/apilist.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnmake.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/api.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/asmhead.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/bootpack.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/chnipl.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/console.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/core.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/core_set.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/cpuid.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/dsctbl.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/fifo.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/file.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/grap_08.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/grap_16.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/grap_32.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/graphic.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/hankaku.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/init.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/inputbox.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/intrpt.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/io.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/keyboard.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/memblock.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/memory.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/mouse.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/mtask.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/nasfunc0.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/nasfunc1.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/paging.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/serial.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/sheet.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/test.mid [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/timer.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/window.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/xception.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/crack1.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/crack2.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/crack3.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/crack4.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/ctest.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_009/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/!comment.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/asmtest.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/bug1.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000001_api_putchar.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000002_api_putstr.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000004_api_end.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000005_api_openwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000006_api_putstrwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000007_api_boxfilwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000008_api_initmalloc.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000009_api_malloc.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000010_api_free.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000011_api_point.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000012_api_refreshwin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000013_api_linewin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000014_api_closewin.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000015_api_getkey.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/apilist.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnmake.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/asmhead.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/bootpack.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/callbios.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/cfunc.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/chnipl.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/chnlogo.bmp [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/color.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/console.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/core.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef0.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef1.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef2.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef3.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/debug.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/display.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/draw08.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/draw16.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/draw32.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/drawing.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/dsctbl.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/emu86.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/emu86asm.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/error.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/fifo.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/file.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/floppy.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/fmt_bmp.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/hankaku.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/intrpt.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/keyboard.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/keyid.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/makeset.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/memory.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/mouse.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/mtask.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/nasfunc0.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/nasfunc1.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/nasfunc2.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/pci.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/serial.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sheet.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sht08.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sht16.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sht32.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/shtdraw.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/shtfunc.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/struct.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/structid.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/system.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/textbox.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/timer.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/vgatmode.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/xception.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/crack1.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/crack2.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/crack3.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/crack4.nas [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/!clean.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/!src_only.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/ctest.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/chnos_010/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/CHNOSP.rul [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/apilib.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/chn010.rul [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/chnlibc.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/errno.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/float.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/golibc.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/limits.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/math.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/setjmp.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/stdarg.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/stddef.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/stdio.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/string.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/GPL.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/LGPL.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/RWFD.EXE [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/RWFD.TXT [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/aksa.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/aska.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/bim2bin.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/bim2chn.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/bim2hrb.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/bin2obj.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bios.bin [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bochs-smp.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bochsrc.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/readme.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/vgabios.bin [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/cc1.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/chnlibc.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/startup.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/startup.obj [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/chnos.img [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/com_mak.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/comcom.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/cpp0.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/cygwin1.dll [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/dsar.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/edimg.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/edimgopt.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/esart5.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/fdimg0at.tek [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/fdimg0tw.tek [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/gas2nask.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/golib00.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/errno.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/float.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/gg00libc.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/gg00old0.rul [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/golibc.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/guigui00.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/guigui00.rul [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/limits.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/math.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/setjmp.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stdarg.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stddef.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stdio.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stdlib.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/string.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/apilib.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/apilib.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/errno.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/float.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/golibc.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/haribote.rul [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/harilibc.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/limits.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/math.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/setjmp.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/stdarg.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/stddef.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/stdio.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/string.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/hrb_mak.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/hrb_qemu/haribote.img [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/imgtol.com [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/ld.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/license.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/make.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/makefont.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/mkisofs.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/nask.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/naskcnv0.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/nothing.com [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/obj2bim.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/osalink1.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/SDL.dll [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/bios.bin [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/qemu-win.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/qemu.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/vgabios.bin [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/SDL.dll [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/bios.bin [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/qemu.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/vgabios.bin [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/SDL.dll [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/bios.bin [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/fmod.dll [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/qemu-system-x86_64.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/qemu-x86_64.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/vgabios.bin [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/sartol.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/sjisconv.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/t5lzma.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/!cons_9x.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/!cons_nt.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/Makefile [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/bim2chn.c [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/make.bat [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/tset_chn.txt [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/upx.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/wce.exe [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/errno.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/float.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/golibc.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/libmingw.lib [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/limits.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/math.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/setjmp.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stdarg.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stddef.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stdio.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stdlib.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/string.h [new file with mode: 0644]
CHNOSProject/chnos/tolset_chn_000/z_tools/win32/w32clibc.lib [new file with mode: 0644]

diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/!comment.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_008/!comment.txt
new file mode 100644 (file)
index 0000000..10b8228
--- /dev/null
@@ -0,0 +1,10 @@
+*****\91\80\8dì\95û\96@*****\r
+Tab\83L\81[\81F\83t\83H\81[\83J\83X\82Ì\90Ø\82è\91Ö\82¦\r
+Shift + F1\81F\83A\83v\83\8a\82Ì\8b­\90§\8fI\97¹\r
+F11:\8dÅ\8cã\96Ê\82Ì\83E\83B\83\93\83h\83E\82ð\95\\82É\8e\9d\82Á\82Ä\82­\82é\r
+\r
+//\8aJ\94­\82Ì\93r\92\86\82Å\8bC\95t\82¢\82½\82±\82Æ\82È\82Ç\82Ì\83\81\83\82\8f\91\82«\81B\r
+//\89º\82Ì\82Ù\82¤\82ª\90V\82µ\82¢\82à\82Ì\81B\r
+#17:28 2010/12/26\r
+\82±\82Ì\83t\83@\83C\83\8b\82ð\92Ç\89Á\81B\r
+\82Ç\82¤\82â\82ç\81A\83\81\83\82\83\8a\82Ì\83T\83C\83Y\82ª\92\86\93r\94¼\92[\82¾\82Æ\83y\81[\83W\83\93\83O\82Ì\8f\89\8aú\89»\82É\8e¸\94s\82·\82é\82ç\82µ\82¢\81B\97v\91Î\8f\88\81B\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/Makefile
new file mode 100644 (file)
index 0000000..32e6fca
--- /dev/null
@@ -0,0 +1,160 @@
+TOOLPATH = ../z_tools/\r
+INCPATH  = ../z_tools/CHNOSProject/\r
+\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+EDIMG    = $(TOOLPATH)edimg.exe\r
+IMGTOL   = $(TOOLPATH)imgtol.com\r
+COPY     = copy\r
+DEL      = del\r
+\r
+# \83f\83t\83H\83\8b\83g\93®\8dì\r
+\r
+default :\r
+       $(MAKE) chnos.img\r
+\r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥\r
+\r
+chnos.img : chnos/chnipl.bin chnos/chnos.sys chnos/chnipl.nas \\r
+               a/a.hrb \\r
+               bug1/bug1.hrb \\r
+               bug2/bug2.hrb \\r
+               bug3/bug3.hrb \\r
+               crack1/crack1.hrb \\r
+               crack2/crack2.hrb \\r
+               crack3/crack3.hrb \\r
+               crack4/crack4.hrb \\r
+               hello/hello.hrb \\r
+               lines/lines.hrb \\r
+               star1/star1.hrb \\r
+               stars/stars.hrb \\r
+               walk/walk.hrb \\r
+               winhelo/winhelo.hrb \\r
+               winhelo2/winhelo2.hrb \\r
+               winhelo3/winhelo3.hrb \r
+       $(EDIMG)   imgin:../z_tools/fdimg0at.tek \\r
+               wbinimg src:chnos/chnipl.bin len:512 from:0 to:0 \\r
+               copy from:chnos/chnos.sys to:@: \\r
+               copy from:chnos/chnipl.nas to:@: \\r
+               copy from:a/a.hrb to:@: \\r
+               copy from:bug1/bug1.hrb to:@: \\r
+               copy from:bug2/bug2.hrb to:@: \\r
+               copy from:bug3/bug3.hrb to:@: \\r
+               copy from:crack1/crack1.hrb to:@: \\r
+               copy from:crack2/crack2.hrb to:@: \\r
+               copy from:crack3/crack3.hrb to:@: \\r
+               copy from:crack4/crack4.hrb to:@: \\r
+               copy from:hello/hello.hrb to:@: \\r
+               copy from:lines/lines.hrb to:@: \\r
+               copy from:star1/star1.hrb to:@: \\r
+               copy from:stars/stars.hrb to:@: \\r
+               copy from:walk/walk.hrb to:@: \\r
+               copy from:winhelo/winhelo.hrb to:@: \\r
+               copy from:winhelo2/winhelo2.hrb to:@: \\r
+               copy from:winhelo3/winhelo3.hrb to:@: \\r
+               imgout:chnos.img\r
+\r
+# \83R\83}\83\93\83h\r
+\r
+run :\r
+       $(MAKE) chnos.img\r
+       $(COPY) chnos.img ..\z_tools\qemu\fdimage0.bin\r
+       $(MAKE) -C ../z_tools/qemu\r
+\r
+run_b :\r
+       $(MAKE) chnos.img\r
+       $(COPY) chnos.img ..\z_tools\bochs\fdimage0.bin\r
+       $(MAKE) -C ../z_tools/bochs\r
+\r
+iso :\r
+       $(MAKE) chnos.img\r
+       ..\z_tools\mkisofs.exe -v -iso-level 1 -b chnos.img -o ..\z_tools\qemu_iso\chnos.iso .\r
+\r
+run_cd :\r
+       $(MAKE) iso\r
+       $(MAKE) -C ../z_tools/qemu_iso\r
+\r
+install :\r
+       $(MAKE) chnos.img\r
+       $(IMGTOL) w a: chnos.img\r
+\r
+full :\r
+       $(MAKE) -C chnos\r
+       $(MAKE) -C a\r
+       $(MAKE) -C bug1\r
+       $(MAKE) -C bug2\r
+       $(MAKE) -C bug3\r
+       $(MAKE) -C crack1\r
+       $(MAKE) -C crack2\r
+       $(MAKE) -C crack3\r
+       $(MAKE) -C crack4\r
+       $(MAKE) -C hello\r
+       $(MAKE) -C lines\r
+       $(MAKE) -C star1\r
+       $(MAKE) -C stars\r
+       $(MAKE) -C walk\r
+       $(MAKE) -C winhelo\r
+       $(MAKE) -C winhelo2\r
+       $(MAKE) -C winhelo3\r
+       $(MAKE) chnos.img\r
+\r
+run_full :\r
+       $(MAKE) full\r
+       $(COPY) chnos.img ..\z_tools\qemu\fdimage0.bin\r
+       $(MAKE) -C ../z_tools/qemu\r
+\r
+install_full :\r
+       $(MAKE) full\r
+       $(IMGTOL) w a: chnos.img\r
+\r
+run_os :\r
+       $(MAKE) -C chnos\r
+       $(MAKE) run\r
+\r
+clean :\r
+# \89½\82à\82µ\82È\82¢\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DEL) chnos.img\r
+\r
+clean_full :\r
+       $(MAKE) -C chnos                clean\r
+       $(MAKE) -C bug1                 clean\r
+       $(MAKE) -C bug2                 clean\r
+       $(MAKE) -C bug3                 clean\r
+       $(MAKE) -C crack1               clean\r
+       $(MAKE) -C crack2               clean\r
+       $(MAKE) -C crack3               clean\r
+       $(MAKE) -C crack4               clean\r
+       $(MAKE) -C hello                clean\r
+       $(MAKE) -C lines                clean\r
+       $(MAKE) -C star1                clean\r
+       $(MAKE) -C stars                clean\r
+       $(MAKE) -C walk                 clean\r
+       $(MAKE) -C winhelo              clean\r
+       $(MAKE) -C winhelo2             clean\r
+       $(MAKE) -C winhelo3             clean\r
+\r
+src_only_full :\r
+       $(MAKE) -C chnos                src_only\r
+       $(MAKE) -C bug1                 src_only\r
+       $(MAKE) -C bug2                 src_only\r
+       $(MAKE) -C bug3                 src_only\r
+       $(MAKE) -C crack1               src_only\r
+       $(MAKE) -C crack2               src_only\r
+       $(MAKE) -C crack3               src_only\r
+       $(MAKE) -C crack4               src_only\r
+       $(MAKE) -C hello                src_only\r
+       $(MAKE) -C lines                src_only\r
+       $(MAKE) -C star1                src_only\r
+       $(MAKE) -C stars                src_only\r
+       $(MAKE) -C walk                 src_only\r
+       $(MAKE) -C winhelo              src_only\r
+       $(MAKE) -C winhelo2             src_only\r
+       $(MAKE) -C winhelo3             src_only\r
+       -$(DEL) chnos.img\r
+\r
+refresh :\r
+       $(MAKE) full\r
+       $(MAKE) clean_full\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/a/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/a/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/a/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/a/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/a/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/a/Makefile
new file mode 100644 (file)
index 0000000..87521bd
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = a\r
+STACK    = 1k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/a/a.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/a/a.c
new file mode 100644 (file)
index 0000000..5448e32
--- /dev/null
@@ -0,0 +1,7 @@
+#include <apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       api_putchar('A');\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/a/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/a/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib.h b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib.h
new file mode 100644 (file)
index 0000000..aee7c1e
--- /dev/null
@@ -0,0 +1,53 @@
+typedef enum _bool { false, true} bool;\r
+typedef unsigned char uchar;\r
+typedef unsigned short ushort;\r
+typedef unsigned int uint;\r
+typedef enum _color_8 { black, red, green, yellow, \r
+                       blue, pink, light_blue, white, \r
+                       gray, brown, dark_green, gold, \r
+                       navy_blue, purple, dark_cyan, dark_gray} color_8;\r
+\r
+int rand(void);\r
+#define srand(seed) (void) (rand_seed = (seed))\r
+extern unsigned int rand_seed;\r
+\r
+void api_putchar(uchar c);\r
+//     hariboteOS:\8cÝ\8a·void api_putchar(int c);\r
+void api_putstr(uchar *s);\r
+//     hariboteOS:\8cÝ\8a·void api_putstr0(char *s);\r
+void api_end(void);\r
+//     hariboteOS:\8cÝ\8a·void api_end(void);\r
+uint api_openwin(uchar *buf, int xsize, int ysize, int col_inv, uchar *title);\r
+//     hariboteOS:\8cÝ\8a·int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);\8cÝ\8a·\r
+void api_putstrwin(uint win, int x, int y, color_8 col, int len, uchar *str);\r
+//     hariboteOS:\8cÝ\8a·void api_putstrwin(int win, int x, int y, int col, int len, char *str);\r
+void api_boxfilwin(uint win, int x0, int y0, int x1, int y1, color_8 col);\r
+//     hariboteOS:\8cÝ\8a·void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col);\r
+void api_initmalloc(void);\r
+//     hariboteOS:\8cÝ\8a·void api_initmalloc(void);\r
+void *api_malloc(uint size);\r
+//     hariboteOS:\8cÝ\8a·char *api_malloc(int size);\r
+void api_free(void *addr, uint size);\r
+//     hariboteOS:\8cÝ\8a·void api_free(char *addr, int size);\r
+void api_point(uint win, int x, int y, color_8 col);\r
+//     hariboteOS:\8cÝ\8a·void api_point(int win, int x, int y, int col);\r
+void api_refreshwin(uint win, int x0, int y0, int x1, int y1);\r
+//     hariboteOS:\8cÝ\8a·void api_refreshwin(int win, int x0, int y0, int x1, int y1);\r
+void api_linewin(uint win, int x0, int y0, int x1, int y1, color_8 col);\r
+//void api_linewin(int win, int x0, int y0, int x1, int y1, int col);\r
+void api_closewin(uint win);\r
+//     hariboteOS:\8cÝ\8a·void api_closewin(int win);\r
+int api_getkey(bool wait);\r
+//     hariboteOS:\8cÝ\8a·int api_getkey(int mode);\r
+//int api_alloctimer(void);\r
+//void api_inittimer(int timer, int data);\r
+//void api_settimer(int timer, int time);\r
+//void api_freetimer(int timer);\r
+//void api_beep(int tone);\r
+//int api_fopen(char *fname);\r
+//void api_fclose(int fhandle);\r
+//void api_fseek(int fhandle, int offset, int mode);\r
+//int api_fsize(int fhandle, int mode);\r
+//int api_fread(char *buf, int maxsize, int fhandle);\r
+//int api_cmdline(char *buf, int maxsize);\r
+//int api_getlang(void);\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/Makefile
new file mode 100644 (file)
index 0000000..a8d324b
--- /dev/null
@@ -0,0 +1,5 @@
+DEL      = del\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/a_nask.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/a_nask.nas
new file mode 100644 (file)
index 0000000..1126120
--- /dev/null
@@ -0,0 +1,162 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+[FILE "a_nask.nas"]\r
+       GLOBAL  _api_putchar\r
+       GLOBAL  _api_putstr\r
+       GLOBAL  _api_end\r
+       GLOBAL  _api_openwin\r
+       GLOBAL  _api_putstrwin\r
+       GLOBAL  _api_boxfilwin\r
+       GLOBAL  _api_initmalloc\r
+       GLOBAL  _api_malloc\r
+       GLOBAL  _api_free\r
+       GLOBAL  _api_point\r
+       GLOBAL  _api_linewin\r
+\r
+[SECTION .text]\r
+\r
+_api_putchar:\r
+       mov     edx,1\r
+       mov     al,[esp+4]\r
+       int     0x40\r
+       ret\r
+\r
+_api_putstr:\r
+       push    ebx\r
+       mov     edx,2\r
+       mov     ebx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
+\r
+_api_end:\r
+       mov     edx,4\r
+       int     0x40\r
+\r
+_api_openwin:\r
+;col_inv\82Í\96³\8e\8b\82³\82ê\82Ü\82·\81Bbuf\82Íunsigned char\82Ì\82Ý\8b\96\89Â\81B\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,5\r
+       mov     ebx,[esp+16]\r
+       mov     esi,[esp+20]\r
+       mov     edi,[esp+24]\r
+       mov     eax,[esp+28]\r
+       mov     ecx,[esp+32]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
+\r
+_api_putstrwin:\r
+;len\82Í\96³\8e\8b\82³\82ê\82Ü\82·\81B\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,6\r
+       mov     ebx,[esp+20]\r
+       mov     esi,[esp+24]\r
+       mov     edi,[esp+28]\r
+       mov     eax,[esp+32]\r
+       mov     ecx,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
+\r
+_api_boxfilwin:\r
+;\90F\8ew\92è\82Í\82Æ\82è\82 \82¦\82¸32\83r\83b\83g\82Å\8ds\82Á\82Ä\82­\82¾\82³\82¢\81B\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,7\r
+       mov     ebx,[esp+20]\r
+       mov     eax,[esp+24]\r
+       mov     ecx,[esp+28]\r
+       mov     esi,[esp+32]\r
+       mov     edi,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
+\r
+\r
+_api_initmalloc:\r
+       push    ebx\r
+       mov     edx,8\r
+       mov     ebx,[cs:0x0020]\r
+       mov     eax,ebx\r
+       add     eax,32*1024\r
+       mov     ecx,[cs:0x0000]\r
+       sub     ecx,eax\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
+\r
+_api_malloc:\r
+       push    ebx\r
+       mov     edx,9\r
+       mov     ebx,[cs:0x0020]\r
+       mov     ecx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
+\r
+_api_free:\r
+       push    ebx\r
+       mov     edx,10\r
+       mov     ebx,[cs:0x0020]\r
+       mov     eax,[esp+8]\r
+       mov     ecx,[esp+12]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
+\r
+_api_point:\r
+;\90F\8ew\92è\82Í\82Æ\82è\82 \82¦\82¸32\83r\83b\83g\82Å\8ds\82Á\82Ä\82­\82¾\82³\82¢\81B\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,11\r
+       mov     ebx,[esp+16]\r
+       mov     esi,[esp+20]\r
+       mov     edi,[esp+24]\r
+       mov     eax,[esp+28]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret     \r
+\r
+_api_linewin:\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,13\r
+       mov     ebx,[esp+20]\r
+       mov     eax,[esp+24]\r
+       mov     ecx,[esp+28]\r
+       mov     esi,[esp+32]\r
+       mov     edi,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000001_api_putchar.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000001_api_putchar.nas
new file mode 100644 (file)
index 0000000..463e160
--- /dev/null
@@ -0,0 +1,14 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_putchar\r
+\r
+[SECTION .text]\r
+\r
+_api_putchar:\r
+       mov     edx,1\r
+       mov     al,[esp+4]\r
+       int     0x40\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000002_api_putstr.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000002_api_putstr.nas
new file mode 100644 (file)
index 0000000..b95f3ba
--- /dev/null
@@ -0,0 +1,16 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_putstr\r
+\r
+[SECTION .text]\r
+\r
+_api_putstr:\r
+       push    ebx\r
+       mov     edx,2\r
+       mov     ebx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000004_api_end.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000004_api_end.nas
new file mode 100644 (file)
index 0000000..ea4e695
--- /dev/null
@@ -0,0 +1,12 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_end\r
+\r
+[SECTION .text]\r
+\r
+_api_end:\r
+       mov     edx,4\r
+       int     0x40\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000005_api_openwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000005_api_openwin.nas
new file mode 100644 (file)
index 0000000..08ee698
--- /dev/null
@@ -0,0 +1,25 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_openwin\r
+\r
+[SECTION .text]\r
+\r
+_api_openwin:\r
+;col_inv\82Í\96³\8e\8b\82³\82ê\82Ü\82·\81Bbuf\82Íunsigned char\82Ì\82Ý\8b\96\89Â\81B\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,5\r
+       mov     ebx,[esp+16]\r
+       mov     esi,[esp+20]\r
+       mov     edi,[esp+24]\r
+       mov     eax,[esp+28]\r
+       mov     ecx,[esp+32]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000006_api_putstrwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000006_api_putstrwin.nas
new file mode 100644 (file)
index 0000000..9e62052
--- /dev/null
@@ -0,0 +1,28 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_putstrwin\r
+\r
+[SECTION .text]\r
+\r
+_api_putstrwin:\r
+;len\82Í\96³\8e\8b\82³\82ê\82Ü\82·\81B\95\8e\9a\97ñ\82Í\8fI\92[\82Énull\82ð\92u\82­\82±\82Æ\81B\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,6\r
+       mov     ebx,[esp+20]\r
+       mov     esi,[esp+24]\r
+       mov     edi,[esp+28]\r
+       mov     eax,[esp+32]\r
+       mov     ecx,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000007_api_boxfilwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000007_api_boxfilwin.nas
new file mode 100644 (file)
index 0000000..0cd91c2
--- /dev/null
@@ -0,0 +1,27 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_boxfilwin\r
+\r
+[SECTION .text]\r
+\r
+_api_boxfilwin:\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,7\r
+       mov     ebx,[esp+20]\r
+       mov     eax,[esp+24]\r
+       mov     ecx,[esp+28]\r
+       mov     esi,[esp+32]\r
+       mov     edi,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000008_api_initmalloc.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000008_api_initmalloc.nas
new file mode 100644 (file)
index 0000000..3643071
--- /dev/null
@@ -0,0 +1,20 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_initmalloc\r
+\r
+[SECTION .text]\r
+\r
+_api_initmalloc:\r
+       push    ebx\r
+       mov     edx,8\r
+       mov     ebx,[cs:0x0020]\r
+       mov     eax,ebx\r
+       add     eax,32*1024\r
+       mov     ecx,[cs:0x0000]\r
+       sub     ecx,eax\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000009_api_malloc.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000009_api_malloc.nas
new file mode 100644 (file)
index 0000000..e0b33a1
--- /dev/null
@@ -0,0 +1,17 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_malloc\r
+\r
+[SECTION .text]\r
+\r
+_api_malloc:\r
+       push    ebx\r
+       mov     edx,9\r
+       mov     ebx,[cs:0x0020]\r
+       mov     ecx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000010_api_free.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000010_api_free.nas
new file mode 100644 (file)
index 0000000..c90a3fe
--- /dev/null
@@ -0,0 +1,19 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_free\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_free:\r
+       push    ebx\r
+       mov     edx,10\r
+       mov     ebx,[cs:0x0020]\r
+       mov     eax,[esp+8]\r
+       mov     ecx,[esp+12]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000011_api_point.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000011_api_point.nas
new file mode 100644 (file)
index 0000000..01dc536
--- /dev/null
@@ -0,0 +1,24 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_point\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_point:\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,11\r
+       mov     ebx,[esp+16]\r
+       mov     esi,[esp+20]\r
+       mov     edi,[esp+24]\r
+       mov     eax,[esp+28]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000012_api_refreshwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000012_api_refreshwin.nas
new file mode 100644 (file)
index 0000000..b2f4f08
--- /dev/null
@@ -0,0 +1,25 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_refreshwin\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_refreshwin:\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,12\r
+       mov     ebx,[esp+16]\r
+       mov     eax,[esp+20]\r
+       mov     ecx,[esp+24]\r
+       mov     esi,[esp+28]\r
+       mov     edi,[esp+32]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000013_api_linewin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000013_api_linewin.nas
new file mode 100644 (file)
index 0000000..0fc9ae1
--- /dev/null
@@ -0,0 +1,28 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_linewin\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_linewin:\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,13\r
+       mov     ebx,[esp+20]\r
+       mov     eax,[esp+24]\r
+       mov     ecx,[esp+28]\r
+       mov     esi,[esp+32]\r
+       mov     edi,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000014_api_closewin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000014_api_closewin.nas
new file mode 100644 (file)
index 0000000..1882dc3
--- /dev/null
@@ -0,0 +1,17 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_closewin\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_closewin:\r
+       push    ebx\r
+       mov     edx,14\r
+       mov     ebx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000015_api_getkey.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/api_00000015_api_getkey.nas
new file mode 100644 (file)
index 0000000..717f4af
--- /dev/null
@@ -0,0 +1,15 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_getkey\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_getkey:\r
+       mov     edx,15\r
+       mov     eax,[esp+4]\r
+       int     0x40\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/apilist.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/apilist.txt
new file mode 100644 (file)
index 0000000..a7f73e4
--- /dev/null
@@ -0,0 +1,14 @@
+OBJS_API =     ../apilib/api_00000001_api_putchar.obj \\r
+               ../apilib/api_00000002_api_putstr.obj \\r
+               ../apilib/api_00000004_api_end.obj \\r
+               ../apilib/api_00000005_api_openwin.obj \\r
+               ../apilib/api_00000006_api_putstrwin.obj \\r
+               ../apilib/api_00000007_api_boxfilwin.obj \\r
+               ../apilib/api_00000008_api_initmalloc.obj \\r
+               ../apilib/api_00000009_api_malloc.obj \\r
+               ../apilib/api_00000010_api_free.obj \\r
+               ../apilib/api_00000011_api_point.obj \\r
+               ../apilib/api_00000012_api_refreshwin.obj \\r
+               ../apilib/api_00000013_api_linewin.obj \\r
+               ../apilib/api_00000014_api_closewin.obj \\r
+               ../apilib/api_00000015_api_getkey.obj 
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/apilib/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/app_make.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_008/app_make.txt
new file mode 100644 (file)
index 0000000..b7a511b
--- /dev/null
@@ -0,0 +1,98 @@
+#\83A\83v\83\8a\97papp_make.txt\r
+#\8aÂ\8b«\82É\8d\87\82í\82¹\82é\r
+\r
+TOOLPATH = ../../z_tools/\r
+INCPATH  = ../../z_tools/CHNOSProject/\r
+\r
+#OBJS_API = ../apilib/a_nask.obj\r
+include ../apilib/apilist.txt\r
+\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+NASK     = $(TOOLPATH)nask.exe\r
+CC1      = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet\r
+BIN2OBJ  = $(TOOLPATH)bin2obj.exe\r
+GAS2NASK = $(TOOLPATH)gas2nask.exe -a\r
+OBJ2BIM  = $(TOOLPATH)obj2bim.exe\r
+BIM2HRB  = $(TOOLPATH)bim2hrb.exe\r
+RULEFILE = $(INCPATH)CHNOSP.rul\r
+EDIMG    = $(TOOLPATH)edimg.exe bias:9\r
+IMGTOL   = $(TOOLPATH)imgtol.com\r
+MAKEFONT = $(TOOLPATH)makefont.exe\r
+COPY     = copy\r
+DEL      = del\r
+SJISCONV = $(TOOLPATH)sjisconv.exe -s\r
+\r
+#\83f\83t\83H\83\8b\83g\93®\8dì\r
+\r
+default :\r
+       $(MAKE) app\r
+\r
+#\83t\83@\83C\83\8b\90\90¬\8bK\91¥\r
+\r
+#$(APP).ca : $(APP).c Makefile\r
+#      $(SJISCONV) $(APP).c $(APP).ca\r
+\r
+#$(APP).gas : $(APP).ca Makefile\r
+#      $(CC1) -o $(APP).gas $(APP).ca\r
+\r
+#$(APP).nas : $(APP).gas Makefile\r
+#      $(GAS2NASK) $(APP).gas $(APP).nas\r
+\r
+$(APP).obj : $(APP).nas Makefile\r
+       $(NASK) $(APP).nas $(APP).obj $(APP).lst\r
+\r
+$(APP).bim : $(APP).obj $(OBJS_API) Makefile\r
+       $(OBJ2BIM) @$(RULEFILE) out:$(APP).bim map:$(APP).map $(APP).obj $(OBJS_API)\r
+\r
+$(APP).hrb : $(APP).bim Makefile\r
+       $(BIM2HRB) $(APP).bim $(APP).hrb $(MALLOC)\r
+\r
+chnos.img : ../chnos/chnipl.bin ../chnos/chnos.sys $(APP).hrb Makefile\r
+       $(EDIMG)   imgin:../../z_tools/fdimg0at.tek \\r
+               wbinimg src:../chnos/chnipl.bin len:512 from:0 to:0 \\r
+               copy from:../chnos/chnos.sys to:@: \\r
+               copy from:$(APP).hrb to:@: \\r
+               imgout:chnos.img\r
+\r
+#\88ê\94Ê\8bK\91¥\r
+\r
+%.ca : %.c Makefile\r
+       $(SJISCONV) $*.c $*.ca\r
+\r
+%.gas : %.ca Makefile\r
+       $(CC1) -o $*.gas $*.ca\r
+\r
+%.nas : %.gas Makefile\r
+       $(GAS2NASK) $*.gas $*.nas\r
+\r
+%.obj : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj $*.lst\r
+\r
+#\83R\83}\83\93\83h\r
+\r
+app :\r
+       $(COPY) ..\apilib.h ..\..\z_tools\CHNOSProject\apilib.h\r
+       $(MAKE) $(APP).hrb\r
+\r
+run :\r
+       $(MAKE) chnos.img\r
+       $(COPY) chnos.img ..\..\z_tools\qemu\fdimage0.bin\r
+       $(MAKE) -C ../../z_tools/qemu\r
+\r
+run_b :\r
+       $(MAKE) chnos.img\r
+       $(COPY) chnos.img ..\..\z_tools\bochs\fdimage0.bin\r
+       $(MAKE) -C ../../z_tools/bochs\r
+\r
+\r
+run_cd :\r
+       $(MAKE) iso\r
+       $(MAKE) -C ../../z_tools/qemu_iso\r
+\r
+iso :\r
+       $(MAKE) chnos.img\r
+       ..\..\z_tools\mkisofs.exe -v -iso-level 1 -b chnos.img -o ..\..\z_tools\qemu_iso\chnos.iso .\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DEL) $(APP).hrb\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/Makefile
new file mode 100644 (file)
index 0000000..6873c59
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = bug1\r
+STACK    = 1k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/bug1.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/bug1.c
new file mode 100644 (file)
index 0000000..7a90328
--- /dev/null
@@ -0,0 +1,13 @@
+#include <apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       char a[100];\r
+       a[10] = 'A';\r
+       api_putchar(a[10]);\r
+       a[10] = 'B';\r
+       api_putchar(a[102]);\r
+       a[10] = 'C';\r
+       api_putchar(a[123]);\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug1/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/Makefile
new file mode 100644 (file)
index 0000000..d3d7590
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = bug2\r
+STACK    = 1k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/bug2.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/bug2.c
new file mode 100644 (file)
index 0000000..2a10de5
--- /dev/null
@@ -0,0 +1,6 @@
+#include <apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       for(;;){}\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug2/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/Makefile
new file mode 100644 (file)
index 0000000..d3b4dc8
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = bug3\r
+STACK    = 1k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/bug3.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/bug3.c
new file mode 100644 (file)
index 0000000..0b7d2cb
--- /dev/null
@@ -0,0 +1,8 @@
+#include <apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       for(;;){\r
+               api_putchar('a');\r
+       }\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/bug3/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/Makefile
new file mode 100644 (file)
index 0000000..31d4b42
--- /dev/null
@@ -0,0 +1,127 @@
+\r
+#OBJS_BOOTPACK = naskfunc.obj hankaku.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj gdtidt.obj int.obj io.obj fifo.obj keyboard.obj timer.obj mouse.obj memory.obj sheet.obj window.obj system.obj bootpack.obj\r
+OBJS_BOOTPACK = naskfunc.obj hankaku.obj gdtidt.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj init.obj intrpt.obj io.obj memory.obj paging.obj sheet.obj fifo.obj mtask.obj timer.obj keyboard.obj mouse.obj window.obj console.obj file.obj uuid.obj api.obj bootpack.obj\r
+TOOLPATH = ../../z_tools/\r
+INCPATH  = ../../z_tools/CHNOSProject/\r
+\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+NASK     = $(TOOLPATH)nask.exe\r
+CC1      = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet\r
+BIN2OBJ  = $(TOOLPATH)bin2obj.exe\r
+GAS2NASK = $(TOOLPATH)gas2nask.exe -a\r
+OBJ2BIM  = $(TOOLPATH)obj2bim.exe\r
+BIM2HRB  = $(TOOLPATH)bim2hrb.exe\r
+RULEFILE = $(INCPATH)CHNOSP.rul\r
+EDIMG    = $(TOOLPATH)edimg.exe bias:9\r
+IMGTOL   = $(TOOLPATH)imgtol.com\r
+MAKEFONT = $(TOOLPATH)makefont.exe\r
+COPY     = copy\r
+DEL      = del\r
+SJISCONV = $(TOOLPATH)sjisconv.exe -s\r
+\r
+# \83f\83t\83H\83\8b\83g\93®\8dì\r
+\r
+default :\r
+       $(MAKE) img\r
+\r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥\r
+\r
+chnipl.bin : chnipl.nas Makefile\r
+       $(NASK) chnipl.nas chnipl.bin chnipl.lst\r
+\r
+hankaku.bin : hankaku.txt Makefile\r
+       $(MAKEFONT) hankaku.txt hankaku.bin\r
+\r
+hankaku.obj : hankaku.bin Makefile\r
+       $(BIN2OBJ) hankaku.bin hankaku.obj _hankaku\r
+\r
+asmhead.bin : asmhead.nas Makefile\r
+       $(NASK) asmhead.nas asmhead.bin asmhead.lst\r
+\r
+bootpack.gas : bootpack.c Makefile\r
+       $(CC1) -o bootpack.gas bootpack.c\r
+\r
+bootpack.nas : bootpack.gas Makefile\r
+       $(GAS2NASK) bootpack.gas bootpack.nas\r
+\r
+bootpack.obj : bootpack.nas Makefile\r
+       $(NASK) bootpack.nas bootpack.obj bootpack.lst\r
+\r
+naskfunc.obj : naskfunc.nas Makefile\r
+       $(NASK) naskfunc.nas naskfunc.obj naskfunc.lst\r
+\r
+bootpack.bim : $(OBJS_BOOTPACK) Makefile\r
+       $(OBJ2BIM) @$(RULEFILE) out:bootpack.bim stack:3136k map:bootpack.map \\r
+               $(OBJS_BOOTPACK)\r
+# 3MB+64KB=3136KB\r
+\r
+bootpack.hrb : bootpack.bim Makefile\r
+       $(BIM2HRB) bootpack.bim bootpack.hrb 0\r
+\r
+chnos.sys : asmhead.bin bootpack.hrb Makefile\r
+       copy /B asmhead.bin+bootpack.hrb chnos.sys\r
+\r
+chnos.img : chnipl.bin chnos.sys Makefile\r
+       $(EDIMG)   imgin:../../z_tools/fdimg0at.tek \\r
+               wbinimg src:chnipl.bin len:512 from:0 to:0 \\r
+               copy from:chnos.sys to:@: \\r
+               imgout:chnos.img\r
+\r
+#\88ê\94Ê\8bK\91¥\r
+\r
+%.ca : %.c Makefile\r
+       $(SJISCONV) $*.c $*.ca\r
+\r
+%.gas : %.ca core.h Makefile\r
+       $(CC1) -o $*.gas $*.ca\r
+\r
+%.nas : %.gas Makefile\r
+       $(GAS2NASK) $*.gas $*.nas\r
+\r
+%.obj : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj $*.lst\r
+\r
+\r
+\r
+# \83R\83}\83\93\83h\r
+\r
+img :\r
+       $(MAKE) chnos.img\r
+\r
+run :\r
+       $(MAKE) img\r
+       $(COPY) chnos.img ..\..\z_tools\qemu\fdimage0.bin\r
+       $(MAKE) -C ../../z_tools/qemu\r
+run_b :\r
+       $(MAKE) img\r
+       $(COPY) chnos.img ..\..\z_tools\bochs\fdimage0.bin\r
+       $(MAKE) -C ../../z_tools/bochs\r
+\r
+\r
+run_cd :\r
+       $(MAKE) iso\r
+       $(MAKE) -C ../../z_tools/qemu_iso\r
+\r
+install :\r
+       $(MAKE) img\r
+       $(IMGTOL) w a: chnos.img\r
+\r
+clean :\r
+       -$(DEL) *.bin\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.gas\r
+       -$(DEL) *.obj\r
+       -$(DEL) bootpack.nas\r
+       -$(DEL) bootpack.map\r
+       -$(DEL) bootpack.bim\r
+       -$(DEL) bootpack.hrb\r
+       -$(DEL) chnos.sys\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DEL) chnos.img\r
+\r
+iso :\r
+       $(MAKE)\r
+       ..\..\z_tools\mkisofs.exe -v -iso-level 1 -b chnos.img -o ..\..\z_tools\qemu_iso\chnos.iso .\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/api.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/api.c
new file mode 100644 (file)
index 0000000..7f09ab2
--- /dev/null
@@ -0,0 +1,144 @@
+\r
+#include "core.h"\r
+\r
+uint hrb_api(uint edi, uint esi, uint ebp, uint esp, uint ebx, uint edx, uint ecx, uint eax)\r
+{\r
+       UI_Task *task = task_now();\r
+       UI_Console *cons;\r
+       UI_Window *win;\r
+       uchar s[64];\r
+       uchar *app_s;\r
+       uint i;\r
+\r
+       uint *reg = &eax + 1;\r
+\r
+       for(i = 0; i < MAX_CONSOLES; i++){\r
+               if(system.ui.console.consoles[i].task == task)break;\r
+       }\r
+       cons = &system.ui.console.consoles[i];\r
+\r
+       if(edx == 1){\r
+               cons_put_char(cons, (uchar)(eax & 0xff));\r
+       } else if(edx == 2){\r
+               cons_put_str(cons, (uchar *)(ebx + cons->app_ds_base));\r
+       } else if(edx == 4){\r
+               return (uint)&(task->tss.esp0);\r
+       } else if(edx == 5){\r
+               win = make_window_app_compatible_hrb((uchar *)(ecx + cons->app_ds_base), esi, edi, 200, 100, sheet_get_topheight(), true, sys_memman_alloc(esi * edi * (system.data.info.vesa.BitsPerPixel >> 3)), task);\r
+               win->app_buf = (uchar *)(ebx + cons->app_ds_base);\r
+               win->app_buf_bits = 8;\r
+               boxfill8(win->app_buf, esi, COL8_FFFFFF, 0, 0, esi, edi);\r
+               reg[7] = GetWindowNumber(win);\r
+               sprintf(s, "winID = %u\n", reg[7]);\r
+               cons_put_str(cons, s);\r
+       } else if(edx == 6){\r
+               i = esi;\r
+               app_s = (uchar *)(ebp + cons->app_ds_base);\r
+               if(GetWindowInfo(ebx)->app_buf_bits == 8){\r
+                       for (; *app_s != 0x00; app_s++) {\r
+                               putfont8(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, esi, edi, eax, hankaku + (*app_s * 16));\r
+                               esi += 8;\r
+                       }\r
+               } else if(GetWindowInfo(ebx)->app_buf_bits == 16){\r
+                       for (; *app_s != 0x00; app_s++) {\r
+                               putfont16(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, esi, edi, eax, hankaku + (*app_s * 16));\r
+                               esi += 8;\r
+                       }\r
+               } else if(GetWindowInfo(ebx)->app_buf_bits == 32){\r
+                       for (; *app_s != 0x00; app_s++) {\r
+                               putfont32(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, esi, edi, eax, hankaku + (*app_s * 16));\r
+                               esi += 8;\r
+                       }\r
+               }\r
+               if((ebx & 1) == 0){\r
+                       putblock_i_convert(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize, i, edi, esi, edi + 16, GetWindowInfo(ebx)->app_buf, system.data.info.vesa.BitsPerPixel, GetWindowInfo(ebx)->app_buf_bits);\r
+                       sheet_refresh(GetWindowInfo(ebx)->win, i, edi, esi, edi + 16);\r
+               }\r
+       } else if(edx == 7){\r
+               boxfill_bpp(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, ebp, eax, ecx, esi, edi, GetWindowInfo(ebx)->app_buf_bits);\r
+               if((ebx & 1) == 0){\r
+                       putblock_i_convert(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize, eax, ecx, esi, edi, GetWindowInfo(ebx)->app_buf, system.data.info.vesa.BitsPerPixel, GetWindowInfo(ebx)->app_buf_bits);\r
+                       sheet_refresh(GetWindowInfo(ebx)->win, eax, ecx, esi, edi);\r
+               }\r
+       } else if(edx == 8){\r
+               memman_init((IO_MemoryControl *)(ebx + cons->app_ds_base));\r
+               ecx &= 0xfffffff0;\r
+               memman_free((IO_MemoryControl *)(ebx + cons->app_ds_base), (uchar *)eax, ecx);\r
+       } else if(edx == 9){\r
+               ecx = (ecx + 0x0f) & 0xfffffff0;\r
+               reg[7] = (uint)memman_alloc((IO_MemoryControl *)(ebx + cons->app_ds_base), ecx);\r
+       } else if(edx == 10){\r
+               ecx = (ecx + 0x0f) & 0xfffffff0;\r
+               memman_free((IO_MemoryControl *)(ebx + cons->app_ds_base), (uchar *)eax, ecx);\r
+       } else if(edx == 11){\r
+               point_bpp(GetWindowInfo(ebx)->app_buf, esi, edi, eax, GetWindowInfo(ebx)->winxsize, GetWindowInfo(ebx)->app_buf_bits);\r
+               if((ebx & 1) == 0){\r
+                       putblock_i_convert(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize, esi, edi, esi + 1, edi + 1, GetWindowInfo(ebx)->app_buf, system.data.info.vesa.BitsPerPixel, GetWindowInfo(ebx)->app_buf_bits);\r
+                       sheet_refresh(GetWindowInfo(ebx)->win, esi, edi, esi + 1, edi + 1);\r
+               }\r
+       } else if(edx == 12){\r
+               putblock_i_convert(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize, eax, ecx, esi, edi, GetWindowInfo(ebx)->app_buf, system.data.info.vesa.BitsPerPixel, GetWindowInfo(ebx)->app_buf_bits);\r
+               sheet_refresh(GetWindowInfo(ebx)->win, eax, ecx, esi, edi);\r
+       } else if(edx == 13){\r
+               line_bpp(GetWindowInfo(ebx)->app_buf, GetWindowInfo(ebx)->winxsize, eax, ecx, esi, edi, ebp, GetWindowInfo(ebx)->app_buf_bits);\r
+               if((ebx & 1) == 0){\r
+                       putblock_i_convert(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize, eax, ecx, esi, edi, GetWindowInfo(ebx)->app_buf, system.data.info.vesa.BitsPerPixel, GetWindowInfo(ebx)->app_buf_bits);\r
+                       sheet_refresh(GetWindowInfo(ebx)->win, eax, ecx, esi, edi);\r
+               }\r
+       } else if(edx == 14){\r
+               sys_memman_free(GetWindowInfo(ebx)->buf, GetWindowInfo(ebx)->winxsize * GetWindowInfo(ebx)->winysize * (system.data.info.vesa.BitsPerPixel >> 3));\r
+               free_window_app(GetWindowInfo(ebx));\r
+       } else if(edx == 15){\r
+               for(;;){\r
+                       io_cli();\r
+                       if(fifo32_status(&cons->task->fifo) == 0){\r
+                               if(eax == 0){\r
+                                       io_sti();\r
+                                       reg[7] = 0xFFFFFFFF;\r
+                                       return 0;\r
+                               } else{\r
+                                       task_sleep(cons->task);\r
+                               }\r
+                       } else {\r
+                               i = fifo32_get(&cons->task->fifo);\r
+                               io_sti();\r
+                               if(i == 1){\r
+                                       if(cons->cursor_on){\r
+                                               if(cons->cursor_state){\r
+                                                       cons->cursor_c = CONSOLE_COLOR_CHAR;\r
+                                                       cons->cursor_state = false;\r
+                                               } else{\r
+                                                       cons->cursor_c = CONSOLE_COLOR_BACKGROUND;\r
+                                                       cons->cursor_state = true;\r
+                                               }\r
+                                               boxfill_win(cons->win, cons->cursor_c, cons->cursor.x, cons->cursor.y, cons->cursor.x + 8, cons->cursor.y +16);\r
+                                       }\r
+                                       timer_settime(cons->timer, 50);\r
+                               } else if(i == CONSOLE_FIFO_CURSOR_START){\r
+                                       cons->cursor_on = true;\r
+                               } else if(i == CONSOLE_FIFO_CURSOR_STOP){\r
+                                       cons->cursor_on = false;\r
+                                       boxfill_win(cons->win, CONSOLE_COLOR_BACKGROUND, cons->cursor.x, cons->cursor.y, cons->cursor.x + 8, cons->cursor.y +16);\r
+                               } else if(CONSOLE_FIFO_START_KEYB <= i && i <= CONSOLE_FIFO_START_KEYB + DATA_BYTE){\r
+                                       i -= CONSOLE_FIFO_START_KEYB;\r
+                                               reg[7] = i;\r
+                                               return 0;\r
+                               }\r
+                       }\r
+               }\r
+       } else {\r
+               cons_put_str(cons, "Unknown api number.");\r
+               return (uint)&(task->tss.esp0);\r
+       }\r
+       return 0;\r
+}\r
+\r
+uint GetWindowNumber(UI_Window *win)\r
+{\r
+       return (uint)((win - system.ui.window.ctrl.winfos) << 1);\r
+}\r
+\r
+UI_Window *GetWindowInfo(uint n)\r
+{\r
+       return &system.ui.window.ctrl.winfos[n >> 1];\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/asmhead.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/asmhead.nas
new file mode 100644 (file)
index 0000000..6483b9b
--- /dev/null
@@ -0,0 +1,649 @@
+\r
+[INSTRSET "i486p"]\r
+VBEMODE equ             0x0115  ;0x0115\r
+;Graphic Modes\r
+;0x0100                640x400         256\r
+;0x0101                640x480         256\r
+;0x0102                800x600         16\r
+;0x0103                800x600         256\r
+;0x0104                1024x768        16\r
+;0x0105                1024x768        256\r
+;0x0106                1280x1024       16\r
+;0x0107                1280x1024       256\r
+;0x010D                320x200         32768           (1:5:5:5)\r
+;0x010E                320x200         65536           (0:5:6:5)\r
+;0x010F                320x200         16777216        (8:8:8:8)\r
+;0x0110                640x480         32768           (1:5:5:5)\r
+;0x0111                640x480         65536           (0:5:6:5)\r
+;0x0112                640x480         16777216        (8:8:8:8)\r
+;0x0113                800x600         32768           (1:5:5:5)\r
+;0x0114                800x600         65536           (0:5:6:5)\r
+;0x0115                800x600         16777216        (8:8:8:8)\r
+;0x0116                1024x768        32768           (1:5:5:5)\r
+;0x0117                1024x768        65536           (0:5:6:5)\r
+;0x0118                1024x768        16777216        (8:8:8:8)\r
+;0x0119                1280x1024       32768           (1:5:5:5)\r
+;0x011A                1280x1024       65536           (0:5:6:5) \r
+;0x011B                1280x1024       16777216        (8:8:8:8) \r
+\r
+\r
+BOTPAK  equ             0x00280000\r
+DSKCAC  equ             0x00100000\r
+DSKCAC0 equ             0x00008000\r
+\r
+; BOOT_INFO\r
+CYLS    equ             0x0ff0\r
+LEDS    equ             0x0ff1\r
+VMODE   equ             0x0ff2\r
+SCRNX   equ             0x0ff4\r
+SCRNY   equ             0x0ff6\r
+VRAM    equ             0x0ff8\r
+\r
+[BITS 16]\r
+\r
+        org     0xc200\r
+asmhead:\r
+        mov     ax, 0\r
+        mov     ss, ax\r
+        mov     sp, 0xc200\r
+        mov     ds, ax\r
+        mov     es, ax\r
+\r
+        call    backc\r
+\r
+        lea     esi, [msg001]\r
+        mov     edi, 0\r
+        call    printf\r
+\r
+        call    a20_try_loop\r
+\r
+        lea     esi, [msg002]\r
+        mov     edi, 80*2\r
+        call    printf\r
+\r
+        call    vbecheck\r
+        call    keyled\r
+        call    pmode\r
+\r
+\r
+;\83T\83u\83\8b\81[\83`\83\93\r
+\r
+halthalt:\r
+        lea     esi, [msg005]\r
+        mov     ax, 0xB800\r
+        mov     es, ax\r
+        mov     edi, 80*2*2*2*2\r
+        call    printf\r
+        call    entkeywait\r
+        call    shutdown\r
+\r
+printf:\r
+        push    eax\r
+        mov     ax, 0xB800\r
+        mov     es, ax\r
+printf_loop:\r
+        mov     al, byte [esi]\r
+        mov     byte [es:edi], al\r
+        or      al, al\r
+        jz      printf_end\r
+        inc     edi\r
+        mov     byte [es:edi], 0x03\r
+        inc     esi\r
+        inc     edi\r
+        jmp     printf_loop\r
+printf_end:\r
+        pop     eax\r
+        ret\r
+\r
+backc:\r
+        mov     ax,0xb800\r
+        mov     es,ax\r
+        mov     di,0\r
+        mov     ax,word[backcc]\r
+        mov     cx,0x7ff\r
+\r
+paint:\r
+        mov     word[es:di],ax\r
+        add     di,2\r
+        dec     cx\r
+        jnz     paint\r
+        ret\r
+\r
+A20_TEST_LOOPS          equ     32\r
+A20_ENABLE_LOOPS        equ     255\r
+A20_TEST_ADDR           equ     4*0x80\r
+\r
+\r
+a20_try_loop:\r
+a20_none:\r
+        call    a20_test\r
+        jnz     a20_done\r
+a20_bios:\r
+        mov     ax, 0x2401\r
+\r
+        pushfd\r
+        int     0x15\r
+        popfd\r
+        call    a20_test\r
+        jnz     a20_done\r
+a20_kbc:\r
+        call    empty_8042\r
+        call    a20_test\r
+        jnz     a20_done\r
+        mov     al, 0xD1\r
+        out     0x64, al\r
+        call    empty_8042\r
+        mov     al, 0xDF\r
+        out     0x60, al\r
+        call    empty_8042\r
+a20_kbc_wait:\r
+        xor     cx, cx\r
+a20_kbc_wait_loop:\r
+        call    a20_test\r
+        jnz     a20_done\r
+        loop    a20_kbc_wait_loop\r
+a20_fast:\r
+        in      al, 0x92\r
+        or      al, 0x02\r
+\r
+        and     al, 0xFE\r
+        out     0x92, al\r
+a20_fast_wait:\r
+        xor     cx, cx\r
+a20_fast_wait_loop:\r
+        call    a20_test\r
+        jnz     a20_done\r
+        loop    a20_fast_wait_loop\r
+        dec     byte [a20_tries]\r
+        jnz     a20_try_loop\r
+\r
+a20_die:\r
+        lea     esi, [msg003]    \r
+        mov     edi, 80*2          \r
+        call    printf\r
+        jmp     halthalt\r
+\r
+a20_tries:\r
+        db      A20_ENABLE_LOOPS\r
+\r
+a20_done:\r
+        ret\r
+\r
+a20_test:\r
+        push    cx\r
+        push    ax\r
+        xor     cx, cx\r
+        mov     fs, cx                      \r
+        dec     cx\r
+        mov     gs, cx                      \r
+        mov     cx, A20_TEST_LOOPS\r
+        mov     ax, word [fs:A20_TEST_ADDR]\r
+        push    ax\r
+a20_test_wait:\r
+        inc     ax\r
+        mov     word [fs:A20_TEST_ADDR], ax\r
+        call    delay\r
+        cmp     ax, word [gs:A20_TEST_ADDR+0x10]\r
+        loop    a20_test_wait\r
+\r
+        pop     word [fs:A20_TEST_ADDR]\r
+        pop     ax\r
+        pop     cx\r
+        ret\r
+\r
+empty_8042:\r
+        push    ecx\r
+        mov     ecx, 100000\r
+\r
+empty_8042_loop:\r
+        dec     ecx\r
+        jz      empty_8042_end_loop\r
+\r
+        call    delay\r
+\r
+        in      al, 0x64\r
+        test    al, 1           \r
+        jz      no_output\r
+\r
+        call    delay\r
+;       in      al, 0x60\r
+        jmp     empty_8042_loop\r
+\r
+no_output:\r
+        test    al, 2\r
+        jnz     empty_8042_loop\r
+\r
+empty_8042_end_loop:\r
+        pop     ecx\r
+        ret\r
+\r
+delay:\r
+        out     0x80, al\r
+        ret\r
+\r
+getc:\r
+        mov     ah,0x00\r
+        int     0x16\r
+        ret\r
+\r
+vbecheck:\r
+        lea     esi, [msg007]\r
+        mov     edi, 80*2*3             \r
+        call    printf\r
+\r
+        lea     esi, [msg008]\r
+        mov     edi, 80*2*4\r
+        call    printf\r
+\r
+        lea     esi, [msg009]\r
+        mov     edi, 80*2*5\r
+        call    printf\r
+\r
+        lea     esi, [msg010]\r
+        mov     edi, 80*2*6\r
+        call    printf\r
+\r
+        lea     esi, [msg011]\r
+        mov     edi, 80*2*7\r
+        call    printf\r
+\r
+        lea     esi, [msg012]\r
+        mov     edi, 80*2*8\r
+        call    printf\r
+\r
+        call    getc\r
+\r
+        cmp     ah,0x01\r
+        je      vbe00\r
+\r
+        cmp     ah,0x02\r
+        je      vbe01\r
+        cmp     ah,0x03\r
+        je      vbe02\r
+        cmp     ah,0x04\r
+        je      vbe03\r
+        cmp     ah,0x05\r
+        je      vbe04\r
+        cmp     ah,0x06\r
+        je      vbe05\r
+        cmp     ah,0x07\r
+        je      vbe06\r
+        cmp     ah,0x08\r
+        je      vbe07\r
+        cmp     ah,0x09\r
+        je      vbe08\r
+        cmp     ah,0x0a\r
+        je      vbe09\r
+\r
+        cmp     ah,0x1e\r
+        je      vbe0a\r
+        cmp     ah,0x30\r
+        je      vbe0b\r
+        cmp     ah,0x2e\r
+        je      vbe0c\r
+        cmp     ah,0x20\r
+        je      vbe0d\r
+        cmp     ah,0x12\r
+        je      vbe0e\r
+        cmp     ah,0x21\r
+        je      vbe0f\r
+        cmp     ah,0x22\r
+        je      vbe0g\r
+        cmp     ah,0x23\r
+        je      vbe0h\r
+        cmp     ah,0x17\r
+        je      vbe0i\r
+\r
+        cmp     ah,0x2d\r
+        je      vbetext\r
+\r
+        jmp     vbecheck\r
+\r
+vbe00:\r
+        mov     al,0x13\r
+        mov     ah,0x00\r
+        int     0x10\r
+        mov     ax,0xe0\r
+        mov     es,ax\r
+        mov     di,0\r
+        mov     word[es:di+0x12],320\r
+        mov     word[es:di+0x14],200\r
+        mov     byte[es:di+0x19],8\r
+        mov     dword[es:di+0x28],0x000a0000\r
+        mov     byte[VMODE],8\r
+        mov     word[SCRNX],320\r
+        mov     word[SCRNY],200\r
+        mov     dword[VRAM],0x000a0000\r
+        ret\r
+\r
+vbe01:\r
+        mov     word[videomode],0x010f\r
+        jmp     vbesub\r
+vbe02:\r
+        mov     word[videomode],0x0112\r
+        jmp     vbesub\r
+vbe03:\r
+        mov     word[videomode],0x0115\r
+        jmp     vbesub\r
+vbe04:\r
+        mov     word[videomode],0x0118\r
+        jmp     vbesub\r
+vbe05:\r
+        mov     word[videomode],0x011b\r
+        jmp     vbesub\r
+vbe06:\r
+        mov     word[videomode],0x011f\r
+        jmp     vbesub\r
+vbe07:\r
+        mov     word[videomode],0x010e\r
+        jmp     vbesub\r
+vbe08:\r
+        mov     word[videomode],0x0111\r
+        jmp     vbesub\r
+vbe09:\r
+        mov     word[videomode],0x0114\r
+        jmp     vbesub\r
+vbe0a:\r
+        mov     word[videomode],0x0117\r
+        jmp     vbesub\r
+vbe0b:\r
+        mov     word[videomode],0x011a\r
+        jmp     vbesub\r
+vbe0c:\r
+        mov     word[videomode],0x011e\r
+        jmp     vbesub\r
+vbe0d:\r
+        mov     word[videomode],0x0100\r
+        jmp     vbesub\r
+vbe0e:\r
+        mov     word[videomode],0x0101\r
+        jmp     vbesub\r
+vbe0f:\r
+        mov     word[videomode],0x0103\r
+        jmp     vbesub\r
+vbe0g:\r
+        mov     word[videomode],0x0105\r
+        jmp     vbesub\r
+vbe0h:\r
+        mov     word[videomode],0x0107\r
+        jmp     vbesub\r
+vbe0i:\r
+        mov     word[videomode],0x011c\r
+        jmp     vbesub\r
+\r
+vbesub:\r
+        mov     ax,0xe0\r
+        mov     es,ax\r
+        mov     di,0\r
+        mov     cx,[videomode]\r
+        mov     ax,0x4f01\r
+        int     0x10\r
+\r
+        mov     ax,0x9000\r
+        mov     es,ax\r
+        mov     di,0\r
+        mov     ax,0x4f00\r
+        int     0x10\r
+        cmp     ax,0x004f\r
+        jne     scrn320\r
+        mov     ax,[es:di+4]\r
+        cmp     ax,0x0200\r
+        jb      scrn320\r
+        mov     cx,[videomode]\r
+        mov     ax,0x4f01\r
+        int     0x10\r
+        cmp     ax,0x004f\r
+        jne     scrn320\r
+\r
+        mov     bx,[videomode]\r
+        add     bx,0x4000\r
+        mov     ax,0x4f02\r
+        int     0x10\r
+        mov     byte[VMODE],16\r
+        mov     ax,[es:di+0x12]\r
+        mov     [SCRNX],ax\r
+        mov     ax,[es:di+0x14]\r
+        mov     [SCRNY],ax\r
+        mov     eax,[es:di+0x28]\r
+        mov     [VRAM],eax\r
+        ret\r
+\r
+vbetext:\r
+        mov     byte[VMODE],0\r
+        mov     word[SCRNX],80\r
+        mov     word[SCRNY],25\r
+        mov     dword[VRAM],0xb8000\r
+        ret\r
+\r
+scrn320:\r
+\r
+        lea     esi, [msg004]            \r
+        mov     edi, 80*2*2*2       \r
+        call    printf\r
+       call    entkeywait\r
+        jmp     vbecheck\r
+\r
+keyled:\r
+        mov     ah,0x02\r
+        int     0x16\r
+        mov     [LEDS],al\r
+        ret\r
+\r
+pmode:\r
+        mov     al,0xff\r
+        out     0x21,al\r
+        nop\r
+        out     0xa1,al\r
+        cli\r
+\r
+        lgdt    [GDTR0]\r
+        mov     eax,cr0\r
+        and     eax,0x7fffffff\r
+        or      eax,0x00000001\r
+        mov     cr0,eax\r
+        jmp     pipelineflush\r
+pipelineflush:\r
+        mov     ax,1*8\r
+        mov     ds,ax\r
+        mov     es,ax\r
+        mov     fs,ax\r
+        mov     gs,ax\r
+        mov     ss,ax\r
+        mov     esi,bootpack    \r
+        mov     edi,BOTPAK      \r
+        mov     ecx,512*1024/4\r
+        call    memcpy\r
+        mov     esi,0x7c00\r
+        mov     edi,DSKCAC\r
+        mov     ecx,512/4\r
+\r
+        call    memcpy\r
+        mov     esi,DSKCAC0+512\r
+        mov     edi,DSKCAC+512\r
+        mov     ecx,0\r
+        mov     cl,byte[CYLS]\r
+        imul    ecx,512*18*2/4\r
+        sub     ecx,512/4\r
+        call    memcpy\r
+\r
+        mov     ebx,BOTPAK\r
+        mov     ecx,[ebx+16]\r
+        add     ecx,3\r
+        shr     ecx,2\r
+        jz      skip\r
+        mov     esi,[ebx+20]\r
+        add     esi,ebx\r
+        mov     edi,[ebx+12]\r
+        call    memcpy\r
+skip:\r
+        mov     esp,[ebx+12]\r
+        jmp     dword 2*8:0x0000001b\r
+\r
+\r
+memcpy:\r
+        mov     eax,[esi]\r
+        add     esi,4\r
+        mov     [edi],eax\r
+        add     edi,4\r
+        sub     ecx,1\r
+        jnz     memcpy\r
+        ret\r
+\r
+entkeywait:\r
+        mov     ah,0\r
+        int     0x16\r
+        cmp     ah,0x1c\r
+        jne     entkeywait\r
+        ret\r
+\r
+shutdown:\r
+        mov     ax,0x5300\r
+        mov     bx,0\r
+        int     0x15\r
+        jc      thend\r
+        mov     ax,0x5301\r
+        mov     bx,0\r
+        int     0x15\r
+        mov     ax,0x530e\r
+        mov     bx,0\r
+        mov     cx,0x0101\r
+        int     0x15\r
+        jc      thend\r
+        mov     ax,0x530f\r
+        mov     bx,0x0001\r
+        mov     cx,0x0001\r
+        int     0x15\r
+        jc      thend\r
+        mov     ax,0x5308\r
+        mov     bx,0x0001\r
+        mov     cx,0x0001\r
+        int     0x15\r
+        jc      thend\r
+        mov     ax,0x5307\r
+        mov     bx,0x0001\r
+        mov     cx,0x0003\r
+        int     0x15\r
+        hlt\r
+\r
+thend:\r
+        lea     esi, [msg006]\r
+        mov     ax, 0xB800\r
+        mov     es, ax\r
+        mov     edi, 80*2*2*2*2\r
+        call    printf\r
+thend2:\r
+        hlt\r
+        jmp     thend2\r
+\r
+;data\r
+\r
+msg001: db      "Welcome to chnos project .",0\r
+msg002: db      "A20GATE on .",0\r
+msg003: db      "A20GATE filed .",0\r
+msg004: db      "Video mode is not supported or invalid.",0\r
+msg005: db      "Press the Enter key to shut down ...",0\r
+msg006: db      "Sorry . Shutdown filed . Press power button .",0\r
+msg007: db      "Video Mode List. Please select the mode number.",0\r
+msg008: db      "32bit--1:320x200--2:640x480--3:800x600--4:1024x768--5:1280x1024--6:1600x1200",0\r
+msg009: db      "16bit--7:320x200--8:640x480--9:800x600--a:1024x768--b:1280x1024--c:1600x1200",0\r
+msg010: db      " 8bit--d:640x400--e:640x480--f:800x600--g:1024x768--h:1280x1024--i:1600x1200",0\r
+msg011: db      "Press ESC to start in VGA mode.",0\r
+msg012: db      "Press X to start in TEXT mode.",0\r
+backcc: db      ".",0x03\r
+\r
+videomode:      dw 0\r
+\r
+                alignb  16\r
+GDT0:\r
+                resb    8                               ; \83k\83\8b\83Z\83\8c\83N\83^\r
+                dw              0xffff,0x0000,0x9200,0x00cf     ; \93Ç\82Ý\8f\91\82«\89Â\94\\83Z\83O\83\81\83\93\83g32bit\r
+                dw              0xffff,0x0000,0x9a28,0x0047     ; \8eÀ\8ds\89Â\94\\83Z\83O\83\81\83\93\83g32bit\81ibootpack\97p\81j\r
+\r
+                dw              0\r
+GDTR0:\r
+                dw              8*3-1\r
+                dd              GDT0\r
+\r
+                alignb  16\r
+bootpack:\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/bootpack.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/bootpack.c
new file mode 100644 (file)
index 0000000..b615362
--- /dev/null
@@ -0,0 +1,215 @@
+\r
+#include "core.h"\r
+\r
+struct SYSTEM *sys_main_str_buf;\r
+\r
+void CHNMain(void)\r
+{\r
+       uchar s[128];\r
+       int i;\r
+       UI_Timer *t_1sec;\r
+       uint new_tsc[2];\r
+       uint old_tsc[2];\r
+       uint sec_clock[2];\r
+\r
+       init_system();\r
+\r
+       init_screen_i(system.ui.draw.sht.desktop_buf, system.ui.draw.sht.taskbar_buf, system.ui.draw.sht.mouse_buf);\r
+       sheet_updown(system.ui.draw.sht.core, -1);\r
+\r
+       sheet_updown(system.ui.draw.sht.desktop, 0);\r
+       sheet_updown(system.ui.draw.sht.taskbar, 1);\r
+       sheet_updown(system.ui.draw.sht.mouse, 2);\r
+\r
+       t_1sec = timer_alloc();\r
+       timer_init(t_1sec, &system.data.fifo.main, 1);\r
+       timer_settime_millisec(t_1sec, 1000);\r
+\r
+       system.ui.console.consoles[0].win = make_window("console", system.ui.console.org_xsize, system.ui.console.org_ysize, 10, 10, sheet_get_topheight(), false);\r
+       system.ui.console.consoles[0].task = task_alloc();\r
+       system.ui.console.consoles[0].task->tss.esp = (int)sys_memman_alloc(64 * 1024) + 64 * 1024;\r
+       system.ui.console.consoles[0].task->tss.eip = (int)&console_main;\r
+       system.ui.console.consoles[0].task->tss.es = 1 * 8;\r
+       system.ui.console.consoles[0].task->tss.cs = 2 * 8;\r
+       system.ui.console.consoles[0].task->tss.ss = 1 * 8;\r
+       system.ui.console.consoles[0].task->tss.ds = 1 * 8;\r
+       system.ui.console.consoles[0].task->tss.fs = 1 * 8;\r
+       system.ui.console.consoles[0].task->tss.gs = 1 * 8;\r
+       task_arguments(system.ui.console.consoles[0].task, 2, &system.ui.console.consoles[0]);\r
+       task_run(system.ui.console.consoles[0].task, 2, 2);\r
+\r
+       for(;;){\r
+               io_cli();\r
+               if(fifo32_status(&system.data.fifo.main) == 0){\r
+                       task_sleep(system.ui.task.main);\r
+                       io_sti();\r
+               } else{\r
+                       i = fifo32_get(&system.data.fifo.main);\r
+                       if(i == 1){\r
+                               sprintf(s, "%02X%02X/%02X/%02X", readcmos(0x32), readcmos(0x09), readcmos(0x08), readcmos(0x07));\r
+                               putfonts_asc_sht_i(system.ui.draw.sht.taskbar, (system.data.info.boot.scrnx - (8 * 10)) - 4, 4, 0x000000, 0xffffff, s);\r
+                               sprintf(s, "%02X:%02X:%02X", readcmos(0x04), readcmos(0x02), readcmos(0x00));\r
+                               putfonts_asc_sht_i(system.ui.draw.sht.taskbar, (system.data.info.boot.scrnx - (8 * 9)) - 4, 4 + 16, 0x000000, 0xffffff, s);\r
+                               old_tsc[0] = new_tsc[0];\r
+                               old_tsc[1] = new_tsc[1];\r
+                               read_tsc(new_tsc);\r
+                               if(new_tsc[1] > old_tsc[1]){\r
+                                       sec_clock[0] = new_tsc[0] - old_tsc[0];\r
+                                       sec_clock[1] = new_tsc[1] - old_tsc[1];\r
+                               } else if(new_tsc[1] < old_tsc[1]){\r
+                                       sec_clock[0] = new_tsc[0] - old_tsc[0] - 1;\r
+                                       sec_clock[1] = (0xffffffff - old_tsc[1]) + new_tsc[1];\r
+                               }\r
+                               sprintf(s, "%08u%08u", sec_clock[0], sec_clock[1]);\r
+                               putfonts_asc_sht_i(system.ui.draw.sht.taskbar, (system.data.info.boot.scrnx - (8 * (10 + 1 + 3 + 21 + 1))) - 4, 20, 0x000000, 0xffffff, s);\r
+\r
+                               timer_settime_millisec(t_1sec, 1000);\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+void KeyBoardControlTask(void)\r
+{\r
+       int i;\r
+       uchar s[128];\r
+       UI_KeyInfo dec_key;\r
+       UI_Console *key_to;\r
+\r
+       key_to = (UI_Console *)0;\r
+\r
+       for(;;){\r
+               if(fifo32_status(&system.data.fifo.keycmd) > 0 && system.io.keyboard.cmd_wait < 0){\r
+                       system.io.keyboard.cmd_wait = fifo32_get(&system.data.fifo.keycmd);\r
+                       wait_KBC_sendready();\r
+                       io_out8(KEYB_DATA, system.io.keyboard.cmd_wait);\r
+               }\r
+               io_cli();\r
+               if(fifo32_status(&system.data.fifo.keyctrl) == 0){\r
+                       task_sleep(system.ui.task.keyctrl);\r
+                       io_sti();\r
+               } else{\r
+                       i = fifo32_get(&system.data.fifo.keyctrl);\r
+                       if(0x100 <= i && i <= 0x1ff){\r
+                               decode_key(&dec_key, i - 0x100);\r
+                               if(dec_key.make && dec_key.c != 0){/*\92Ê\8fí\95\8e\9a*/\r
+                                       sprintf(s, "[ ]");\r
+                                       s[1] = dec_key.c;\r
+                                       putfonts_asc_sht_i(system.ui.draw.sht.taskbar, (system.data.info.boot.scrnx - (8 * (10 + 1 + 3))) - 4, 4, 0x000000, 0xffffff, s);\r
+                                       if(key_to != 0) fifo32_put(&key_to->task->fifo, dec_key.c + CONSOLE_FIFO_START_KEYB);\r
+                               } else if(dec_key.make && dec_key.keycode == 0x3B && key_shift != 0){/*Shift + F1*/\r
+                                       if(key_to != 0 && key_to->task->tss.ss0 != 0){\r
+                                               cons_put_str(key_to, "\nBreak(key) :\n");\r
+                                               io_cli();\r
+                                               key_to->task->tss.eax = (int)&(key_to->task->tss.esp0);\r
+                                               key_to->task->tss.eip = (int)asm_end_app;\r
+                                               change_window_active(key_to->win, true);\r
+                                               io_sti();\r
+                                       }\r
+                               } else if(dec_key.make && dec_key.keycode == 0x0E){/*BackSpace*/\r
+                                       if(key_to != 0) fifo32_put(&key_to->task->fifo, 0x0e + CONSOLE_FIFO_START_KEYB);\r
+                               } else if(dec_key.make && dec_key.keycode == 0x0f){/*Tab*/\r
+                                       if(key_to == 0){\r
+                                               key_to = &system.ui.console.consoles[0];\r
+                                               change_window_active(key_to->win, true);\r
+                                               fifo32_put(&key_to->task->fifo, CONSOLE_FIFO_CURSOR_START);\r
+                                       } else{\r
+                                               fifo32_put(&key_to->task->fifo, CONSOLE_FIFO_CURSOR_STOP);\r
+                                               change_window_active(key_to->win, false);\r
+                                               key_to = (UI_Console *)0;\r
+                                       }\r
+                               } else if(dec_key.make && dec_key.keycode == 0x57){/*F11*/\r
+                                       if(system.ui.draw.sht.ctrl.top > 3) sheet_updown(system.ui.draw.sht.ctrl.sheets[2], sheet_get_topheight());\r
+                               } else if(dec_key.make && dec_key.keycode == 0x1c){/*Enter*/\r
+                                       if(key_to != 0) fifo32_put(&key_to->task->fifo, 0x0a + CONSOLE_FIFO_START_KEYB);\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+void MouseControlTask(void)\r
+{\r
+       int i, mx, my, scrool = 0;\r
+       int j, x, y;\r
+       int k;\r
+       UI_Sheet *sht = 0;\r
+       int mmx = -1, mmy = -1;\r
+       bool win_move = false;\r
+       uchar s[128];\r
+\r
+       mx = system.data.info.boot.scrnx >> 1;\r
+       my = system.data.info.boot.scrny >> 1;\r
+\r
+       for(;;){\r
+               io_cli();\r
+               if(fifo32_status(&system.data.fifo.mousectrl) == 0){\r
+                       task_sleep(system.ui.task.mousectrl);\r
+                       io_sti();\r
+               } else{\r
+                       i = fifo32_get(&system.data.fifo.mousectrl);\r
+                       if(0x100 <= i && i <= 0x1ff){\r
+                               if(decode_mouse(i - 0x100) != 0){\r
+                                       mx += system.io.mouse.decode.x;\r
+                                       my += system.io.mouse.decode.y;\r
+                                       if(mx < 0) mx = 0;\r
+                                       if(my < 0) my = 0;\r
+                                       if(mx > system.data.info.boot.scrnx - 1) mx = system.data.info.boot.scrnx - 1;\r
+                                       if(my > system.data.info.boot.scrny - 1) my = system.data.info.boot.scrny - 1;\r
+\r
+                                       if(system.io.mouse.decode.scrool == 0xFFFFFFFF) scrool++;\r
+                                       if(system.io.mouse.decode.scrool == 0x00000001) scrool--;\r
+\r
+                                       sprintf(s, "[lcr](%4d,%4d,%04d)", mx, my, scrool);\r
+                                       if((system.io.mouse.decode.btn & 0x01) != 0){\r
+                                               s[1] = 'L';\r
+                                               if(win_move == false){\r
+                                                       for(j = system.ui.draw.sht.ctrl.top - 1; j >= 1; j--){\r
+                                                               sht = system.ui.draw.sht.ctrl.sheets[j];\r
+                                                               x = mx - sht->vx0;\r
+                                                               y = my - sht->vy0;\r
+                                                               if(0 <= x && x < sht->bxsize && 0 <= y && y < sht->bysize){\r
+                                                                       sheet_updown(sht, sheet_get_topheight());\r
+                                                                       if(0 <= y && y <= 24){\r
+                                                                               for(k = 0;k < MAX_WINDOWS;k++){\r
+                                                                                       if(system.ui.window.ctrl.winfos[k].win == sht) break;\r
+                                                                               }\r
+                                                                               if(k < MAX_WINDOWS && y <= 16 && (sht->bxsize - 44) <= x && x <= (sht->bxsize - 4) && system.ui.window.ctrl.winfos[k].task != 0){\r
+                                                                                       io_cli();\r
+                                                                                       system.ui.window.ctrl.winfos[k].task->tss.eax = (int)&(system.ui.window.ctrl.winfos[k].task->tss.esp0);\r
+                                                                                       system.ui.window.ctrl.winfos[k].task->tss.eip = (int)asm_end_app;\r
+                                                                                       change_window_active(&system.ui.window.ctrl.winfos[k], true);\r
+                                                                                       io_sti();\r
+                                                                               }\r
+                                                                               if(k < MAX_WINDOWS){\r
+                                                                                       win_move = true;\r
+                                                                                       mmx = mx;\r
+                                                                                       mmy = my;\r
+                                                                               }\r
+                                                                       }\r
+                                                                       break;\r
+                                                               }\r
+                                                       }\r
+                                               } else{\r
+                                                       x = mx - mmx;\r
+                                                       y = my - mmy;\r
+                                                       sheet_slide(sht, sht->vx0 + x, sht->vy0 + y);\r
+                                                       mmx = mx;\r
+                                                       mmy = my;\r
+                                               }\r
+                                       } else{\r
+                                               win_move = false;\r
+                                       }\r
+                                       if((system.io.mouse.decode.btn & 0x02) != 0){\r
+                                               s[3] = 'R';\r
+                                       }\r
+                                       if((system.io.mouse.decode.btn & 0x04) != 0){\r
+                                               s[2] = 'C';\r
+                                       }\r
+                                       putfonts_asc_sht_i(system.ui.draw.sht.taskbar, (system.data.info.boot.scrnx - (8 * (10 + 1 + 3 + 21 + 1))) - 4, 4, 0x000000, 0xffffff, s);\r
+                                       sheet_slide(system.ui.draw.sht.mouse, mx, my);\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/chnipl.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/chnipl.nas
new file mode 100644 (file)
index 0000000..0080cac
--- /dev/null
@@ -0,0 +1,183 @@
+\r
+[INSTRSET "i486p"]\r
+\r
+               org             0x7c00                  ; \82±\82Ì\83v\83\8d\83O\83\89\83\80\82ª\82Ç\82±\82É\93Ç\82Ý\8d\9e\82Ü\82ê\82é\82Ì\82©\r
+\r
+; \88È\89º\82Í\95W\8f\80\93I\82Èfat12\83t\83H\81[\83}\83b\83g\83t\83\8d\83b\83s\81[\83f\83B\83X\83N\82Ì\82½\82ß\82Ì\8bL\8fq\r
+\r
+               jmp             entry\r
+               db              0x90\r
+               db              "chnos   "              ; \83u\81[\83g\83Z\83N\83^\82Ì\96¼\91O\82ð\8e©\97R\82É\8f\91\82¢\82Ä\82æ\82¢\81i8\83o\83C\83g\81j\r
+               dw              512                             ; 1\83Z\83N\83^\82Ì\91å\82«\82³\81i512\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+               db              1                               ; \83N\83\89\83X\83^\82Ì\91å\82«\82³\81i1\83Z\83N\83^\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+               dw              1                               ; fat\82ª\82Ç\82±\82©\82ç\8en\82Ü\82é\82©\81i\95\81\92Ê\82Í1\83Z\83N\83^\96Ú\82©\82ç\82É\82·\82é\81j\r
+               db              2                               ; fat\82Ì\8cÂ\90\94\81i2\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+               dw              224                             ; \83\8b\81[\83g\83f\83B\83\8c\83N\83g\83\8a\97Ì\88æ\82Ì\91å\82«\82³\81i\95\81\92Ê\82Í224\83G\83\93\83g\83\8a\82É\82·\82é\81j\r
+               dw              2880                    ; \82±\82Ì\83h\83\89\83C\83u\82Ì\91å\82«\82³\81i2880\83Z\83N\83^\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+               db              0xf0                    ; \83\81\83f\83B\83A\82Ì\83^\83C\83v\81i0xf0\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+               dw              9                               ; fat\97Ì\88æ\82Ì\92·\82³\81i9\83Z\83N\83^\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+               dw              18                              ; 1\83g\83\89\83b\83N\82É\82¢\82­\82Â\82Ì\83Z\83N\83^\82ª\82 \82é\82©\81i18\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+               dw              2                               ; \83w\83b\83h\82Ì\90\94\81i2\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+               dd              0                               ; \83p\81[\83e\83B\83V\83\87\83\93\82ð\8eg\82Á\82Ä\82È\82¢\82Ì\82Å\82±\82±\82Í\95K\82¸0\r
+               dd              2880                    ; \82±\82Ì\83h\83\89\83C\83u\91å\82«\82³\82ð\82à\82¤\88ê\93x\8f\91\82­\r
+               db              0,0,0x29                ; \82æ\82­\82í\82©\82ç\82È\82¢\82¯\82Ç\82±\82Ì\92l\82É\82µ\82Ä\82¨\82­\82Æ\82¢\82¢\82ç\82µ\82¢\r
+               dd              0xffffffff              ; \82½\82Ô\82ñ\83{\83\8a\83\85\81[\83\80\83V\83\8a\83A\83\8b\94Ô\8d\86\r
+               db              "chnosboot  "   ; \83f\83B\83X\83N\82Ì\96¼\91O\81i11\83o\83C\83g\81j\r
+               db              "fat12   "              ; \83t\83H\81[\83}\83b\83g\82Ì\96¼\91O\81i8\83o\83C\83g\81j\r
+               resb    18                              ; \82Æ\82è\82 \82¦\82¸18\83o\83C\83g\82 \82¯\82Ä\82¨\82­\r
+\r
+; \83v\83\8d\83O\83\89\83\80\96{\91Ì\r
+\r
+entry:\r
+               mov             ax,0                    ; \83\8c\83W\83X\83^\8f\89\8aú\89»\r
+               mov             ss,ax\r
+               mov             sp,0x7c00\r
+               mov             ds,ax\r
+\r
+; \83f\83B\83X\83N\82ð\93Ç\82Þ\r
+\r
+        mov     ax,0x0820\r
+        mov     es,ax\r
+        mov     ch,0            ; \83V\83\8a\83\93\83_0\r
+        mov     dh,0            ; \83w\83b\83h0\r
+        mov     cl,2            ; \83Z\83N\83^2\r
+        mov     bx,18*2-1       ; \93Ç\82Ý\8d\9e\82Ý\82½\82¢\8d\87\8cv\83Z\83N\83^\90\94 (2006.12.23 \83o\83O\8fC\90³)\r
+        call    readfast        ; \8d\82\91¬\93Ç\82Ý\8d\9e\82Ý\r
+\r
+        mov     bx,4312+0x8200+2\r
+fatloop:\r
+        add     bx,-2\r
+        cmp     word [bx],0\r
+        jz      fatloop\r
+        mov     ax,bx\r
+        add     ax,-0x8200-5+54+53\r
+        mov     bl,54\r
+        div     bl              ; al = ax / bl\r
+\r
+        cmp     al,0\r
+        jnz     fatskip1\r
+        mov     al,1\r
+fatskip1:\r
+        cmp     al,33\r
+        jbe     fatskip2\r
+        mov     al,33\r
+fatskip2:\r
+        mov     [0x0ff0],al     ; ipl\82ª\82Ç\82±\82Ü\82Å\93Ç\82ñ\82¾\82Ì\82©\82ð\83\81\83\82\r
+        add     al,-1\r
+        jz      fatskip3\r
+        mov     ah,0\r
+        imul    bx,ax,18*2\r
+\r
+        mov     ax,0x0c80\r
+        mov     es,ax\r
+        mov     ch,1            ; \83V\83\8a\83\93\83_1\r
+        mov     dh,0            ; \83w\83b\83h0\r
+        mov     cl,1            ; \83Z\83N\83^1\r
+        call    readfast        ; \8d\82\91¬\93Ç\82Ý\8d\9e\82Ý\r
+fatskip3:\r
+\r
+; \93Ç\82Ý\8fI\82í\82Á\82½\82Ì\82Åharibote.sys\82ð\8eÀ\8ds\82¾\81I\r
+\r
+        jmp     0xc200\r
+\r
+\r
+error:\r
+               mov             ax,0\r
+               mov             es,ax\r
+               mov             si,msg\r
+putloop:\r
+               mov             al,[si]\r
+               add             si,1                    ; si\82É1\82ð\91«\82·\r
+               cmp             al,0\r
+               je              fin\r
+               mov             ah,0x0e                 ; \88ê\95\8e\9a\95\\8e¦\83t\83@\83\93\83N\83V\83\87\83\93\r
+               mov             bx,15                   ; \83J\83\89\81[\83R\81[\83h\r
+               int             0x10                    ; \83r\83f\83Ibios\8cÄ\82Ñ\8fo\82µ\r
+               jmp             putloop\r
+fin:\r
+               hlt                                             ; \89½\82©\82 \82é\82Ü\82Åcpu\82ð\92â\8e~\82³\82¹\82é\r
+               jmp             fin                             ; \96³\8cÀ\83\8b\81[\83v\r
+msg:\r
+               db              0x0a, 0x0a              ; \89ü\8ds\82ð2\82Â\r
+               db              "load error"\r
+               db              0x0a                    ; \89ü\8ds\r
+               db              0\r
+\r
+readfast:      ; al\82ð\8eg\82Á\82Ä\82Å\82«\82é\82¾\82¯\82Ü\82Æ\82ß\82Ä\93Ç\82Ý\8fo\82·\r
+;      es:\93Ç\82Ý\8d\9e\82Ý\94Ô\92n, ch:\83V\83\8a\83\93\83_, dh:\83w\83b\83h, cl:\83Z\83N\83^, bx:\93Ç\82Ý\8d\9e\82Ý\83Z\83N\83^\90\94\r
+\r
+               mov             ax,es                   ; < es\82©\82çal\82Ì\8dÅ\91å\92l\82ð\8cv\8eZ >\r
+               shl             ax,3                    ; ax\82ð32\82Å\8a\84\82Á\82Ä\81A\82»\82Ì\8c\8b\89Ê\82ðah\82É\93ü\82ê\82½\82±\82Æ\82É\82È\82é \81ishl\82Í\8d\83V\83t\83g\96½\97ß\81j\r
+               and             ah,0x7f                 ; ah\82Íah\82ð128\82Å\8a\84\82Á\82½\97]\82è\81i512*128=64k\81j\r
+               mov             al,128                  ; al = 128 - ah; \88ê\94Ô\8bß\82¢64kb\8b«\8aE\82Ü\82Å\8dÅ\91å\89½\83Z\83N\83^\93ü\82é\82©\r
+               sub             al,ah\r
+\r
+               mov             ah,bl                   ; < bx\82©\82çal\82Ì\8dÅ\91å\92l\82ðah\82É\8cv\8eZ >\r
+               cmp             bh,0                    ; if (bh != 0) { ah = 18; }\r
+               je              .skip1\r
+               mov             ah,18\r
+.skip1:\r
+               cmp             al,ah                   ; if (al > ah) { al = ah; }\r
+               jbe             .skip2\r
+               mov             al,ah\r
+.skip2:\r
+\r
+               mov             ah,19                   ; < cl\82©\82çal\82Ì\8dÅ\91å\92l\82ðah\82É\8cv\8eZ >\r
+               sub             ah,cl                   ; ah = 19 - cl;\r
+               cmp             al,ah                   ; if (al > ah) { al = ah; }\r
+               jbe             .skip3\r
+               mov             al,ah\r
+.skip3:\r
+\r
+               push    bx\r
+               mov             si,0                    ; \8e¸\94s\89ñ\90\94\82ð\90\94\82¦\82é\83\8c\83W\83X\83^\r
+retry:\r
+               mov             ah,0x02                 ; ah=0x02 : \83f\83B\83X\83N\93Ç\82Ý\8d\9e\82Ý\r
+               mov             bx,0\r
+               mov             dl,0x00                 ; a\83h\83\89\83C\83u\r
+               push    es\r
+               push    dx\r
+               push    cx\r
+               push    ax\r
+               int             0x13                    ; \83f\83B\83X\83Nbios\8cÄ\82Ñ\8fo\82µ\r
+               jnc             next                    ; \83G\83\89\81[\82ª\82¨\82«\82È\82¯\82ê\82Înext\82Ö\r
+               add             si,1                    ; si\82É1\82ð\91«\82·\r
+               cmp             si,5                    ; si\82Æ5\82ð\94ä\8ar\r
+               jae             error                   ; si >= 5 \82¾\82Á\82½\82çerror\82Ö\r
+               mov             ah,0x00\r
+               mov             dl,0x00                 ; a\83h\83\89\83C\83u\r
+               int             0x13                    ; \83h\83\89\83C\83u\82Ì\83\8a\83Z\83b\83g\r
+               pop             ax\r
+               pop             cx\r
+               pop             dx\r
+               pop             es\r
+               jmp             retry\r
+next:\r
+               pop             ax\r
+               pop             cx\r
+               pop             dx\r
+               pop             bx                              ; es\82Ì\93à\97e\82ðbx\82Å\8eó\82¯\8eæ\82é\r
+               shr             bx,5                    ; bx\82ð16\83o\83C\83g\92P\88Ê\82©\82ç512\83o\83C\83g\92P\88Ê\82Ö\r
+               mov             ah,0\r
+               add             bx,ax                   ; bx += al;\r
+               shl             bx,5                    ; bx\82ð512\83o\83C\83g\92P\88Ê\82©\82ç16\83o\83C\83g\92P\88Ê\82Ö\r
+               mov             es,bx                   ; \82±\82ê\82Å es += al * 0x20; \82É\82È\82é\r
+               pop             bx\r
+               sub             bx,ax\r
+               jz              .ret\r
+               add             cl,al                   ; cl\82Éal\82ð\91«\82·\r
+               cmp             cl,18                   ; cl\82Æ18\82ð\94ä\8ar\r
+               jbe             readfast                ; cl <= 18 \82¾\82Á\82½\82çreadfast\82Ö\r
+               mov             cl,1\r
+               add             dh,1\r
+               cmp             dh,2\r
+               jb              readfast                ; dh < 2 \82¾\82Á\82½\82çreadfast\82Ö\r
+               mov             dh,0\r
+               add             ch,1\r
+               jmp             readfast\r
+.ret:\r
+               ret\r
+\r
+               resb    0x7dfe-$                ; 0x7dfe\82Ü\82Å\82ð0x00\82Å\96\84\82ß\82é\96½\97ß\r
+\r
+               db              0x55, 0xaa\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/console.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/console.c
new file mode 100644 (file)
index 0000000..245b623
--- /dev/null
@@ -0,0 +1,459 @@
+\r
+#include "core.h"\r
+#include <string.h>\r
+\r
+void console_main(UI_Console *cons)\r
+{      \r
+       int i;\r
+       uint fifobuf[CONSOLE_FIFO_BUF_SIZE];\r
+       uchar s[128];\r
+       uchar cmdline[CONSOLE_CMDLINE_BUF_SIZE];\r
+       uint cmdlines;\r
+       bool cmdline_overflow;\r
+\r
+       cons->cursor_state = true;\r
+       cons->cursor_on = false;\r
+\r
+       cons->prompt.x = 0;\r
+       cons->prompt.y = 0;\r
+\r
+       fifo32_init(&cons->task->fifo, CONSOLE_FIFO_BUF_SIZE, fifobuf, cons->task);\r
+       cons->timer = timer_alloc();\r
+       timer_init(cons->timer, &cons->task->fifo, 1);\r
+       timer_settime(cons->timer, 50);\r
+\r
+       boxfill_win(cons->win, CONSOLE_COLOR_BACKGROUND, 0, 0, cons->win->xsize, cons->win->ysize);\r
+       cons_put_prompt(cons);\r
+\r
+       cons_reset_cmdline(cmdline, &cmdlines, &cmdline_overflow);\r
+\r
+       for(;;){\r
+               io_cli();\r
+               if(fifo32_status(&cons->task->fifo) == 0){\r
+                       task_sleep(cons->task);\r
+                       io_sti();\r
+               } else {\r
+                       i = fifo32_get(&cons->task->fifo);\r
+                       io_sti();\r
+                       if(i == 1){\r
+                               if(cons->cursor_on){\r
+                                       if(cons->cursor_state){\r
+                                               cons->cursor_c = CONSOLE_COLOR_CHAR;\r
+                                               cons->cursor_state = false;\r
+                                       } else{\r
+                                               cons->cursor_c = CONSOLE_COLOR_BACKGROUND;\r
+                                               cons->cursor_state = true;\r
+                                       }\r
+                                       boxfill_win(cons->win, cons->cursor_c, cons->cursor.x, cons->cursor.y, cons->cursor.x + 8, cons->cursor.y +16);\r
+                               }\r
+                               timer_settime(cons->timer, 50);\r
+                       } else if(i == CONSOLE_FIFO_CURSOR_START){\r
+                               cons->cursor_on = true;\r
+                       } else if(i == CONSOLE_FIFO_CURSOR_STOP){\r
+                               cons->cursor_on = false;\r
+                               boxfill_win(cons->win, CONSOLE_COLOR_BACKGROUND, cons->cursor.x, cons->cursor.y, cons->cursor.x + 8, cons->cursor.y +16);\r
+                       } else if(CONSOLE_FIFO_START_KEYB <= i && i <= CONSOLE_FIFO_START_KEYB + DATA_BYTE){\r
+                               i -= CONSOLE_FIFO_START_KEYB;\r
+                               if(i == 0x0e){\r
+                                       putfonts_win(cons->win, cons->cursor.x, cons->cursor.y, CONSOLE_COLOR_BACKGROUND, CONSOLE_COLOR_BACKGROUND, " ");\r
+                                       cons->cursor.x -= 8;\r
+                                       cons_check_newline(cons);\r
+                                       putfonts_win(cons->win, cons->cursor.x, cons->cursor.y, CONSOLE_COLOR_BACKGROUND, CONSOLE_COLOR_BACKGROUND, " ");\r
+                                       if(cmdlines != 0){\r
+                                               cmdlines--;\r
+                                               cmdline[cmdlines] = 0x00;\r
+                                       }\r
+                               } else if(i == 0x0a){\r
+                                       cons_command_start(cons, cmdline, &cmdlines, &cmdline_overflow);\r
+                               } else{\r
+                                       s[0] = (uchar)i;\r
+                                       s[1] = 0x00;\r
+                                       cons_put_str(cons, s);\r
+                                       if(cmdlines >= CONSOLE_CMDLINE_BUF_SIZE){\r
+                                               cmdline_overflow = true;\r
+                                               cmdlines = 0;\r
+                                       }\r
+                                       cmdline[cmdlines] = (uchar)i;\r
+                                       cmdline[cmdlines + 1] = 0x00;\r
+                                       cmdlines++;\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+void cons_reset_cmdline(uchar *cmdline, uint *cmdlines, bool *cmdline_overflow)\r
+{\r
+       *cmdlines = 0;\r
+       *cmdline_overflow = false;\r
+       cmdline[*cmdlines] = 0x00;\r
+       return;\r
+}\r
+\r
+void cons_command_start(UI_Console *cons, uchar *cmdline, uint *cmdlines, bool *cmdline_overflow)\r
+{\r
+       uchar s[128], t[7];\r
+       uint i;\r
+       UUID uuid;\r
+\r
+       i = 0;\r
+\r
+       if(cmdline[0] != 0x00){\r
+               cons_new_line_no_prompt(cons);\r
+       }\r
+       if(strcmp(cmdline, "mem") == 0){\r
+               cons_command_mem(cons);\r
+       } else if(strcmp(cmdline, "cls") == 0){\r
+               cons->prompt.x = 0;\r
+               cons->prompt.y = 0;\r
+               boxfill_win(cons->win, CONSOLE_COLOR_BACKGROUND, 0, 0, cons->win->xsize, cons->win->ysize);\r
+               cons_reset_cmdline(cmdline, cmdlines, cmdline_overflow);\r
+               cons_put_prompt(cons);\r
+               goto end;\r
+       } else if(strcmp(cmdline, "dir") == 0){\r
+               cons_command_dir(cons);\r
+       } else if(strcmp(cmdline, "reset") == 0){\r
+               reset_cpu();\r
+       } else if(strcmp(cmdline, "uuid") == 0){\r
+               gen_UUID(&uuid);\r
+               sprintf(s, "{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}\r\n", uuid.data[0], uuid.data[1], uuid.data[2], uuid.data[3], uuid.data[4], uuid.data[5], uuid.data[6], uuid.data[7], uuid.data[8], uuid.data[9], uuid.data[10], uuid.data[11], uuid.data[12], uuid.data[13], uuid.data[14], uuid.data[15]);\r
+               cons_put_str(cons, s);\r
+       } else if(strcmp(cmdline, "date") == 0){\r
+               readrtc(t);\r
+               sprintf(s, "%02X%02X.%02X.%02X %02X:%02X:%02X\n", t[6], t[5], t[4], t[3], t[2], t[1], t[0]);\r
+               cons_put_str(cons, s);\r
+       } else if(strcmp(cmdline, "sht") == 0){\r
+               sprintf(s, " console = %d\n top = %d\n top_get = %d\n", cons->win->win->height, system.ui.draw.sht.ctrl.top, sheet_get_topheight());\r
+               cons_put_str(cons, s);\r
+       } else if(strncmp(cmdline, "fdc", 3) == 0){\r
+               cons_command_fdc(cons, cmdline);\r
+       } else if(strncmp(cmdline, "cpuid ", 5) == 0){\r
+               cons_command_cpuid(cons, cmdline);\r
+       } else if(strncmp(cmdline, "systeminfo", 10) == 0){\r
+               cons_command_systeminfo(cons, cmdline);\r
+       } else if(strncmp(cmdline, "type ", 5) == 0){\r
+               cons_command_type(cons, cmdline);\r
+       } else if(cmdline[0] != 0x00){\r
+               for(i = 0; i < 11 && cmdline[i] != 0x00; i++){\r
+                       if(cmdline[i] <= ' ' || cmdline[i] == '.') break;\r
+               }\r
+               cmdline[i] = 0x00;\r
+               if(cons_app_hrb_start(cons, cmdline) == 0xFFFFFFFF){\r
+                       cons_put_str(cons, "Bad Command...\n");\r
+               }\r
+       }\r
+       cons_reset_cmdline(cmdline, cmdlines, cmdline_overflow);\r
+       cons_new_line(cons);\r
+end:\r
+       return;\r
+}\r
+\r
+void cons_command_mem(UI_Console *cons)\r
+{\r
+       uchar s[32];\r
+\r
+       sprintf(s, "ÒÓØ°:%dMB\n", system.io.mem.total >> 20);\r
+       cons_put_str(cons, s);\r
+       sprintf(s, "±·:%dKB\n", sys_memman_free_total() >> 10);\r
+       cons_put_str(cons, s);\r
+       return;\r
+}\r
+\r
+void cons_command_dir(UI_Console *cons)\r
+{\r
+       uchar s[64];\r
+       int i, j;\r
+\r
+       for(i = 0; i < 0xe0; i++){\r
+               if(system.io.file.list[i].name[0] == 0x00) break;\r
+               if(system.io.file.list[i].name[0] != 0xe5){\r
+                       if((system.io.file.list[i].type & 0x18) == 0){\r
+                               sprintf(s, "FILENAME.EXT %7d %04d/%02d/%02d-%02d:%02d:%02d\n", system.io.file.list[i].size, (system.io.file.list[i].date >> 9) + 1980, (system.io.file.list[i].date & 0x01e0) >> 5, system.io.file.list[i].date & 0x001f, system.io.file.list[i].time >> 11, (system.io.file.list[i].time & 0x07e0) >> 5, system.io.file.list[i].time & 0x1f);\r
+                               for(j = 0; j < 8; j++){\r
+                                       s[j] = system.io.file.list[i].name[j];\r
+                               }\r
+                               s[ 9] = system.io.file.list[i].ext[0];\r
+                               s[10] = system.io.file.list[i].ext[1];\r
+                               s[11] = system.io.file.list[i].ext[2];\r
+                               cons_put_str(cons, s);\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void cons_command_fdc(UI_Console *cons, uchar *cmdline)\r
+{\r
+       int i;\r
+\r
+       cons_put_str(cons, "FDCconfig...\n");\r
+       if(cmdline[3] == 0x00){\r
+               i = io_in8(0x03f2);\r
+               if((i & 0x10) != 0) cons_put_str(cons, "FD0 Motor-ON\n");\r
+               else cons_put_str(cons, "FD0 Motor-OFF\n");\r
+               if((i & 0x20) != 0) cons_put_str(cons, "FD1 Motor-ON\n");\r
+               else cons_put_str(cons, "FD1 Motor-OFF\n");\r
+               if((i & 0x40) != 0) cons_put_str(cons, "FD2 Motor-ON\n");\r
+               else cons_put_str(cons, "FD2 Motor-OFF\n");\r
+               if((i & 0x80) != 0) cons_put_str(cons, "FD3 Motor-ON\n");\r
+               else cons_put_str(cons, "FD3 Motor-OFF\n");\r
+       }\r
+       if(cmdline[3] == ' '){\r
+               if(cmdline[4] == '0'){\r
+                       if(cmdline[5] == ' ' && cmdline[6] == 'o' && cmdline[7] == 'n' && cmdline[8] == 0x00){\r
+                               fdc_motor_on(0);\r
+                       } else if(cmdline[5] == ' ' && cmdline[6] == 'o' && cmdline[7] == 'f' && cmdline[8] == 'f' && cmdline[9] == 0x00){\r
+                               fdc_motor_off(0);\r
+                       }\r
+               } else if(cmdline[4] == '1'){\r
+                       if(cmdline[5] == ' ' && cmdline[6] == 'o' && cmdline[7] == 'n' && cmdline[8] == 0x00){\r
+                               fdc_motor_on(1);\r
+                       } else if(cmdline[5] == ' ' && cmdline[6] == 'o' && cmdline[7] == 'f' && cmdline[8] == 'f' && cmdline[9] == 0x00){\r
+                               fdc_motor_off(1);\r
+                       }\r
+               } else if(cmdline[4] == '2'){\r
+                       if(cmdline[5] == ' ' && cmdline[6] == 'o' && cmdline[7] == 'n' && cmdline[8] == 0x00){\r
+                               fdc_motor_on(2);\r
+                       } else if(cmdline[5] == ' ' && cmdline[6] == 'o' && cmdline[7] == 'f' && cmdline[8] == 'f' && cmdline[9] == 0x00){\r
+                               fdc_motor_off(2);\r
+                       }\r
+               } else if(cmdline[4] == '3'){\r
+                       if(cmdline[5] == ' ' && cmdline[6] == 'o' && cmdline[7] == 'n' && cmdline[8] == 0x00){\r
+                               fdc_motor_on(3);\r
+                       } else if(cmdline[5] == ' ' && cmdline[6] == 'o' && cmdline[7] == 'f' && cmdline[8] == 'f' && cmdline[9] == 0x00){\r
+                               fdc_motor_off(3);\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void cons_command_type(UI_Console *cons, uchar *cmdline)\r
+{\r
+       int i, j;\r
+       uchar s[32];\r
+       uchar *p;\r
+\r
+       j = 0;\r
+       for(i = 5; cmdline[i] != 0x00; i++){\r
+               s[i - 5] = cmdline[i];\r
+               s[i - 4] = 0x00;\r
+       }\r
+       i = search_file(s);\r
+       if(i != 0xFFFFFFFF){\r
+               j = system.io.file.list[i].size;\r
+               p = sys_memman_alloc(j); \r
+               load_file(i, p);\r
+               for(i = 0; i < j; i++){\r
+                       s[0] = p[i];\r
+                       s[1] = 0x00;\r
+                       cons_put_str(cons, s);\r
+               }\r
+               sys_memman_free(p, j);\r
+       } else{\r
+               cons_put_str(cons, "File not found...\n");\r
+       }\r
+       return;\r
+}\r
+\r
+void cons_command_cpuid(UI_Console *cons, uchar *cmdline)\r
+{\r
+       uint i, j;\r
+       bool cpuide;\r
+       uchar s[32];\r
+       uchar idbuf[32];\r
+\r
+       i = io_load_eflags();\r
+       io_store_eflags((i | 0x00200000));\r
+       j = io_load_eflags();   \r
+       if(i != j){\r
+               cpuide = true;\r
+               cons_put_str(cons, "CPUID is Enable.\n");\r
+       } else{\r
+               cpuide = false;\r
+               cons_put_str(cons, "CPUID is Disable.\n");\r
+       }\r
+       io_store_eflags((j & ~0x00200000));\r
+\r
+       idbuf[16] = '\n';\r
+       idbuf[17] = 0x00;\r
+\r
+       if(cpuide){\r
+               if(strcmp((uchar *)(cmdline + 6), "0x00000000") == 0){\r
+                       s[16] = 0x00;\r
+                       cpuid(idbuf, 0x00000000);\r
+                       sprintf(s, "MAX=0x%02X%02X%02X%02X\n", idbuf[0], idbuf[1], idbuf[2], idbuf[3]);\r
+                       cons_put_str(cons, s);\r
+                       cons_put_str(cons, (uchar *)(idbuf + 4));\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void cons_command_systeminfo(UI_Console *cons, uchar *cmdline)\r
+{\r
+       uchar s[64];\r
+\r
+       sprintf(s, "CHNOSProject ver.Beta008\n Compiled at %s %s\n", __DATE__, __TIME__);\r
+       cons_put_str(cons, s);\r
+       return;\r
+}\r
+\r
+uint cons_app_hrb_start(UI_Console *cons, uchar *cmdline)\r
+{\r
+       uint i, j, k;\r
+       uchar *p, *q;\r
+       UI_Task *task = task_now();\r
+       FORMAT_Haribote *head;\r
+\r
+       i = search_file(cmdline);\r
+       if(i == 0xFFFFFFFF){\r
+               strcat(cmdline, ".hrb");\r
+               i = search_file(cmdline);\r
+       }\r
+       if(i != 0xFFFFFFFF){\r
+               j = system.io.file.list[i].size;\r
+               p = sys_memman_alloc(j);\r
+               head = (FORMAT_Haribote *) p;\r
+               load_file(i, p);\r
+               if(j >= 36 && strncmp(p + 4, "Hari", 4) == 0 && *p == 0x00){\r
+                       q = sys_memman_alloc(head->DataSegmentSize);\r
+                       cons->app_ds_base = q;\r
+                       cons->app_cs_base = p;\r
+                       set_segmdesc(system.io.mem.segment.gdt + 1003, j - 1, (int)p, AR_CODE32_ER + AR_APP);\r
+                       set_segmdesc(system.io.mem.segment.gdt + 1004, head->DataSegmentSize - 1, (int)q, AR_DATA32_RW + AR_APP);\r
+                       for(i = 0; i < head->DataSegmentSize; i++){\r
+                               q[head->DefaultESP + i] = p[head->OriginDataSection + i];\r
+                       }\r
+                       start_app(0x1b, 1003 * 8, head->DefaultESP, 1004 * 8, &(task->tss.esp0));\r
+\r
+                       for(k = 0;k < MAX_WINDOWS;k++){\r
+                               if(system.ui.window.ctrl.winfos[k].task == task){\r
+                                       sys_memman_free(system.ui.window.ctrl.winfos[k].buf, system.ui.window.ctrl.winfos[k].winxsize * system.ui.window.ctrl.winfos[k].winysize * (system.data.info.vesa.BitsPerPixel >> 3));\r
+                                       free_window_app(&system.ui.window.ctrl.winfos[k]);      \r
+                               }\r
+                       }\r
+\r
+                       sys_memman_free(q, head->DataSegmentSize);\r
+               } else{\r
+                       cons_put_str(cons, ".hrb̧²ÙÌ«°Ï¯Ä´×°\n");\r
+               }\r
+               sys_memman_free(p, j);\r
+               return i;\r
+       }\r
+       return 0xFFFFFFFF;\r
+}\r
+\r
+void cons_put_str(UI_Console *cons, uchar *str)\r
+{\r
+       int i;\r
+       uchar s[3];\r
+\r
+       for(i = 0; i < 128; i++){\r
+               if(str[i] == 0x00){\r
+                       break;\r
+               } else if(str[i] == '\r'){\r
+\r
+               } else if(str[i] == '\n'){\r
+                       if(cons->cursor.x != 0)cons_new_line_no_prompt(cons);\r
+               } else if(str[i] == '\t'){\r
+                       for(;;){\r
+                               putfonts_win(cons->win, cons->cursor.x, cons->cursor.y, CONSOLE_COLOR_CHAR, CONSOLE_COLOR_BACKGROUND, " ");\r
+                               cons->cursor.x += 8;\r
+                               cons_check_newline(cons);\r
+                               if((cons->cursor.x & 0x1f) == 0 && cons->cursor.x != 0) break;\r
+                       }\r
+               } else{\r
+                       s[0] = str[i];\r
+                       s[1] = 0x00;\r
+                       putfonts_win(cons->win, cons->cursor.x, cons->cursor.y, CONSOLE_COLOR_CHAR, CONSOLE_COLOR_BACKGROUND, s);\r
+                       cons->cursor.x += 8;\r
+                       cons_check_newline(cons);\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void cons_put_char(UI_Console *cons, uchar c)\r
+{\r
+       uchar s[2];\r
+\r
+       s[0] = c;\r
+       s[1] = 0x00;\r
+       cons_put_str(cons, s);\r
+       return;\r
+}\r
+\r
+void cons_put_prompt(UI_Console *cons)\r
+{\r
+       putfonts_win(cons->win, cons->cursor.x, cons->cursor.y, CONSOLE_COLOR_BACKGROUND, CONSOLE_COLOR_BACKGROUND, " ");\r
+       putfonts_win(cons->win, cons->prompt.x, cons->prompt.y, CONSOLE_COLOR_CHAR, CONSOLE_COLOR_BACKGROUND, ">");\r
+       cons->cursor.x = cons->prompt.x + 8;\r
+       cons->cursor.y = cons->prompt.y;\r
+       return;\r
+}\r
+\r
+void cons_new_line(UI_Console *cons)\r
+{\r
+       if(cons->cursor.y <= system.ui.console.org_ysize - 17){\r
+               cons->prompt.y = cons->cursor.y + 16;\r
+               cons_put_prompt(cons);\r
+       } else{\r
+               putfonts_win(cons->win, cons->cursor.x, cons->cursor.y, CONSOLE_COLOR_BACKGROUND, CONSOLE_COLOR_BACKGROUND, " ");\r
+               cons_slide_line(cons);\r
+               cons->prompt.y = (system.ui.console.org_ychars - 1) * 16;\r
+               cons_put_prompt(cons);\r
+       }\r
+       return;\r
+}\r
+\r
+void cons_new_line_no_prompt(UI_Console *cons)\r
+{\r
+       if(cons->cursor.y <= system.ui.console.org_ysize - 17){\r
+               putfonts_win(cons->win, cons->cursor.x, cons->cursor.y, CONSOLE_COLOR_BACKGROUND, CONSOLE_COLOR_BACKGROUND, " ");\r
+               cons->cursor.x = 0;\r
+               cons->cursor.y = cons->cursor.y + 16;\r
+       } else{\r
+               putfonts_win(cons->win, cons->cursor.x, cons->cursor.y, CONSOLE_COLOR_BACKGROUND, CONSOLE_COLOR_BACKGROUND, " ");\r
+               cons_slide_line(cons);\r
+               cons->cursor.x = 0;\r
+       }\r
+       return;\r
+}\r
+\r
+void cons_slide_line(UI_Console *cons)\r
+{\r
+       scrool_win(cons->win);\r
+       refresh_window(cons->win);\r
+       return;\r
+}\r
+\r
+void cons_check_newline(UI_Console *cons)\r
+{\r
+       if(cons->cursor.x <= cons->prompt.x){\r
+               if(cons->cursor.y != cons->prompt.y){\r
+                       if(cons->cursor.x < cons->prompt.x){\r
+                               cons->cursor.y -= 16;\r
+                               cons->cursor.x = system.ui.console.org_xsize - 8;\r
+                       }\r
+               } else{\r
+                       cons->cursor.y = cons->prompt.y;\r
+                       cons->cursor.x = 8;\r
+               }\r
+       } else if(cons->cursor.x >= system.ui.console.org_xsize){\r
+               if(cons->cursor.y <= system.ui.console.org_ysize - 17){\r
+                       cons->cursor.x = 0;\r
+                       cons->cursor.y += 16;\r
+               } else{\r
+                       cons_slide_line(cons);\r
+                       cons->cursor.x = 0;\r
+                       if(cons->prompt.y > 0) cons->prompt.y -= 16;\r
+                       else{\r
+                               cons->prompt.y = 0;\r
+                               cons->prompt.x = 0;\r
+                       }\r
+               }\r
+       } \r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/core.h b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/core.h
new file mode 100644 (file)
index 0000000..3c7bfd5
--- /dev/null
@@ -0,0 +1,813 @@
+\r
+/*include files*/\r
+#include <stdio.h>\r
+#include <stdarg.h>\r
+#include <math.h>\r
+#include <string.h>\r
+\r
+int rand(void);\r
+#define srand(seed)                    (void) (rand_seed = (seed))\r
+extern unsigned int rand_seed;\r
+\r
+/*definemacros*/\r
+#define RGB16(r,g,b) ((r)<<11|(g)<<5|(b))\r
+\r
+/*settings*/\r
+#define system (*sys_main_str_buf)\r
+\r
+#define ADR_BOOTINFO   0x00000ff0\r
+#define ADR_VESAINFO   0x00000e00\r
+#define ADR_DISKIMG    0x00100000\r
+\r
+#define EFLAGS_AC_BIT  0x00040000\r
+\r
+#define CR0_PROTECTIONENABLE   0x00000001\r
+#define CR0_MONITORCOPROCESSOR 0x00000002\r
+#define CR0_EMULATION          0x00000004\r
+#define CR0_TASKSWITCH         0x00000008\r
+#define CR0_EXTENDEDTYPE       0x00000010\r
+#define CR0_NUMERICERROR       0x00000020\r
+#define CR0_WRITEPROTECT       0x00010000\r
+#define CR0_ALIGNMENTMASK      0x00040000\r
+#define CR0_NOTWRITETHROUGH    0x20000000\r
+#define CR0_CACHE_DISABLE      0x40000000\r
+#define CR0_PAGING             0x80000000\r
+\r
+#define CR0_ALL_CACHE_DISABLE  CR0_NOTWRITETHROUGH + CR0_CACHE_DISABLE\r
+\r
+#define PG_NOTPRESENT  0x00000000\r
+#define PG_PRESENT     0x00000001\r
+#define PG_READONLY    0x00000000\r
+#define PG_WRITABLE    0x00000002\r
+#define PG_SUPERVISOR  0x00000000\r
+#define PG_USER                0x00000004\r
+#define PG_WRITEBACK   0x00000000\r
+#define PG_WRITETHROUGH        0x00000008\r
+#define PG_CACHE_ENABLE        0x00000000\r
+#define PG_CACHE_DISABLE       0x00000010\r
+#define PG_NOTACCESSED 0x00000000\r
+#define PG_ACCESSED    0x00000020\r
+#define PG_NOTWRITTEN  0x00000000\r
+#define PG_WRITTEN     0x00000040\r
+#define PG_4KBPAGE     0x00000000\r
+#define PG_4MBPAGE     0x00000080\r
+#define PG_NOTGLOBAL   0x00000000\r
+#define        PG_GLOBAL       0x00000100\r
+\r
+#define ADR_IDT                0x0026f800\r
+#define LIMIT_IDT      0x000007ff\r
+#define ADR_GDT                0x00270000\r
+#define LIMIT_GDT      0x0000ffff\r
+#define ADR_BOTPAK     0x00280000\r
+#define LIMIT_BOTPAK   0x0007ffff\r
+#define AR_DATA32_RW   0x4092\r
+#define AR_CODE32_ER   0x409a\r
+#define AR_LDT         0x0082\r
+#define AR_TSS32       0x0089\r
+#define AR_INTGATE32   0x008e\r
+#define AR_APP         0x60\r
+\r
+#define COL8_000000            0\r
+#define COL8_FF0000            1\r
+#define COL8_00FF00            2\r
+#define COL8_FFFF00            3\r
+#define COL8_0000FF            4\r
+#define COL8_FF00FF            5\r
+#define COL8_00FFFF            6\r
+#define COL8_FFFFFF            7\r
+#define COL8_C6C6C6            8\r
+#define COL8_840000            9\r
+#define COL8_008400            10\r
+#define COL8_848400            11\r
+#define COL8_000084            12\r
+#define COL8_840084            13\r
+#define COL8_008484            14\r
+#define COL8_848484            15\r
+\r
+#define INV_COL32      0xFFFFFFFF\r
+#define INV_COL16      0x1192\r
+#define INV_COL8       0xFF\r
+\r
+#define DESKTOP_COL8   COL8_C6C6C6\r
+#define TASKBAR_COL8   COL8_0000FF\r
+\r
+#define DESKTOP_COL16  RGB16(17,33,17)         /*\8f\89\8aú\92l\81F10,20,10*/\r
+#define TASKBAR_COL16  RGB16(20,40,30)         /*\8f\89\8aú\92l\81F20,40,30*/\r
+\r
+#define DESKTOP_COL32  0x34FF1E\r
+#define TASKBAR_COL32  0x5EC1E8\r
+\r
+#define TASKBAR_HEIGHT 40\r
+\r
+#define MEMMAN_FREES   4000\r
+\r
+#define INV_COL32      0xFFFFFFFF\r
+#define INV_COL16      0x1192\r
+#define INV_COL8       0xFF\r
+\r
+#define MAX_SHEETS     1024\r
+\r
+#define PIC0_ICW1      0x0020\r
+#define PIC0_OCW2      0x0020\r
+#define PIC0_IMR       0x0021\r
+#define PIC0_ICW2      0x0021\r
+#define PIC0_ICW3      0x0021\r
+#define PIC0_ICW4      0x0021\r
+#define PIC1_ICW1      0x00a0\r
+#define PIC1_OCW2      0x00a0\r
+#define PIC1_IMR       0x00a1\r
+#define PIC1_ICW2      0x00a1\r
+#define PIC1_ICW3      0x00a1\r
+#define PIC1_ICW4      0x00a1\r
+\r
+#define MAX_TASKS      1000\r
+#define TASK_GDT_START 3\r
+#define MAX_LEVEL_TASKS        100\r
+#define MAX_LEVELS     10\r
+\r
+#define MAX_TIMER      512\r
+\r
+#define FIFO32_PUT_OVERFLOW    0x0001\r
+\r
+#define SYS_FIFOSIZE   256\r
+#define KEYCMD_FIFOSIZE        128\r
+#define KEYCTRL_FIFOSIZE       128\r
+#define MOUSECTRL_FIFOSIZE     128\r
+\r
+#define PIT_CTRL       0x0043\r
+#define PIT_CNT0       0x0040\r
+\r
+#define KEYB_DATA      0x0060\r
+#define PORT_KEYSTA    0x0064\r
+#define KEYSTA_SEND_NOTREADY   0x02\r
+#define KEYCMD_WRITE_MODE      0x60\r
+#define KBC_MODE       0x47\r
+#define PORT_KEYCMD    0x0064\r
+#define KEYCMD_SENDTO_MOUSE    0xd4\r
+#define MOUSECMD_ENABLE        0xf4\r
+#define KEYCMD_LED     0xed\r
+\r
+#define MAX_WINDOWS    256\r
+#define WIN_COL8_ACTIVE                0x000084\r
+#define WIN_COL8_INACTIVE      0x848484\r
+#define WIN_COL16_ACTIVE       0x60F8f0\r
+#define WIN_COL16_INACTIVE     0xBCFCF8\r
+#define WIN_COL32_ACTIVE       0x93D9FF\r
+#define WIN_COL32_INACTIVE     0xD0EFFF\r
+\r
+#define CONSOLE_FIFO_BUF_SIZE  128\r
+#define CONSOLE_FIFO_START_KEYB        128\r
+#define CONSOLE_FIFO_CURSOR_START      2\r
+#define CONSOLE_FIFO_CURSOR_STOP       3\r
+#define CONSOLE_COLOR_BACKGROUND       0x000000\r
+#define CONSOLE_COLOR_CHAR     0xFFFFFF\r
+#define CONSOLE_CMDLINE_BUF_SIZE       128\r
+#define MAX_CONSOLES   16\r
+\r
+#define DATA_BYTE      0xFF\r
+#define DATA_WORD      0xFFFF\r
+#define DATA_DWORD     0xFFFFFFFF\r
+\r
+/*new object types*/\r
+typedef enum _bool { false, true} bool;\r
+typedef enum _state_alloc { none, initialized, allocated, configured, inuse} state_alloc;\r
+typedef enum _col_text { black, blue, green, skyblue, red, purple, brown, white} col_text;\r
+typedef unsigned char uchar;\r
+typedef unsigned short ushort;\r
+typedef unsigned int uint;\r
+\r
+/*structures*/\r
+struct BOOTINFO { \r
+       uchar cyls; \r
+       uchar leds; \r
+       uchar vmode; \r
+       uchar reserve;\r
+       ushort scrnx, scrny;\r
+       uchar *vram;\r
+};\r
+\r
+struct VESAINFO {/*0xe00--->512byte*/\r
+       ushort  ModeAttributes;\r
+       uchar   WinAAttributes;\r
+       uchar   WinBAttributes;\r
+       ushort  WinGranularity;\r
+       ushort  WinSize;\r
+       ushort  WinASegment;\r
+       ushort  WinBSegment;\r
+       uint    WinFuncPtr;\r
+       ushort  BytesPerScanLine;\r
+       ushort  XResolution;\r
+       ushort  YResolution;\r
+       uchar   XCharSize;\r
+       uchar   YCharSize;\r
+       uchar   NumberOfPlanes;\r
+       uchar   BitsPerPixel;\r
+       uchar   NumberOfBanks;\r
+       uchar   MemoryModel;\r
+       uchar   BankSize;\r
+       uchar   NumberOfImagePages;\r
+       uchar   Reserved;\r
+       uchar   RedMaskSize;\r
+       uchar   RedFieldPosition;\r
+       uchar   GreenMaskSize;\r
+       uchar   GreenFieldPosition;\r
+       uchar   BlueMaskSize;\r
+       uchar   BlueFieldPosition;\r
+       uchar   RsvdMaskSize;\r
+       uchar   RsvdFieldPodition;\r
+       uchar   DirectColorModeInfo;\r
+       uint*   PhysBasePtr;\r
+};\r
+\r
+struct SEGMENT_DESCRIPTOR { \r
+       short limit_low,base_low;\r
+       char base_mid,access_right;\r
+       char limit_high,base_high;\r
+};\r
+\r
+struct GATE_DESCRIPTOR { \r
+       short offset_low,selector;\r
+       char dw_count,access_right;\r
+       short offset_high;\r
+};\r
+\r
+struct MEMMAN {\r
+       int frees,maxfrees,lostsize,losts;\r
+       struct MEM_FREEINFO {\r
+               uint addr, size;\r
+       } free[MEMMAN_FREES];\r
+};\r
+\r
+struct SHEET {\r
+       void *buf;\r
+       uint col_inv;\r
+       int bxsize, bysize, vx0, vy0, height;\r
+       state_alloc flags; \r
+};\r
+\r
+struct SHTCTL {\r
+       uint *map;\r
+       void *vram;\r
+       int xsize, ysize, top;\r
+       struct SHEET *sheets[MAX_SHEETS];\r
+       struct SHEET sheets0[MAX_SHEETS];\r
+};\r
+\r
+struct TSS32 {\r
+       int backlink, esp0, ss0, esp1, ss1, esp2, ss2, cr3;\r
+       int eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi;\r
+       int es, cs, ss, ds, fs, gs;\r
+       int ldtr, iomap;\r
+};\r
+\r
+struct FIFO32 {\r
+       uint *buf;\r
+       uint p, q, size, free, flags;\r
+       struct TASK *task;\r
+};\r
+\r
+struct TASK {\r
+       int selector;\r
+       state_alloc flags;\r
+       int level, priority;\r
+       struct FIFO32 fifo;\r
+       struct TSS32 tss;\r
+};\r
+\r
+struct TASKCTL {\r
+       int level_now;\r
+       bool change_lv_next;\r
+       struct TASKLEVEL {\r
+               int running_tasks;\r
+               int task_now;\r
+               struct TASK *tasks[MAX_LEVEL_TASKS];\r
+       } level[MAX_LEVELS];\r
+       struct TASK tasks0[MAX_TASKS];\r
+};\r
+\r
+struct TIMER {\r
+       struct TIMER *next_timer;\r
+       uint timeout;\r
+       struct FIFO32 *fifo;\r
+       uint data;\r
+       state_alloc flags;\r
+};\r
+\r
+struct TIMERCTL {\r
+       uint count, next_count;\r
+       struct TIMER timer[MAX_TIMER];\r
+       struct TIMER *timers;\r
+};\r
+\r
+struct KEYINFO {\r
+       uchar c;\r
+       uint keycode;\r
+       bool make;\r
+       bool alphabet;\r
+};\r
+\r
+struct MOUSE_DECODE {\r
+       uint buf[4], scrool;\r
+       int x, y, btn, whinfo;\r
+       uchar phase; \r
+};\r
+\r
+struct POSITION_2D {\r
+       int x, y;\r
+};\r
+\r
+struct WINDOWINFO {\r
+       char title[32];\r
+       struct SHEET *win;\r
+       void *buf;\r
+       int winxsize, winysize, xsize, ysize;\r
+       struct POSITION_2D position;\r
+       struct POSITION_2D origin;\r
+       state_alloc flags;\r
+       bool active;\r
+       void *app_buf;\r
+       uchar app_buf_bits;\r
+       struct TASK *task;\r
+};\r
+\r
+struct WINCTL {\r
+       struct WINDOWINFO winfos[MAX_WINDOWS];\r
+};\r
+\r
+struct FILEINFO {\r
+       uchar name[8];\r
+       uchar ext[3];\r
+       uchar type;\r
+       uchar reserve;\r
+       uchar VFAT_createTimeMs;\r
+       ushort VFAT_createTime;\r
+       ushort VFAT_createDate;\r
+       ushort VFAT_accessDate;\r
+       ushort VFAT_clusterHighWord;\r
+       ushort time;\r
+       ushort date;\r
+       ushort clustno;\r
+       uint size;\r
+};\r
+\r
+struct SYS_UI_CONSOLES {\r
+       struct TASK *task;\r
+       struct WINDOWINFO *win;\r
+       struct POSITION_2D prompt;\r
+       struct POSITION_2D cursor;\r
+       uchar *app_cs_base;\r
+       uchar *app_ds_base;\r
+       struct TIMER *timer;\r
+       bool cursor_state;\r
+       bool cursor_on;\r
+       uint cursor_c;\r
+};\r
+\r
+struct _UUID {\r
+       uchar data[16];\r
+};\r
+\r
+struct FORMAT_HRB {\r
+       uint DataSegmentSize;\r
+       uchar sign[4];\r
+       uint DataSegmentExtSize;\r
+       uint DefaultESP;\r
+       uint TransferToDataSegBytes;\r
+       uint OriginDataSection;\r
+       uint JMPCode;\r
+       uint EntryPoint;\r
+       uint StartMallocAddr;\r
+};\r
+\r
+/*typedef structures*/\r
+typedef struct BOOTINFO                        DATA_BootInfo;\r
+typedef struct VESAINFO                        DATA_VESAInfo;\r
+typedef struct SEGMENT_DESCRIPTOR      IO_SegmentDescriptor;\r
+typedef struct GATE_DESCRIPTOR         IO_GateDescriptor;\r
+typedef struct MEMMAN                  IO_MemoryControl;\r
+typedef struct SHEET                   UI_Sheet;\r
+typedef struct SHTCTL                  UI_SheetControl;\r
+typedef struct FIFO32                  DATA_FIFO;\r
+typedef struct TSS32                   IO_TaskStatusSegment32;\r
+typedef struct TASK                    UI_Task;\r
+typedef struct TASKCTL                 UI_TaskControl;\r
+typedef struct TIMER                   UI_Timer;\r
+typedef struct TIMERCTL                        UI_TimerControl;\r
+typedef struct KEYINFO                 UI_KeyInfo;\r
+typedef struct MOUSE_DECODE            UI_Mouse;\r
+typedef struct POSITION_2D             DATA_Position2D;\r
+typedef struct WINDOWINFO              UI_Window;\r
+typedef struct WINCTL                  UI_WindowControl;\r
+typedef struct FILEINFO                        IO_FileInfo;\r
+typedef struct SYS_UI_CONSOLES         UI_Console;\r
+typedef struct _UUID                   UUID;\r
+typedef struct FORMAT_HRB              FORMAT_Haribote;\r
+\r
+/*virtual classes*/\r
+struct SYSTEM {\r
+       struct SYS_IO {\r
+               struct SYS_IO_MEM {\r
+                       struct SYS_IO_MEM_PAGING {\r
+                               uint *dir;\r
+                               uint (*table)[1024];\r
+                       } paging;\r
+                       struct SYS_IO_MEM_SEGMENT {\r
+                               IO_SegmentDescriptor *gdt;\r
+                       } segment;\r
+                       uint total;\r
+                       IO_MemoryControl ctrl;\r
+               } mem;\r
+               struct SYS_IO_INTERRUPT {\r
+                       IO_GateDescriptor *idt;\r
+               } interrupt;\r
+               struct SYS_IO_KEYBOARD {\r
+                       int cmd_wait;\r
+               } keyboard;\r
+               struct SYS_IO_MOUSE {\r
+                       UI_Mouse decode;\r
+               } mouse;\r
+               struct SYS_IO_FILE {\r
+                       IO_FileInfo *list;\r
+                       ushort *fat;\r
+               } file;\r
+       } io;\r
+       struct SYS_UI {\r
+               struct SYS_UI_DRAW {\r
+                       struct SYS_UI_DRAW_SHT {\r
+                               UI_SheetControl ctrl;\r
+                               UI_Sheet *core;\r
+                               UI_Sheet *desktop;\r
+                               UI_Sheet *taskbar;\r
+                               UI_Sheet *mouse;\r
+                               void *core_buf;\r
+                               void *desktop_buf;\r
+                               void *taskbar_buf;\r
+                               void *mouse_buf;\r
+                       } sht;\r
+               } draw;\r
+               struct SYS_UI_TASK {\r
+                       UI_Task *idle;\r
+                       UI_Task *main;\r
+                       UI_Task *keyctrl;\r
+                       UI_Task *mousectrl;\r
+               } task;\r
+               struct SYS_UI_TIMER {\r
+                       UI_Timer *taskswitch;\r
+                       UI_TimerControl ctrl;\r
+               } timer;\r
+               struct SYS_UI_CONSOLE {\r
+                       int org_xsize;\r
+                       int org_ysize;\r
+                       int org_xchars;\r
+                       int org_ychars;\r
+                       UI_Console consoles[MAX_CONSOLES];\r
+               } console;\r
+               struct SYS_UI_WINDOW {\r
+                       UI_WindowControl ctrl;\r
+               } window;\r
+       } ui;\r
+       struct SYS_DATA {\r
+               struct SYS_DATA_INFO {\r
+                       DATA_BootInfo boot;\r
+                       DATA_VESAInfo vesa;\r
+               } info;\r
+               struct SYS_DATA_FIFO {\r
+                       DATA_FIFO main;\r
+                       uint main_buf[SYS_FIFOSIZE];\r
+                       DATA_FIFO keycmd;\r
+                       uint keycmd_buf[KEYCMD_FIFOSIZE];\r
+                       DATA_FIFO keyctrl;\r
+                       uint keyctrl_buf[MOUSECTRL_FIFOSIZE];\r
+                       DATA_FIFO mousectrl;\r
+                       uint mousectrl_buf[MOUSECTRL_FIFOSIZE];\r
+               } fifo;\r
+       } data;\r
+};\r
+\r
+/*externs*/\r
+extern struct SYSTEM *sys_main_str_buf;\r
+extern uchar hankaku[4096];\r
+extern char cursor[24][24];\r
+extern uint rgb_int2char_list[16];\r
+extern uint key_shift;\r
+\r
+/*functions*/\r
+/*bootpack.c*/\r
+void KeyBoardControlTask(void);\r
+void MouseControlTask(void);\r
+\r
+/*api.c*/\r
+uint hrb_api(uint edi, uint esi, uint ebp, uint esp, uint ebx, uint edx, uint ecx, uint eax);\r
+uint GetWindowNumber(UI_Window *win);\r
+UI_Window *GetWindowInfo(uint n);\r
+\r
+/*uuid.c*/\r
+void gen_UUID(UUID *uuid);\r
+\r
+/*file.c*/\r
+void decode_fat(ushort *fat, bool backup);\r
+void load_file(uint finfo_no, uchar *buf);\r
+uint search_file(char *name);\r
+\r
+/*console.c*/\r
+void console_main(UI_Console *cons);\r
+void cons_reset_cmdline(uchar *cmdline, uint *cmdlines, bool *cmdline_overflow);\r
+void cons_command_start(UI_Console *cons, uchar *cmdline, uint *cmdlines, bool *cmdline_overflow);\r
+void cons_command_mem(UI_Console *cons);\r
+void cons_command_dir(UI_Console *cons);\r
+void cons_command_fdc(UI_Console *cons, uchar *cmdline);\r
+void cons_command_type(UI_Console *cons, uchar *cmdline);\r
+void cons_command_cpuid(UI_Console *cons, uchar *cmdline);\r
+void cons_command_systeminfo(UI_Console *cons, uchar *cmdline);\r
+uint cons_app_hrb_start(UI_Console *cons, uchar *cmdline);\r
+void cons_put_str(UI_Console *cons, uchar *str);\r
+void cons_put_char(UI_Console *cons, uchar c);\r
+void cons_put_prompt(UI_Console *cons);\r
+void cons_new_line(UI_Console *cons);\r
+void cons_new_line_no_prompt(UI_Console *cons);\r
+void cons_slide_line(UI_Console *cons);\r
+void cons_check_newline(UI_Console *cons);\r
+\r
+/*window.c*/\r
+void init_windows(void);\r
+UI_Window *window_alloc(void);\r
+void window_free(UI_Window *winfo);\r
+UI_Window *make_window(uchar *title, int xsize, int ysize, int px, int py, int height, bool active);\r
+UI_Window *make_window_app(uchar *title, int xsize, int ysize, int px, int py, int height, bool active, uint *buf, UI_Task *task);\r
+UI_Window *make_window_app_compatible_hrb(uchar *title, int xsize, int ysize, int px, int py, int height, bool active, uint *buf, UI_Task *task);\r
+void free_window_app(UI_Window *winfo);\r
+void change_window(UI_Window *winfo, uchar *title, bool active);\r
+void change_window_title(UI_Window *winfo, uchar *title);\r
+void change_window_active(UI_Window *winfo, bool active);\r
+void slide_window(UI_Window *winfo, int px, int py);\r
+void refresh_window(UI_Window *winfo);\r
+void refresh_window_alpha(UI_Window *winfo);\r
+void boxfill_win(UI_Window *winfo, uint c, int x0, int y0, int x1, int y1);\r
+void point_win(UI_Window *winfo, uint c, int x, int y);\r
+void putfonts_win(UI_Window *winfo, int x, int y, uint c, uint bc, const uchar *s);\r
+void putfonts_win_no_bc(UI_Window *winfo, int x, int y, uint c, const uchar *s);\r
+void scrool_win(UI_Window *winfo);\r
+void scrool_win_32(UI_Window *winfo, uint *vram);\r
+void scrool_win_16(UI_Window *winfo, ushort *vram);\r
+void scrool_win_8(UI_Window *winfo, uchar *vram);\r
+void line_win(UI_Window *winfo, int x0, int y0, int x1, int y1, uint c);\r
+void draw_hexagon_win(UI_Window *winfo, int a, int x, int y, uint c);\r
+\r
+\r
+/*mouse.c*/\r
+void init_mouse(uint offset);\r
+void inthandler2c(int *esp);\r
+int decode_mouse(uint data);\r
+void sendto_mouse(uint data);\r
+\r
+/*keyboard.c*/\r
+void init_keyboard(uint offset);\r
+void inthandler21(int *esp);\r
+void decode_key(UI_KeyInfo *info, uint data);\r
+void keylock(uint led);\r
+void wait_KBC_sendready(void);\r
+\r
+/*fifo.c*/\r
+void fifo32_init(DATA_FIFO *fifo, uint size, uint *buf, UI_Task *task);\r
+int fifo32_put(DATA_FIFO *fifo, uint data);\r
+uint fifo32_get(DATA_FIFO *fifo);\r
+uint fifo32_status(DATA_FIFO *fifo);\r
+\r
+/*mtask.c*/\r
+void task_init(void);\r
+UI_Task *task_alloc(void);\r
+void task_run(UI_Task *task, int level, int priority);\r
+void task_switch(void);\r
+void task_sleep(UI_Task *task);\r
+void task_arguments(UI_Task *task, int args, ...);\r
+UI_Task *task_now(void);\r
+void task_add(UI_Task *task);\r
+void task_remove(UI_Task *task);\r
+void task_switchsub(void);\r
+void task_idle(void);\r
+\r
+/*timer.c*/\r
+void inthandler20(int *esp);\r
+void init_pit(void);\r
+UI_Timer *timer_alloc(void);\r
+void timer_free(UI_Timer *timer);\r
+void timer_init(UI_Timer *timer, DATA_FIFO *fifo, uint data);\r
+void timer_settime(UI_Timer *timer, uint timeout);\r
+void timer_settime_millisec(UI_Timer *timer, uint timeout_ms);\r
+\r
+/*gdtidt.c*/\r
+void init_gdtidt(void);\r
+void set_segmdesc(IO_SegmentDescriptor *sd, uint limit, int base, int ar);\r
+void set_gatedesc(IO_GateDescriptor *gd, int offset, int selector, int ar);\r
+\r
+/*graphic.c grap_08.c grap_16.c grap_32.c*/\r
+/*All*/\r
+void init_screen_i(void *desktop, void *taskbar, void *mousecursor);\r
+void init_desktop_i(void *vrami);\r
+void init_taskbar_i(void *vrami);\r
+void init_mousecursor_i(void *vrami);\r
+uint mix_color(uint c0, uint c1);\r
+void point_i(void *vrami, int x, int y, uint c, int xsize);\r
+void point_bpp(void *vrami, int x, int y, uint c, int xsize, uint bpp);\r
+void boxfill_i(void *vrami, int xsize, uint c, int x0, int y0, int x1, int y1);\r
+void boxfill_bpp(void *vrami, int xsize, uint c, int x0, int y0, int x1, int y1, uint bpp);\r
+void putfonts_asc_i(void *vrami, int xsize, int x, int y, uint c, const uchar *s);\r
+void putblock_i(void *vrami, int vxsize, int pxsize, int pysize, int px0, int py0, void *buf, int bxsize);\r
+void putblock_i_convert(void *to, int xsize, int px0, int py0, int px1, int py1, void *from, int tobpp, int frombpp);\r
+void line_i(void *vrami, int xsize, int x0, int y0, int x1, int y1, uint c);\r
+void line_bpp(void *vrami, int xsize, int x0, int y0, int x1, int y1, uint c, uint bpp);\r
+void draw_hexagon_i(void *vrami, int xsize, int a, int x, int y, uint c);\r
+void draw_chnos_logo(void *vrami, int xsize, int a, int x, int y);\r
+uchar rgb_int2char (uint c32);\r
+ushort rgb_int2short (uint c32);\r
+void col_pat(void *vrami, int xsize, int ysize);\r
+void putfonts_asc_sht_i(UI_Sheet *sht, int x, int y, uint c, uint bc, const uchar *s);\r
+void putfonts_asc_sht_i_no_bc(UI_Sheet *sht, int x, int y, uint c, const uchar *s);\r
+\r
+/*08Bits*/\r
+void boxfill8(uchar *vram, int xsize, uchar c, int x0, int y0, int x1, int y1);\r
+void init_desktop8(uchar *vram, uint xsize, uint ysize);\r
+void init_taskbar8(uchar *vram, uint xsize);\r
+void putfont8(uchar *vram, int xsize, int x, int y, uchar c, uchar *font);\r
+void putfonts8_asc(uchar *vram, int xsize, int x, int y, uchar c, const uchar *s);\r
+void init_mouse_cursor8(uchar *mouse);\r
+void putblock8_8(uchar *vram, int vxsize, int pxsize,int pysize, int px0, int py0, uchar *buf, int bxsize);\r
+void init_palette(void);\r
+void set_palette(int start, int end, uchar *rgb);\r
+/*16Bits*/\r
+void boxfill16(ushort *vram, int xsize, ushort c, int x0, int y0, int x1, int y1);\r
+void init_desktop16(ushort *vram, uint xsize, uint ysize);\r
+void init_taskbar16(ushort *vram, uint xsize);\r
+void putfont16(ushort *vram, int xsize, int x, int y, ushort c, uchar *font);\r
+void putfonts16_asc(ushort *vram, int xsize, int x, int y, ushort c, const uchar *s);\r
+void init_mouse_cursor16(ushort *mouse);\r
+void putblock16_16(ushort *vram, int vxsize, int pxsize,int pysize, int px0, int py0, ushort *buf, int bxsize);\r
+/*32Bits*/\r
+void boxfill32(uint *vram, int xsize, uint c, int x0, int y0, int x1, int y1);\r
+void init_desktop32(uint *vram, uint xsize, uint ysize);\r
+void init_taskbar32(uint *vram, uint xsize);\r
+void putfont32(uint *vram, int xsize, int x, int y, uint c, uchar *font);\r
+void putfonts32_asc(uint *vram, int xsize, int x, int y, uint c, const uchar *s);\r
+void init_mouse_cursor32(uint *mouse);\r
+void putblock32_32(uint *vram, int vxsize, int pxsize,int pysize, int px0, int py0, uint *buf, int bxsize);\r
+\r
+/*init.c*/\r
+void init_system(void);\r
+\r
+/*intrpt.c*/\r
+void init_pic(void);\r
+void inthandler27(int *esp);\r
+void cpu_exception_abort(int exception, int *esp);\r
+uint cpu_exception_fault(int exception, int *esp);\r
+void inthandler00(int *esp);\r
+void inthandler01(int *esp);\r
+void inthandler02(int *esp);\r
+void inthandler03(int *esp);\r
+void inthandler04(int *esp);\r
+void inthandler05(int *esp);\r
+void inthandler06(int *esp);\r
+void inthandler07(int *esp);\r
+void inthandler08(int *esp);\r
+void inthandler09(int *esp);\r
+void inthandler0a(int *esp);\r
+void inthandler0b(int *esp);\r
+void inthandler0c(int *esp);\r
+void inthandler0d(int *esp);\r
+void inthandler0e(int *esp);\r
+void inthandler0f(int *esp);\r
+void inthandler11(int *esp);\r
+void inthandler12(int *esp);\r
+void inthandler13(int *esp);\r
+void inthandler14(int *esp);\r
+void inthandler15(int *esp);\r
+void inthandler16(int *esp);\r
+void inthandler17(int *esp);\r
+void inthandler18(int *esp);\r
+void inthandler19(int *esp);\r
+void inthandler1a(int *esp);\r
+void inthandler1b(int *esp);\r
+void inthandler1c(int *esp);\r
+void inthandler1d(int *esp);\r
+void inthandler1e(int *esp);\r
+void inthandler1f(int *esp);\r
+\r
+/*io.c*/\r
+void init_serial(void);\r
+void send_serial(uchar *s);\r
+uint readcmos(uchar addr);\r
+void readrtc(uchar *t);\r
+void fdc_motor_on(uchar d);\r
+void fdc_motor_off(uchar d);\r
+void reset_cpu(void);\r
+\r
+/*memory.c*/\r
+uint memtest(uint start, uint end);\r
+void memman_init(IO_MemoryControl *man);\r
+uint memman_free_total(IO_MemoryControl *man);\r
+void *memman_alloc(IO_MemoryControl *man, uint size);\r
+int memman_free(IO_MemoryControl *man, void *addr0, uint size);\r
+void *memman_alloc_page(IO_MemoryControl *man);\r
+void sys_memman_init(void);\r
+uint sys_memman_free_total(void);\r
+void *sys_memman_alloc(uint size);\r
+int sys_memman_free(void *addr, uint size);\r
+void *sys_memman_alloc_page(void);\r
+\r
+/*paging.c*/\r
+void init_paging(void);\r
+void paging_set_dir(uint *dir_entry, uint *table_base, uint attribute, uint available);\r
+void paging_set_table(uint *table_entry, uint *page_base, uint attribute, uint available);\r
+\r
+/*sheet.c*/\r
+void init_sheets(void *vram, int xsize, int ysize, uchar bits);\r
+UI_Sheet *sheet_alloc(void);\r
+void sheet_setbuf(UI_Sheet *sht, void *buf,int xsize, int ysize, uint col_inv);\r
+void sheet_updown(UI_Sheet *sht, int height);\r
+void sheet_refresh(UI_Sheet *sht, int bx0, int by0, int bx1, int by1);\r
+void sheet_refresh_full_alpha(UI_Sheet *sht);\r
+void sheet_refresh_full(UI_Sheet *sht);\r
+void sheet_slide(UI_Sheet *sht, int vx0, int vy0);\r
+void sheet_free(UI_Sheet *sht);\r
+void sheet_refreshsub32(int vx0, int vy0, int vx1, int vy1, int h0, int h1);\r
+void sheet_refreshsub16(int vx0, int vy0, int vx1, int vy1, int h0, int h1);\r
+void sheet_refreshsub8(int vx0, int vy0, int vx1, int vy1, int h0, int h1);\r
+void sheet_refreshmap32(int vx0, int vy0, int vx1, int vy1, int h0);\r
+void sheet_refreshmap16(int vx0, int vy0, int vx1, int vy1, int h0);\r
+void sheet_refreshmap8(int vx0, int vy0, int vx1, int vy1, int h0);\r
+int sheet_get_topheight(void);\r
+\r
+/* naskfunc.nas */\r
+void cpuid(void *addr, uint idaddr);\r
+void read_tsc(uint *addr);\r
+void pipelineflush(void);\r
+void pit_beep_on(void);\r
+void pit_beep_off(void);\r
+void clts(void);\r
+void fnsave(uint *addr);\r
+void frstore(uint *addr);\r
+void asm_inthandler07(void);\r
+void io_hlt(void);\r
+void io_cli(void);\r
+void io_sti(void);\r
+void io_stihlt(void);\r
+uint io_in8(uint port);\r
+uint io_in16(uint port);\r
+uint io_in32(uint port);\r
+void io_out8(uint port, uint data);\r
+void io_out16(uint port, uint data);\r
+void io_out32(uint port, uint data);\r
+uint io_load_eflags(void);\r
+void io_store_eflags(uint eflags);\r
+void load_gdtr(uint limit, uint addr);\r
+void load_idtr(uint limit, uint addr);\r
+uint load_cr0(void);\r
+void store_cr0(uint cr0);\r
+uint load_cr1(void);\r
+void store_cr1(uint cr1);\r
+uint load_cr2(void);\r
+void store_cr2(uint cr2);\r
+uint load_cr3(void);\r
+void store_cr3(uint cr3);\r
+void load_tr(uint tr);\r
+uint memtest_sub(uint start, uint end);\r
+void farjmp(uint eip, uint cs);\r
+void farcall(uint eip, uint cs);\r
+void start_app(int eip, int cs, int esp, int ds, int *tss_esp0);\r
+void asm_end_app(void);\r
+void asm_hrb_api(void);\r
+void asm_inthandler00(void);\r
+void asm_inthandler01(void);\r
+void asm_inthandler02(void);\r
+void asm_inthandler03(void);\r
+void asm_inthandler04(void);\r
+void asm_inthandler05(void);\r
+void asm_inthandler06(void);\r
+void asm_inthandler07(void);\r
+void asm_inthandler08(void);\r
+void asm_inthandler09(void);\r
+void asm_inthandler0a(void);\r
+void asm_inthandler0b(void);\r
+void asm_inthandler0c(void);\r
+void asm_inthandler0d(void);\r
+void asm_inthandler0e(void);\r
+void asm_inthandler0f(void);\r
+void asm_inthandler10(void);\r
+void asm_inthandler11(void);\r
+void asm_inthandler12(void);\r
+void asm_inthandler13(void);\r
+void asm_inthandler14(void);\r
+void asm_inthandler15(void);\r
+void asm_inthandler16(void);\r
+void asm_inthandler17(void);\r
+void asm_inthandler18(void);\r
+void asm_inthandler19(void);\r
+void asm_inthandler1a(void);\r
+void asm_inthandler1b(void);\r
+void asm_inthandler1c(void);\r
+void asm_inthandler1d(void);\r
+void asm_inthandler1e(void);\r
+void asm_inthandler1f(void);\r
+void asm_inthandler20(void);\r
+void asm_inthandler21(void);\r
+void asm_inthandler27(void);\r
+void asm_inthandler2c(void);\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/fifo.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/fifo.c
new file mode 100644 (file)
index 0000000..274791d
--- /dev/null
@@ -0,0 +1,62 @@
+\r
+#include "core.h"\r
+\r
+void fifo32_init(DATA_FIFO *fifo, uint size, uint *buf, UI_Task *task)\r
+{\r
+       fifo->size = size;\r
+       fifo->buf = buf;\r
+       fifo->free = size;      /*freesize*/\r
+       fifo->flags = 0;\r
+       fifo->p = 0;    /*write*/\r
+       fifo->q = 0;    /*read*/\r
+       fifo->task = task;\r
+       return;\r
+}\r
+\r
+int fifo32_put(DATA_FIFO *fifo, uint data)\r
+{\r
+       int eflags;\r
+\r
+       eflags = io_load_eflags();\r
+       io_cli();\r
+\r
+       if (fifo->free == 0 ) {\r
+               fifo->flags |= FIFO32_PUT_OVERFLOW;\r
+               return -1;\r
+               }\r
+       fifo->buf[fifo->p] = data;\r
+       fifo->p++;\r
+       if(fifo->p == fifo->size) {\r
+               fifo->p = 0;\r
+               }\r
+       fifo->free--;\r
+       if(fifo->task != 0){\r
+               if(fifo->task->flags != inuse) task_run(fifo->task, -1, 0);\r
+       }\r
+\r
+       io_store_eflags(eflags);\r
+\r
+       return 0;\r
+\r
+}\r
+\r
+uint fifo32_get(DATA_FIFO *fifo)\r
+{\r
+       int data;\r
+       if (fifo->free == fifo->size) {\r
+               if(fifo->q == 0) return fifo->buf[fifo->size];\r
+               return fifo->buf[fifo->q - 1];\r
+       }\r
+       data = fifo->buf[fifo->q];\r
+       fifo->q++;\r
+       if (fifo->q == fifo->size) {\r
+               fifo->q = 0;\r
+       }\r
+       fifo->free++;\r
+       return data;\r
+}\r
+\r
+uint fifo32_status(DATA_FIFO *fifo)\r
+{\r
+       return fifo->size - fifo->free;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/file.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/file.c
new file mode 100644 (file)
index 0000000..7cb45a1
--- /dev/null
@@ -0,0 +1,87 @@
+\r
+#include "core.h"\r
+\r
+void decode_fat(ushort *fat, bool backup)\r
+{\r
+       int i, j = 0;\r
+       uchar *img;\r
+\r
+       if(backup)      img = (uchar *)ADR_DISKIMG + 0x00001400;\r
+       else            img = (uchar *)ADR_DISKIMG + 0x00000200;\r
+\r
+       for(i = 0; i < 2880; i += 2){\r
+               fat[i + 0] = (img[j + 0]        | img[j + 1] << 8) & 0xfff;\r
+               fat[i + 1] = (img[j + 1] >> 4   | img[j + 2] << 4) & 0xfff;\r
+               j += 3;\r
+       }\r
+       return;\r
+}\r
+\r
+void load_file(uint finfo_no, uchar *buf)\r
+{\r
+       int i;\r
+       uchar *img;\r
+       uint size;\r
+       ushort clustno;\r
+\r
+       if(finfo_no > 224) return;\r
+\r
+       img = (uchar *)ADR_DISKIMG + 0x00003e00;\r
+       size = system.io.file.list[finfo_no].size;\r
+       clustno = system.io.file.list[finfo_no].clustno;\r
+\r
+\r
+       for(;;){\r
+               if(size <= 512){\r
+                       for(i = 0; i < size; i++){\r
+                               buf[i] = img[clustno * 512 + i];\r
+                       }\r
+                       break;\r
+               }\r
+               for(i = 0; i < 512; i++){\r
+                       buf[i] = img[clustno * 512 + i];\r
+               }\r
+               size -= 512;\r
+               buf += 512;\r
+               clustno = system.io.file.fat[clustno];\r
+               \r
+       }\r
+}\r
+\r
+uint search_file(char *name)\r
+{\r
+       int i, j;\r
+       uchar s[12];\r
+\r
+       for(j = 0; j < 11; j++){\r
+               s[j] = ' ';\r
+       }\r
+       j = 0;\r
+       for(i = 0; j < 11 && name[i] != 0x00; i++){\r
+               if(name[i] == '.' && j <= 8){\r
+                       j = 8;\r
+               } else{\r
+                       s[j] = name[i];\r
+                       if('a' <= s[j] && s[j] <= 'z'){\r
+                               s[j] -= 0x20;\r
+                       }\r
+                       j++;\r
+               }\r
+       }\r
+       for(i = 0; i < 224; ){\r
+               if(system.io.file.list[i].name[0] == 0x00) break;\r
+               if((system.io.file.list[i].type & 0x18) == 0){\r
+                       for(j = 0; j < 11; j++){\r
+                               if(system.io.file.list[i].name[j] != s[j]) goto next_file;\r
+                       }\r
+                       break; \r
+               }\r
+next_file:\r
+               i++;\r
+       }\r
+       if(i < 224 && system.io.file.list[i].name[0] != 0x00){\r
+               return i;\r
+       } else {\r
+               return 0xFFFFFFFF;\r
+       }\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/gdtidt.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/gdtidt.c
new file mode 100644 (file)
index 0000000..c55bf48
--- /dev/null
@@ -0,0 +1,83 @@
+\r
+#include "core.h"\r
+\r
+void init_gdtidt(void)\r
+{\r
+       int i;\r
+       IO_SegmentDescriptor *gdt = system.io.mem.segment.gdt;\r
+       IO_GateDescriptor *idt = system.io.interrupt.idt;\r
+\r
+       for(i =0; i < 8192; i++){\r
+               set_segmdesc(gdt + i, 0, 0, 0);\r
+       }\r
+       set_segmdesc(gdt + 1, 0xffffffff, 0x00000000, AR_DATA32_RW);\r
+       set_segmdesc(gdt + 2, 0x0007ffff, 0x00280000, AR_CODE32_ER);\r
+       load_gdtr(0xffff, (int)gdt);\r
+       \r
+       for(i = 0; i < 256; i++) {\r
+               set_gatedesc(idt + i, 0, 0, 0);\r
+       }\r
+       load_idtr(0x7ff, (int)idt);\r
+\r
+       set_gatedesc(idt+0x00, (int) asm_inthandler00, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x01, (int) asm_inthandler01, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x02, (int) asm_inthandler02, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x03, (int) asm_inthandler03, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x04, (int) asm_inthandler04, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x05, (int) asm_inthandler05, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x06, (int) asm_inthandler06, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x07, (int) asm_inthandler07, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x08, (int) asm_inthandler08, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x09, (int) asm_inthandler09, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x0a, (int) asm_inthandler0a, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x0b, (int) asm_inthandler0b, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x0c, (int) asm_inthandler0c, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x0d, (int) asm_inthandler0d, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x0e, (int) asm_inthandler0e, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x0f, (int) asm_inthandler0f, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x10, (int) asm_inthandler10, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x11, (int) asm_inthandler11, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x12, (int) asm_inthandler12, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x13, (int) asm_inthandler13, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x14, (int) asm_inthandler14, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x15, (int) asm_inthandler15, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x16, (int) asm_inthandler16, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x17, (int) asm_inthandler17, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x18, (int) asm_inthandler18, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x19, (int) asm_inthandler19, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x1a, (int) asm_inthandler1a, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x1b, (int) asm_inthandler1b, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x1c, (int) asm_inthandler1c, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x1d, (int) asm_inthandler1d, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x1e, (int) asm_inthandler1e, 2 * 8, AR_INTGATE32);\r
+       set_gatedesc(idt+0x1f, (int) asm_inthandler1f, 2 * 8, AR_INTGATE32);\r
+\r
+       set_gatedesc(idt+0x40, (int) asm_hrb_api, 2 * 8, AR_INTGATE32 + AR_APP);\r
+\r
+       return;\r
+}\r
+\r
+void set_segmdesc(IO_SegmentDescriptor *sd, uint limit, int base, int ar)\r
+{\r
+       if(limit > 0xfffff){\r
+               ar |= 0x8000;\r
+               limit = limit >> 12;\r
+       }\r
+       sd->limit_low           = limit & 0xffff;\r
+       sd->base_low            = base & 0xffff;\r
+       sd->base_mid            = (base >> 16) & 0xff;\r
+       sd->access_right        = ar & 0xff;\r
+       sd->limit_high          = ((limit >> 16) & 0x0f) | ((ar >> 8) & 0xf0);\r
+       sd->base_high           = (base >> 24) & 0xff;\r
+       return;\r
+}\r
+\r
+void set_gatedesc(IO_GateDescriptor *gd, int offset, int selector, int ar)\r
+{\r
+       gd->offset_low          = offset & 0xffff;\r
+       gd->selector            = selector;\r
+       gd->dw_count            = (ar >> 8) & 0xff;\r
+       gd->access_right        = ar & 0xff;\r
+       gd->offset_high         = (offset >> 16) & 0xffff;\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/grap_08.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/grap_08.c
new file mode 100644 (file)
index 0000000..652ac1c
--- /dev/null
@@ -0,0 +1,152 @@
+\r
+#include "core.h"\r
+\r
+void boxfill8(uchar *vram, int xsize, uchar c, int x0, int y0, int x1, int y1)\r
+{\r
+       int x, y;\r
+\r
+       y1 -= 1;\r
+       x1 -= 1;\r
+\r
+       for (y = y0; y <= y1; y++) {\r
+               for (x = x0; x <= x1; x++)\r
+                       vram[y * xsize + x] = c;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void init_desktop8(uchar *vram, uint xsize, uint ysize)\r
+{\r
+       boxfill8(vram, xsize, DESKTOP_COL8, 0, 0, xsize, ysize);\r
+\r
+       return; \r
+}\r
+\r
+void init_taskbar8(uchar *vram, uint xsize)\r
+{\r
+       boxfill8(vram, xsize, COL8_FFFFFF, 0, 0, xsize, TASKBAR_HEIGHT);\r
+       boxfill8(vram, xsize, COL8_FFFFFF, 0, 0, xsize - 2, TASKBAR_HEIGHT - 2);\r
+       boxfill8(vram, xsize, TASKBAR_COL8, 2, 2, xsize - 2, TASKBAR_HEIGHT - 2);\r
+\r
+       return;\r
+}\r
+\r
+void putfont8(uchar *vram, int xsize, int x, int y, uchar c, uchar *font)\r
+{\r
+       int i;\r
+       uchar d;\r
+       uchar *p;\r
+       for (i = 0; i < 16; i++) {\r
+               p = vram + (y + i) * xsize + x;\r
+               d = font[i];\r
+               if ((d & 0x80) != 0) { p[0] = c; }\r
+               if ((d & 0x40) != 0) { p[1] = c; }\r
+               if ((d & 0x20) != 0) { p[2] = c; }\r
+               if ((d & 0x10) != 0) { p[3] = c; }\r
+               if ((d & 0x08) != 0) { p[4] = c; }\r
+               if ((d & 0x04) != 0) { p[5] = c; }\r
+               if ((d & 0x02) != 0) { p[6] = c; }\r
+               if ((d & 0x01) != 0) { p[7] = c; }\r
+       }\r
+       return;\r
+}\r
+\r
+void putfonts8_asc(uchar *vram, int xsize, int x, int y, uchar c, const uchar *s)\r
+{\r
+       for (; *s != 0x00; s++) {\r
+               putfont8(vram, xsize, x, y, c, hankaku + *s * 16);\r
+               x += 8;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void init_mouse_cursor8(uchar *mouse)\r
+{\r
+       int x, y;\r
+\r
+       for (y = 0; y < 24; y++) {\r
+               for (x = 0; x < 24; x++) {\r
+                       if (cursor[y][x] == '*') {\r
+                               mouse[y * 24 + x] = COL8_000000;\r
+                       }\r
+                       if (cursor[y][x] == 'O') {\r
+                               mouse[y * 24 + x] = COL8_FFFFFF;\r
+                       }\r
+                       if (cursor[y][x] == '.') {\r
+                               mouse[y * 24 + x] = INV_COL8;\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void putblock8_8(uchar *vram, int vxsize, int pxsize,int pysize, int px0, int py0, uchar *buf, int bxsize)\r
+{\r
+       int x, y;\r
+\r
+       for (y = 0; y < pysize; y++) {\r
+               for (x = 0; x < pxsize; x++) {\r
+                       vram[(py0 + y) * vxsize + (px0 + x)] = buf[y * bxsize + x];\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void init_palette(void)\r
+{\r
+       static uchar table_rgb[16 * 3] = {\r
+               0x00, 0x00, 0x00,\r
+               0xff, 0x00, 0x00,\r
+               0x00, 0xff, 0x00,\r
+               0xff, 0xff, 0x00,\r
+               0x00, 0x00, 0xff,\r
+               0xff, 0x00, 0xff,\r
+               0x00, 0xff, 0xff,\r
+               0xff, 0xff, 0xff,\r
+               0xc6, 0xc6, 0xc6,\r
+               0x84, 0x00, 0x00,\r
+               0x00, 0x84, 0x00,\r
+               0x84, 0x84, 0x00,\r
+               0x00, 0x00, 0x84,\r
+               0x84, 0x00, 0x84,\r
+               0x00, 0x84, 0x84,\r
+               0x84, 0x84, 0x84\r
+       };\r
+       uchar table2[216 * 3];\r
+       int r, g, b;\r
+\r
+       set_palette(0, 15, table_rgb);\r
+       for (b = 0; b < 6; b++) {\r
+               for (g = 0; g < 6; g++) {\r
+                       for (r = 0; r < 6; r++) {\r
+                               table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;\r
+                               table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;\r
+                               table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;\r
+                       }\r
+               }\r
+       }\r
+       set_palette(16, 231, table2);\r
+\r
+       return;\r
+}\r
+\r
+void set_palette(int start, int end, uchar *rgb)\r
+{\r
+       int i, eflags;\r
+\r
+       eflags = io_load_eflags();\r
+       io_cli(); \r
+       io_out8(0x03c8, start);\r
+       for (i = start; i <= end; i++) {\r
+               io_out8(0x03c9, rgb[0] >> 2);\r
+               io_out8(0x03c9, rgb[1] >> 2);\r
+               io_out8(0x03c9, rgb[2] >> 2);\r
+               rgb += 3;\r
+       }\r
+       io_store_eflags(eflags);\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/grap_16.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/grap_16.c
new file mode 100644 (file)
index 0000000..ffe528f
--- /dev/null
@@ -0,0 +1,97 @@
+\r
+#include "core.h"\r
+\r
+void boxfill16(ushort *vram, int xsize, ushort c, int x0, int y0, int x1, int y1)\r
+{\r
+       int x, y;\r
+\r
+       y1 -= 1;\r
+       x1 -= 1;\r
+\r
+       for (y = y0;y <= y1;y++) {\r
+               for (x = x0; x <= x1; x++)\r
+               vram[y * xsize + x] = c;\r
+       }\r
+\r
+       return;\r
+}\r
+void init_desktop16(ushort *vram, uint xsize, uint ysize)\r
+{\r
+       boxfill16(vram, xsize, DESKTOP_COL16, 0, 0, xsize, ysize);\r
+\r
+       return; \r
+}\r
+\r
+void init_taskbar16(ushort *vram, uint xsize)\r
+{\r
+       boxfill16(vram, xsize, RGB16(31,62,31), 0, 0, xsize, TASKBAR_HEIGHT);\r
+       boxfill16(vram, xsize, RGB16(31,62,31), 0, 0, xsize - 2, TASKBAR_HEIGHT - 2);\r
+       boxfill16(vram, xsize, TASKBAR_COL16, 2, 2, xsize - 2, TASKBAR_HEIGHT - 2);\r
+\r
+       return;\r
+}\r
+void putfont16(ushort *vram, int xsize, int x, int y, ushort c, uchar *font)\r
+{\r
+       int i;\r
+       ushort *p;\r
+       char d;\r
+\r
+       for (i = 0; i < 16; i++) {\r
+               p = vram + (y + i) * xsize + x;\r
+               d = font[i];\r
+               if ((d & 0x80) != 0) { p[0] = c; }\r
+               if ((d & 0x40) != 0) { p[1] = c; }\r
+               if ((d & 0x20) != 0) { p[2] = c; }\r
+               if ((d & 0x10) != 0) { p[3] = c; }\r
+               if ((d & 0x08) != 0) { p[4] = c; }\r
+               if ((d & 0x04) != 0) { p[5] = c; }\r
+               if ((d & 0x02) != 0) { p[6] = c; }\r
+               if ((d & 0x01) != 0) { p[7] = c; }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void putfonts16_asc(ushort *vram, int xsize, int x, int y, ushort c, const uchar *s)\r
+{\r
+       for (; *s != 0x00; s++) {\r
+               putfont16(vram, xsize, x, y, c, hankaku + *s * 16);\r
+               x += 8;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void init_mouse_cursor16(ushort *mouse)\r
+{\r
+       int x, y;\r
+\r
+       for (y = 0; y < 24; y++) {\r
+               for (x = 0; x < 24; x++) {\r
+                       if (cursor[y][x] == '*') {\r
+                               mouse[y * 24 + x] = RGB16(0,0,0);\r
+                       }\r
+                       if (cursor[y][x] == 'O') {\r
+                               mouse[y * 24 + x] = RGB16(31,62,31);\r
+                       }\r
+                       if (cursor[y][x] == '.') {\r
+                               mouse[y * 24 + x] = INV_COL16;\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void putblock16_16(ushort *vram, int vxsize, int pxsize,int pysize, int px0, int py0, ushort *buf, int bxsize)\r
+{\r
+       int x, y;\r
+\r
+       for (y = 0; y < pysize; y++) {\r
+               for (x = 0; x < pxsize; x++) {\r
+                       vram[(py0 + y) * vxsize + (px0 + x)] = buf[y * bxsize + x];\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/grap_32.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/grap_32.c
new file mode 100644 (file)
index 0000000..81daf0c
--- /dev/null
@@ -0,0 +1,99 @@
+\r
+#include "core.h"\r
+\r
+void boxfill32(uint *vram, int xsize, uint c, int x0, int y0, int x1, int y1)\r
+{\r
+       int x, y;\r
+\r
+       y1 -= 1;\r
+       x1 -= 1;\r
+\r
+       for (y = y0;y <= y1;y++) {\r
+               for (x = x0; x <= x1; x++)\r
+               vram[y * xsize + x] = c;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void init_desktop32(uint *vram, uint xsize, uint ysize)\r
+{\r
+       boxfill32(vram, xsize, DESKTOP_COL32, 0, 0, xsize, ysize);\r
+\r
+       return; \r
+}\r
+\r
+void init_taskbar32(uint *vram, uint xsize)\r
+{\r
+       boxfill32(vram, xsize, 0xFFFFFF, 0, 0, xsize, TASKBAR_HEIGHT);\r
+       boxfill32(vram, xsize, 0xFFFFFF, 0, 0, xsize - 2, TASKBAR_HEIGHT - 2);\r
+       boxfill32(vram, xsize, TASKBAR_COL32, 2, 2, xsize - 2, TASKBAR_HEIGHT - 2);\r
+\r
+       return;\r
+}\r
+\r
+void putfont32(uint *vram, int xsize, int x, int y, uint c, uchar *font)\r
+{\r
+       int i;\r
+       int *p;\r
+       char d;\r
+\r
+       for (i = 0; i < 16; i++) {\r
+               p = vram + (y + i) * xsize + x;\r
+               d = font[i];\r
+               if ((d & 0x80) != 0) { p[0] = c; }\r
+               if ((d & 0x40) != 0) { p[1] = c; }\r
+               if ((d & 0x20) != 0) { p[2] = c; }\r
+               if ((d & 0x10) != 0) { p[3] = c; }\r
+               if ((d & 0x08) != 0) { p[4] = c; }\r
+               if ((d & 0x04) != 0) { p[5] = c; }\r
+               if ((d & 0x02) != 0) { p[6] = c; }\r
+               if ((d & 0x01) != 0) { p[7] = c; }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void putfonts32_asc(uint *vram, int xsize, int x, int y, uint c, const uchar *s)\r
+{\r
+       for (; *s != 0x00; s++) {\r
+               putfont32(vram, xsize, x, y, c, hankaku + *s * 16);\r
+               x += 8;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void init_mouse_cursor32(uint *mouse)\r
+{\r
+       int x, y;\r
+\r
+       for (y = 0; y < 24; y++) {\r
+               for (x = 0; x < 24; x++) {\r
+                       if (cursor[y][x] == '*') {\r
+                               mouse[y * 24 + x] = 0x55000000;\r
+                       }\r
+                       if (cursor[y][x] == 'O') {\r
+                               mouse[y * 24 + x] = 0x55FFFFFF;\r
+                       }\r
+                       if (cursor[y][x] == '.') {\r
+                               mouse[y * 24 + x] = INV_COL32;\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void putblock32_32(uint *vram, int vxsize, int pxsize,int pysize, int px0, int py0, uint *buf, int bxsize)\r
+{\r
+       int x, y;\r
+\r
+       for (y = 0; y < pysize; y++) {\r
+               for (x = 0; x < pxsize; x++) {\r
+                       vram[(py0 + y) * vxsize + (px0 + x)] = buf[y * bxsize + x];\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/graphic.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/graphic.c
new file mode 100644 (file)
index 0000000..005a57d
--- /dev/null
@@ -0,0 +1,603 @@
+\r
+#include "core.h"\r
+\r
+/*ColorTable*/\r
+uint rgb_int2char_list [16] = {\r
+       0x000000,\r
+       0xff0000,\r
+       0x00ff00,\r
+       0xffff00,\r
+       0x0000ff,\r
+       0xff00ff,\r
+       0x00ffff,\r
+       0xffffff,\r
+       0xc6c6c6,\r
+       0x840000,\r
+       0x008400,\r
+       0x848400,\r
+       0x000084,\r
+       0x840084,\r
+       0x008484,\r
+       0x848484\r
+};\r
+char cursor[24][24] = {\r
+       "***.....................",\r
+       "*O**....................",\r
+       "*OO**...................",\r
+       "*OOO**..................",\r
+       "*OOOO**.................",\r
+       "*OOOOO**................",\r
+       "*OOOOOO**...............",\r
+       "*OOOOOOO**..............",\r
+       "*OOOOOOOO**.............",\r
+       "*OOOOOOOOO**............",\r
+       "*OOOOOOOOOO**...........",\r
+       "*OOOOOOOOOOO**..........",\r
+       "*OOOOOOOOOOOO**.........",\r
+       "*OOOOOOOOOOOOO**........",\r
+       "*OOOOOOOOOOOOOO**.......",\r
+       "*OOOOOOOOOOOOOOO**......",\r
+       "*OOOOOOOOOOOOOOOO**.....",\r
+       "*OOOOOO*************....",\r
+       "*OOOOO**................",\r
+       "*OOOO**.................",\r
+       "*OOO**..................",\r
+       "*OO**...................",\r
+       "*O**....................",\r
+       "***.....................",\r
+};\r
+\r
+void putfonts_asc_sht_i(UI_Sheet *sht, int x, int y, uint c, uint bc, const uchar *s)\r
+{\r
+       int l;\r
+       l = strlen(s);\r
+       boxfill_i(sht->buf, sht->bxsize, bc, x, y, x + l * 8, y + 16);\r
+       putfonts_asc_i(sht->buf, sht->bxsize, x, y, c, s);\r
+       sheet_refresh(sht, x, y, x + l * 8, y + 16);\r
+       return;\r
+}\r
+\r
+void putfonts_asc_sht_i_no_bc(UI_Sheet *sht, int x, int y, uint c, const uchar *s)\r
+{\r
+       int l;\r
+       l = strlen(s);\r
+       putfonts_asc_i(sht->buf, sht->bxsize, x, y, c, s);\r
+       sheet_refresh(sht, x, y, x + l * 8, y + 16);\r
+       return;\r
+}\r
+\r
+void init_screen_i(void *desktop, void *taskbar, void *mousecursor)\r
+{\r
+       uchar bpp;\r
+\r
+       bpp = system.data.info.vesa.BitsPerPixel;\r
+\r
+       if(bpp == 8){\r
+               init_palette();\r
+       }\r
+       init_desktop_i(desktop);\r
+       init_taskbar_i(taskbar);\r
+       init_mousecursor_i(mousecursor);\r
+\r
+       return;\r
+}\r
+\r
+void init_desktop_i(void *vrami)\r
+{\r
+       uchar bpp;\r
+       uint xsize, ysize;\r
+\r
+       bpp = system.data.info.vesa.BitsPerPixel;\r
+       xsize = system.data.info.boot.scrnx;\r
+       ysize = system.data.info.boot.scrny;\r
+\r
+       if(bpp == 8){\r
+               init_desktop8(vrami, xsize, ysize);\r
+       } else if(bpp == 16){\r
+               init_desktop16(vrami, xsize, ysize);\r
+       } else if(bpp == 32){\r
+               init_desktop32(vrami, xsize, ysize);\r
+       }\r
+       return; \r
+}\r
+\r
+void init_taskbar_i(void *vrami)\r
+{\r
+       uchar bpp;\r
+       uint xsize;\r
+\r
+       bpp = system.data.info.vesa.BitsPerPixel;\r
+       xsize = system.data.info.boot.scrnx;\r
+\r
+       if(bpp == 8){\r
+               init_taskbar8(vrami, xsize);\r
+       } else if(bpp == 16){\r
+               init_taskbar16(vrami, xsize);\r
+       } else if(bpp == 32){\r
+               init_taskbar32(vrami, xsize);\r
+       }\r
+       return; \r
+}\r
+\r
+void init_mousecursor_i(void *vrami)\r
+{\r
+       uchar bpp;\r
+\r
+       bpp = system.data.info.vesa.BitsPerPixel;\r
+\r
+       if(bpp == 8){\r
+               init_mouse_cursor8(vrami);\r
+       } else if(bpp == 16){\r
+               init_mouse_cursor16(vrami);\r
+       } else if(bpp == 32){\r
+               init_mouse_cursor32(vrami);\r
+       }\r
+       return; \r
+}\r
+\r
+uint mix_color(uint c0, uint c1)\r
+{\r
+       float r0,g0,b0,r1,g1,b1,alpha;\r
+       uint cc;\r
+\r
+       cc = c0 << 24;\r
+       b0 = (float)(cc >> 24);\r
+       cc = c0 << 16;\r
+       g0 = (float)(cc >> 24);\r
+       cc = c0 << 8;\r
+       r0 = (float)(cc >> 24);\r
+\r
+       cc = c1 << 24;\r
+       b1 = (float)(cc >> 24);\r
+       cc = c1 << 16;\r
+       g1 = (float)(c1 >> 24);\r
+       cc = c1 << 8;\r
+       r1 = (float)(c1 >> 24);\r
+\r
+       alpha = (float)(c1 >> 24);\r
+\r
+       r1 = r1 * (alpha / 255) + r0 * (1 - (alpha / 255));\r
+       g1 = g1 * (alpha / 255) + g0 * (1 - (alpha / 255));\r
+       b1 = b1 * (alpha / 255) + b0 * (1 - (alpha / 255));\r
+\r
+       c1 = (uint) alpha;\r
+       c1 = c1 << 8;\r
+       c1 += (uint) r1;\r
+       c1 = c1 << 8;\r
+       c1 += (uint) g1;\r
+       c1 = c1 << 8;\r
+       c1 += (uint) b1;\r
+\r
+       return c1;\r
+}\r
+\r
+void point_i(void *vrami, int x, int y, uint c, int xsize)\r
+{\r
+       uint cc = 0x00000000;\r
+\r
+       if(system.data.info.vesa.BitsPerPixel == 8){\r
+               cc = rgb_int2char(c);\r
+       } else if(system.data.info.vesa.BitsPerPixel == 16){\r
+               cc = rgb_int2short(c);\r
+       } else if(system.data.info.vesa.BitsPerPixel == 32){\r
+               cc = c;\r
+       }\r
+       point_bpp(vrami, x, y, cc, xsize, system.data.info.vesa.BitsPerPixel);\r
+       return;\r
+}\r
+\r
+void point_bpp(void *vrami, int x, int y, uint c, int xsize, uint bpp)\r
+{\r
+       uchar *buf8;\r
+       ushort *buf16;\r
+       uint *buf32;\r
+\r
+       if(bpp == 8){\r
+               buf8 = vrami;\r
+               buf8[y * xsize + x] = (uchar)c;\r
+       } else if(bpp == 16){\r
+               buf16 = vrami;\r
+               buf16[y * xsize + x] = (ushort)c;\r
+       } else if(bpp == 32){\r
+               buf32 = vrami;\r
+               buf32[y * xsize + x] = (uint)c;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void boxfill_i(void *vrami, int xsize, uint c, int x0, int y0, int x1, int y1)\r
+{\r
+       uint cc = 0x00000000;\r
+\r
+       if(system.data.info.vesa.BitsPerPixel == 8){\r
+               cc = rgb_int2char(c);\r
+       } else if(system.data.info.vesa.BitsPerPixel == 16){\r
+               cc = rgb_int2short(c);\r
+       } else if(system.data.info.vesa.BitsPerPixel == 32){\r
+               cc = c;\r
+       }\r
+       boxfill_bpp(vrami, xsize, cc, x0, y0, x1, y1, system.data.info.vesa.BitsPerPixel);\r
+       return;\r
+}\r
+\r
+void boxfill_bpp(void *vrami, int xsize, uint c, int x0, int y0, int x1, int y1, uint bpp)\r
+{\r
+       if(bpp == 8){\r
+               boxfill8(vrami, xsize, c, x0, y0, x1, y1);      \r
+       } else if(bpp == 16){\r
+               boxfill16(vrami, xsize, c, x0, y0, x1, y1);\r
+       } else if(bpp == 32){\r
+               boxfill32(vrami, xsize, c, x0, y0, x1, y1);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void putfonts_asc_i(void *vrami, int xsize, int x, int y, uint c, const uchar *s)\r
+{\r
+       if(system.data.info.vesa.BitsPerPixel == 8){\r
+               uchar c8 = rgb_int2char(c);\r
+               for (; *s != 0x00; s++) {\r
+                       putfont8(vrami, xsize, x, y, c8, hankaku + *s * 16);\r
+                       x += 8;\r
+               }\r
+               return;\r
+       } else if(system.data.info.vesa.BitsPerPixel == 16){\r
+               ushort c16 = rgb_int2short(c);\r
+               for (; *s != 0x00; s++) {\r
+                       putfont16(vrami, xsize, x, y, c16, hankaku + *s * 16);\r
+                       x += 8;\r
+               }\r
+               return;\r
+       } else if(system.data.info.vesa.BitsPerPixel == 32){\r
+               for (; *s != 0x00; s++) {\r
+                       putfont32(vrami, xsize, x, y, c, hankaku + *s * 16);\r
+                       x += 8;\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void putblock_i(void *vrami, int vxsize, int pxsize, int pysize, int px0, int py0, void *buf, int bxsize)\r
+{\r
+       if(system.data.info.vesa.BitsPerPixel == 8){\r
+               putblock8_8(vrami, vxsize, pxsize, pysize, px0, py0, buf, bxsize);\r
+       } else if(system.data.info.vesa.BitsPerPixel == 16){\r
+               putblock16_16(vrami, vxsize, pxsize, pysize, px0, py0, buf, bxsize);\r
+       } else if(system.data.info.vesa.BitsPerPixel == 32){\r
+               putblock32_32(vrami, vxsize, pxsize, pysize, px0, py0, buf, bxsize);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void putblock_i_convert(void *to, int xsize, int px0, int py0, int px1, int py1, void *from, int tobpp, int frombpp)\r
+{\r
+       int x, y;\r
+\r
+       if(tobpp == 32){\r
+               if(frombpp == 8){\r
+                       for(y = py0; y < py1; y++){\r
+                               for(x = px0; x < px1; x++){\r
+                                       ((uint *)to)[(xsize * y) + x] = rgb_int2char_list[((uchar *)from)[(xsize * y) + x]];\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void line_i(void *vrami, int xsize, int x0, int y0, int x1, int y1, uint c)\r
+{\r
+       int i, x, y, len, dx, dy;\r
+\r
+       dx = x1 - x0;\r
+       dy = y1 - y0;\r
+       x = x0 << 10;\r
+       y = y0 << 10;\r
+       if(dx < 0) dx = -dx;\r
+       if(dy < 0) dy = -dy;\r
+       if(dx >= dy){\r
+               len = dx + 1;\r
+               if(x0 > x1) dx = -1024;\r
+               else dx = 1024;\r
+               if(y0 <= y1) dy = ((y1 - y0 + 1) << 10) / len;\r
+               else dy = ((y1 - y0 - 1) << 10) / len;\r
+       } else{\r
+               len = dy + 1;\r
+               if(y0 > y1) dy = -1024;\r
+               else dy = 1024;\r
+               if(x0 <= x1) dx = ((x1 - x0 + 1) << 10) / len;\r
+               else dx = ((x1 - x0 - 1) << 10) / len;\r
+       }\r
+       for(i = 0; i < len; i++){\r
+               point_i(vrami, x >> 10, y >> 10, c, xsize);\r
+               x += dx;\r
+               y += dy;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void line_bpp(void *vrami, int xsize, int x0, int y0, int x1, int y1, uint c, uint bpp)\r
+{\r
+       int i, x, y, len, dx, dy;\r
+\r
+       dx = x1 - x0;\r
+       dy = y1 - y0;\r
+       x = x0 << 10;\r
+       y = y0 << 10;\r
+       if(dx < 0) dx = -dx;\r
+       if(dy < 0) dy = -dy;\r
+       if(dx >= dy){\r
+               len = dx + 1;\r
+               if(x0 > x1) dx = -1024;\r
+               else dx = 1024;\r
+               if(y0 <= y1) dy = ((y1 - y0 + 1) << 10) / len;\r
+               else dy = ((y1 - y0 - 1) << 10) / len;\r
+       } else{\r
+               len = dy + 1;\r
+               if(y0 > y1) dy = -1024;\r
+               else dy = 1024;\r
+               if(x0 <= x1) dx = ((x1 - x0 + 1) << 10) / len;\r
+               else dx = ((x1 - x0 - 1) << 10) / len;\r
+       }\r
+       for(i = 0; i < len; i++){\r
+               point_bpp(vrami, x >> 10, y >> 10, c, xsize, bpp);\r
+               x += dx;\r
+               y += dy;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void draw_hexagon_i(void *vrami, int xsize, int a, int x, int y, uint c)\r
+{\r
+       int n, m;\r
+\r
+       if(a < 0) a = -a;\r
+       m = a >> 1;\r
+       n = (1773 * m) >> 10;\r
+\r
+\r
+       line_i(vrami, xsize, x    , y - a, x + n, y - m, c);\r
+       line_i(vrami, xsize, x + n, y - m, x + n, y + m, c);\r
+       line_i(vrami, xsize, x + n, y + m, x    , y + a, c);\r
+       line_i(vrami, xsize, x    , y + a, x - n, y + m, c);\r
+       line_i(vrami, xsize, x - n, y + m, x - n, y - m, c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y - a, c);\r
+\r
+       return;\r
+}\r
+\r
+void draw_chnos_logo(void *vrami, int xsize, int a, int x, int y)\r
+{\r
+       int n, m, oldx, oldy;\r
+       uint c;\r
+\r
+       oldx = x;\r
+       oldy = y;\r
+\r
+       if(a < 0) a = -a;\r
+       m = a >> 1;\r
+       n = (1773 * m) >> 10;\r
+       c = 0x00FFFF;\r
+\r
+       x = x - n;\r
+       x = x - n;\r
+       x = x - n;\r
+       y = y - (3 * m);\r
+\r
+       line_i(vrami, xsize, x    , y - a, x + n, y - m, c);\r
+       line_i(vrami, xsize, x + n, y + m, x    , y + a, c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y - a, c);\r
+\r
+       x = x + n;\r
+       x = x + n;\r
+\r
+       line_i(vrami, xsize, x    , y - a, x + n, y - m, c);\r
+       line_i(vrami, xsize, x + n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x + n, y - m, x + n, y + m, c);\r
+       line_i(vrami, xsize, x + n, y + m, x    , y + a, c);\r
+       line_i(vrami, xsize, x    , y + a, x    , y    , c);\r
+       line_i(vrami, xsize, x    , y + a, x - n, y + m, c);\r
+       line_i(vrami, xsize, x - n, y + m, x - n, y - m, c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y - a, c);\r
+\r
+       x = x + n;\r
+       x = x + n;\r
+\r
+       line_i(vrami, xsize, x    , y - a, x + n, y - m, c);\r
+       line_i(vrami, xsize, x + n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x + n, y - m, x + n, y + m, c);\r
+       line_i(vrami, xsize, x + n, y + m, x    , y + a, c);\r
+       line_i(vrami, xsize, x    , y + a, x    , y    , c);\r
+       line_i(vrami, xsize, x    , y + a, x - n, y + m, c);\r
+       line_i(vrami, xsize, x - n, y + m, x - n, y - m, c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y - a, c);\r
+\r
+       x = x + n;\r
+       x = x + n;\r
+\r
+       line_i(vrami, xsize, x    , y - a, x + n, y - m, c);\r
+       line_i(vrami, xsize, x    , y + a, x - n, y + m, c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y - a, c);\r
+\r
+       x = x - n;\r
+       x = x - n;\r
+\r
+       x = x - n;\r
+       x = x - n;\r
+\r
+       x = x + n;\r
+       y = y + (3 * m);\r
+\r
+       line_i(vrami, xsize, x    , y - a, x + n, y - m, c);\r
+       line_i(vrami, xsize, x + n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x + n, y - m, x + n, y + m, c);\r
+       line_i(vrami, xsize, x + n, y + m, x    , y + a, c);\r
+       line_i(vrami, xsize, x    , y + a, x    , y    , c);\r
+       line_i(vrami, xsize, x    , y + a, x - n, y + m, c);\r
+       line_i(vrami, xsize, x - n, y + m, x - n, y - m, c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y - a, c);\r
+\r
+       x = x + n;\r
+       y = y + (3 * m);\r
+\r
+       line_i(vrami, xsize, x    , y - a, x + n, y - m, c);\r
+\r
+       x = x + n;\r
+       x = x + n;\r
+\r
+       line_i(vrami, xsize, x    , y - a, x + n, y - m, c);\r
+       line_i(vrami, xsize, x + n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x + n, y - m, x + n, y + m, c);\r
+       line_i(vrami, xsize, x + n, y + m, x    , y + a, c);\r
+       line_i(vrami, xsize, x    , y + a, x    , y    , c);\r
+       line_i(vrami, xsize, x    , y + a, x - n, y + m, c);\r
+       line_i(vrami, xsize, x - n, y + m, x - n, y - m, c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y - a, c);\r
+\r
+       x = x - n;\r
+       x = x - n;\r
+\r
+       x = x - n;\r
+       y = y - (3 * m);\r
+\r
+       x = x - n;\r
+       y = y + (3 * m);\r
+\r
+       line_i(vrami, xsize, x - n, y - m, x    , y - a, c);\r
+\r
+       x = x - n;\r
+       x = x - n;\r
+\r
+       line_i(vrami, xsize, x    , y - a, x + n, y - m, c);\r
+       line_i(vrami, xsize, x + n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x + n, y - m, x + n, y + m, c);\r
+       line_i(vrami, xsize, x + n, y + m, x    , y + a, c);\r
+       line_i(vrami, xsize, x    , y + a, x    , y    , c);\r
+       line_i(vrami, xsize, x    , y + a, x - n, y + m, c);\r
+       line_i(vrami, xsize, x - n, y + m, x - n, y - m, c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y - a, c);\r
+\r
+       x = x + n;\r
+       x = x + n;\r
+\r
+       line_i(vrami, xsize, x + n, y - m, x + n, y + m, c);\r
+\r
+       x = x + n;\r
+       y = y + (3 * m);\r
+\r
+       line_i(vrami, xsize, x    , y - a, x + n, y - m, c);\r
+       line_i(vrami, xsize, x + n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x + n, y - m, x + n, y + m, c);\r
+       line_i(vrami, xsize, x + n, y + m, x    , y + a, c);\r
+       line_i(vrami, xsize, x    , y + a, x    , y    , c);\r
+       line_i(vrami, xsize, x    , y + a, x - n, y + m, c);\r
+       line_i(vrami, xsize, x - n, y + m, x - n, y - m, c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y    , c);\r
+       line_i(vrami, xsize, x - n, y - m, x    , y - a, c);\r
+\r
+       putfonts_asc_i(vrami, xsize, oldx + n + 8, oldy, 0x00FF00, "CHNOSProject");\r
+\r
+       return;\r
+}\r
+\r
+uchar rgb_int2char (uint c32)\r
+{\r
+       uchar i ;\r
+       for(i = 0;i < 15; i++) {\r
+               if(rgb_int2char_list[i] == c32) {\r
+                       return i;\r
+               }\r
+       }\r
+       return 8;\r
+}\r
+\r
+ushort rgb_int2short (uint c32)\r
+{\r
+       ushort c16;\r
+       uchar c[4];\r
+\r
+       c[3] = (c32 << 24) >> 24;\r
+       c[2] = (c32 << 16) >> 24;\r
+       c[1] = (c32 <<  8) >> 24;\r
+       c[0] = (c32 >> 24);\r
+\r
+       c16 = ((c[1] >> 3) << 11 | (c[2] >> 2) << 5 | (c[3] >> 3));\r
+       \r
+       return c16;\r
+}\r
+\r
+void col_pat(void *vrami, int xsize, int ysize)\r
+{\r
+       int x,y;\r
+\r
+       x=0;\r
+       y=0;\r
+       boxfill_i(vrami,xsize,0x000000,x,y,x+20,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x000000,0x7fff0000),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0xFF0000,x,y,x+20,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7fff0000,0x7f00ff00),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0x00FF00,x,y,x+20,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7f00ff00,0x7fffff00),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0xFFFF00,x,y,x+20,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7fffff00,0x7f0000ff),x+20,y,x+40,y+40);\r
+\r
+       y+=40;\r
+       x=0;\r
+       boxfill_i(vrami,xsize,0x0000FF,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7f0000ff,0x7fff00ff),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0xFF00FF,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7fff00ff,0x7f00ffff),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0x00FFFF,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7f00ffff,0x7fffffff),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0xFFFFFF,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7fffffff,0x7fc6c6c6),x+20,y,x+40,y+40);\r
+\r
+       y+=40;\r
+       x=0;\r
+       boxfill_i(vrami,xsize,0xC6C6C6,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7fc6c6c6,0x7fff0000),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0x840000,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7fff0000,0x7f008400),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0x008400,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7f008400,0x7f848400),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0x848400,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7f848400,0x7f000084),x+20,y,x+40,y+40);\r
+\r
+       y+=40;\r
+       x=0;\r
+       boxfill_i(vrami,xsize,0x000084,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x000000,0x7fff0000),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0x840084,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7fff0000,0x7f840084),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0x008484,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x7f840084,0x7f008484),x+20,y,x+40,y+40);\r
+       x+=40;\r
+       boxfill_i(vrami,xsize,0x848484,x,y,x+40,y+40);\r
+       boxfill_i(vrami,xsize,mix_color(0x07f008484,0x7f848484),x+20,y,x+40,y+40);\r
+\r
+       return;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/hankaku.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/hankaku.txt
new file mode 100644 (file)
index 0000000..6d5bb91
--- /dev/null
@@ -0,0 +1,4653 @@
+\r
+char 0x00\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x01\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.....*.\r
+*.....*.\r
+*.*.*.*.\r
+*..*..*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+........\r
+\r
+char 0x02\r
+........\r
+........\r
+..***...\r
+.*****..\r
+*******.\r
+**.*.**.\r
+**.*.**.\r
+*******.\r
+*******.\r
+**.*.**.\r
+***.***.\r
+.*****..\r
+..***...\r
+........\r
+........\r
+........\r
+\r
+char 0x03\r
+........\r
+........\r
+........\r
+........\r
+.**.**..\r
+*******.\r
+*******.\r
+*******.\r
+.*****..\r
+..***...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x04\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*****..\r
+*******.\r
+.*****..\r
+..***...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x05\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*******.\r
+.*.*.*..\r
+...*....\r
+..***...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x06\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*****..\r
+*******.\r
+**.*.**.\r
+...*....\r
+..***...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x07\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+..****..\r
+..****..\r
+...**...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x08\r
+********\r
+********\r
+********\r
+********\r
+********\r
+********\r
+***..***\r
+**....**\r
+**....**\r
+***..***\r
+********\r
+********\r
+********\r
+********\r
+********\r
+********\r
+\r
+char 0x09\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..****..\r
+.**..**.\r
+.*....*.\r
+.*....*.\r
+.**..**.\r
+..****..\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x0a\r
+********\r
+********\r
+********\r
+********\r
+********\r
+**....**\r
+*..**..*\r
+*.****.*\r
+*.****.*\r
+*..**..*\r
+**....**\r
+********\r
+********\r
+********\r
+********\r
+********\r
+\r
+char 0x0b\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x0c\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x0d\r
+........\r
+........\r
+....**..\r
+....***.\r
+....*.**\r
+....*.**\r
+....*.*.\r
+....*...\r
+....*...\r
+...**...\r
+.****...\r
+*****...\r
+.***....\r
+........\r
+........\r
+........\r
+\r
+char 0x0e\r
+........\r
+........\r
+...*****\r
+...*****\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+.***.***\r
+********\r
+.**..**.\r
+........\r
+........\r
+........\r
+\r
+char 0x0f\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+.*.*.*..\r
+..***...\r
+..*.*...\r
+..***...\r
+.*.*.*..\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x10\r
+........\r
+*.......\r
+**......\r
+***.....\r
+****....\r
+*****...\r
+******..\r
+*******.\r
+******..\r
+*****...\r
+****....\r
+***.....\r
+**......\r
+*.......\r
+........\r
+........\r
+\r
+char 0x11\r
+........\r
+......*.\r
+.....**.\r
+....***.\r
+...****.\r
+..*****.\r
+.******.\r
+*******.\r
+.******.\r
+..*****.\r
+...****.\r
+....***.\r
+.....**.\r
+......*.\r
+........\r
+........\r
+\r
+char 0x12\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+...*....\r
+........\r
+........\r
+........\r
+\r
+char 0x13\r
+........\r
+........\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+........\r
+........\r
+.*...*..\r
+.*...*..\r
+........\r
+........\r
+\r
+char 0x14\r
+........\r
+..*****.\r
+.*..*.*.\r
+*...*.*.\r
+*...*.*.\r
+*...*.*.\r
+*...*.*.\r
+.*..*.*.\r
+..***.*.\r
+....*.*.\r
+....*.*.\r
+....*.*.\r
+....*.*.\r
+....*.*.\r
+........\r
+........\r
+\r
+char 0x15\r
+.*****..\r
+*.....*.\r
+.*......\r
+..*.....\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+....*...\r
+.....*..\r
+*.....*.\r
+.*****..\r
+........\r
+\r
+char 0x16\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+*******.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x17\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x18\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x19\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+...*....\r
+........\r
+........\r
+\r
+char 0x1a\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+....*...\r
+.....*..\r
+*******.\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1b\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..*.....\r
+.*......\r
+*******.\r
+.*......\r
+..*.....\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1c\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*.......\r
+*.......\r
+*******.\r
+........\r
+........\r
+\r
+char 0x1d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..*.*...\r
+.*...*..\r
+*******.\r
+.*...*..\r
+..*.*...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1e\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+...*....\r
+..***...\r
+..***...\r
+.*****..\r
+.*****..\r
+*******.\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1f\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+*******.\r
+.*****..\r
+.*****..\r
+..***...\r
+..***...\r
+...*....\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x20\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x21\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x22\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x23\r
+........\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+*******.\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+*******.\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+........\r
+........\r
+\r
+char 0x24\r
+...*....\r
+..***.*.\r
+.*.*.**.\r
+*..*..*.\r
+*..*..*.\r
+*..*....\r
+.*.*....\r
+..***...\r
+...*.*..\r
+...*..*.\r
+*..*..*.\r
+*..*..*.\r
+**.*.*..\r
+*.***...\r
+...*....\r
+...*....\r
+\r
+char 0x25\r
+.**...*.\r
+*..*..*.\r
+*..*.*..\r
+*..*.*..\r
+.**.*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.**..\r
+.*.*..*.\r
+.*.*..*.\r
+*..*..*.\r
+*...**..\r
+........\r
+........\r
+\r
+char 0x26\r
+........\r
+.***....\r
+*...*...\r
+*...*...\r
+*...*...\r
+*..*....\r
+.**.....\r
+.*...***\r
+*.*...*.\r
+*..*..*.\r
+*...*.*.\r
+*....*..\r
+.*...**.\r
+..***..*\r
+........\r
+........\r
+\r
+char 0x27\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x28\r
+......*.\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+....*...\r
+.....*..\r
+......*.\r
+........\r
+\r
+char 0x29\r
+*.......\r
+.*......\r
+..*.....\r
+..*.....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+*.......\r
+........\r
+\r
+char 0x2a\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x2b\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x2c\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+....*...\r
+....*...\r
+...*....\r
+\r
+char 0x2d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x2e\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x2f\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*......\r
+.*......\r
+*.......\r
+*.......\r
+\r
+char 0x30\r
+........\r
+...**...\r
+..*..*..\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x31\r
+........\r
+....*...\r
+...**...\r
+..*.*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x32\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*......\r
+.******.\r
+........\r
+........\r
+\r
+char 0x33\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+......*.\r
+......*.\r
+.....*..\r
+...**...\r
+.....*..\r
+......*.\r
+......*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x34\r
+........\r
+....**..\r
+....**..\r
+....**..\r
+...*.*..\r
+...*.*..\r
+...*.*..\r
+..*..*..\r
+..*..*..\r
+.*...*..\r
+.******.\r
+.....*..\r
+.....*..\r
+...****.\r
+........\r
+........\r
+\r
+char 0x35\r
+........\r
+.*****..\r
+.*......\r
+.*......\r
+.*......\r
+.*.**...\r
+.**..*..\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x36\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*......\r
+.*.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x37\r
+........\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..***...\r
+........\r
+........\r
+\r
+char 0x38\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x39\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..**.\r
+...**.*.\r
+......*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x3a\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x3b\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+....*...\r
+....*...\r
+...*....\r
+\r
+char 0x3c\r
+........\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*......\r
+*.......\r
+*.......\r
+.*......\r
+..*.....\r
+...*....\r
+....*...\r
+.....*..\r
+......*.\r
+........\r
+\r
+char 0x3d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+........\r
+........\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x3e\r
+........\r
+*.......\r
+.*......\r
+..*.....\r
+...*....\r
+....*...\r
+.....*..\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*......\r
+*.......\r
+........\r
+\r
+char 0x3f\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.....*..\r
+....*...\r
+...*....\r
+...*....\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x40\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*..**.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*..***..\r
+*.......\r
+.*...**.\r
+..***...\r
+........\r
+........\r
+\r
+char 0x41\r
+........\r
+...**...\r
+...**...\r
+...**...\r
+...**...\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x42\r
+........\r
+****....\r
+.*..*...\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*..*...\r
+.****...\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...*..\r
+*****...\r
+........\r
+........\r
+\r
+char 0x43\r
+........\r
+..***.*.\r
+.*...**.\r
+.*....*.\r
+*.....*.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.....*.\r
+.*....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x44\r
+........\r
+*****...\r
+.*...*..\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...*..\r
+.*...*..\r
+*****...\r
+........\r
+........\r
+\r
+char 0x45\r
+........\r
+*******.\r
+.*....*.\r
+.*....*.\r
+.*......\r
+.*......\r
+.*...*..\r
+.*****..\r
+.*...*..\r
+.*......\r
+.*......\r
+.*....*.\r
+.*....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x46\r
+........\r
+*******.\r
+.*....*.\r
+.*....*.\r
+.*......\r
+.*......\r
+.*...*..\r
+.*****..\r
+.*...*..\r
+.*...*..\r
+.*......\r
+.*......\r
+.*......\r
+****....\r
+........\r
+........\r
+\r
+char 0x47\r
+........\r
+..***.*.\r
+.*...**.\r
+.*....*.\r
+*.....*.\r
+*.......\r
+*.......\r
+*..****.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+.*...**.\r
+..***...\r
+........\r
+........\r
+\r
+char 0x48\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x49\r
+........\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x4a\r
+........\r
+...*****\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+*....*..\r
+.*..*...\r
+..**....\r
+........\r
+\r
+char 0x4b\r
+........\r
+***..***\r
+.*....*.\r
+.*...*..\r
+.*..*...\r
+.*.*....\r
+.*.*....\r
+.**.....\r
+.*.*....\r
+.*.*....\r
+.*..*...\r
+.*...*..\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x4c\r
+........\r
+****....\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*....*.\r
+.*....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x4d\r
+........\r
+**....**\r
+.*....*.\r
+.**..**.\r
+.**..**.\r
+.**..**.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x4e\r
+........\r
+**...***\r
+.*....*.\r
+.**...*.\r
+.**...*.\r
+.*.*..*.\r
+.*.*..*.\r
+.*.*..*.\r
+.*..*.*.\r
+.*..*.*.\r
+.*..*.*.\r
+.*...**.\r
+.*...**.\r
+***...*.\r
+........\r
+........\r
+\r
+char 0x4f\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x50\r
+........\r
+*****...\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...*..\r
+.****...\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+****....\r
+........\r
+........\r
+\r
+char 0x51\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*..*..*.\r
+*...*.*.\r
+.*...*..\r
+..***.*.\r
+........\r
+........\r
+\r
+char 0x52\r
+........\r
+******..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*****..\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x53\r
+........\r
+..***.*.\r
+.*...**.\r
+*.....*.\r
+*.....*.\r
+*.......\r
+.*......\r
+..***...\r
+.....*..\r
+......*.\r
+*.....*.\r
+*.....*.\r
+**...*..\r
+*.***...\r
+........\r
+........\r
+\r
+char 0x54\r
+........\r
+*******.\r
+*..*..*.\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x55\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..****..\r
+........\r
+........\r
+\r
+char 0x56\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+...**...\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x57\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+........\r
+........\r
+\r
+char 0x58\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x59\r
+........\r
+***.***.\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x5a\r
+........\r
+*******.\r
+*....*..\r
+*....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*....*.\r
+*.....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x5b\r
+........\r
+..*****.\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*****.\r
+........\r
+\r
+char 0x5c\r
+*.......\r
+*.......\r
+.*......\r
+.*......\r
+..*.....\r
+..*.....\r
+..*.....\r
+...*....\r
+...*....\r
+....*...\r
+....*...\r
+.....*..\r
+.....*..\r
+.....*..\r
+......*.\r
+......*.\r
+\r
+char 0x5d\r
+........\r
+.*****..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.*****..\r
+........\r
+\r
+char 0x5e\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+*.....*.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x5f\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+........\r
+\r
+char 0x60\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x61\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.***....\r
+....*...\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+*...**..\r
+.***.**.\r
+........\r
+........\r
+\r
+char 0x62\r
+**......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.**..*..\r
+.*.**...\r
+........\r
+........\r
+\r
+char 0x63\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..**....\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*.......\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x64\r
+....**..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+..**.*..\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+.*..**..\r
+..**.**.\r
+........\r
+........\r
+\r
+char 0x65\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+******..\r
+*.......\r
+*.....*.\r
+.*....*.\r
+..****..\r
+........\r
+........\r
+\r
+char 0x66\r
+....***.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x67\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..**.**.\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+.*..**..\r
+..**.*..\r
+.....*..\r
+.....*..\r
+.****...\r
+\r
+char 0x68\r
+**......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***...**\r
+........\r
+........\r
+\r
+char 0x69\r
+........\r
+...*....\r
+...*....\r
+........\r
+........\r
+..**....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..***...\r
+........\r
+........\r
+\r
+char 0x6a\r
+........\r
+.....*..\r
+.....*..\r
+........\r
+........\r
+....**..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+..**....\r
+\r
+char 0x6b\r
+**......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*..***.\r
+.*...*..\r
+.*..*...\r
+.*.*....\r
+.**.....\r
+.*.*....\r
+.*..*...\r
+.*...*..\r
+***..**.\r
+........\r
+........\r
+\r
+char 0x6c\r
+..**....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..***...\r
+........\r
+........\r
+\r
+char 0x6d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+****.**.\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+**.**.**\r
+........\r
+........\r
+\r
+char 0x6e\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***...**\r
+........\r
+........\r
+\r
+char 0x6f\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x70\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.**..*..\r
+.*.**...\r
+.*......\r
+***.....\r
+\r
+char 0x71\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..**.*..\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+.*..**..\r
+..**.*..\r
+.....*..\r
+....***.\r
+\r
+char 0x72\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**.***..\r
+.**...*.\r
+.*....*.\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+***.....\r
+........\r
+........\r
+\r
+char 0x73\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.****.*.\r
+*....**.\r
+*.....*.\r
+**......\r
+..***...\r
+.....**.\r
+*.....*.\r
+**....*.\r
+*.****..\r
+........\r
+........\r
+\r
+char 0x74\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....***.\r
+........\r
+........\r
+\r
+char 0x75\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**...**.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...**.\r
+..***.**\r
+........\r
+........\r
+\r
+char 0x76\r
+........\r
+........\r
+........\r
+........\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x77\r
+........\r
+........\r
+........\r
+........\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+........\r
+........\r
+\r
+char 0x78\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**...**.\r
+.*...*..\r
+..*.*...\r
+..*.*...\r
+...*....\r
+..*.*...\r
+..*.*...\r
+.*...*..\r
+**...**.\r
+........\r
+........\r
+\r
+char 0x79\r
+........\r
+........\r
+........\r
+........\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+...**...\r
+...*....\r
+...*....\r
+.**.....\r
+\r
+char 0x7a\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+*.....*.\r
+*....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*....*.\r
+*.....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x7b\r
+........\r
+.....**.\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.**.....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+.....**.\r
+........\r
+........\r
+\r
+char 0x7c\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+\r
+char 0x7d\r
+........\r
+.**.....\r
+...*....\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+.....**.\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+.**.....\r
+........\r
+........\r
+\r
+char 0x7e\r
+........\r
+.***..*.\r
+*...**..\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x7f\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+*.....*.\r
+*******.\r
+*.....*.\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x80\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+...*....\r
+..*.....\r
+\r
+char 0x81\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x82\r
+....**..\r
+....*...\r
+...*....\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x83\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x84\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x85\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x86\r
+........\r
+...**...\r
+..*..*..\r
+...**...\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x87\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..****..\r
+.*....*.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+.*....*.\r
+..****..\r
+....*...\r
+...*....\r
+\r
+char 0x88\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x89\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x8a\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x8b\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x8c\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x8d\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x8e\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+........\r
+........\r
+\r
+char 0x8f\r
+........\r
+..***...\r
+.*...*..\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+........\r
+........\r
+\r
+char 0x90\r
+....**..\r
+....*...\r
+...*....\r
+*******.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*****...\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*******.\r
+........\r
+........\r
+\r
+char 0x91\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.**.....\r
+...***..\r
+...*..*.\r
+.***..*.\r
+*..****.\r
+*..*....\r
+*..*....\r
+*..*..*.\r
+.**.**..\r
+........\r
+........\r
+\r
+char 0x92\r
+....**..\r
+...*....\r
+..*.....\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+*******.\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+........\r
+........\r
+\r
+char 0x93\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x94\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x95\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x96\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x97\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x98\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+.*...*..\r
+..*.*...\r
+..*.*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+\r
+char 0x99\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x9a\r
+..*..*..\r
+..*..*..\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x9b\r
+........\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..****..\r
+.**.*.*.\r
+*.*.*...\r
+*.*.*...\r
+*.*.*...\r
+*.*.*...\r
+*.*.*...\r
+.**.*.*.\r
+..****..\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+\r
+char 0x9c\r
+........\r
+....**..\r
+...*..*.\r
+..*.....\r
+..*.....\r
+..*.....\r
+******..\r
+..*.....\r
+..*.....\r
+..*.....\r
+.**.....\r
+*.*.....\r
+*.**..*.\r
+.*..**..\r
+........\r
+........\r
+\r
+char 0x9d\r
+........\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..*.*...\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x9e\r
+........\r
+***.....\r
+*..*....\r
+*...*...\r
+*...*...\r
+*...*...\r
+*..*.*..\r
+***..*..\r
+*..*****\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+........\r
+........\r
+\r
+char 0x9f\r
+........\r
+....**..\r
+...*..*.\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+*..*....\r
+.**.....\r
+........\r
+........\r
+\r
+char 0xa0\r
+....**..\r
+....*...\r
+...*....\r
+........\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0xa1\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.**.....\r
+*..*....\r
+*..*....\r
+.**.....\r
+\r
+char 0xa2\r
+****....\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xa3\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+....****\r
+\r
+char 0xa4\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*.......\r
+*.......\r
+.*......\r
+..*.....\r
+...*....\r
+\r
+char 0xa5\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xa6\r
+........\r
+********\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+*******.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+.**.....\r
+........\r
+\r
+char 0xa7\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.*******\r
+.......*\r
+....*.*.\r
+....*...\r
+...*....\r
+..*.....\r
+........\r
+\r
+char 0xa8\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+......**\r
+....**..\r
+..**....\r
+**..*...\r
+....*...\r
+....*...\r
+........\r
+\r
+char 0xa9\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+********\r
+*......*\r
+......*.\r
+.....*..\r
+....*...\r
+........\r
+\r
+char 0xaa\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+........\r
+........\r
+\r
+char 0xab\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+....*...\r
+*******.\r
+...**...\r
+..*.*...\r
+.*..*...\r
+*...*...\r
+....*...\r
+\r
+char 0xac\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..*.....\r
+..*.****\r
+****..*.\r
+..*..*..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+\r
+char 0xad\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.****...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+********\r
+........\r
+\r
+char 0xae\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+.......*\r
+********\r
+.......*\r
+.......*\r
+********\r
+\r
+char 0xaf\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.*..*..*\r
+.*..*..*\r
+.......*\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+\r
+char 0xb0\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.......*\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xb1\r
+........\r
+........\r
+********\r
+.......*\r
+...*..*.\r
+...*.*..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*......\r
+*.......\r
+........\r
+\r
+char 0xb2\r
+........\r
+........\r
+.......*\r
+......**\r
+....**..\r
+..**....\r
+**..*...\r
+*...*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+........\r
+........\r
+\r
+char 0xb3\r
+........\r
+........\r
+...*....\r
+...*....\r
+********\r
+*......*\r
+*......*\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+..*.....\r
+........\r
+\r
+\r
+char 0xb4\r
+........\r
+........\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+........\r
+........\r
+\r
+\r
+char 0xb5\r
+........\r
+........\r
+........\r
+....*...\r
+....*...\r
+********\r
+...**...\r
+...**...\r
+..*.*...\r
+..*.*...\r
+.*..*...\r
+.*..*...\r
+*...*...\r
+...**...\r
+....*...\r
+........\r
+\r
+\r
+char 0xb6\r
+........\r
+........\r
+...*....\r
+...*....\r
+********\r
+...*...*\r
+..*....*\r
+..*....*\r
+..*....*\r
+..*....*\r
+.*.....*\r
+.*....*.\r
+*..*..*.\r
+....**.\r
+.....*..\r
+........\r
+\r
+\r
+char 0xb7\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*.***\r
+..***...\r
+**.*....\r
+....*.**\r
+...***..\r
+***.*...\r
+....*...\r
+....*...\r
+....*...\r
+.....*..\r
+.....*..\r
+........\r
+\r
+\r
+char 0xb8\r
+........\r
+........\r
+........\r
+...*****\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+..*....*.\r
+..*....*.\r
+.*....*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+........\r
+\r
+\r
+char 0xb9\r
+........\r
+........\r
+..*.....\r
+..*.....\r
+..******\r
+..*...*.\r
+.*....*.\r
+.*....*.\r
+*....*..\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+..*.....\r
+........\r
+\r
+\r
+char 0xba\r
+........\r
+........\r
+........\r
+........\r
+.*******\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.*******\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xbb\r
+........\r
+........\r
+.*...*..\r
+.*...*..\r
+********\r
+.*...*..\r
+*....*..\r
+*....*..\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+........\r
+\r
+\r
+char 0xbc\r
+........\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.......*\r
+.**....*\r
+...**..*\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xbd\r
+........\r
+........\r
+........\r
+******..\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.*...\r
+..*.*...\r
+.*...*..\r
+.*...*..\r
+*.....*.\r
+........\r
+\r
+\r
+char 0xbe\r
+........\r
+........\r
+........\r
+..*.....\r
+..*.....\r
+..*.....\r
+..******\r
+***....*\r
+..*...*.\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+...*****\r
+........\r
+........\r
+\r
+\r
+char 0xbf\r
+........\r
+........\r
+........\r
+.*.....*\r
+..*....*\r
+..*....*\r
+...*...*\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+\r
+char 0xc0\r
+........\r
+........\r
+..******\r
+..*....*\r
+..*....*\r
+.*.....*\r
+.*.**..*\r
+*....**.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+........\r
+\r
+\r
+char 0xc1\r
+........\r
+........\r
+........\r
+....**..\r
+..***...\r
+....*...\r
+....*...\r
+********\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xc2\r
+........\r
+........\r
+........\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.......*\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+\r
+\r
+char 0xc3\r
+........\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+********\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xc4\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...**...\r
+...*.*..\r
+...*.*..\r
+...*..*.\r
+...*..*.\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+\r
+\r
+char 0xc5\r
+........\r
+........\r
+........\r
+....*...\r
+....*...\r
+....*...\r
+********\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xc6\r
+........\r
+........\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+********\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xc7\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+......*.\r
+......*.\r
+..*..*..\r
+...*.*..\r
+....*...\r
+....**..\r
+...*..*.\r
+...*....\r
+..*.....\r
+..*.....\r
+........\r
+\r
+\r
+\r
+char 0xc8\r
+........\r
+........\r
+...*....\r
+...*....\r
+.******.\r
+......*.\r
+.....*..\r
+....*...\r
+...***..\r
+..*.*.*.\r
+.*..*..*\r
+*...*...\r
+....*...\r
+....*...\r
+....*...\r
+........\r
+\r
+\r
+char 0xc9\r
+........\r
+........\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+........\r
+\r
+\r
+\r
+char 0xca\r
+........\r
+........\r
+........\r
+........\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+*......*\r
+*......*\r
+*......*\r
+*......*\r
+*......*\r
+*......*\r
+........\r
+........\r
+\r
+\r
+char 0xcb\r
+........\r
+........\r
+........\r
+..*.....\r
+..*.....\r
+..*..***\r
+..***...\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+...*....\r
+....****\r
+........\r
+\r
+\r
+char 0xcc\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+\r
+\r
+char 0xcd\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+*....*..\r
+......*.\r
+......*.\r
+.......*\r
+.......*\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xce\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+********\r
+...*....\r
+...*....\r
+.*.*.*..\r
+.*.*.*..\r
+*..*..*.\r
+*..*..*.\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+\r
+char 0xcf\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+.*...*..\r
+..*.*...\r
+...**...\r
+....*...\r
+.....*..\r
+......*.\r
+.......*\r
+........\r
+\r
+\r
+char 0xd0\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.....**.\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.....**.\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.....**.\r
+........\r
+\r
+\r
+char 0xd1\r
+........\r
+........\r
+........\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*...*..\r
+.*....*.\r
+.*..**.*\r
+****...*\r
+........\r
+........\r
+\r
+\r
+char 0xd2\r
+........\r
+........\r
+.....*..\r
+.....*..\r
+.*..*...\r
+..*.*...\r
+...*....\r
+...**...\r
+...*.*..\r
+..*...*.\r
+..*.....\r
+.*......\r
+.*......\r
+*.......\r
+*.......\r
+........\r
+\r
+\r
+char 0xd3\r
+........\r
+........\r
+........\r
+........\r
+********\r
+...*....\r
+...*....\r
+...*....\r
+********\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+.....***\r
+........\r
+\r
+\r
+char 0xd4\r
+........\r
+........\r
+.*......\r
+.*....**\r
+.*..**.*\r
+..**..*.\r
+***.....\r
+..*.....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+....*...\r
+....*...\r
+.....*..\r
+........\r
+\r
+\r
+char 0xd5\r
+........\r
+........\r
+........\r
+........\r
+.******.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+********\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xd6\r
+........\r
+........\r
+.******.\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.******.\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.******.\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xd7\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+********\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+........\r
+\r
+\r
+char 0xd8\r
+........\r
+........\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+........\r
+\r
+\r
+char 0xd9\r
+........\r
+........\r
+....*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+.*..*...\r
+.*..*...\r
+.*..*...\r
+*...*..*\r
+*...*.*.\r
+*...**..\r
+....*...\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xda\r
+........\r
+........\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*.....*\r
+.*....*.\r
+.*...*..\r
+.*..*...\r
+.*.*....\r
+.**.....\r
+........\r
+........\r
+\r
+\r
+char 0xdb\r
+........\r
+........\r
+........\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.******.\r
+.*....*.\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xdc\r
+........\r
+........\r
+........\r
+.*******\r
+.*.....*\r
+.*.....*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+........\r
+\r
+\r
+char 0xdd\r
+........\r
+........\r
+........\r
+***....*\r
+...**..*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+.**.....\r
+........\r
+\r
+\r
+\r
+char 0xde\r
+........\r
+..*.....\r
+*..*....\r
+.*......\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xdf\r
+........\r
+.*......\r
+*.*.....\r
+.*......\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe0\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe1\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe2\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe3\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe4\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe5\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe6\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe7\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe8\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe9\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xea\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xeb\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xec\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xed\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xee\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xef\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf0\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf1\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf2\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf3\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf4\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf5\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf6\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf7\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf8\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf9\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfa\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfb\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfc\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfd\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfe\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xff\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/init.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/init.c
new file mode 100644 (file)
index 0000000..25af90e
--- /dev/null
@@ -0,0 +1,111 @@
+\r
+#include "core.h"\r
+\r
+void init_system(void)\r
+{\r
+       DATA_VESAInfo *vesa                             = (DATA_VESAInfo *) ADR_VESAINFO;\r
+       DATA_BootInfo *boot                             = (DATA_BootInfo *) ADR_BOOTINFO;\r
+       uint i;\r
+\r
+       i                                               = memtest(0x00400000, 0xbfffffff);\r
+       sys_main_str_buf                                = (struct SYSTEM *)(i - sizeof(struct SYSTEM));\r
+\r
+       system.io.mem.paging.dir                        = (uint *)0x00400000;\r
+       (uint)system.io.mem.paging.table                = 0x00400000 + (1024 * 4);\r
+\r
+       system.io.mem.segment.gdt                       = (IO_SegmentDescriptor *)ADR_GDT;\r
+       system.io.interrupt.idt                         = (IO_GateDescriptor *)ADR_IDT;\r
+\r
+       system.io.mem.total                             = i;\r
+       system.data.info.vesa                           = *vesa;\r
+       system.data.info.boot                           = *boot;\r
+\r
+       system.ui.console.org_xsize                     = (system.data.info.boot.scrnx >> 1) & 0xfffffff0;\r
+       system.ui.console.org_ysize                     = (system.data.info.boot.scrny >> 1) & 0xffffffe0;\r
+       system.ui.console.org_xchars                    = system.ui.console.org_xsize >> 3;\r
+       system.ui.console.org_ychars                    = system.ui.console.org_ysize >> 4;\r
+\r
+       system.io.file.list                             = (IO_FileInfo *)(ADR_DISKIMG + 0x00002600);\r
+\r
+       init_gdtidt();\r
+       init_pic();\r
+       init_serial();\r
+       init_paging();\r
+       sys_memman_init();\r
+       sys_memman_free((void *)(0x00400000 + (1024 * 4) + (1024 * 1024 * 4)), system.io.mem.total - sizeof(struct SYSTEM) - 0x00400000) - (1024 * 4) - (1024 * 1024 * 4);\r
+       init_sheets(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, system.data.info.boot.scrny, system.data.info.vesa.BitsPerPixel);\r
+\r
+       system.ui.draw.sht.core                         = sheet_alloc();\r
+       system.ui.draw.sht.desktop                      = sheet_alloc();\r
+       system.ui.draw.sht.taskbar                      = sheet_alloc();\r
+       system.ui.draw.sht.mouse                        = sheet_alloc();\r
+\r
+       system.ui.draw.sht.core_buf                     = sys_memman_alloc(system.data.info.boot.scrnx * system.data.info.boot.scrny * (system.data.info.vesa.BitsPerPixel >> 3));\r
+       system.ui.draw.sht.desktop_buf                  = sys_memman_alloc(system.data.info.boot.scrnx * system.data.info.boot.scrny * (system.data.info.vesa.BitsPerPixel >> 3));\r
+       system.ui.draw.sht.taskbar_buf                  = sys_memman_alloc(system.data.info.boot.scrnx * TASKBAR_HEIGHT * (system.data.info.vesa.BitsPerPixel >> 3));\r
+       system.ui.draw.sht.mouse_buf                    = sys_memman_alloc(24 * 24 * (system.data.info.vesa.BitsPerPixel >> 3));\r
+\r
+       sheet_setbuf(system.ui.draw.sht.desktop, system.ui.draw.sht.desktop_buf, system.data.info.boot.scrnx, system.data.info.boot.scrny, INV_COL32);\r
+       sheet_setbuf(system.ui.draw.sht.mouse, system.ui.draw.sht.mouse_buf, 24, 24, INV_COL32);\r
+       sheet_setbuf(system.ui.draw.sht.taskbar, system.ui.draw.sht.taskbar_buf, system.data.info.boot.scrnx, TASKBAR_HEIGHT, INV_COL32);\r
+       sheet_setbuf(system.ui.draw.sht.core, system.ui.draw.sht.core_buf, system.data.info.boot.scrnx, system.data.info.boot.scrny, INV_COL32);\r
+\r
+       sheet_slide(system.ui.draw.sht.desktop, 0, 0);\r
+       sheet_updown(system.ui.draw.sht.desktop, -1);\r
+       sheet_slide(system.ui.draw.sht.taskbar, 0, system.data.info.boot.scrny - TASKBAR_HEIGHT);\r
+       sheet_updown(system.ui.draw.sht.taskbar, -1);\r
+       sheet_slide(system.ui.draw.sht.mouse, system.data.info.boot.scrnx >> 1, system.data.info.boot.scrny >> 1);\r
+       sheet_updown(system.ui.draw.sht.mouse, -1);\r
+\r
+       sheet_slide(system.ui.draw.sht.core, 0, 0);\r
+       boxfill_i(system.ui.draw.sht.core_buf, system.data.info.boot.scrnx, 0x000000, 0, 0, system.data.info.boot.scrnx, system.data.info.boot.scrny);\r
+       draw_chnos_logo(system.ui.draw.sht.core_buf, system.data.info.boot.scrnx, system.data.info.boot.scrnx >> 4, system.data.info.boot.scrnx >> 1, (system.data.info.boot.scrny >> 1) - (system.data.info.boot.scrny / 10));\r
+       sheet_updown(system.ui.draw.sht.core, 0);\r
+\r
+       fifo32_init(&system.data.fifo.main, SYS_FIFOSIZE, system.data.fifo.main_buf, 0);\r
+       fifo32_init(&system.data.fifo.keycmd, KEYCMD_FIFOSIZE, system.data.fifo.keycmd_buf, 0);\r
+       fifo32_init(&system.data.fifo.keyctrl, KEYCTRL_FIFOSIZE, system.data.fifo.keyctrl_buf, 0);\r
+       fifo32_init(&system.data.fifo.mousectrl, MOUSECTRL_FIFOSIZE, system.data.fifo.mousectrl_buf, 0);\r
+       init_pit();\r
+       task_init();\r
+\r
+       system.ui.task.keyctrl                          = task_alloc();\r
+       system.ui.task.keyctrl->tss.esp                 = (int)sys_memman_alloc(64 * 1024) + 64 * 1024;\r
+       system.ui.task.keyctrl->tss.eip                 = (int)&KeyBoardControlTask;\r
+       system.ui.task.keyctrl->tss.es                  = 1 * 8;\r
+       system.ui.task.keyctrl->tss.cs                  = 2 * 8;\r
+       system.ui.task.keyctrl->tss.ss                  = 1 * 8;\r
+       system.ui.task.keyctrl->tss.ds                  = 1 * 8;\r
+       system.ui.task.keyctrl->tss.fs                  = 1 * 8;\r
+       system.ui.task.keyctrl->tss.gs                  = 1 * 8;\r
+\r
+       system.ui.task.mousectrl                        = task_alloc();\r
+       system.ui.task.mousectrl->tss.esp               = (int)sys_memman_alloc(64 * 1024) + 64 * 1024;\r
+       system.ui.task.mousectrl->tss.eip               = (int)&MouseControlTask;\r
+       system.ui.task.mousectrl->tss.es                = 1 * 8;\r
+       system.ui.task.mousectrl->tss.cs                = 2 * 8;\r
+       system.ui.task.mousectrl->tss.ss                = 1 * 8;\r
+       system.ui.task.mousectrl->tss.ds                = 1 * 8;\r
+       system.ui.task.mousectrl->tss.fs                = 1 * 8;\r
+       system.ui.task.mousectrl->tss.gs                = 1 * 8;\r
+\r
+       system.data.fifo.main.task                      = system.ui.task.main;\r
+       system.data.fifo.keycmd.task                    = system.ui.task.keyctrl;\r
+       system.data.fifo.keyctrl.task                   = system.ui.task.keyctrl;\r
+       system.data.fifo.mousectrl.task                 = system.ui.task.mousectrl;\r
+\r
+       task_run(system.ui.task.main, 1, 0);\r
+       task_run(system.ui.task.keyctrl, 1, 1);\r
+       task_run(system.ui.task.mousectrl, 1, 1);\r
+\r
+       init_keyboard(0x100);\r
+       init_mouse(0x100);\r
+       init_windows();\r
+\r
+       fdc_motor_off(4);\r
+\r
+       system.io.file.fat                              = sys_memman_alloc(2 * 2880);\r
+       decode_fat(system.io.file.fat, false);\r
+\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/intrpt.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/intrpt.c
new file mode 100644 (file)
index 0000000..aca6dc7
--- /dev/null
@@ -0,0 +1,336 @@
+\r
+#include "core.h"\r
+\r
+void init_pic(void)\r
+{\r
+       /*\r
+       IRR\81F\83C\83\93\83^\83\89\83v\83g\83\8a\83N\83G\83X\83g\83\8c\83W\83X\83\r
+               .IRQ\83s\83\93\82Ì\8fó\91Ô\82ð\95\\82·\81B\83|\81[\83g\82ð\93Ç\82ñ\82¾\82Æ\82«\82É\81AIRR\82É\82È\82é\82©ISR\82É\82È\82é\82©\82Í\81AOCW3\82Å\91I\91ð\82·\82é\81B\r
+               .1\82É\82È\82Á\82Ä\82¢\82é\83r\83b\83g\82Í\81A\8c»\8dÝ\97v\8b\81\82ª\97\88\82Ä\82¢\82é\81i\82à\82µ\82­\82Í\8f\88\97\9d\92\86\82Ì\81j\8a\84\82è\8d\9e\82Ý\81B\r
+       ISR\81F\83C\83\93\83T\81[\83r\83X\83\8c\83W\83X\83\r
+               .\8c»\8dÝ\8f\88\97\9d\92\86\82Ì\8a\84\82è\8d\9e\82Ý\82ª\82Ç\82ê\82Å\82 \82é\82©\82ð\8e¦\82·\81B\83|\81[\83g\82ð\93Ç\82ñ\82¾\82Æ\82«\82É\81AIRR\82É\82È\82é\82©ISR\82É\82È\82é\82©\82Í\81AOCW3\82Å\91I\91ð\82·\82é\81B\r
+               .1\82É\82È\82Á\82Ä\82¢\82é\83r\83b\83g\82Í\81A\8c»\8dÝ\8f\88\97\9d\92\86\82Ì\8a\84\82è\8d\9e\82Ý\81B\8f\88\97\9d\92\86\82Æ\82¢\82¤\82Ì\82Í\81ACPU\82É\91Î\82µ\82ÄINT\96½\97ß\82ð\94­\8ds\82µ\82½\82ª\81AEOI\81i\8a\84\82è\8d\9e\82Ý\8fI\97¹\96½\97ß\81j\82ð\8eó\82¯\8eæ\82Á\82Ä\82¢\82È\82¢\8a\84\82è\8d\9e\82Ý\81B\r
+       IMR\81F\83C\83\93\83^\83\89\83v\83g\83}\83X\83N\83\8c\83W\83X\83\r
+               .\82±\82ê\82ª1\82É\82È\82Á\82Ä\82¢\82é\8a\84\82è\8d\9e\82Ý\82Í\81AIRR\82ª1\82É\82È\82Á\82Ä\82¢\82Ä\82à\81A\94½\89\9e\82µ\82È\82¢\81\r
+       */\r
+\r
+       io_out8(PIC0_IMR, 0xff);        /*\8a\84\82è\8d\9e\82Ý\91S\95\94\96³\8e\8b\81i\83}\83X\83^\81j*/\r
+       io_out8(PIC1_IMR, 0xff);        /*\8a\84\82è\8d\9e\82Ý\91S\95\94\96³\8e\8b\81i\83X\83\8c\81[\83u\81j*/\r
+\r
+       io_out8(PIC0_ICW1, 0x11);       /*\83G\83b\83W\83g\83\8a\83K\83\82\81[\83h\82É\90Ý\92è\81i\83}\83X\83^\81j*/\r
+       io_out8(PIC0_ICW2, 0x20);       /*\8a\84\82è\8d\9e\82Ý\94Ô\8d\86\82ð\81A20~27\82É\90Ý\92è\81B\81i\83}\83X\83^\81j*/\r
+       io_out8(PIC0_ICW3, 1 << 2);     /*00000100 \82Â\82Ü\82è\81A\83X\83\8c\81[\83u\82ÍIRQ2\82É\82Â\82È\82ª\82Á\82Ä\82Ü\82·\82æ\82Æ\82¢\82¤\82±\82Æ\81B*/\r
+       io_out8(PIC0_ICW4, 0x01);       /*\83m\83\93\83o\83b\83t\83@\83\82\81[\83h\81i\83}\83X\83^\81j*/\r
+\r
+       io_out8(PIC1_ICW1, 0x11);       /*\83G\83b\83W\83g\83\8a\83K\83\82\81[\83h\82É\90Ý\92è\81i\83X\83\8c\81[\83u\81j*/\r
+       io_out8(PIC1_ICW2, 0x28);       /*\8a\84\82è\8d\9e\82Ý\94Ô\8d\86\82ð\81A28~2f\82É\90Ý\92è\81B\81i\83X\83\8c\81[\83u\81j*/\r
+       io_out8(PIC1_ICW3, 2);  /*\8e©\95ª\82Í\83}\83X\83^\82ÌIRQ2\94Ô\82É\82Â\82È\82ª\82Á\82Ä\82Ü\82·\82Æ\82¢\82¤\82±\82Æ\81B*/\r
+       io_out8(PIC1_ICW4, 0x01);       /*\83m\83\93\83o\83b\83t\83@\83\82\81[\83h\81i\83X\83\8c\81[\83u\81j*/\r
+\r
+       io_out8(PIC0_IMR, 0xfb);        /*11111011\82Â\82Ü\82è\81AIRQ2\94Ô\81i\83X\83\8c\81[\83u\81j\82¾\82¯\8b\96\89Â\81B\82 \82Æ\82Í\96³\8e\8b\81B\81i\83}\83X\83^\81j*/  \r
+       io_out8(PIC1_IMR, 0xff);        /*11111111\82Â\82Ü\82è\81A\91S\82Ä\96³\8e\8b*/\r
+\r
+       set_gatedesc(system.io.interrupt.idt+0x27, (int)asm_inthandler27, 2 * 8, AR_INTGATE32);\r
+       io_out8(PIC0_IMR, io_in8(PIC0_IMR) & 0x7f);     /*IRQ-07\91Î\8dô*/\r
+\r
+       return;\r
+}\r
+\r
+void inthandler27(int *esp)\r
+{\r
+       io_out8(PIC0_OCW2, 0x67);       /* IRQ-07\8eó\95t\8a®\97¹\82ðPIC\82É\92Ê\92\81B0x60+\94Ô\8d\86\81B*/\r
+       return;\r
+}\r
+\r
+/*CPU Exceptions*/\r
+char *cpu_exceptions[0x20] = {\r
+       "Exception 0x00:\n\rDivided by zero.",\r
+       "Exception 0x01:\n\rReserved.",\r
+       "Exception 0x02:\n\rNonmaskable interrupt.",\r
+       "Exception 0x03:\n\rBreakpoint.",\r
+       "Exception 0x04:\n\rOverflow.",\r
+       "Exception 0x05:\n\rOutside BOUND.",\r
+       "Exception 0x06:\n\rInvalid opcode.",\r
+       "Exception 0x07:\n\rDisable Device.",\r
+       "Exception 0x08:\n\rDouble fault.",\r
+       "Exception 0x09:\n\rCoprocessor Segment Overrun.",\r
+       "Exception 0x0a:\n\rInvalid task status segment.",\r
+       "Exception 0x0b:\n\rSegment absent.",\r
+       "Exception 0x0c:\n\rStack Segment Fault.",\r
+       "Exception 0x0d:\n\rGeneral Protection Exception.",\r
+       "Exception 0x0e:\n\rPage fault.",\r
+       "Exception 0x0f:\n\rReserved.",\r
+       "Exception 0x10:\n\rFloating point error.",\r
+       "Exception 0x11:\n\rAlignment Check.",\r
+       "Exception 0x12:\n\rMachine Check.",\r
+       "Exception 0x13:\n\rSIMD floating-point exception.",\r
+       "Exception 0x14:\n\rReserved.",\r
+       "Exception 0x15:\n\rReserved.",\r
+       "Exception 0x16:\n\rReserved.",\r
+       "Exception 0x17:\n\rReserved.",\r
+       "Exception 0x18:\n\rReserved.",\r
+       "Exception 0x19:\n\rReserved.",\r
+       "Exception 0x1a:\n\rReserved.",\r
+       "Exception 0x1b:\n\rReserved.",\r
+       "Exception 0x1c:\n\rReserved.",\r
+       "Exception 0x1d:\n\rReserved.",\r
+       "Exception 0x1e:\n\rReserved.",\r
+       "Exception 0x1f:\n\rReserved."\r
+};\r
+\r
+char *cpu_exception_infos[16] = {\r
+       "EDI      ",\r
+       "ESI      ",\r
+       "EBP      ",\r
+       "ESP      ",\r
+       "EBX      ",\r
+       "EDX      ",\r
+       "ECX      ",\r
+       "EAX      ",\r
+       "DS       ",\r
+       "ES       ",\r
+       "ERRORCODE",\r
+       "EIP      ",\r
+       "CS       ",\r
+       "EFLAGS   ",\r
+       "APP's ESP",\r
+       "APP's SS "\r
+};\r
+\r
+void cpu_exception_abort(int exception, int *esp)\r
+{\r
+       int i;\r
+       char s[32];\r
+\r
+//     putfonts32_asc(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 0, 0xFFFFFF, (const uchar *)cpu_exceptions[exception]);\r
+//     putfonts32_asc(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 16, 0xFFFFFF, "***registers info***");\r
+\r
+       sprintf(s, "%s\n\r", (uchar *)cpu_exceptions[exception]);\r
+       send_serial(s);\r
+\r
+//     putfonts32_asc(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 32, 0xFFFFFF, "#PUSHAD by _asm_inthandler");\r
+\r
+       send_serial("#PUSHAD by _asm_inthandler\n\r");\r
+\r
+       for(i = 0; i <= 7; i++){\r
+//             sprintf(s, "%s:0x%08X", cpu_exception_infos[i], esp[i]);\r
+//             putfonts32_asc(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 16 * (i + 3), 0xFFFFFF, s);\r
+\r
+               sprintf(s, "%s:0x%08X\n\r", cpu_exception_infos[i], esp[i]);\r
+               send_serial(s);\r
+       }\r
+\r
+//     putfonts32_asc(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 176, 0xFFFFFF, "#PUSH by _asm_inthandler");\r
+       send_serial("#PUSH by _asm_inthandler\n\r");\r
+\r
+       for(i = 8; i <= 9; i++){\r
+//             sprintf(s, "%s:0x%08X", cpu_exception_infos[i], esp[i]);\r
+//             putfonts32_asc(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 16 * (i + 4), 0xFFFFFF, s);\r
+\r
+               sprintf(s, "%s:0x%08X\n\r", cpu_exception_infos[i], esp[i]);\r
+               send_serial(s);\r
+       }\r
+\r
+//     putfonts32_asc(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 224, 0xFFFFFF, "#PUSH by CPU");\r
+\r
+       send_serial("#PUSH by CPU\n\r");\r
+       for(i = 10; i <= 15; i++){\r
+//             sprintf(s, "%s:0x%08X", cpu_exception_infos[i], esp[i]);\r
+//             putfonts32_asc(system.data.info.vesa.PhysBasePtr, system.data.info.boot.scrnx, 0, 16 * (i + 5), 0xFFFFFF, s);\r
+\r
+               sprintf(s, "%s:0x%08X\n\r", cpu_exception_infos[i], esp[i]);\r
+               send_serial(s);\r
+       }\r
+\r
+       send_serial("#Control Registers\n\r");\r
+       sprintf(s, "CR0 = 0x%08X\n\r", load_cr0());\r
+       send_serial(s);\r
+       sprintf(s, "CR2 = 0x%08X\n\r", load_cr2());\r
+       send_serial(s);\r
+       sprintf(s, "CR3 = 0x%08X\n\r", load_cr3());\r
+       send_serial(s);\r
+\r
+       for(;;){\r
+               io_hlt();\r
+       }\r
+}\r
+\r
+uint cpu_exception_fault(int exception, int *esp)\r
+{\r
+       UI_Task *task = task_now();\r
+       UI_Console *cons;\r
+       uchar s[64];\r
+       uint i;\r
+\r
+       for(i = 0; i < MAX_CONSOLES; i++){\r
+               if(system.ui.console.consoles[i].task == task)break;\r
+       }\r
+       if(system.ui.console.consoles[i].task != task)cpu_exception_abort(exception, esp);\r
+       cons = &system.ui.console.consoles[i];\r
+\r
+       cons_put_str(cons, (uchar *)cpu_exceptions[exception]);\r
+       sprintf(s, "\n%s:0x%08X", cpu_exception_infos[11], esp[11]);\r
+       cons_put_str(cons, s);\r
+\r
+       return (uint)&(task->tss.esp0);\r
+}\r
+\r
+void inthandler00(int *esp)\r
+{\r
+       cpu_exception_abort(0x00, esp);\r
+}\r
+\r
+void inthandler01(int *esp)\r
+{\r
+       cpu_exception_abort(0x01, esp);\r
+}\r
+\r
+void inthandler02(int *esp)\r
+{\r
+       cpu_exception_abort(0x02, esp);\r
+}\r
+\r
+void inthandler03(int *esp)\r
+{\r
+       cpu_exception_abort(0x03, esp);\r
+}\r
+\r
+void inthandler04(int *esp)\r
+{\r
+       cpu_exception_abort(0x04, esp);\r
+}\r
+\r
+void inthandler05(int *esp)\r
+{\r
+       cpu_exception_abort(0x05, esp);\r
+}\r
+\r
+void inthandler06(int *esp)\r
+{\r
+       cpu_exception_abort(0x06, esp);\r
+}\r
+\r
+void inthandler07(int *esp)\r
+{\r
+       cpu_exception_abort(0x07, esp);\r
+}\r
+\r
+void inthandler08(int *esp)\r
+{\r
+       cpu_exception_abort(0x08, esp);\r
+}\r
+\r
+void inthandler09(int *esp)\r
+{\r
+       cpu_exception_abort(0x09, esp);\r
+}\r
+\r
+void inthandler0a(int *esp)\r
+{\r
+       cpu_exception_abort(0x0a, esp);\r
+}\r
+\r
+void inthandler0b(int *esp)\r
+{\r
+       cpu_exception_abort(0x0b, esp);\r
+}\r
+\r
+void inthandler0c(int *esp)\r
+{\r
+       cpu_exception_fault(0x0c, esp);\r
+}\r
+\r
+void inthandler0d(int *esp)\r
+{\r
+       cpu_exception_fault(0x0d, esp);\r
+}\r
+\r
+void inthandler0e(int *esp)\r
+{\r
+       cpu_exception_abort(0x0e, esp);\r
+}\r
+\r
+void inthandler0f(int *esp)\r
+{\r
+       cpu_exception_abort(0x0f, esp);\r
+}\r
+\r
+void inthandler10(int *esp)\r
+{\r
+       cpu_exception_abort(0x10, esp);\r
+}\r
+\r
+void inthandler11(int *esp)\r
+{\r
+       cpu_exception_abort(0x11, esp);\r
+}\r
+\r
+void inthandler12(int *esp)\r
+{\r
+       cpu_exception_abort(0x12, esp);\r
+}\r
+\r
+void inthandler13(int *esp)\r
+{\r
+       cpu_exception_abort(0x13, esp);\r
+}\r
+\r
+void inthandler14(int *esp)\r
+{\r
+       cpu_exception_abort(0x14, esp);\r
+}\r
+\r
+void inthandler15(int *esp)\r
+{\r
+       cpu_exception_abort(0x15, esp);\r
+}\r
+\r
+void inthandler16(int *esp)\r
+{\r
+       cpu_exception_abort(0x16, esp);\r
+}\r
+\r
+void inthandler17(int *esp)\r
+{\r
+       cpu_exception_abort(0x17, esp);\r
+}\r
+\r
+void inthandler18(int *esp)\r
+{\r
+       cpu_exception_abort(0x18, esp);\r
+}\r
+\r
+void inthandler19(int *esp)\r
+{\r
+       cpu_exception_abort(0x19, esp);\r
+}\r
+\r
+void inthandler1a(int *esp)\r
+{\r
+       cpu_exception_abort(0x1a, esp);\r
+}\r
+\r
+void inthandler1b(int *esp)\r
+{\r
+       cpu_exception_abort(0x1b, esp);\r
+}\r
+\r
+void inthandler1c(int *esp)\r
+{\r
+       cpu_exception_abort(0x1c, esp);\r
+}\r
+\r
+void inthandler1d(int *esp)\r
+{\r
+       cpu_exception_abort(0x1d, esp);\r
+}\r
+\r
+void inthandler1e(int *esp)\r
+{\r
+       cpu_exception_abort(0x1e, esp);\r
+}\r
+\r
+void inthandler1f(int *esp)\r
+{\r
+       cpu_exception_abort(0x1f, esp);\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/io.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/io.c
new file mode 100644 (file)
index 0000000..8639e9c
--- /dev/null
@@ -0,0 +1,107 @@
+\r
+#include "core.h"\r
+\r
+#define COM1_RX                0x03f8\r
+#define COM1_TX                0x03f8\r
+#define COM1_BAUD_LSB  0x03f8\r
+#define COM1_BAUD_MSB  0x03f9\r
+#define COM1_INTR_ENBL 0x03f9\r
+#define COM1_INTR_ID   0x03fa\r
+#define COM1_CTRL_FIFO 0x03fa\r
+#define COM1_CTRL_LINE 0x03fb\r
+#define COM1_CTRL_MODEM        0x03fc\r
+#define COM1_STA_LINE  0x03fd\r
+#define COM1_STA_MODEM 0x03fe\r
+\r
+void init_serial(void)\r
+{\r
+       io_out8(COM1_CTRL_LINE, 0x80);  //\83{\81[\83\8c\81[\83g\90Ý\92è\8aJ\8en\r
+       io_out8(COM1_BAUD_LSB, 0x06);   //0x06 = 19.2bps\r
+       io_out8(COM1_CTRL_LINE, 0x03);  //\83{\81[\83\8c\81[\83g\90Ý\92è\8fI\97¹\81A\91\97\8eó\90M\83f\81[\83^8bit\r
+       io_out8(COM1_CTRL_MODEM, 0x0b); //\8a\84\82è\8d\9e\82Ý\97L\8cø\81ARTS\81ADTR\83s\83\93\82ð\83A\83N\83e\83B\83u\89»\r
+//     io_out8(COM1_INTR_ENBL, 0x04);  //\83\89\83C\83\93\83X\83e\81[\83^\83X\8a\84\82è\8d\9e\82Ý\r
+       io_out8(COM1_INTR_ENBL, 0x00);\r
+\r
+       return;\r
+}\r
+\r
+void send_serial(uchar *s)\r
+{\r
+       for (; *s != 0x00; s++) {\r
+               io_out8(COM1_TX, *s);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+uint readcmos(uchar addr)\r
+{\r
+       io_out8(0x70, addr);\r
+       return io_in8(0x71);\r
+}\r
+\r
+void readrtc(uchar *t)\r
+{\r
+       char err;\r
+       static uchar adr[7] = { 0x00, 0x02, 0x04, 0x07, 0x08, 0x09, 0x32 };\r
+       static uchar max[7] = { 0x60, 0x59, 0x23, 0x31, 0x12, 0x99, 0x99 };\r
+       int i;\r
+\r
+       for (;;) {\r
+               err = 0;\r
+               for (i = 0; i < 7; i++) {\r
+                       t[i] = readcmos(adr[i]);\r
+               }\r
+               for (i = 0; i < 7; i++) {\r
+                       if (t[i] != readcmos(adr[i]) || (t[i] & 0x0f) > 9 || t[i] > max[i]) {\r
+                               err = 1;\r
+                       }\r
+               }\r
+               if (err == 0) {\r
+                       return;\r
+               }\r
+       }\r
+}\r
+\r
+void fdc_motor_on(uchar d)\r
+{\r
+       if(d == 0){\r
+               io_out8(0x3f2,io_in8(0x3f2) | 0x10);\r
+       } else if(d == 1){\r
+               io_out8(0x3f2,io_in8(0x3f2) | 0x20);\r
+       } else if(d == 2){\r
+               io_out8(0x3f2,io_in8(0x3f2) | 0x40);\r
+       } else if(d == 3){\r
+               io_out8(0x3f2,io_in8(0x3f2) | 0x80);\r
+       } \r
+       return;\r
+}\r
+\r
+void fdc_motor_off(uchar d)\r
+{\r
+       if(d == 0){\r
+               io_out8(0x3f2,io_in8(0x3f2) & 0xef);\r
+       } else if(d == 1){\r
+               io_out8(0x3f2,io_in8(0x3f2) & 0xdf);\r
+       } else if(d == 2){\r
+               io_out8(0x3f2,io_in8(0x3f2) & 0xbf);\r
+       } else if(d == 3){\r
+               io_out8(0x3f2,io_in8(0x3f2) & 0x7f);\r
+       } else if(d == 4){\r
+               io_out8(0x3f2,io_in8(0x3f2) & 0xef);\r
+               io_out8(0x3f2,io_in8(0x3f2) & 0xdf);\r
+               io_out8(0x3f2,io_in8(0x3f2) & 0xbf);\r
+               io_out8(0x3f2,io_in8(0x3f2) & 0x7f);\r
+       }\r
+       return;\r
+}\r
+\r
+void reset_cpu(void)\r
+{\r
+    wait_KBC_sendready();\r
+    io_out8(PORT_KEYCMD, 0xfe);\r
+    for (;;) { io_hlt(); }\r
+}\r
+\r
+\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/keyboard.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/keyboard.c
new file mode 100644 (file)
index 0000000..d63c6a3
--- /dev/null
@@ -0,0 +1,116 @@
+\r
+#include "core.h"\r
+\r
+uchar keytable0[0x80] = {\r
+       0  , 0  , '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0  , 0  ,\r
+       'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '@', '[', 0  , 0  , 'A', 'S', \r
+       'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', ':', 0  , 0  , ']', 'Z', 'X', 'C', 'V',\r
+       'B', 'N', 'M', ',', '.', '/', 0  , '*', 0  , ' ', 0  , 0  , 0  , 0  , 0  , 0  ,      \r
+       0  , 0  , 0  , 0  , 0  , 0  , 0  , '7', '8', '9', '-', '4', '5', '6', '+', '1',\r
+       '2', '3', '0', '.', 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , \r
+       0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , \r
+       0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  \r
+};\r
+\r
+uchar keytable1[0x80] = {\r
+       0  , 0  , '!',0x22, '#', '$', '%', '&',0x27, '(', ')', '~', '=', '~', 0  , 0  ,\r
+       'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '`', '{', 0  , 0  , 'A', 'S', \r
+       'D', 'F', 'G', 'H', 'J', 'K', 'L', '+', '*', 0  , 0  , '}', 'Z', 'X', 'C', 'V',\r
+       'B', 'N', 'M', '<', '>', '?', 0  , '*', 0  , ' ', 0  , 0  , 0  , 0  , 0  , 0  ,      \r
+       0  , 0  , 0  , 0  , 0  , 0  , 0  , '7', '8', '9', '-', '4', '5', '6', '+', '1',\r
+       '2', '3', '0', '.', 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , \r
+       0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , \r
+       0  , 0  , 0  , '_', 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , '|', 0  , 0  \r
+};\r
+\r
+uint key_shift = 0, key_leds;\r
+uint offset_data_k;\r
+\r
+void init_keyboard(uint offset)\r
+{\r
+       offset_data_k = offset;\r
+\r
+       wait_KBC_sendready();\r
+       io_out8(PORT_KEYCMD, KEYCMD_WRITE_MODE);\r
+       wait_KBC_sendready();\r
+       io_out8(KEYB_DATA, KBC_MODE);\r
+\r
+       set_gatedesc(system.io.interrupt.idt + 0x21, (int) asm_inthandler21, 2 * 8, AR_INTGATE32);\r
+       io_out8(PIC0_IMR, io_in8(PIC0_IMR) & 0xfd);\r
+\r
+       key_leds = (system.data.info.boot.leds >> 4) & 7;\r
+       fifo32_put(&system.data.fifo.keycmd, KEYCMD_LED);\r
+       fifo32_put(&system.data.fifo.keycmd, key_leds);\r
+\r
+       return;\r
+}\r
+\r
+void inthandler21(int *esp)\r
+{\r
+       int data;\r
+       data = io_in8(KEYB_DATA);\r
+       io_out8(PIC0_OCW2, 0x61);       /* IRQ-01\8eó\95t\8a®\97¹\82ðPIC\82É\92Ê\92\81B0x60+\94Ô\8d\86\81B*/\r
+       fifo32_put(&system.data.fifo.keyctrl, data + offset_data_k);\r
+       return;\r
+}\r
+\r
+void decode_key(UI_KeyInfo *info, uint data)\r
+{\r
+       if(data == 0xfa){\r
+               system.io.keyboard.cmd_wait = -1;\r
+       } else if(data == 0xfe){\r
+               wait_KBC_sendready();\r
+               io_out8(KEYB_DATA, system.io.keyboard.cmd_wait);\r
+       }\r
+\r
+       if(data >= 0x00 && data <= 0x7f){\r
+               info->make = true;\r
+               if(data == 0x2a) key_shift |= 1;/*LShift on*/\r
+               else if(data == 0x36) key_shift |= 2;/*Rshift on*/\r
+               else if(data == 0x3a) keylock(4);/*CapsLock*/\r
+               else if(data == 0x45) keylock(2);/*NumLock*/\r
+               else if(data == 0x46) keylock(1);/*ScrollLock*/\r
+       } else if(data >= 0x80 && data <= 0xff){\r
+               info->make = false;\r
+               data -= 0x80;\r
+               if(data == 0x2a) key_shift &= ~1;/*LShift off*/\r
+               else if(data == 0x36) key_shift &= ~2;/*Rshift off*/\r
+       }\r
+\r
+       if(key_shift == 0){\r
+               info->c = keytable0[data];\r
+       } else{\r
+               info->c = keytable1[data];\r
+       }\r
+\r
+       if('A' <= info->c && info->c <= 'Z'){\r
+               if(((key_leds & 4) == 0 && key_shift == 0) || ((key_leds & 4) != 0 && key_shift != 0)) info->c += 0x20;\r
+               info->alphabet = true;\r
+       } else {\r
+               info->alphabet = false;\r
+       }\r
+\r
+       info->keycode = data;\r
+       return;\r
+}\r
+\r
+void keylock(uint led)\r
+{\r
+       if(key_leds == (key_leds ^ led)) key_leds &= ~led;\r
+       else key_leds ^= led;\r
+       fifo32_put(&system.data.fifo.keycmd, KEYCMD_LED);\r
+       fifo32_put(&system.data.fifo.keycmd, key_leds);\r
+       return;\r
+}\r
+\r
+void wait_KBC_sendready(void)\r
+{\r
+       /* \83L\81[\83{\81[\83h\83R\83\93\83g\83\8d\81[\83\89\82ª\83f\81[\83^\91\97\90M\89Â\94\\82É\82È\82é\82Ì\82ð\91Ò\82 */\r
+       for (;;) {\r
+               if ((io_in8(PORT_KEYSTA) & KEYSTA_SEND_NOTREADY) == 0) {\r
+                       break;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/memory.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/memory.c
new file mode 100644 (file)
index 0000000..242e084
--- /dev/null
@@ -0,0 +1,156 @@
+\r
+#include "core.h"\r
+\r
+uint memtest(uint start, uint end)\r
+{\r
+\r
+       char flg486 = 0;\r
+       uint eflg,cr0,i;\r
+\r
+       eflg = io_load_eflags();\r
+       eflg |= EFLAGS_AC_BIT;\r
+       io_store_eflags(eflg);\r
+       eflg = io_load_eflags();\r
+       if((eflg & EFLAGS_AC_BIT) != 0) flg486 = 1;\r
+       eflg &= ~EFLAGS_AC_BIT;\r
+       io_store_eflags(eflg);\r
+       if(flg486 != 0) {\r
+               cr0 = load_cr0();\r
+               cr0 |= CR0_ALL_CACHE_DISABLE;\r
+               store_cr0(cr0);\r
+               }\r
+       i = memtest_sub(start, end);\r
+       if(flg486 != 0) {\r
+               cr0 = load_cr0();\r
+               cr0 &= ~CR0_ALL_CACHE_DISABLE;\r
+               store_cr0(cr0);         \r
+               }\r
+       return i;\r
+\r
+}\r
+\r
+void memman_init(IO_MemoryControl *man)\r
+{\r
+       man->frees = 0;\r
+       man->maxfrees = 0;\r
+       man->lostsize = 0;\r
+       man->losts = 0;\r
+       return;\r
+}\r
+\r
+uint memman_free_total(IO_MemoryControl *man)\r
+{\r
+       uint i,t = 0;\r
+       for (i = 0; i < man->frees; i++) {\r
+               t += man->free[i].size;\r
+               }\r
+       return t;\r
+}\r
+\r
+void *memman_alloc(IO_MemoryControl *man, uint size)\r
+{\r
+       uint i,a;\r
+       for(i = 0; i < man->frees; i++) {\r
+               if (man->free[i].size >= size) {\r
+               a = man->free[i].addr;\r
+               man->free[i].addr += size;\r
+               man->free[i].size -= size;\r
+               if(man->free[i].size == 0) {\r
+                       man->frees--;\r
+                       for (; i < man->frees; i++) {\r
+                               man->free[i] = man->free[i+1];\r
+                               }\r
+                       }\r
+                       return (void *)a;\r
+               }\r
+       }\r
+       return 0;\r
+}\r
+int memman_free(IO_MemoryControl *man, void *addr0, uint size)\r
+{\r
+       int i, j;\r
+       uint addr;\r
+       addr = (uint)addr0;\r
+       for(i = 0; i < man->frees; i++){\r
+               if(man->free[i].addr > addr) break;\r
+       }\r
+       if(i > 0) {\r
+               if(man->free[i-1].addr + man->free[i-1].size == addr){\r
+                       man->free[i-1].size += size;\r
+                       if(i < man->frees){\r
+                               if(addr + size == man->free[i].addr){\r
+                                       man->free[i-1].size += man->free[i].size;\r
+                                       man->frees--;\r
+                                       for (;i < man->frees; i++){\r
+                                               man->free[i] = man->free[i+1];\r
+                                       }\r
+                               }\r
+                       }\r
+                       return 0;\r
+               }\r
+       }\r
+       if(i < man->frees){\r
+               if(addr + size == man->free[i].addr){\r
+                       man->free[i].addr = addr;\r
+                       man->free[i].size += size;\r
+                       return 0;\r
+               }\r
+       }\r
+       if(man->frees < MEMMAN_FREES){\r
+               for(j = man->frees;j>i;j--) {\r
+                       man->free[j] = man->free[j-1];\r
+\r
+               }\r
+               man->frees++;\r
+               if(man->maxfrees < man->frees) man->maxfrees = man->frees;\r
+               man->free[i].addr = addr;\r
+               man->free[i].size = size;\r
+               return 0;\r
+\r
+       }\r
+       man->losts++;\r
+       man->lostsize += size;\r
+       return -1;\r
+}\r
+\r
+void *memman_alloc_page(IO_MemoryControl *man)\r
+{\r
+       void *addr, *mem_head_4k, *offset;\r
+\r
+       addr = memman_alloc(man, 0x2000);\r
+       if(addr == 0) return 0;\r
+       mem_head_4k = (void *)(((uint)addr + 0xfff) & 0xfffff000);\r
+       (uint)offset = (uint)mem_head_4k - (uint)addr;\r
+       if (offset > 0) {\r
+               memman_free(man, addr, (uint)offset);\r
+       }\r
+       memman_free(man, mem_head_4k + 0x1000, 0x1000 - (uint)offset);\r
+\r
+       return mem_head_4k;\r
+}\r
+\r
+void sys_memman_init(void)\r
+{\r
+       memman_init(&system.io.mem.ctrl);\r
+}\r
+\r
+uint sys_memman_free_total(void)\r
+{\r
+       return memman_free_total(&system.io.mem.ctrl);\r
+}\r
+\r
+void *sys_memman_alloc(uint size)\r
+{\r
+       return memman_alloc(&system.io.mem.ctrl, size);\r
+}\r
+\r
+int sys_memman_free(void *addr, uint size)\r
+{\r
+       return memman_free(&system.io.mem.ctrl, addr, size);\r
+}\r
+\r
+void *sys_memman_alloc_page(void)\r
+{\r
+       return memman_alloc_page(&system.io.mem.ctrl);\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/mouse.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/mouse.c
new file mode 100644 (file)
index 0000000..894d95f
--- /dev/null
@@ -0,0 +1,123 @@
+\r
+#include "core.h"\r
+\r
+uint offset_data_m;\r
+\r
+void init_mouse(uint offset)\r
+{\r
+       offset_data_m = offset;\r
+\r
+       system.io.mouse.decode.phase = 0;\r
+       /* \83}\83E\83X\82Ì\8f\89\8aú\89» */\r
+       sendto_mouse(MOUSECMD_ENABLE);\r
+       set_gatedesc(system.io.interrupt.idt + 0x2c, (int) asm_inthandler2c, 2 * 8, AR_INTGATE32);\r
+       io_out8(PIC1_IMR, io_in8(PIC1_IMR) & 0xef);\r
+\r
+       return;\r
+}\r
+\r
+void inthandler2c(int *esp)\r
+{\r
+       int data;\r
+\r
+       data = io_in8(KEYB_DATA);\r
+       io_out8(PIC1_OCW2, 0x64);       /* IRQ-12\8eó\95t\8a®\97¹\82ðPIC\82É\92Ê\92\81B0x60+\94Ô\8d\86\81B*/\r
+       io_out8(PIC0_OCW2, 0x62);       /*IRQ-2\81i\83X\83\8c\81[\83u\81j\8eó\95t\8a®\97¹\82ðPIC\82É\92Ê\92m*/\r
+       fifo32_put(&system.data.fifo.mousectrl, data + offset_data_m);\r
+       return;\r
+}\r
+\r
+int decode_mouse(uint data)\r
+{\r
+       switch (system.io.mouse.decode.phase){\r
+               case 0:\r
+                       if(data == 0xfa) system.io.mouse.decode.phase = 4;\r
+                       sendto_mouse(0xf3);\r
+                       sendto_mouse(200);\r
+                       break;\r
+               case 1:\r
+                       if((data & 0xc8) == 0x08) {\r
+                               system.io.mouse.decode.buf[0] = data;\r
+                               system.io.mouse.decode.phase = 2;\r
+                       }\r
+                       break;\r
+               case 2:\r
+                       system.io.mouse.decode.buf[1] = data;\r
+                       system.io.mouse.decode.phase = 3;\r
+                       break;\r
+               case 3:\r
+                       system.io.mouse.decode.buf[2] = data;\r
+                       system.io.mouse.decode.phase = 1;\r
+                       system.io.mouse.decode.btn = system.io.mouse.decode.buf[0];\r
+                       system.io.mouse.decode.x = system.io.mouse.decode.buf[1];\r
+                       system.io.mouse.decode.y = system.io.mouse.decode.buf[2];\r
+                       if((system.io.mouse.decode.buf[0] & 0x10) != 0) system.io.mouse.decode.x |= 0xffffff00;\r
+                       if((system.io.mouse.decode.buf[0] & 0x20) != 0) system.io.mouse.decode.y |= 0xffffff00;\r
+                       system.io.mouse.decode.y = - system.io.mouse.decode.y;\r
+                       return 1;\r
+               case 4:\r
+                       if(data == 0xfa) system.io.mouse.decode.phase = 5;\r
+                       sendto_mouse(0xf3);\r
+                       sendto_mouse(100);\r
+                       break;\r
+               case 5:\r
+                       if(data == 0xfa) system.io.mouse.decode.phase = 6;\r
+                       sendto_mouse(0xf3);\r
+                       sendto_mouse(80);\r
+                       break;\r
+               case 6:\r
+                       if(data == 0xfa) system.io.mouse.decode.phase = 7;\r
+                       sendto_mouse(0xf2);\r
+                       break;\r
+               case 7:\r
+                       if(data == 0xfa) break;\r
+                       if(data == 0x00){\r
+                               system.io.mouse.decode.whinfo = 0x00;\r
+                               system.io.mouse.decode.scrool = 0x00;\r
+                               system.io.mouse.decode.phase = 1;\r
+                       } else {\r
+                               system.io.mouse.decode.whinfo = data;\r
+                               system.io.mouse.decode.phase = 8;\r
+                       }                       \r
+                       break;\r
+               case 8:\r
+                       if((data & 0xc8) == 0x08) {\r
+                               system.io.mouse.decode.buf[0] = data;\r
+                               system.io.mouse.decode.phase = 9;\r
+                               }\r
+                       break;\r
+               case 9:\r
+                       system.io.mouse.decode.buf[1] = data;\r
+                       system.io.mouse.decode.phase = 10;\r
+                       break;\r
+               case 10:\r
+                       system.io.mouse.decode.buf[2] = data;\r
+                       system.io.mouse.decode.btn = system.io.mouse.decode.buf[0];\r
+                       system.io.mouse.decode.x = system.io.mouse.decode.buf[1];\r
+                       system.io.mouse.decode.y = system.io.mouse.decode.buf[2];\r
+                       if((system.io.mouse.decode.buf[0] & 0x10) != 0) system.io.mouse.decode.x |= 0xffffff00;\r
+                       if((system.io.mouse.decode.buf[0] & 0x20) != 0) system.io.mouse.decode.y |= 0xffffff00;\r
+                       system.io.mouse.decode.y = - system.io.mouse.decode.y;\r
+                       system.io.mouse.decode.phase = 11;\r
+                       break;\r
+               case 11:\r
+                       system.io.mouse.decode.phase = 8;\r
+                       system.io.mouse.decode.buf[3] = data;\r
+                       system.io.mouse.decode.scrool = system.io.mouse.decode.buf[3] & 0x0f;\r
+                       if(system.io.mouse.decode.scrool & 0x08) {\r
+                               system.io.mouse.decode.scrool |= 0xfffffff0;\r
+                       }\r
+                       return 1;\r
+       }\r
+       return 0;\r
+}\r
+\r
+void sendto_mouse(uint data)\r
+{\r
+       wait_KBC_sendready();\r
+       io_out8(PORT_KEYCMD, KEYCMD_SENDTO_MOUSE);\r
+       wait_KBC_sendready();\r
+       io_out8(KEYB_DATA, data);\r
+       return;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/mtask.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/mtask.c
new file mode 100644 (file)
index 0000000..2ade50d
--- /dev/null
@@ -0,0 +1,189 @@
+\r
+#include "core.h"\r
+\r
+UI_TaskControl *taskctl;\r
+\r
+void task_init(void)\r
+{\r
+       int i;\r
+       taskctl = (UI_TaskControl *)sys_memman_alloc(sizeof(UI_TaskControl));\r
+       for(i = 0; i < MAX_TASKS; i++){\r
+               taskctl->tasks0[i].flags = initialized;\r
+               taskctl->tasks0[i].selector = (TASK_GDT_START + i) * 8;\r
+               set_segmdesc(system.io.mem.segment.gdt + TASK_GDT_START + i, 103, (int)&taskctl->tasks0[i].tss, AR_TSS32);\r
+       }\r
+       for(i = 0; i < MAX_LEVELS; i++){\r
+               taskctl->level[i].running_tasks = 0;\r
+               taskctl->level[i].task_now = 0;\r
+       }\r
+\r
+       system.ui.task.idle = task_alloc();\r
+       system.ui.task.idle->tss.esp = (int)sys_memman_alloc(64 * 1024) + 64 * 1024;\r
+       system.ui.task.idle->tss.eip = (int)&task_idle;\r
+       system.ui.task.idle->tss.es = 1 * 8;\r
+       system.ui.task.idle->tss.cs = 2 * 8;\r
+       system.ui.task.idle->tss.ss = 1 * 8;\r
+       system.ui.task.idle->tss.ds = 1 * 8;\r
+       system.ui.task.idle->tss.fs = 1 * 8;\r
+       system.ui.task.idle->tss.gs = 1 * 8;\r
+       task_run(system.ui.task.idle, MAX_LEVELS - 1, 1);\r
+\r
+       system.ui.task.main = task_alloc();\r
+       system.ui.task.main->flags = inuse;\r
+       system.ui.task.main->priority = 2; /*0.02sec*/\r
+       system.ui.task.main->level = 0;\r
+       task_add(system.ui.task.main);\r
+       task_switchsub();\r
+       load_tr(system.ui.task.main->selector);\r
+       system.ui.timer.taskswitch = timer_alloc();\r
+       timer_settime(system.ui.timer.taskswitch, system.ui.task.main->priority);\r
+       return;\r
+}\r
+\r
+UI_Task *task_alloc(void)\r
+{\r
+       int i;\r
+       UI_Task *task;\r
+       for(i = 0; i < MAX_TASKS; i++){\r
+               if(taskctl->tasks0[i].flags == initialized){\r
+                       task = &taskctl->tasks0[i];\r
+                       task->flags = allocated;\r
+                       task->tss.eflags = 0x00000202;\r
+                       task->tss.eax = 0;\r
+                       task->tss.ecx = 0;\r
+                       task->tss.edx = 0;\r
+                       task->tss.ebx = 0;\r
+                       task->tss.ebp = 0;\r
+                       task->tss.esi = 0;\r
+                       task->tss.edi = 0;\r
+                       task->tss.es = 0;\r
+                       task->tss.ds = 0;\r
+                       task->tss.fs = 0;\r
+                       task->tss.gs = 0;\r
+                       task->tss.ldtr = 0;\r
+                       task->tss.iomap = 0x40000000;\r
+                       task->tss.ss0 = 0;\r
+                       task->tss.cr3 = 0x00400000;\r
+                       return task;\r
+               }\r
+       }\r
+       return 0;\r
+}\r
+\r
+void task_run(UI_Task *task, int level, int priority)\r
+{\r
+       if(level < 0){\r
+               level = task->level;\r
+       }\r
+       if(priority > 0) {\r
+               task->priority = priority;\r
+       }\r
+       if(task->flags == inuse && task->level != level)task_remove(task);\r
+       if(task->flags != inuse){\r
+               task->level = level;\r
+               task_add(task);\r
+       }\r
+       taskctl->change_lv_next = true;\r
+       return;\r
+}\r
+\r
+void task_switch(void)\r
+{\r
+       UI_Task *new_task, *now_task = taskctl->level[taskctl->level_now].tasks[taskctl->level[taskctl->level_now].task_now];\r
+\r
+       taskctl->level[taskctl->level_now].task_now++;\r
+       if(taskctl->level[taskctl->level_now].task_now == taskctl->level[taskctl->level_now].running_tasks) taskctl->level[taskctl->level_now].task_now = 0;\r
+       if(taskctl->change_lv_next) task_switchsub();\r
+       new_task = taskctl->level[taskctl->level_now].tasks[taskctl->level[taskctl->level_now].task_now];\r
+       timer_settime(system.ui.timer.taskswitch, new_task->priority);\r
+       if(new_task != now_task){\r
+               farjmp(0, new_task->selector);\r
+       }\r
+       return;\r
+}\r
+\r
+void task_sleep(UI_Task *task)\r
+{\r
+       UI_Task *now_task;\r
+       int eflags;\r
+\r
+       eflags = io_load_eflags();\r
+       io_cli();\r
+\r
+       if(task->flags == inuse){\r
+               now_task = task_now();\r
+               task_remove(task);\r
+               if(task == now_task){\r
+                       task_switchsub();\r
+                       now_task = task_now();\r
+                       farjmp(0, now_task->selector);\r
+               }\r
+       }\r
+\r
+       io_store_eflags(eflags);\r
+\r
+       return;\r
+}\r
+\r
+void task_arguments(UI_Task *task, int args, ...)\r
+{\r
+       int i;\r
+       va_list ap;\r
+\r
+       va_start(ap, args);\r
+       \r
+       task->tss.esp -= 4 * (args + 1);\r
+\r
+       for(i = 1; i < args + 1; i++){\r
+               *((int *)(task->tss.esp + (i * 4))) = va_arg(ap, int);\r
+       }\r
+       va_end(ap);\r
+       return; \r
+}\r
+\r
+UI_Task *task_now(void)\r
+{\r
+       return taskctl->level[taskctl->level_now].tasks[taskctl->level[taskctl->level_now].task_now];\r
+}\r
+\r
+void task_add(UI_Task *task)\r
+{\r
+       taskctl->level[task->level].tasks[taskctl->level[task->level].running_tasks] = task;\r
+       taskctl->level[task->level].running_tasks++;\r
+       task->flags = inuse;\r
+       return; \r
+}\r
+\r
+void task_remove(UI_Task *task)\r
+{\r
+       int i;\r
+       for(i = 0; i < taskctl->level[task->level].running_tasks; i++){\r
+               if(taskctl->level[task->level].tasks[i] == task) break;\r
+       }\r
+       taskctl->level[task->level].running_tasks--;\r
+       if(i < taskctl->level[task->level].task_now) taskctl->level[task->level].task_now--;\r
+       if(taskctl->level[task->level].task_now >= taskctl->level[task->level].running_tasks) taskctl->level[task->level].task_now = 0;\r
+       task->flags = allocated;\r
+       for(; i < taskctl->level[task->level].running_tasks; i++){\r
+               taskctl->level[task->level].tasks[i] = taskctl->level[task->level].tasks[i + 1];\r
+       }\r
+       return;\r
+}\r
+\r
+void task_switchsub(void)\r
+{\r
+       int i;\r
+       for(i = 0; i < MAX_LEVELS; i++){\r
+               if(taskctl->level[i].running_tasks > 0) break;\r
+       }\r
+       taskctl->level_now = i;\r
+       taskctl->change_lv_next = false;\r
+       return;\r
+}\r
+\r
+void task_idle(void)\r
+{\r
+       for(;;){\r
+               io_hlt();\r
+       }\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/naskfunc.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/naskfunc.nas
new file mode 100644 (file)
index 0000000..50bac68
--- /dev/null
@@ -0,0 +1,891 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+[FILE "naskfunc.nas"]\r
+\r
+       GLOBAL  _io_hlt, _io_cli, _io_sti, _io_stihlt\r
+       GLOBAL  _io_in8,  _io_in16,  _io_in32\r
+       GLOBAL  _io_out8, _io_out16, _io_out32\r
+       GLOBAL  _io_load_eflags, _io_store_eflags\r
+       GLOBAL  _load_gdtr, _load_idtr\r
+       GLOBAL  _load_cr0, _store_cr0\r
+       GLOBAL  _load_cr1, _store_cr1\r
+       GLOBAL  _load_cr2, _store_cr2\r
+       GLOBAL  _load_cr3, _store_cr3\r
+       GLOBAL  _load_tr\r
+       GLOBAL  _asm_end_app\r
+       GLOBAL  _memtest_sub\r
+       GLOBAL  _farjmp, _farcall\r
+       GLOBAL  _start_app\r
+       GLOBAL  _asm_osselect_third\r
+       GLOBAL  _clts, _fnsave, _frstor\r
+       GLOBAL  _pit_beep_on, _pit_beep_off\r
+       GLOBAL  _pipelineflush\r
+       GLOBAL  _read_tsc\r
+       GLOBAL  _cpuid\r
+\r
+       GLOBAL  _asm_inthandler00, _asm_inthandler01, _asm_inthandler02, _asm_inthandler03, _asm_inthandler04, _asm_inthandler05, _asm_inthandler06, _asm_inthandler07, _asm_inthandler08, _asm_inthandler09, _asm_inthandler0a, _asm_inthandler0b, _asm_inthandler0c, _asm_inthandler0d, _asm_inthandler0e, _asm_inthandler0f, _asm_inthandler10, _asm_inthandler11, _asm_inthandler12, _asm_inthandler13, _asm_inthandler14, _asm_inthandler15, _asm_inthandler16, _asm_inthandler17, _asm_inthandler18, _asm_inthandler19, _asm_inthandler1a, _asm_inthandler1b, _asm_inthandler1c, _asm_inthandler1d, _asm_inthandler1e, _asm_inthandler1f\r
+       EXTERN  _inthandler00, _inthandler01, _inthandler02, _inthandler03, _inthandler04, _inthandler05, _inthandler06, _inthandler07, _inthandler08, _inthandler09, _inthandler0a, _inthandler0b, _inthandler0c, _inthandler0d, _inthandler0e, _inthandler0f, _inthandler10, _inthandler11, _inthandler12, _inthandler13, _inthandler14, _inthandler15, _inthandler16, _inthandler17, _inthandler18, _inthandler19, _inthandler1a, _inthandler1b, _inthandler1c, _inthandler1d, _inthandler1e, _inthandler1f\r
+\r
+       GLOBAL  _asm_inthandler27\r
+       EXTERN  _inthandler27\r
+\r
+       GLOBAL  _asm_inthandler20\r
+       EXTERN  _inthandler20\r
+\r
+       GLOBAL  _asm_inthandler21\r
+       EXTERN  _inthandler21\r
+\r
+       GLOBAL  _asm_inthandler2c\r
+       EXTERN  _inthandler2c\r
+\r
+       GLOBAL  _asm_hrb_api\r
+       EXTERN  _hrb_api\r
+\r
+[SECTION .text]\r
+\r
+_asm_hrb_api:\r
+       sti\r
+       push    ds\r
+       push    es\r
+       pushad\r
+       pushad\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call _hrb_api\r
+       cmp     eax,0\r
+       jne     _asm_end_app\r
+       add     esp,32\r
+       popad\r
+       pop     es\r
+       pop     ds\r
+       iretd\r
+\r
+_cpuid:\r
+       pushad\r
+       mov     esi,[esp+36]\r
+       mov     eax,[esp+40]\r
+       db      0x0f,0xa2\r
+       mov     [esi   ],eax\r
+       mov     [esi+ 4],ebx\r
+       mov     [esi+ 8],edx\r
+       mov     [esi+12],ecx\r
+       popad\r
+       ret\r
+\r
+_read_tsc:\r
+       pushad\r
+       mov     ebx,[esp+36]\r
+       db      0x0f,0x31\r
+       mov     [ebx],edx\r
+       mov     [ebx+4],eax\r
+       popad\r
+       ret\r
+\r
+_asm_inthandler2c:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler2c\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler21:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler21\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler20:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler20\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_pipelineflush:\r
+       jmp     flush\r
+flush:\r
+       ret\r
+\r
+\r
+_asm_inthandler00:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler00\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler01:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler01\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler02:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler02\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler03:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler03\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler04:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler04\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler05:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler05\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler06:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler06\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler07:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler07\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler08:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler08\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler09:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler09\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler0a:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler0a\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler0b:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler0b\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler0c:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler0c\r
+       cmp     eax,0\r
+       jne     _asm_end_app\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler0d:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler0d\r
+       cmp     eax,0\r
+       jne     _asm_end_app\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler0e:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler0e\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler0f:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler0f\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler10:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler10\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler11:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler11\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler12:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler12\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler13:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler13\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler14:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler14\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler15:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler15\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler16:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler16\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler17:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler17\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler18:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler18\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler19:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler19\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler1a:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler1a\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler1b:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler1b\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler1c:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler1c\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler1d:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler1d\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler1e:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler1e\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler1f:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler1f\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_inthandler27:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _inthandler27\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_pit_beep_on:\r
+       in      al,0x61\r
+       or      al,0x03\r
+       and     al,0x0f\r
+       out     0x61,al\r
+       ret\r
+\r
+_pit_beep_off:\r
+       in      al,0x61\r
+       and     al,0xd\r
+       out     0x61,al\r
+       ret\r
+\r
+_asm_osselect_third:\r
+        mov     ax,ss\r
+        mov     fs,ax\r
+        mov     gs,ax\r
+        mov     esp,[esp+4]\r
+        jmp     2*8:0x0000001b\r
+\r
+_clts:\r
+        clts\r
+        ret\r
+\r
+_fnsave:\r
+        mov     eax,[esp+4]     ; addr\r
+        fnsave  [eax]\r
+        ret\r
+\r
+_frstor:\r
+        mov     eax,[esp+4]     ; addr\r
+        frstor  [eax]\r
+        ret\r
+\r
+\r
+_io_hlt:\r
+       hlt\r
+       ret\r
+\r
+_io_cli:\r
+       cli\r
+       ret\r
+\r
+_io_sti:\r
+       sti\r
+       ret\r
+\r
+_io_stihlt:\r
+       sti\r
+       hlt\r
+       ret\r
+\r
+_io_in8:\r
+       mov     edx,[esp+4]\r
+       mov     eax,0\r
+       in      al,dx\r
+       ret\r
+\r
+_io_in16:\r
+       mov     edx,[esp+4]\r
+       mov     eax,0\r
+       in      ax,dx\r
+       ret\r
+\r
+_io_in32:\r
+       mov     edx,[esp+4]\r
+       in      eax,dx\r
+       ret\r
+\r
+_io_out8:\r
+       mov     edx,[esp+4]\r
+       mov     al,[esp+8]\r
+       out     dx,al\r
+       ret\r
+\r
+_io_out16:\r
+       mov     edx,[esp+4]\r
+       mov     eax,[esp+8]\r
+       out     dx,ax\r
+       ret\r
+\r
+_io_out32:\r
+       mov     edx,[esp+4]\r
+       mov     eax,[esp+8]\r
+       out     dx,eax\r
+       ret\r
+\r
+_io_load_eflags:\r
+       pushfd\r
+       pop     eax\r
+       ret\r
+\r
+_io_store_eflags:\r
+       mov     eax,[esp+4]\r
+       push    eax\r
+       popfd\r
+       ret\r
+\r
+_load_gdtr:\r
+       mov     ax,[esp+4]\r
+       mov     [esp+6],ax\r
+       lgdt    [esp+6]\r
+       ret\r
+\r
+_load_idtr:\r
+       mov     ax,[esp+4]\r
+       mov     [esp+6],ax\r
+       lidt    [esp+6]\r
+       ret\r
+\r
+_load_cr0:\r
+       mov     eax,cr0\r
+       ret\r
+\r
+_store_cr0:\r
+       mov     eax,[esp+4]\r
+       mov     cr0,eax\r
+       ret\r
+\r
+_load_cr1:\r
+       mov     eax,cr1\r
+       ret\r
+\r
+_store_cr1:\r
+       mov     eax,[esp+4]\r
+       mov     cr1,eax\r
+       ret\r
+\r
+_load_cr2:\r
+       mov     eax,cr2\r
+       ret\r
+\r
+_store_cr2:\r
+       mov     eax,[esp+4]\r
+       mov     cr2,eax\r
+       ret\r
+\r
+_load_cr3:\r
+       mov     eax,cr3\r
+       ret\r
+\r
+_store_cr3:\r
+       mov     eax,[esp+4]\r
+       mov     cr3,eax\r
+       ret\r
+\r
+_load_tr:\r
+       ltr     [esp+4]\r
+       ret\r
+\r
+_memtest_sub:\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     esi,0xaa55aa55\r
+       mov     edi,0x55aa55aa\r
+       mov     eax,[esp+12+4]\r
+mts_loop:\r
+       mov     ebx,eax\r
+       add     ebx,0xffc\r
+       mov     edx,[ebx]\r
+       mov     [ebx],esi\r
+       xor     dword [ebx],0xffffffff\r
+       cmp     edi,[ebx]\r
+       jne     mts_fin\r
+       xor     dword [ebx],0xffffffff\r
+       cmp     esi,[ebx]\r
+       jne     mts_fin\r
+       mov     [ebx],edx\r
+       add     eax,0x1000\r
+       cmp     eax,[esp+12+8]\r
+       jbe     mts_loop\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
+mts_fin:\r
+       mov     [ebx],edx\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
+\r
+_farjmp:\r
+       jmp     far     [esp+4]\r
+       ret\r
+\r
+_farcall:\r
+       call    far     [esp+4]\r
+       ret\r
+\r
+\r
+_asm_end_app:\r
+       mov     esp,[eax]\r
+       mov     dword [eax+4],0\r
+       popad\r
+       ret\r
+\r
+_start_app:\r
+       pushad\r
+       mov     eax,[esp+36]\r
+       mov     ecx,[esp+40]\r
+       mov     edx,[esp+44]\r
+       mov     ebx,[esp+48]\r
+       mov     ebp,[esp+52]\r
+       mov     [ebp  ],esp\r
+       mov     [ebp+4],ss\r
+       mov     es,bx\r
+       mov     ds,bx\r
+       mov     fs,bx\r
+       mov     gs,bx\r
+\r
+       or      ecx,3\r
+       or      ebx,3\r
+       push    ebx\r
+       push    edx\r
+       push    ecx\r
+       push    eax\r
+       retf\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/paging.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/paging.c
new file mode 100644 (file)
index 0000000..a50aae5
--- /dev/null
@@ -0,0 +1,94 @@
+\r
+#include "core.h"\r
+\r
+void init_paging(void)\r
+{\r
+       uint i, j, k, l, m, n, o, cr0;\r
+\r
+       j = (system.io.mem.total + 1) >> 22;\r
+       l = ((system.io.mem.total - ((j - 1) << 22)) + 4095) >> 12;\r
+\r
+       for(i = 0; i < 1024; i++){\r
+               paging_set_dir(&system.io.mem.paging.dir[i], &system.io.mem.paging.table[i][0], PG_NOTPRESENT, 0x00000000);\r
+               for(k = 0; k < 1024; k++){\r
+                       paging_set_table(&system.io.mem.paging.table[i][k], (uint *)((i << 22) + (k * 1024 * 4)), PG_NOTPRESENT, 0x00000000);\r
+               }\r
+       }\r
+\r
+       for(i = 0; i < j; i++){\r
+//             paging_set_dir(&system.io.mem.paging.dir[i], &system.io.mem.paging.table[i][0], PG_PRESENT | PG_WRITABLE | PG_SUPERVISOR | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+               paging_set_dir(&system.io.mem.paging.dir[i], &system.io.mem.paging.table[i][0], PG_PRESENT | PG_WRITABLE | PG_USER | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+\r
+               if(i == j - 1){\r
+                       for(k = 0; k < l; k++){\r
+//                             paging_set_table(&system.io.mem.paging.table[i][k], (uint *)((i << 22) + (k * 1024 * 4)), PG_PRESENT | PG_WRITABLE | PG_SUPERVISOR | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+                               paging_set_table(&system.io.mem.paging.table[i][k], (uint *)((i << 22) + (k * 1024 * 4)), PG_PRESENT | PG_WRITABLE | PG_USER | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+                       }\r
+               } else{\r
+                       for(k = 0; k < 1024; k++){\r
+//                             paging_set_table(&system.io.mem.paging.table[i][k], (uint *)((i << 22) + (k * 1024 * 4)), PG_PRESENT | PG_WRITABLE | PG_SUPERVISOR | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+                               paging_set_table(&system.io.mem.paging.table[i][k], (uint *)((i << 22) + (k * 1024 * 4)), PG_PRESENT | PG_WRITABLE | PG_USER | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+                       }\r
+               }\r
+       }\r
+\r
+       m = (uint)system.data.info.vesa.PhysBasePtr >> 22;\r
+       n = system.data.info.boot.scrnx * system.data.info.boot.scrny * (system.data.info.vesa.BitsPerPixel >> 3);\r
+       o = n >> 12;\r
+       if(n != (o << 12)) o++;\r
+       j = (o + 1023) >> 10;\r
+       l = o - ((j - 1) << 10);\r
+\r
+       for(i = 0; i < j; i++){\r
+               paging_set_dir(&system.io.mem.paging.dir[m + i], &system.io.mem.paging.table[m + i][0], PG_PRESENT | PG_WRITABLE | PG_SUPERVISOR | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+               if(i == j - 1){\r
+                       for(k = 0; k < l; k++){\r
+                               paging_set_table(&system.io.mem.paging.table[m + i][k], (uint *)(((m + i) << 22) + (k * 1024 * 4)), PG_PRESENT | PG_WRITABLE | PG_SUPERVISOR | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+                       }\r
+               } else{\r
+                       for(k = 0; k < 1024; k++){\r
+                               paging_set_table(&system.io.mem.paging.table[m + i][k], (uint *)(((m + i) << 22) + (k * 1024 * 4)), PG_PRESENT | PG_WRITABLE | PG_SUPERVISOR | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+                       }\r
+               }\r
+       }\r
+\r
+       store_cr3((uint)system.io.mem.paging.dir);\r
+       cr0 = load_cr0();\r
+       cr0 |= CR0_PAGING + CR0_PROTECTIONENABLE;\r
+       store_cr0(cr0);\r
+       pipelineflush();\r
+\r
+       return;\r
+}\r
+\r
+void paging_set_dir(uint *dir_entry, uint *table_base, uint attribute, uint available)\r
+{\r
+       uint entry;\r
+\r
+       if(attribute & PG_PRESENT){\r
+               entry = ((uint)table_base & 0xfffff000);\r
+               entry |= (attribute & 0x000001ff);\r
+               entry |= ((available & 0x00000007) << 9);       \r
+       } else{\r
+               entry = (available << 1);\r
+               entry &= 0xfffffffe;\r
+       }\r
+       *dir_entry = entry;\r
+       return;\r
+}\r
+\r
+void paging_set_table(uint *table_entry, uint *page_base, uint attribute, uint available)\r
+{\r
+       uint entry;\r
+\r
+       if(attribute & PG_PRESENT){\r
+               entry = ((uint)page_base & 0xfffff000);\r
+               entry |= (attribute & 0x000001ff);\r
+               entry |= ((available & 0x00000007) << 9);       \r
+       } else{\r
+               entry = (available << 1);\r
+               entry &= 0xfffffffe;\r
+       }\r
+       *table_entry = entry;\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/sheet.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/sheet.c
new file mode 100644 (file)
index 0000000..67799eb
--- /dev/null
@@ -0,0 +1,429 @@
+\r
+#include "core.h"\r
+\r
+UI_SheetControl *ctl;\r
+void (*sheet_refreshsub)(int vx0, int vy0, int vx1, int vy1, int h0, int h1);\r
+void (*sheet_refreshmap)(int vx0, int vy0, int vx1, int vy1, int h0);\r
+\r
+void init_sheets(void *vram, int xsize, int ysize, uchar bits)\r
+{\r
+       int i;\r
+\r
+       switch(bits){\r
+               case 8:\r
+                       sheet_refreshsub = sheet_refreshsub8;\r
+                       sheet_refreshmap = sheet_refreshmap8;\r
+                       break;\r
+               case 16:\r
+                       sheet_refreshsub = sheet_refreshsub16;\r
+                       sheet_refreshmap = sheet_refreshmap16;\r
+                       break;\r
+               case 32:\r
+                       sheet_refreshsub = sheet_refreshsub32;\r
+                       sheet_refreshmap = sheet_refreshmap32;\r
+                       break;\r
+       }\r
+\r
+       ctl = &system.ui.draw.sht.ctrl;\r
+       if(ctl == 0) goto err;\r
+       ctl->map = (uint *)sys_memman_alloc(xsize * ysize * 4);\r
+       if(ctl->map == 0){\r
+               sys_memman_free(ctl, sizeof(UI_SheetControl));\r
+               goto err;\r
+       }\r
+       ctl->vram = vram;\r
+       ctl->xsize = xsize;\r
+       ctl->ysize = ysize;\r
+       ctl->top = -1;\r
+       for(i = 0;i < MAX_SHEETS;i++){\r
+               ctl->sheets0[i].flags = initialized;\r
+       }\r
+err:\r
+       return;\r
+}\r
+\r
+UI_Sheet *sheet_alloc(void)\r
+{\r
+       UI_Sheet *sht;\r
+       int i;\r
+\r
+       for(i = 0;i < MAX_SHEETS;i++){\r
+               if(ctl->sheets0[i].flags == initialized){\r
+                       sht = &ctl->sheets0[i];\r
+                       sht->flags = allocated;\r
+                       sht->height = -1;\r
+                       return sht;\r
+               }\r
+       }\r
+       return 0;\r
+}\r
+\r
+void sheet_setbuf(UI_Sheet *sht, void *buf,int xsize, int ysize, uint col_inv)\r
+{\r
+       sht->buf = buf;\r
+       sht->bxsize = xsize;\r
+       sht->bysize = ysize;\r
+       sht->col_inv = col_inv;\r
+       return;\r
+}\r
+/*\r
+void sheet_updown(UI_Sheet *sht, int height)\r
+{\r
+       int h, old = sht->height;\r
+\r
+       if(height > ctl->top + 1) height = ctl->top + 1;\r
+       if (height < -1) height = -1;\r
+       sht->height = height;\r
+\r
+       if (old > height){\r
+               if (height >= 0){\r
+                       for (h = old; h > height; h--){\r
+                               ctl->sheets[h] = ctl->sheets[h - 1];\r
+                               ctl->sheets[h]->height = h;\r
+                       }\r
+                       ctl->sheets[height] = sht;\r
+                       sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1);\r
+                       sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1, old);\r
+               } else {\r
+                       if(ctl->top > old){\r
+                               for(h = old; h < ctl->top; h++){\r
+                                       ctl->sheets[h] = ctl->sheets[h + 1];\r
+                                       ctl->sheets[h]->height = h;\r
+                               }\r
+                       }\r
+                       ctl->top--;\r
+                       sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0);\r
+                       sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1);\r
+               }\r
+       } else if(old < height) {\r
+               if(old >= 0){\r
+                       for(h = old; h < height; h++){\r
+                               ctl->sheets[h] = ctl->sheets[h + 1];\r
+                               ctl->sheets[h]->height = h;\r
+                               }\r
+                               ctl->sheets[height]= sht;\r
+                       } else {\r
+                               for(h = ctl->top; h >= height; h--){\r
+                               ctl->sheets[h + 1] = ctl->sheets[h];\r
+                               ctl->sheets[h + 1]->height = h;                 \r
+                       }\r
+                       ctl->sheets[height] = sht;\r
+                       ctl->top++;\r
+               }\r
+               sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height);\r
+               sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height);\r
+       }\r
+\r
+       return;\r
+}\r
+*/\r
+void sheet_updown(UI_Sheet *sht, int height)\r
+{\r
+       int i, old = sht->height;                                                       //\95Ï\89»\82³\82¹\82é\83V\81[\83g\82Ì\8c³\82Ì\8d\82\82³\82ð\95Û\91\81B\r
+\r
+       if(height > ctl->top + 1) height = ctl->top + 1;                                //\90Ý\92è\82µ\82æ\82¤\82Æ\82µ\82Ä\82¢\82é\8d\82\82³\82ð\81A\82à\82Á\82Æ\82à\8d\82\82¢\82à\82Ì\82Ì\88ê\82Â\8fã\82É\90§\8cÀ\81B\r
+       if (height < -1) height = -1;                                                   //\94ñ\95\\8e¦\82Í\83}\83C\83i\83X1\82É\93\9d\88ê\81B\r
+\r
+       if(old == -1 && height >= 0){                                                   //\94ñ\95\\8e¦\82©\82ç\95\\8e¦\81B\8fã\82É\82¸\82ç\82·\81B\r
+               for(i = ctl->top; i >= height; i--){\r
+                       ctl->sheets[i + 1] = ctl->sheets[i];\r
+                       ctl->sheets[i + 1]->height = i + 1;\r
+               }\r
+               ctl->sheets[height] = sht;\r
+               ctl->sheets[height]->height = height;\r
+               ctl->top++;\r
+               sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height);\r
+               sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height);\r
+       } else if(old >= 0 && height == -1){                                            //\95\\8e¦\82©\82ç\94ñ\95\\8e¦\81B\89º\82É\82¸\82ç\82·\81B\r
+               for(i = old; i <= (ctl->top - 1); i++){\r
+                       ctl->sheets[i] = ctl->sheets[i + 1];\r
+                       ctl->sheets[i]->height = i;\r
+               }\r
+               sht->height = -1;\r
+               ctl->top--;\r
+               sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0);\r
+               sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1);\r
+       } else if(old < height){                                                        //\95\\8e¦\92\86\82Ì\82ð\8fã\82É\82¸\82ç\82·\81B\8aÔ\82Í\89º\82É\82¸\82ç\82·\81B\r
+               for(i = old; i < height; i++){\r
+                       ctl->sheets[i] = ctl->sheets[i + 1];\r
+                       ctl->sheets[i]->height = i;\r
+               }\r
+               ctl->sheets[height] = sht;\r
+               ctl->sheets[height]->height = height;\r
+               sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height);\r
+               sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height);\r
+       } else if(old > height){                                                        //\95\\8e¦\92\86\82Ì\82ð\89º\82É\82¸\82ç\82·\81B\8aÔ\82Í\8fã\82É\82¸\82ç\82·\81B\r
+               for(i = old; i > height; i--){\r
+                       ctl->sheets[i] = ctl->sheets[i - 1];\r
+                       ctl->sheets[i]->height = i;\r
+               }\r
+               ctl->sheets[height] = sht;\r
+               ctl->sheets[height]->height = height;\r
+               sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, old);\r
+               sheet_refreshsub(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, old);\r
+       }\r
+       return;\r
+}\r
+\r
+void sheet_refresh(UI_Sheet *sht, int bx0, int by0, int bx1, int by1)\r
+{\r
+       if(sht->height >= 0){\r
+               sheet_refreshsub(sht->vx0 + bx0, sht->vy0 + by0, sht->vx0 + bx1, sht->vy0 + by1 , sht->height, sht->height);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void sheet_refresh_full_alpha(UI_Sheet *sht)\r
+{\r
+       sheet_refreshmap(sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, sht->height);\r
+       sheet_refresh_full(sht);\r
+\r
+       return;\r
+}\r
+\r
+void sheet_refresh_full(UI_Sheet *sht)\r
+{\r
+       sheet_refresh(sht, 0, 0, sht->bxsize, sht->bysize);\r
+\r
+       return;\r
+}\r
+\r
+void sheet_slide(UI_Sheet *sht, int vx0, int vy0)\r
+{\r
+       int old_vx0 = sht->vx0, old_vy0 = sht->vy0;\r
+\r
+       sht->vx0 = vx0;\r
+       sht->vy0 = vy0;\r
+       if(sht->height >= 0) {\r
+               sheet_refreshmap(old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize,0);\r
+               sheet_refreshmap(vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize,sht->height);\r
+               sheet_refreshsub(old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize,0,sht->height - 1);\r
+               sheet_refreshsub(vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize,sht->height, sht->height);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void sheet_free(UI_Sheet *sht)\r
+{\r
+       if(sht->height >= 0) sheet_updown(sht, -1);\r
+       sht->flags = initialized;\r
+\r
+       return;\r
+}\r
+\r
+void sheet_refreshsub32(int vx0, int vy0, int vx1, int vy1, int h0, int h1)\r
+{\r
+       int h, bx, by, vx, vy, bx0, by0, bx1, by1;\r
+       uint *map = ctl->map,sid;\r
+       uint *buf, *vram = (uint *)ctl->vram;\r
+       UI_Sheet *sht;\r
+\r
+       if(vx0 < 0) vx0 = 0;\r
+       if(vy0 < 0) vy0 = 0;\r
+       if(vx1 > ctl->xsize) vx1 = ctl->xsize;\r
+       if(vy1 > ctl->ysize) vy1 = ctl->ysize;\r
+       for(h = 0; h <= ctl->top; h++){\r
+               sht = ctl->sheets[h];\r
+               buf = sht->buf;\r
+               sid = sht - ctl->sheets0;\r
+               bx0 = vx0 - sht->vx0;\r
+               by0 = vy0 - sht->vy0;\r
+               bx1 = vx1 - sht->vx0;\r
+               by1 = vy1 - sht->vy0;\r
+               if(bx0 < 0) bx0 = 0;\r
+               if(by0 < 0) by0 = 0;\r
+               if(bx1 > sht->bxsize) bx1 = sht->bxsize;\r
+               if(by1 > sht->bysize) by1 = sht->bysize;\r
+               for(by = by0; by < by1; by++){\r
+                       vy = sht->vy0 + by;\r
+                       for(bx = bx0; bx < bx1; bx++){\r
+                               vx = sht->vx0 + bx;\r
+                               if(map[vy * ctl->xsize + vx] == sid) vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx];\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void sheet_refreshsub16(int vx0, int vy0, int vx1, int vy1, int h0, int h1)\r
+{\r
+       int h, bx, by, vx, vy, bx0, by0, bx1, by1;\r
+       uint *map = ctl->map,sid;\r
+       ushort *buf, *vram = (ushort *)ctl->vram;\r
+       UI_Sheet *sht;\r
+\r
+       if(vx0 < 0) vx0 = 0;\r
+       if(vy0 < 0) vy0 = 0;\r
+       if(vx1 > ctl->xsize) vx1 = ctl->xsize;\r
+       if(vy1 > ctl->ysize) vy1 = ctl->ysize;\r
+       for(h = 0; h <= ctl->top; h++){\r
+               sht = ctl->sheets[h];\r
+               buf = sht->buf;\r
+               sid = sht - ctl->sheets0;\r
+               bx0 = vx0 - sht->vx0;\r
+               by0 = vy0 - sht->vy0;\r
+               bx1 = vx1 - sht->vx0;\r
+               by1 = vy1 - sht->vy0;\r
+               if(bx0 < 0) bx0 = 0;\r
+               if(by0 < 0) by0 = 0;\r
+               if(bx1 > sht->bxsize) bx1 = sht->bxsize;\r
+               if(by1 > sht->bysize) by1 = sht->bysize;\r
+               for(by = by0; by < by1; by++){\r
+                       vy = sht->vy0 + by;\r
+                       for(bx = bx0; bx < bx1; bx++){\r
+                               vx = sht->vx0 + bx;\r
+                               if(map[vy * ctl->xsize + vx] == sid) vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx];\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void sheet_refreshsub8(int vx0, int vy0, int vx1, int vy1, int h0, int h1)\r
+{\r
+       int h, bx, by, vx, vy, bx0, by0, bx1, by1;\r
+       uint *map = ctl->map,sid;\r
+       uchar *buf, *vram = (uchar *)ctl->vram;\r
+       UI_Sheet *sht;\r
+\r
+       if(vx0 < 0) vx0 = 0;\r
+       if(vy0 < 0) vy0 = 0;\r
+       if(vx1 > ctl->xsize) vx1 = ctl->xsize;\r
+       if(vy1 > ctl->ysize) vy1 = ctl->ysize;\r
+       for(h = 0; h <= ctl->top; h++){\r
+               sht = ctl->sheets[h];\r
+               buf = sht->buf;\r
+               sid = sht - ctl->sheets0;\r
+               bx0 = vx0 - sht->vx0;\r
+               by0 = vy0 - sht->vy0;\r
+               bx1 = vx1 - sht->vx0;\r
+               by1 = vy1 - sht->vy0;\r
+               if(bx0 < 0) bx0 = 0;\r
+               if(by0 < 0) by0 = 0;\r
+               if(bx1 > sht->bxsize) bx1 = sht->bxsize;\r
+               if(by1 > sht->bysize) by1 = sht->bysize;\r
+               for(by = by0; by < by1; by++){\r
+                       vy = sht->vy0 + by;\r
+                       for(bx = bx0; bx < bx1; bx++){\r
+                               vx = sht->vx0 + bx;\r
+                               if(map[vy * ctl->xsize + vx] == sid) vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx];\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void sheet_refreshmap32(int vx0, int vy0, int vx1, int vy1, int h0)\r
+{\r
+       int h, bx, by, vx, vy, bx0, by0, bx1, by1;\r
+       uint sid, *map = ctl->map;\r
+       uint *buf;\r
+       UI_Sheet *sht;\r
+\r
+       if(vx0 < 0) vx0 = 0;\r
+       if(vy0 < 0) vy0 = 0;\r
+       if(vx1 > ctl->xsize) vx1 = ctl->xsize;\r
+       if(vy1 > ctl->ysize) vy1 = ctl->ysize;\r
+       for(h = 0; h <= ctl->top; h++){\r
+               sht = ctl->sheets[h];\r
+               sid = sht - ctl->sheets0;\r
+               buf = sht->buf;\r
+               bx0 = vx0 - sht->vx0;\r
+               by0 = vy0 - sht->vy0;\r
+               bx1 = vx1 - sht->vx0;\r
+               by1 = vy1 - sht->vy0;\r
+               if(bx0 < 0) bx0 = 0;\r
+               if(by0 < 0) by0 = 0;\r
+               if(bx1 > sht->bxsize) bx1 = sht->bxsize;\r
+               if(by1 > sht->bysize) by1 = sht->bysize;\r
+               for(by = by0; by < by1; by++){\r
+                       vy = sht->vy0 + by;\r
+                       for(bx = bx0; bx < bx1; bx++){\r
+                               vx = sht->vx0 + bx;\r
+                               if(buf[by * sht->bxsize + bx] != INV_COL32) map[vy * ctl->xsize + vx] = sid;\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void sheet_refreshmap16(int vx0, int vy0, int vx1, int vy1, int h0)\r
+{\r
+       int h, bx, by, vx, vy, bx0, by0, bx1, by1;\r
+       uint sid, *map = ctl->map;\r
+       ushort *buf;\r
+       UI_Sheet *sht;\r
+\r
+       if(vx0 < 0) vx0 = 0;\r
+       if(vy0 < 0) vy0 = 0;\r
+       if(vx1 > ctl->xsize) vx1 = ctl->xsize;\r
+       if(vy1 > ctl->ysize) vy1 = ctl->ysize;\r
+       for(h = 0; h <= ctl->top; h++){\r
+               sht = ctl->sheets[h];\r
+               sid = sht - ctl->sheets0;\r
+               buf = sht->buf;\r
+               bx0 = vx0 - sht->vx0;\r
+               by0 = vy0 - sht->vy0;\r
+               bx1 = vx1 - sht->vx0;\r
+               by1 = vy1 - sht->vy0;\r
+               if(bx0 < 0) bx0 = 0;\r
+               if(by0 < 0) by0 = 0;\r
+               if(bx1 > sht->bxsize) bx1 = sht->bxsize;\r
+               if(by1 > sht->bysize) by1 = sht->bysize;\r
+               for(by = by0; by < by1; by++){\r
+                       vy = sht->vy0 + by;\r
+                       for(bx = bx0; bx < bx1; bx++){\r
+                               vx = sht->vx0 + bx;\r
+                               if(buf[by * sht->bxsize + bx] != INV_COL16) map[vy * ctl->xsize + vx] = sid;\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void sheet_refreshmap8(int vx0, int vy0, int vx1, int vy1, int h0)\r
+{\r
+       int h, bx, by, vx, vy, bx0, by0, bx1, by1;\r
+       uint sid, *map = ctl->map;\r
+       uchar *buf;\r
+       UI_Sheet *sht;\r
+\r
+       if(vx0 < 0) vx0 = 0;\r
+       if(vy0 < 0) vy0 = 0;\r
+       if(vx1 > ctl->xsize) vx1 = ctl->xsize;\r
+       if(vy1 > ctl->ysize) vy1 = ctl->ysize;\r
+       for(h = 0; h <= ctl->top; h++){\r
+               sht = ctl->sheets[h];\r
+               sid = sht - ctl->sheets0;\r
+               buf = sht->buf;\r
+               bx0 = vx0 - sht->vx0;\r
+               by0 = vy0 - sht->vy0;\r
+               bx1 = vx1 - sht->vx0;\r
+               by1 = vy1 - sht->vy0;\r
+               if(bx0 < 0) bx0 = 0;\r
+               if(by0 < 0) by0 = 0;\r
+               if(bx1 > sht->bxsize) bx1 = sht->bxsize;\r
+               if(by1 > sht->bysize) by1 = sht->bysize;\r
+               for(by = by0; by < by1; by++){\r
+                       vy = sht->vy0 + by;\r
+                       for(bx = bx0; bx < bx1; bx++){\r
+                               vx = sht->vx0 + bx;\r
+                               if(buf[by * sht->bxsize + bx] != INV_COL8) map[vy * ctl->xsize + vx] = sid;\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+int sheet_get_topheight(void)\r
+{\r
+       return ctl->top - 1;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/timer.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/timer.c
new file mode 100644 (file)
index 0000000..dff8773
--- /dev/null
@@ -0,0 +1,116 @@
+\r
+#include "core.h"\r
+\r
+void inthandler20(int *esp)\r
+{\r
+       UI_Timer *timer;\r
+       char ts = 0;\r
+\r
+       system.ui.timer.ctrl.count++;\r
+       io_out8(PIC0_OCW2, 0x60);       /* IRQ-00\8eó\95t\8a®\97¹\82ðPIC\82É\92Ê\92\81B0x60+\94Ô\8d\86\81B*/\r
+       if(system.ui.timer.ctrl.next_count > system.ui.timer.ctrl.count) return;\r
+       timer = system.ui.timer.ctrl.timers;\r
+       for(;;){\r
+               if(timer->timeout > system.ui.timer.ctrl.count) break;\r
+               timer->flags = allocated;\r
+               if(timer != system.ui.timer.taskswitch){\r
+                       fifo32_put(timer->fifo, timer->data);\r
+               } else {\r
+                       ts = 1;\r
+               }\r
+               timer = timer->next_timer;\r
+       }\r
+       system.ui.timer.ctrl.timers = timer;\r
+       system.ui.timer.ctrl.next_count = timer->timeout;\r
+       if(ts != 0) task_switch();\r
+       return;\r
+}\r
+\r
+void init_pit(void)\r
+{\r
+       int i;\r
+       UI_Timer *watch;\r
+       for(i = 0; i < MAX_TIMER; i++) {\r
+               system.ui.timer.ctrl.timer[i].flags = initialized;\r
+       }\r
+       watch = timer_alloc();\r
+       watch->timeout = 0xffffffff;\r
+       watch->flags = inuse;\r
+       watch->next_timer = 0;\r
+       system.ui.timer.ctrl.timers = watch;\r
+       system.ui.timer.ctrl.next_count = 0xffffffff;\r
+       io_out8(PIT_CTRL, 0x34);\r
+       io_out8(PIT_CNT0, 0x9c);\r
+       io_out8(PIT_CNT0, 0x2e);\r
+       set_gatedesc(system.io.interrupt.idt + 0x20, (int) asm_inthandler20, 2 * 8, AR_INTGATE32);\r
+       io_out8(PIC0_IMR, io_in8(PIC0_IMR) & 0xfe);\r
+       system.ui.timer.ctrl.count = 0;\r
+       return;\r
+}\r
+\r
+UI_Timer *timer_alloc(void)\r
+{\r
+       int i;\r
+       for(i = 0; i < MAX_TIMER; i++){\r
+               if(system.ui.timer.ctrl.timer[i].flags == initialized){\r
+                       system.ui.timer.ctrl.timer[i].flags = allocated;\r
+                       return &system.ui.timer.ctrl.timer[i];\r
+               }\r
+       }\r
+       return 0;\r
+}\r
+\r
+void timer_free(UI_Timer *timer)\r
+{\r
+       timer->flags = initialized;\r
+       return;\r
+}\r
+\r
+void timer_init(UI_Timer *timer, DATA_FIFO *fifo, uint data)\r
+{\r
+       timer->fifo = fifo;\r
+       timer->data = data;\r
+       return;\r
+}\r
+\r
+void timer_settime(UI_Timer *timer, uint timeout)\r
+{\r
+       int ef;\r
+       UI_Timer *t, *s;\r
+\r
+       timer->timeout = timeout + system.ui.timer.ctrl.count;\r
+       timer->flags = inuse;\r
+       ef = io_load_eflags();\r
+       io_cli();\r
+       t = system.ui.timer.ctrl.timers;\r
+       if(timer->timeout <= t->timeout){\r
+               system.ui.timer.ctrl.timers = timer;\r
+               timer->next_timer = t;\r
+               system.ui.timer.ctrl.next_count = timer->timeout;\r
+               io_store_eflags(ef);\r
+               return;\r
+       }\r
+       for(;;){\r
+               s = t;\r
+               t = t->next_timer;\r
+               if(timer->timeout <= t->timeout){\r
+                       s->next_timer = timer;\r
+                       timer->next_timer = t;\r
+                       io_store_eflags(ef);\r
+                       return;                         \r
+               }\r
+       }\r
+}\r
+\r
+void timer_settime_millisec(UI_Timer *timer, uint timeout_ms)\r
+{\r
+       timer_settime(timer, timeout_ms / 10);\r
+       return;\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/uuid.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/uuid.c
new file mode 100644 (file)
index 0000000..e81ca35
--- /dev/null
@@ -0,0 +1,67 @@
+\r
+#include "core.h"\r
+\r
+void gen_UUID(UUID *uuid)\r
+{\r
+       uint tsc[2];\r
+\r
+       /*from date*/\r
+       srand((uint)readcmos(0x32));\r
+       uuid->data[0] = (uchar)rand();\r
+\r
+       srand((uint)readcmos(0x09));\r
+       uuid->data[1] = (uchar)rand();\r
+\r
+       srand((uint)readcmos(0x08));\r
+       uuid->data[2] = (uchar)rand();\r
+\r
+       srand((uint)readcmos(0x07));\r
+       uuid->data[3] = (uchar)rand();\r
+\r
+       srand((uint)readcmos(0x04));\r
+       uuid->data[4] = (uchar)rand();\r
+\r
+       srand((uint)readcmos(0x02));\r
+       uuid->data[5] = (uchar)rand();\r
+\r
+       srand((uint)readcmos(0x00));\r
+       uuid->data[6] = (uchar)rand();\r
+\r
+       /*from tsc*/\r
+       read_tsc(tsc);\r
+       srand((uint)(tsc[0] & 0x000000ff));\r
+       uuid->data[7] = (uchar)rand();\r
+\r
+       read_tsc(tsc);\r
+       srand((uint)(tsc[0] & 0x0000ff00) >> 8);\r
+       uuid->data[8] = (uchar)rand();\r
+\r
+       read_tsc(tsc);\r
+       srand((uint)(tsc[0] & 0x00ff0000) >> 16);\r
+       uuid->data[9] = (uchar)rand();\r
+\r
+       read_tsc(tsc);\r
+       srand((uint)(tsc[0] >> 24));\r
+       uuid->data[10] = (uchar)rand();\r
+\r
+       read_tsc(tsc);\r
+       srand((uint)(tsc[1] & 0x000000ff));\r
+       uuid->data[11] = (uchar)rand();\r
+\r
+       read_tsc(tsc);\r
+       srand((uint)(tsc[1] & 0x0000ff00) >> 8);\r
+       uuid->data[12] = (uchar)rand();\r
+\r
+       read_tsc(tsc);\r
+       srand((uint)(tsc[1] & 0x00ff0000) >> 16);\r
+       uuid->data[13] = (uchar)rand();\r
+\r
+       read_tsc(tsc);\r
+       srand((uint)(tsc[1] >> 24));\r
+       uuid->data[14] = (uchar)rand();\r
+\r
+       read_tsc(tsc);\r
+       uuid->data[15] = (uchar)(tsc[1] & 0x000000ff);\r
+\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/window.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/chnos/window.c
new file mode 100644 (file)
index 0000000..1c73f1a
--- /dev/null
@@ -0,0 +1,307 @@
+#include "core.h"\r
+\r
+void scrool_win_8(UI_Window *winfo, uchar *vram);\r
+void scrool_win_16(UI_Window *winfo, ushort *vram);\r
+void scrool_win_32(UI_Window *winfo, uint *vram);\r
+\r
+char closebtn[16][40] = {\r
+       "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",\r
+       "OQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQJJQQQQQQQQJJQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQJJJQQQQQQJJJQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQJJJQQQQJJJQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQJJJQQJJJQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQQJJJJJJQQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQQQJJJJQQQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQQQJJJJQQQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQQJJJJJJQQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQJJJQQJJJQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQJJJQQQQJJJQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQJJJQQQQQQJJJQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQJJQQQQQQQQJJQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ$@",\r
+       "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"\r
+};\r
+\r
+void init_windows(void)\r
+{\r
+       int i;\r
+\r
+       for(i = 0;i < MAX_WINDOWS;i++){\r
+               system.ui.window.ctrl.winfos[i].flags = initialized;\r
+               system.ui.window.ctrl.winfos[i].buf = (void *)0x00000000;\r
+               system.ui.window.ctrl.winfos[i].app_buf = (void *)0x00000000;\r
+               system.ui.window.ctrl.winfos[i].app_buf_bits = 0;\r
+               system.ui.window.ctrl.winfos[i].task = (UI_Task *)0;\r
+       }\r
+       return;\r
+}\r
+\r
+UI_Window *window_alloc(void)\r
+{\r
+       UI_Window *win;\r
+       int i;\r
+\r
+       for(i = 0;i < MAX_WINDOWS;i++){\r
+               if(system.ui.window.ctrl.winfos[i].flags == initialized){\r
+                       win = &system.ui.window.ctrl.winfos[i];\r
+                       win->flags = allocated;\r
+                       win->buf = (void *)0x00000000;\r
+                       win->app_buf = (void *)0x00000000;\r
+                       win->app_buf_bits = 0;\r
+                       win->task = (UI_Task *)0;\r
+                       return win;\r
+               }\r
+       }\r
+       return 0;\r
+}\r
+\r
+void window_free(UI_Window *winfo)\r
+{\r
+       winfo->flags = initialized;\r
+       winfo->task = (UI_Task *)0;\r
+       return;\r
+}\r
+\r
+UI_Window *make_window(uchar *title, int xsize, int ysize, int px, int py, int height, bool active)\r
+{\r
+       UI_Window *winfo = window_alloc();\r
+\r
+       if(winfo == 0) goto err;\r
+       winfo->winxsize = xsize + 8;\r
+       winfo->winysize = ysize + 28;\r
+       winfo->xsize = xsize;\r
+       winfo->ysize = ysize;\r
+       winfo->position.x = px;\r
+       winfo->position.y = py;\r
+       winfo->origin.x = 4;\r
+       winfo->origin.y = 24;\r
+       winfo->win = sheet_alloc();\r
+       winfo->buf = (uint *)sys_memman_alloc((winfo->winxsize * winfo->winysize) * (system.data.info.vesa.BitsPerPixel >> 2));\r
+\r
+       sheet_setbuf(winfo->win, winfo->buf, winfo->winxsize, winfo->winysize,INV_COL32);       \r
+\r
+       change_window(winfo, title, active);\r
+       boxfill_win(winfo, 0xFFFFFF, 0, 0, winfo->xsize, winfo->ysize);\r
+\r
+       sheet_slide(winfo->win, px, py);\r
+       sheet_updown(winfo->win, height);       \r
+err:\r
+       return winfo;\r
+}\r
+\r
+UI_Window *make_window_app(uchar *title, int xsize, int ysize, int px, int py, int height, bool active, uint *buf, UI_Task *task)\r
+{\r
+       UI_Window *winfo = window_alloc();\r
+\r
+       if(winfo == 0) goto err;\r
+       winfo->winxsize = xsize + 8;\r
+       winfo->winysize = ysize + 28;\r
+       winfo->xsize = xsize;\r
+       winfo->ysize = ysize;\r
+       winfo->position.x = px;\r
+       winfo->position.y = py;\r
+       winfo->origin.x = 4;\r
+       winfo->origin.y = 24;\r
+       winfo->win = sheet_alloc();\r
+       winfo->buf = buf;\r
+       winfo->task = task;\r
+\r
+       sheet_setbuf(winfo->win, winfo->buf, winfo->winxsize, winfo->winysize,INV_COL32);       \r
+\r
+       change_window(winfo, title, active);\r
+       boxfill_win(winfo, 0xFFFFFF, 0, 0, winfo->xsize, winfo->ysize);\r
+\r
+       sheet_slide(winfo->win, px, py);\r
+       sheet_updown(winfo->win, height);       \r
+err:\r
+       return winfo;\r
+}\r
+\r
+UI_Window *make_window_app_compatible_hrb(uchar *title, int xsize, int ysize, int px, int py, int height, bool active, uint *buf, UI_Task *task)\r
+{\r
+       xsize = xsize - 8;\r
+       ysize = ysize - 28;\r
+       return make_window_app(title, xsize, ysize, px, py, height, active, buf, task);\r
+}\r
+\r
+void free_window_app(UI_Window *winfo)\r
+{\r
+       sheet_free(winfo->win);\r
+       window_free(winfo);\r
+       return;\r
+}\r
+\r
+void change_window(UI_Window *winfo, uchar *title, bool active)\r
+{\r
+       uint color = 0;\r
+       int x = 0, y = 0;\r
+       char c;\r
+\r
+       for (; *title != 0x00; title++) {\r
+               winfo->title[x] = *title;               \r
+               x++;\r
+       }\r
+       winfo->title[x] = 0x00;\r
+       winfo->active = active; \r
+\r
+       if(system.data.info.vesa.BitsPerPixel == 8){\r
+               if(active) color = WIN_COL8_ACTIVE;\r
+               else color = WIN_COL8_INACTIVE;\r
+       } else if(system.data.info.vesa.BitsPerPixel == 16){\r
+               if(active) color = WIN_COL16_ACTIVE;\r
+               else color = WIN_COL16_INACTIVE;\r
+       } else if(system.data.info.vesa.BitsPerPixel == 32){\r
+               if(active) color = WIN_COL32_ACTIVE;\r
+               else color = WIN_COL32_INACTIVE;\r
+       }\r
+\r
+       boxfill_i(winfo->buf, winfo->winxsize, color, 0, 0, winfo->winxsize, 24);       \r
+       boxfill_i(winfo->buf, winfo->winxsize, color, 0, 0, 4, winfo->winysize);\r
+       boxfill_i(winfo->buf, winfo->winxsize, color, winfo->winxsize - 4, 0, winfo->winxsize, winfo->winysize);\r
+       boxfill_i(winfo->buf, winfo->winxsize, color, 0, winfo->winysize - 4, winfo->winxsize, winfo->winysize);\r
+\r
+\r
+       line_i(winfo->buf, winfo->winxsize, 0, 0, winfo->winxsize - 1, 0, 0xFFFFFF);\r
+       line_i(winfo->buf, winfo->winxsize, 0, 0, 0, winfo->winysize - 1, 0xFFFFFF);\r
+       line_i(winfo->buf, winfo->winxsize, winfo->winxsize - 1, 0, winfo->winxsize - 1, winfo->winysize - 1, 0x000000);\r
+       line_i(winfo->buf, winfo->winxsize, 0, winfo->winysize - 1, winfo->winxsize - 1, winfo->winysize - 1, 0x000000);\r
+\r
+       putfonts_asc_sht_i(winfo->win, 4, 4, 0xFFFFFF, color, winfo->title);\r
+\r
+       for(y = 0; y < 16; y++){\r
+               for(x = 0; x < 40; x++){\r
+                       c = closebtn[y][x];\r
+                       if(c == '@')            color = 0xFF0000;\r
+                       else if(c == '$')       color = 0xFF0000;\r
+                       else if(c == 'Q')       color = 0xFF0000;\r
+                       else if(c == 'J')       color = 0xFFFFFF;\r
+                       else if(c == 'O')       color = 0xFFFFFF;\r
+                       point_i(winfo->buf, winfo->winxsize - 44 + x, y, color, winfo->winxsize);\r
+               }\r
+       }\r
+       refresh_window(winfo);\r
+       return;\r
+}\r
+\r
+void change_window_title(UI_Window *winfo, uchar *title)\r
+{\r
+       change_window(winfo, title, winfo->active);\r
+}\r
+\r
+void change_window_active(UI_Window *winfo, bool active)\r
+{\r
+       change_window(winfo, winfo->title, active);\r
+}\r
+\r
+void slide_window(UI_Window *winfo, int px, int py)\r
+{\r
+       winfo->position.x = px;\r
+       winfo->position.y = py;\r
+\r
+       sheet_slide(winfo->win, winfo->position.x, winfo->position.y);\r
+       return;\r
+}\r
+\r
+void refresh_window(UI_Window *winfo)\r
+{\r
+       sheet_refresh_full(winfo->win);\r
+       return;\r
+}\r
+\r
+void refresh_window_alpha(UI_Window *winfo)\r
+{\r
+       sheet_refresh_full_alpha(winfo->win);\r
+       return;\r
+}\r
+\r
+void boxfill_win(UI_Window *winfo, uint c, int x0, int y0, int x1, int y1)\r
+{\r
+       if(x0 < 0 || y0 < 0 || x1 > winfo->xsize || y1 > winfo->ysize) goto err;\r
+\r
+       boxfill_i(winfo->buf, winfo->winxsize, c, winfo->origin.x + x0, winfo->origin.y + y0, winfo->origin.x + x1, winfo->origin.y + y1);\r
+       sheet_refresh(winfo->win, x0 + winfo->origin.x, y0 + winfo->origin.y, x1 + winfo->origin.x, y1 + winfo->origin.y);\r
+err:\r
+       return;\r
+}\r
+\r
+void point_win(UI_Window *winfo, uint c, int x, int y)\r
+{\r
+       point_i(winfo->buf, x + winfo->origin.x, y + winfo->origin.y, c, winfo->winxsize);\r
+       return;\r
+}\r
+\r
+void putfonts_win(UI_Window *winfo, int x, int y, uint c, uint bc, const uchar *s)\r
+{\r
+       if(x < 0 || y < 0 || x > winfo->xsize || y > winfo->ysize) goto err;\r
+       putfonts_asc_sht_i(winfo->win, x + winfo->origin.x, y + winfo->origin.y, c, bc, s);\r
+err:\r
+       return;\r
+}\r
+\r
+void putfonts_win_no_bc(UI_Window *winfo, int x, int y, uint c, const uchar *s)\r
+{\r
+       if(x < 0 || y < 0 || x > winfo->xsize || y > winfo->ysize) goto err;\r
+       putfonts_asc_sht_i_no_bc(winfo->win, x + winfo->origin.x, y + winfo->origin.y, c, s);\r
+err:\r
+       return;\r
+}\r
+\r
+void scrool_win(UI_Window *winfo)\r
+{\r
+       if(system.data.info.vesa.BitsPerPixel == 8) scrool_win_8(winfo, winfo->buf);\r
+       else if(system.data.info.vesa.BitsPerPixel == 16) scrool_win_16(winfo, winfo->buf);\r
+       else if(system.data.info.vesa.BitsPerPixel == 32) scrool_win_32(winfo, winfo->buf);\r
+       boxfill_win(winfo, 0x000000, 0, winfo->ysize - 16, winfo->xsize, winfo->ysize);\r
+       return;\r
+}\r
+\r
+void scrool_win_32(UI_Window *winfo, uint *vram)\r
+{\r
+       int x, y;\r
+       for (y = winfo->origin.y; y < winfo->ysize + winfo->origin.y - 16; y++) {\r
+               for (x = winfo->origin.x; x < winfo->xsize + winfo->origin.x; x++) {\r
+                       vram[x + y * winfo->winxsize] = vram[x + (y + 16) * winfo->winxsize];\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void scrool_win_16(UI_Window *winfo, ushort *vram)\r
+{\r
+       int x, y;\r
+\r
+       for (y = winfo->origin.y; y < winfo->ysize + winfo->origin.y - 16; y++) {\r
+               for (x = winfo->origin.x; x < winfo->xsize + winfo->origin.x; x++) {\r
+                       vram[x + y * winfo->winxsize] = vram[x + (y + 16) * winfo->winxsize];\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void scrool_win_8(UI_Window *winfo, uchar *vram)\r
+{\r
+       int x, y;\r
+\r
+       for (y = winfo->origin.y; y < winfo->ysize + winfo->origin.y - 16; y++) {\r
+               for (x = winfo->origin.x; x < winfo->xsize + winfo->origin.x; x++) {\r
+                       vram[x + y * winfo->winxsize] = vram[x + (y + 16) * winfo->winxsize];\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void line_win(UI_Window *winfo, int x0, int y0, int x1, int y1, uint c)\r
+{\r
+       line_i(winfo->buf, winfo->winxsize, x0 + winfo->origin.x, y0 + winfo->origin.y, x1 + winfo->origin.x, y1 + winfo->origin.y, c);\r
+       return;\r
+}\r
+\r
+void draw_hexagon_win(UI_Window *winfo, int a, int x, int y, uint c)\r
+{\r
+       draw_hexagon_i(winfo->buf, winfo->winxsize, a, x + winfo->origin.x, y + winfo->origin.y, c);\r
+       return;\r
+}\r
+\r
+\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/Makefile
new file mode 100644 (file)
index 0000000..0af495e
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = crack1\r
+STACK    = 1k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/crack1.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/crack1.c
new file mode 100644 (file)
index 0000000..10b294d
--- /dev/null
@@ -0,0 +1,7 @@
+#include <apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       *((char *)0x00102600) = 0;\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack1/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/Makefile
new file mode 100644 (file)
index 0000000..2d5f1e6
--- /dev/null
@@ -0,0 +1,15 @@
+#\83A\83Z\83\93\83u\83\89\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = crack2\r
+STACK    = 1k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/crack2.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/crack2.nas
new file mode 100644 (file)
index 0000000..d784e76
--- /dev/null
@@ -0,0 +1,14 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       EXTERN  _api_end\r
+[FILE "crack1.ca"]\r
+[SECTION .text]\r
+       GLOBAL  _CHNMain\r
+_CHNMain:\r
+       MOV     EAX,1*8\r
+       MOV     DS,AX\r
+       MOV     BYTE [0x102600],0\r
+       JMP     _api_end\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack2/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/Makefile
new file mode 100644 (file)
index 0000000..14ee343
--- /dev/null
@@ -0,0 +1,15 @@
+#\83A\83Z\83\93\83u\83\89\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = crack3\r
+STACK    = 1k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/crack3.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/crack3.nas
new file mode 100644 (file)
index 0000000..cb591dd
--- /dev/null
@@ -0,0 +1,17 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       EXTERN  _api_end\r
+[FILE "crack1.ca"]\r
+[SECTION .text]\r
+       GLOBAL  _CHNMain\r
+_CHNMain:\r
+       MOV     AL, 0x34\r
+       OUT     0x43,AL\r
+       MOV     AL, 0xFF\r
+       OUT     0x40,AL\r
+       MOV     AL, 0xFF\r
+       OUT     0x40,AL\r
+       JMP     _api_end\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack3/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/Makefile
new file mode 100644 (file)
index 0000000..a7d4a85
--- /dev/null
@@ -0,0 +1,15 @@
+#\83A\83Z\83\93\83u\83\89\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = crack4\r
+STACK    = 1k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/crack4.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/crack4.nas
new file mode 100644 (file)
index 0000000..750c9e1
--- /dev/null
@@ -0,0 +1,13 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+[FILE "crack4.ca"]\r
+[SECTION .text]\r
+       GLOBAL  _CHNMain\r
+_CHNMain:\r
+       CLI\r
+fin:\r
+       HLT\r
+       JMP     fin\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/crack4/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/Makefile
new file mode 100644 (file)
index 0000000..0b8de9f
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = hello\r
+STACK    = 1k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/hello.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/hello.c
new file mode 100644 (file)
index 0000000..e0af5a4
--- /dev/null
@@ -0,0 +1,7 @@
+#include<apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       api_putstr("Hello World\n");\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/hello/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/Makefile
new file mode 100644 (file)
index 0000000..402fbd7
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = lines\r
+STACK    = 8k\r
+MALLOC   = 40k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/lines.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/lines.c
new file mode 100644 (file)
index 0000000..00880ee
--- /dev/null
@@ -0,0 +1,23 @@
+#include <apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       uchar *buf;\r
+       uint winID;\r
+       int i;\r
+\r
+       api_initmalloc();\r
+       buf = api_malloc(160 * 100);\r
+       winID = api_openwin(buf, 160, 100, -1, "lines");\r
+       for(i = 0; i < 8; i++){\r
+               api_linewin(winID + 1, 8, 26, 77, i * 9 + 26, i);\r
+               api_linewin(winID + 1, 88, 26, i * 9 + 88, 89, i);\r
+       }\r
+       api_refreshwin(winID, 6, 26, 154, 90);\r
+       for(;;){\r
+               if(api_getkey(true) == 0x0a) break;\r
+       }\r
+       api_closewin(winID);\r
+       api_end();\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/lines/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/make.bat
new file mode 100644 (file)
index 0000000..e489766
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/Makefile
new file mode 100644 (file)
index 0000000..532faab
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = star1\r
+STACK    = 1k\r
+MALLOC   = 40k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/star1.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/star1/star1.c
new file mode 100644 (file)
index 0000000..01b2bd0
--- /dev/null
@@ -0,0 +1,18 @@
+#include <apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       uchar *buf;\r
+       uint winID;\r
+\r
+       api_initmalloc();\r
+       buf = api_malloc(150 * 100);\r
+       winID = api_openwin(buf, 150, 100, -1, "star1");\r
+       api_boxfilwin(winID, 6, 26, 143, 93, black);\r
+       api_point(winID, 75, 59, yellow);\r
+       for(;;){\r
+               if(api_getkey(true) == 0x0a) break;\r
+       }\r
+       api_end();\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/Makefile
new file mode 100644 (file)
index 0000000..a887ec1
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = stars\r
+STACK    = 1k\r
+MALLOC   = 40k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/stars.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/stars/stars.c
new file mode 100644 (file)
index 0000000..6a3e988
--- /dev/null
@@ -0,0 +1,24 @@
+#include <apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       uchar *buf;\r
+       uint winID;\r
+       int i, x, y;\r
+\r
+       api_initmalloc();\r
+       buf = api_malloc(150*100);\r
+       winID = api_openwin(buf, 150, 100, -1, "stars");\r
+       api_boxfilwin(winID + 1, 6, 26, 143, 93, black);\r
+       for(i = 0; i < 50; i++){\r
+               x = (rand() % 137) + 6;\r
+               y = (rand() % 67) + 26;\r
+               api_point(winID + 1, x, y, yellow);\r
+       }\r
+       api_refreshwin(winID, 6, 26, 144, 94);\r
+       for(;;){\r
+               if(api_getkey(true) == 0x0a) break;\r
+       }\r
+       api_end();\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/Makefile
new file mode 100644 (file)
index 0000000..a9144d4
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = walk\r
+STACK    = 1k\r
+MALLOC   = 40k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/walk.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/walk/walk.c
new file mode 100644 (file)
index 0000000..a3d8355
--- /dev/null
@@ -0,0 +1,26 @@
+#include <apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       uchar *buf;\r
+       int win, i, x, y;\r
+       api_initmalloc();\r
+       buf = api_malloc(160 * 100);\r
+       win = api_openwin(buf, 160, 100, -1, "walk");\r
+       api_boxfilwin(win, 4, 24, 155, 95, black);\r
+       x = 76;\r
+       y = 56;\r
+       api_putstrwin(win, x, y, yellow, 1, "*");\r
+       for (;;) {\r
+               i = api_getkey(true);\r
+               api_putstrwin(win, x, y, black, 1, "*");\r
+               if (i == '4' && x >   4) { x -= 8; }\r
+               if (i == '6' && x < 148) { x += 8; }\r
+               if (i == '8' && y >  24) { y -= 8; }\r
+               if (i == '2' && y <  80) { y += 8; }\r
+               if (i == 0x0a) { break; }\r
+               api_putstrwin(win, x, y, yellow, 1, "*");\r
+       }       \r
+       api_closewin(win);\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/Makefile
new file mode 100644 (file)
index 0000000..409db59
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = winhelo\r
+STACK    = 8k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/winhelo.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo/winhelo.c
new file mode 100644 (file)
index 0000000..17a811a
--- /dev/null
@@ -0,0 +1,14 @@
+#include<apilib.h>\r
+\r
+uchar win_buf[150 * 50];\r
+\r
+void CHNMain(void)\r
+{\r
+       uint winID;\r
+       \r
+       winID = api_openwin(win_buf, 150, 50, 0, "WinHello");\r
+       for(;;){\r
+               if(api_getkey(true) == 0x0a) break;\r
+       }\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/Makefile
new file mode 100644 (file)
index 0000000..c706fe8
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = winhelo2\r
+STACK    = 8k\r
+MALLOC   = 0k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/winhelo2.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo2/winhelo2.c
new file mode 100644 (file)
index 0000000..d0df5b2
--- /dev/null
@@ -0,0 +1,16 @@
+#include <apilib.h>\r
+\r
+uchar win_buf[150 * 50];\r
+\r
+void CHNMain(void)\r
+{\r
+       uint winID;\r
+       \r
+       winID = api_openwin(win_buf, 150, 50, -1, "WinHello2");\r
+       api_boxfilwin(winID, 8, 36, 141, 43, yellow);\r
+       api_putstrwin(winID, 30, 30, black, 12, "hello,world");\r
+       for(;;){\r
+               if(api_getkey(true) == 0x0a) break;\r
+       }\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/Makefile
new file mode 100644 (file)
index 0000000..893720d
--- /dev/null
@@ -0,0 +1,17 @@
+#C\8c¾\8cê\83A\83v\83\8a\97pMakefile\r
+#\83A\83v\83\8a\90Ý\92è\r
+APP      = winhelo3\r
+STACK    = 8k\r
+MALLOC   = 40k\r
+\r
+include ../app_make.txt\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.map\r
+       -$(DEL) *.bim\r
+       -$(DEL) *.ca\r
+       -$(DEL) $(APP).nas\r
+       -$(DEL) *.gas\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/winhelo3.c b/CHNOSProject/chnos/tolset_chn_000/chnos_008/winhelo3/winhelo3.c
new file mode 100644 (file)
index 0000000..d362489
--- /dev/null
@@ -0,0 +1,17 @@
+#include <apilib.h>\r
+\r
+void CHNMain(void)\r
+{\r
+       uint winID;\r
+       uchar *win_buf;\r
+\r
+       api_initmalloc();\r
+       win_buf = api_malloc(150 * 50);\r
+       winID = api_openwin(win_buf, 150, 50, 0, "WinHelo3");\r
+       api_boxfilwin(winID, 8, 36, 141, 43, yellow);\r
+       api_putstrwin(winID, 30, 30, black, 12, "hello,world");\r
+       for(;;){\r
+               if(api_getkey(true) == 0x0a) break;\r
+       }\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/!clean.bat
new file mode 100644 (file)
index 0000000..260443d
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean_full\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/!comment.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_009/!comment.txt
new file mode 100644 (file)
index 0000000..fb8ac21
--- /dev/null
@@ -0,0 +1,16 @@
+//\8aJ\94­\82Ì\93r\92\86\82Å\8bC\95t\82¢\82½\82±\82Æ\82È\82Ç\82Ì\83\81\83\82\8f\91\82«\81B\r
+//\89º\82Ì\82Ù\82¤\82ª\90V\82µ\82¢\82à\82Ì\81B\r
+#17:28 2010/12/26\r
+\82±\82Ì\83t\83@\83C\83\8b\82ð\92Ç\89Á\81B\r
+\82Ç\82¤\82â\82ç\81A\83\81\83\82\83\8a\82Ì\83T\83C\83Y\82ª\92\86\93r\94¼\92[\82¾\82Æ\83y\81[\83W\83\93\83O\82Ì\8f\89\8aú\89»\82É\8e¸\94s\82·\82é\82ç\82µ\82¢\81B\97v\91Î\8f\88\81B\r
+\r
+#8:35 2011/02/12\r
+chnos_008->chnos_009\r
+008\82Å\82â\82é\82±\82Æ\82Ì\96Ú\95W\r
+naskfunc.nas\82ð\82¢\82­\82Â\82©\82É\95ª\97£\81B\r
+nasfunc0.nas:\91¼\82Ì\8aÖ\90\94\82É\88Ë\91\82¹\82¸\81A\92P\93Æ\82Å\93®\82­\82à\82Ì\81B\r
+nasfunc1.nas:C\8c¾\8cê\82Ì\8aÖ\90\94\82É\88Ë\91\82·\82é\82à\82Ì\81B\8a\84\82è\8d\9e\82Ý\8aÖ\8cW\82Æ\82©\81B\r
+nasfunc2.nas:nasfunc0.nas\82É\88Ë\91\81BC\82Å\8f\91\82­\82Ù\82Ç\82Å\82Í\82È\82¢\82à\82Ì\82È\82Ç\81B\83r\81[\83v\82Ì\8aî\96{\90§\8cä\82Æ\82©\81B\r
+\82Æ\82è\82 \82¦\82¸\96Ú\91O\82Í\82±\82ñ\82È\8a´\82\81B\r
+\82¢\82Ü\82Íbootpack.c\82Åhlt\83\8b\81[\83v\82Å\8e~\82ß\82Ä\82¢\82é\81B\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_009/Makefile
new file mode 100644 (file)
index 0000000..5807972
--- /dev/null
@@ -0,0 +1,124 @@
+\r
+#\83A\83v\83\8a\92Ç\89Á\8e\9e\82É\8f\91\82«\91«\82·\82×\82«\89Ó\8f\8a        \r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥ 2\89Ó\8f\8a\r
+# \83R\83}\83\93\83h\r
+#  full, clan_full, src_only_full\r
+\r
+TOOLPATH = ../z_tools/\r
+INCPATH  = ../z_tools/CHNOSProject/\r
+\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+EDIMG    = $(TOOLPATH)edimg.exe\r
+IMGTOL   = $(TOOLPATH)RWFD.EXE\r
+COPY     = copy\r
+DEL      = del\r
+\r
+# \83f\83t\83H\83\8b\83g\93®\8dì\r
+\r
+default :\r
+       $(MAKE) chnos.img\r
+\r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥\r
+\r
+chnos.img : chnos/chnipl.bin chnos/chnos.sys chnos/chnipl.nas \\r
+               asmtest/asmtest.chn \\r
+               bug1/bug1.chn \\r
+               crack1/crack1.chn \\r
+               crack2/crack2.chn \\r
+               crack3/crack3.chn \\r
+               crack4/crack4.chn \\r
+               ctest/ctest.chn\r
+       $(EDIMG)   imgin:../z_tools/fdimg0at.tek \\r
+               wbinimg src:chnos/chnipl.bin len:512 from:0 to:0 \\r
+               copy from:chnos/chnos.sys to:@: \\r
+               copy from:chnos/chnipl.nas to:@: \\r
+               copy from:chnos/test.mid to:@: \\r
+               copy from:asmtest/asmtest.chn to:@: \\r
+               copy from:bug1/bug1.chn to:@: \\r
+               copy from:crack1/crack1.chn to:@: \\r
+               copy from:crack2/crack2.chn to:@: \\r
+               copy from:crack3/crack3.chn to:@: \\r
+               copy from:crack4/crack4.chn to:@: \\r
+               copy from:ctest/ctest.chn to:@: \\r
+               imgout:chnos.img\r
+\r
+# \83R\83}\83\93\83h\r
+\r
+run :\r
+       $(MAKE) chnos.img\r
+       $(COPY) chnos.img ..\z_tools\qemu\fdimage0.bin\r
+       $(MAKE) -C ../z_tools/qemu\r
+\r
+run_b :\r
+       $(MAKE) chnos.img\r
+       $(COPY) chnos.img ..\z_tools\bochs\fdimage0.bin\r
+       $(MAKE) -C ../z_tools/bochs\r
+\r
+iso :\r
+       $(MAKE) chnos.img\r
+       ..\z_tools\mkisofs.exe -v -iso-level 1 -b chnos.img -o ..\z_tools\qemu_iso\chnos.iso .\r
+\r
+run_cd :\r
+       $(MAKE) iso\r
+       $(MAKE) -C ../z_tools/qemu_iso\r
+\r
+install :\r
+       $(MAKE) chnos.img\r
+       $(IMGTOL) chnos.img a:\r
+\r
+full :\r
+       $(MAKE) -C chnos\r
+       $(MAKE) -C asmtest\r
+       $(MAKE) -C bug1\r
+       $(MAKE) -C crack1\r
+       $(MAKE) -C crack2\r
+       $(MAKE) -C crack3\r
+       $(MAKE) -C crack4\r
+       $(MAKE) -C ctest\r
+       $(MAKE) chnos.img\r
+\r
+run_full :\r
+       $(MAKE) full\r
+       $(COPY) chnos.img ..\z_tools\qemu\fdimage0.bin\r
+       $(MAKE) -C ../z_tools/qemu\r
+\r
+install_full :\r
+       $(MAKE) full\r
+       $(IMGTOL) chnos.img a:\r
+\r
+run_os :\r
+       $(MAKE) -C chnos\r
+       $(MAKE) run\r
+\r
+clean :\r
+# \89½\82à\82µ\82È\82¢\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DEL) chnos.img\r
+\r
+clean_full :\r
+       $(MAKE) -C asmtest              clean\r
+       $(MAKE) -C bug1                 clean\r
+       $(MAKE) -C crack1               clean\r
+       $(MAKE) -C crack2               clean\r
+       $(MAKE) -C crack3               clean\r
+       $(MAKE) -C crack4               clean\r
+       $(MAKE) -C ctest                clean\r
+       $(MAKE) -C chnos                clean\r
+\r
+src_only_full :\r
+       $(MAKE) -C asmtest              src_only\r
+       $(MAKE) -C bug1                 src_only\r
+       $(MAKE) -C crack1               src_only\r
+       $(MAKE) -C crack2               src_only\r
+       $(MAKE) -C crack3               src_only\r
+       $(MAKE) -C crack4               src_only\r
+       $(MAKE) -C ctest                src_only\r
+       $(MAKE) -C chnos                src_only\r
+       -$(DEL) chnos.img\r
+\r
+refresh :\r
+       $(MAKE) full\r
+       $(MAKE) clean_full\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/Makefile
new file mode 100644 (file)
index 0000000..d6d9f2f
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = asmtest\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/asmtest.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/asmtest.nas
new file mode 100644 (file)
index 0000000..7cb3d51
--- /dev/null
@@ -0,0 +1,16 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+\r
+       GLOBAL  _CHNMain\r
+\r
+[SECTION .text]\r
+\r
+_CHNMain:\r
+       mov     edx, 2\r
+       mov     ebx, msg\r
+       int     0x40\r
+       mov     edx, 4\r
+       int     0x40\r
+msg:\r
+       db      "hello", 0\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/asmtest/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/Makefile
new file mode 100644 (file)
index 0000000..252940e
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = bug1\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/bug1.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/bug1.c
new file mode 100644 (file)
index 0000000..d233e7a
--- /dev/null
@@ -0,0 +1,15 @@
+\r
+#include "../chnapi.h"\r
+\r
+void CHNMain(void)\r
+{\r
+       uchar a[100];\r
+\r
+       a[10] = 'A';\r
+       api_putchar(a[10]);\r
+       a[102] = 'B';\r
+       api_putchar(a[102]);\r
+       a[123] = 'C';\r
+       api_putchar(a[123]);\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/bug1/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi.h b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi.h
new file mode 100644 (file)
index 0000000..c249438
--- /dev/null
@@ -0,0 +1,8 @@
+\r
+typedef unsigned char uchar;\r
+typedef unsigned short ushort;\r
+typedef unsigned int uint;\r
+\r
+void api_putchar(uchar c);     //hariboteOS\8cÝ\8a·: void api_putchar(int c);\r
+void api_putstr(uchar *s);     //hariboteOS\8cÝ\8a·: void api_putstr0(char *s);\r
+void api_end(void);            //hariboteOS\8cÝ\8a·: void api_end(void);\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/Makefile
new file mode 100644 (file)
index 0000000..a8d324b
--- /dev/null
@@ -0,0 +1,5 @@
+DEL      = del\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000001_api_putchar.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000001_api_putchar.nas
new file mode 100644 (file)
index 0000000..463e160
--- /dev/null
@@ -0,0 +1,14 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_putchar\r
+\r
+[SECTION .text]\r
+\r
+_api_putchar:\r
+       mov     edx,1\r
+       mov     al,[esp+4]\r
+       int     0x40\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000002_api_putstr.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000002_api_putstr.nas
new file mode 100644 (file)
index 0000000..b95f3ba
--- /dev/null
@@ -0,0 +1,16 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_putstr\r
+\r
+[SECTION .text]\r
+\r
+_api_putstr:\r
+       push    ebx\r
+       mov     edx,2\r
+       mov     ebx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000004_api_end.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000004_api_end.nas
new file mode 100644 (file)
index 0000000..ea4e695
--- /dev/null
@@ -0,0 +1,12 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_end\r
+\r
+[SECTION .text]\r
+\r
+_api_end:\r
+       mov     edx,4\r
+       int     0x40\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000005_api_openwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000005_api_openwin.nas
new file mode 100644 (file)
index 0000000..08ee698
--- /dev/null
@@ -0,0 +1,25 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_openwin\r
+\r
+[SECTION .text]\r
+\r
+_api_openwin:\r
+;col_inv\82Í\96³\8e\8b\82³\82ê\82Ü\82·\81Bbuf\82Íunsigned char\82Ì\82Ý\8b\96\89Â\81B\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,5\r
+       mov     ebx,[esp+16]\r
+       mov     esi,[esp+20]\r
+       mov     edi,[esp+24]\r
+       mov     eax,[esp+28]\r
+       mov     ecx,[esp+32]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000006_api_putstrwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000006_api_putstrwin.nas
new file mode 100644 (file)
index 0000000..9e62052
--- /dev/null
@@ -0,0 +1,28 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_putstrwin\r
+\r
+[SECTION .text]\r
+\r
+_api_putstrwin:\r
+;len\82Í\96³\8e\8b\82³\82ê\82Ü\82·\81B\95\8e\9a\97ñ\82Í\8fI\92[\82Énull\82ð\92u\82­\82±\82Æ\81B\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,6\r
+       mov     ebx,[esp+20]\r
+       mov     esi,[esp+24]\r
+       mov     edi,[esp+28]\r
+       mov     eax,[esp+32]\r
+       mov     ecx,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000007_api_boxfilwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000007_api_boxfilwin.nas
new file mode 100644 (file)
index 0000000..0cd91c2
--- /dev/null
@@ -0,0 +1,27 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_boxfilwin\r
+\r
+[SECTION .text]\r
+\r
+_api_boxfilwin:\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,7\r
+       mov     ebx,[esp+20]\r
+       mov     eax,[esp+24]\r
+       mov     ecx,[esp+28]\r
+       mov     esi,[esp+32]\r
+       mov     edi,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000008_api_initmalloc.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000008_api_initmalloc.nas
new file mode 100644 (file)
index 0000000..3643071
--- /dev/null
@@ -0,0 +1,20 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_initmalloc\r
+\r
+[SECTION .text]\r
+\r
+_api_initmalloc:\r
+       push    ebx\r
+       mov     edx,8\r
+       mov     ebx,[cs:0x0020]\r
+       mov     eax,ebx\r
+       add     eax,32*1024\r
+       mov     ecx,[cs:0x0000]\r
+       sub     ecx,eax\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000009_api_malloc.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000009_api_malloc.nas
new file mode 100644 (file)
index 0000000..e0b33a1
--- /dev/null
@@ -0,0 +1,17 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_malloc\r
+\r
+[SECTION .text]\r
+\r
+_api_malloc:\r
+       push    ebx\r
+       mov     edx,9\r
+       mov     ebx,[cs:0x0020]\r
+       mov     ecx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000010_api_free.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000010_api_free.nas
new file mode 100644 (file)
index 0000000..c90a3fe
--- /dev/null
@@ -0,0 +1,19 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_free\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_free:\r
+       push    ebx\r
+       mov     edx,10\r
+       mov     ebx,[cs:0x0020]\r
+       mov     eax,[esp+8]\r
+       mov     ecx,[esp+12]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000011_api_point.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000011_api_point.nas
new file mode 100644 (file)
index 0000000..01dc536
--- /dev/null
@@ -0,0 +1,24 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_point\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_point:\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,11\r
+       mov     ebx,[esp+16]\r
+       mov     esi,[esp+20]\r
+       mov     edi,[esp+24]\r
+       mov     eax,[esp+28]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000012_api_refreshwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000012_api_refreshwin.nas
new file mode 100644 (file)
index 0000000..b2f4f08
--- /dev/null
@@ -0,0 +1,25 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_refreshwin\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_refreshwin:\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,12\r
+       mov     ebx,[esp+16]\r
+       mov     eax,[esp+20]\r
+       mov     ecx,[esp+24]\r
+       mov     esi,[esp+28]\r
+       mov     edi,[esp+32]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000013_api_linewin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000013_api_linewin.nas
new file mode 100644 (file)
index 0000000..0fc9ae1
--- /dev/null
@@ -0,0 +1,28 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_linewin\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_linewin:\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,13\r
+       mov     ebx,[esp+20]\r
+       mov     eax,[esp+24]\r
+       mov     ecx,[esp+28]\r
+       mov     esi,[esp+32]\r
+       mov     edi,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000014_api_closewin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000014_api_closewin.nas
new file mode 100644 (file)
index 0000000..1882dc3
--- /dev/null
@@ -0,0 +1,17 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_closewin\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_closewin:\r
+       push    ebx\r
+       mov     edx,14\r
+       mov     ebx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000015_api_getkey.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/api_00000015_api_getkey.nas
new file mode 100644 (file)
index 0000000..717f4af
--- /dev/null
@@ -0,0 +1,15 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_getkey\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_getkey:\r
+       mov     edx,15\r
+       mov     eax,[esp+4]\r
+       int     0x40\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/apilist.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/apilist.txt
new file mode 100644 (file)
index 0000000..32d85c5
--- /dev/null
@@ -0,0 +1,16 @@
+APIPATH  = ../chnapi/\r
+\r
+OBJS_API =     $(APIPATH)api_00000001_api_putchar.obj \\r
+               $(APIPATH)api_00000002_api_putstr.obj \\r
+               $(APIPATH)api_00000004_api_end.obj \\r
+               $(APIPATH)api_00000005_api_openwin.obj \\r
+               $(APIPATH)api_00000006_api_putstrwin.obj \\r
+               $(APIPATH)api_00000007_api_boxfilwin.obj \\r
+               $(APIPATH)api_00000008_api_initmalloc.obj \\r
+               $(APIPATH)api_00000009_api_malloc.obj \\r
+               $(APIPATH)api_00000010_api_free.obj \\r
+               $(APIPATH)api_00000011_api_point.obj \\r
+               $(APIPATH)api_00000012_api_refreshwin.obj \\r
+               $(APIPATH)api_00000013_api_linewin.obj \\r
+               $(APIPATH)api_00000014_api_closewin.obj \\r
+               $(APIPATH)api_00000015_api_getkey.obj 
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnapi/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnmake.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnmake.txt
new file mode 100644 (file)
index 0000000..12c721c
--- /dev/null
@@ -0,0 +1,69 @@
+# .chn\83A\83v\83\8a\97p\8b¤\92ÊMakefile\r
+\r
+# APP      = \83A\83v\83\8a\96¼\r
+\r
+# OBJS_APP = \83A\83v\83\8a\82É\95K\97v\82È\83I\83u\83W\83F\83N\83g.obj\r
+\r
+TOOLPATH = ../../z_tools/\r
+INCPATH  = ../../z_tools/CHNOSProject/\r
+\r
+include ../chnapi/apilist.txt\r
+\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+NASK     = $(TOOLPATH)nask.exe\r
+CC1      = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet\r
+BIN2OBJ  = $(TOOLPATH)bin2obj.exe\r
+GAS2NASK = $(TOOLPATH)gas2nask.exe -a\r
+OBJ2BIM  = $(TOOLPATH)obj2bim.exe\r
+BIM2CHN  = $(TOOLPATH)bim2chn.exe\r
+RULEFILE = $(INCPATH)CHNOSP.rul\r
+EDIMG    = $(TOOLPATH)edimg.exe bias:9\r
+IMGTOL   = $(TOOLPATH)RWFD.EXE\r
+MAKEFONT = $(TOOLPATH)makefont.exe\r
+COPY     = copy\r
+DEL      = del\r
+SJISCONV = $(TOOLPATH)sjisconv.exe -s\r
+\r
+# \83f\83t\83H\83\8b\83g\93®\8dì\r
+\r
+default :\r
+       $(MAKE) $(APP).chn\r
+\r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥\r
+\r
+$(APP).bim : $(OBJS_APP) $(OBJS_API) Makefile\r
+       $(OBJ2BIM) @$(RULEFILE) out:$(APP).bim map:$(APP).map $(OBJS_APP) $(OBJS_API)\r
+\r
+$(APP).chn : $(APP).bim Makefile\r
+       $(BIM2CHN) $(APP).bim $(APP).chn 0\r
+\r
+#\88ê\94Ê\8bK\91¥\r
+\r
+%.ca : %.c Makefile\r
+       $(SJISCONV) $*.c $*.ca\r
+\r
+%.gas : %.ca Makefile\r
+       $(CC1) -o $*.gas $*.ca\r
+\r
+%.nas : %.gas Makefile\r
+       $(GAS2NASK) $*.gas $*.nas\r
+\r
+%.obj : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj $*.lst\r
+\r
+\r
+\r
+# \83R\83}\83\93\83h\r
+\r
+clean :\r
+       -$(DEL) *.bin\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.gas\r
+       -$(DEL) *.obj\r
+       -$(DEL) $(APP).bim\r
+       -$(DEL) $(APP).map\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DEL) $(APP).chn\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/Makefile
new file mode 100644 (file)
index 0000000..9336704
--- /dev/null
@@ -0,0 +1,129 @@
+\r
+#OBJS_BOOTPACK = naskfunc.obj hankaku.obj gdtidt.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj init.obj intrpt.obj io.obj memory.obj paging.obj sheet.obj fifo.obj mtask.obj timer.obj keyboard.obj mouse.obj window.obj console.obj file.obj uuid.obj api.obj bootpack.obj\r
+OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj hankaku.obj api.obj console.obj cpuid.obj dsctbl.obj fifo.obj file.obj grap_08.obj grap_16.obj grap_32.obj graphic.obj init.obj inputbox.obj intrpt.obj io.obj keyboard.obj memblock.obj memory.obj mouse.obj mtask.obj paging.obj serial.obj sheet.obj timer.obj window.obj xception.obj bootpack.obj\r
+TOOLPATH = ../../z_tools/\r
+INCPATH  = ../../z_tools/CHNOSProject/\r
+\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+NASK     = $(TOOLPATH)nask.exe\r
+CC1      = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet\r
+BIN2OBJ  = $(TOOLPATH)bin2obj.exe\r
+GAS2NASK = $(TOOLPATH)gas2nask.exe -a\r
+OBJ2BIM  = $(TOOLPATH)obj2bim.exe\r
+BIM2CHN  = $(TOOLPATH)bim2chn.exe\r
+RULEFILE = $(INCPATH)CHNOSP.rul\r
+EDIMG    = $(TOOLPATH)edimg.exe bias:9\r
+IMGTOL   = $(TOOLPATH)RWFD.EXE\r
+MAKEFONT = $(TOOLPATH)makefont.exe\r
+COPY     = copy\r
+DEL      = del\r
+SJISCONV = $(TOOLPATH)sjisconv.exe -s\r
+\r
+# \83f\83t\83H\83\8b\83g\93®\8dì\r
+\r
+default :\r
+       $(MAKE) img\r
+\r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥\r
+\r
+chnipl.bin : chnipl.nas Makefile\r
+       $(NASK) chnipl.nas chnipl.bin chnipl.lst\r
+\r
+hankaku.bin : hankaku.txt Makefile\r
+       $(MAKEFONT) hankaku.txt hankaku.bin\r
+\r
+hankaku.obj : hankaku.bin Makefile\r
+       $(BIN2OBJ) hankaku.bin hankaku.obj _hankaku\r
+\r
+asmhead.bin : asmhead.nas Makefile\r
+       $(NASK) asmhead.nas asmhead.bin asmhead.lst\r
+\r
+bootpack.gas : bootpack.c Makefile\r
+       $(CC1) -o bootpack.gas bootpack.c\r
+\r
+bootpack.nas : bootpack.gas Makefile\r
+       $(GAS2NASK) bootpack.gas bootpack.nas\r
+\r
+bootpack.obj : bootpack.nas Makefile\r
+       $(NASK) bootpack.nas bootpack.obj bootpack.lst\r
+\r
+nasfunc0.obj : nasfunc0.nas Makefile\r
+       $(NASK) nasfunc0.nas nasfunc0.obj nasfunc0.lst\r
+\r
+bootpack.bim : $(OBJS_BOOTPACK) Makefile\r
+       $(OBJ2BIM) @$(RULEFILE) out:bootpack.bim stack:3136k map:bootpack.map \\r
+               $(OBJS_BOOTPACK)\r
+# 3MB+64KB=3136KB\r
+\r
+bootpack.chn : bootpack.bim Makefile\r
+       $(BIM2CHN) bootpack.bim bootpack.chn 0\r
+\r
+chnos.sys : asmhead.bin bootpack.chn Makefile\r
+       copy /B asmhead.bin+bootpack.chn chnos.sys\r
+\r
+chnos.img : chnipl.bin chnos.sys Makefile\r
+       $(EDIMG)   imgin:../../z_tools/fdimg0at.tek \\r
+               wbinimg src:chnipl.bin len:512 from:0 to:0 \\r
+               copy from:chnos.sys to:@: \\r
+               copy from:chnipl.nas to:@: \\r
+               copy from:test.mid to:@: \\r
+               imgout:chnos.img\r
+\r
+#\88ê\94Ê\8bK\91¥\r
+\r
+%.ca : %.c Makefile\r
+       $(SJISCONV) $*.c $*.ca\r
+\r
+%.gas : %.ca core.h core_set.h Makefile\r
+       $(CC1) -o $*.gas $*.ca\r
+\r
+%.nas : %.gas Makefile\r
+       $(GAS2NASK) $*.gas $*.nas\r
+\r
+%.obj : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj $*.lst\r
+\r
+\r
+\r
+# \83R\83}\83\93\83h\r
+\r
+img :\r
+       $(MAKE) chnos.img\r
+\r
+run :\r
+       $(MAKE) img\r
+       $(COPY) chnos.img ..\..\z_tools\qemu\fdimage0.bin\r
+       $(MAKE) -C ../../z_tools/qemu\r
+run_b :\r
+       $(MAKE) img\r
+       $(COPY) chnos.img ..\..\z_tools\bochs\fdimage0.bin\r
+       $(MAKE) -C ../../z_tools/bochs\r
+\r
+\r
+run_cd :\r
+       $(MAKE) iso\r
+       $(MAKE) -C ../../z_tools/qemu_iso\r
+\r
+install :\r
+       $(MAKE) img\r
+       $(IMGTOL) chnos.img a:\r
+\r
+clean :\r
+       -$(DEL) *.bin\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.gas\r
+       -$(DEL) *.obj\r
+       -$(DEL) bootpack.nas\r
+       -$(DEL) bootpack.map\r
+       -$(DEL) bootpack.bim\r
+       -$(DEL) bootpack.chn\r
+       -$(DEL) chnos.sys\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DEL) chnos.img\r
+\r
+iso :\r
+       $(MAKE)\r
+       ..\..\z_tools\mkisofs.exe -v -iso-level 1 -b chnos.img -o ..\..\z_tools\qemu_iso\chnos.iso .\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/api.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/api.c
new file mode 100644 (file)
index 0000000..952e936
--- /dev/null
@@ -0,0 +1,28 @@
+\r
+#include "core.h"\r
+\r
+uint *API_Execute(uint edi, uint esi, uint ebp, uint esp, uint ebx, uint edx, uint ecx, uint eax)\r
+{\r
+       UI_Task *nowtask;\r
+       uchar s[128];\r
+       uint i;\r
+\r
+       nowtask = MultiTask_Get_NowTask();\r
+\r
+       if(edx == 0x00000001){\r
+               InputBox_Put_Character(nowtask->cons->input, eax & 0xff);\r
+       } else if(edx == 0x00000002){\r
+               InputBox_Put_String(nowtask->cons->input, (uchar *)(ebx + System_SegmentDescriptor_Get_Base(nowtask->cons->app_ds)));\r
+       } else if(edx == 0x00000003){\r
+               for(i = 0; i < ecx; i++){\r
+                       InputBox_Put_Character(nowtask->cons->input, ((uchar *)ebx + System_SegmentDescriptor_Get_Base(nowtask->cons->app_ds))[i]);\r
+               }\r
+       } else if(edx == 0x00000004){\r
+               return &nowtask->tss.esp0;\r
+       } else{\r
+               sprintf(s, "API:0x%08X:Unknown API Function.\n", edx);\r
+               InputBox_Put_String(nowtask->cons->input, s);\r
+       }\r
+\r
+       return 0;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/asmhead.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/asmhead.nas
new file mode 100644 (file)
index 0000000..d1ed5f6
--- /dev/null
@@ -0,0 +1,888 @@
+\r
+[INSTRSET "i486p"]\r
+BOTPAK  equ             0x00280000\r
+DSKCAC  equ             0x00100000\r
+DSKCAC0 equ             0x00008000\r
+\r
+; BOOT_INFO_ADDR\r
+CYLS    equ             0x0ff0 ; uchar\r
+LEDS    equ             0x0ff1 ; uchar\r
+VMODE   equ             0x0ff2 ; uchar\r
+                               ; uchar Padding\r
+SCRNX   equ             0x0ff4 ; ushort\r
+SCRNY   equ             0x0ff6 ; ushort\r
+VRAM    equ             0x0ff8 ; uchar*\r
+VESAVER        equ             0x0ffc  ; ushort\r
+APMVER equ             0x0ffe  ; ushort\r
+ACPI_MEMMAPS   equ     0x1000  ; uint\r
+ACPI_MEMMAP    equ     0x1004  ; 0x18(24)*16=0x180(384)bytes\r
+APM_FLAGS      equ     0x1184  ; ushort\r
+\r
+; INFO_ADDR\r
+ADR_VESA_BIOS_INFO     equ     0x0d00  ;0x0d00-0x0dff\r
+ADR_VESA_MODE_INFO     equ     0x0e00  ;0x0e00-0x0eff\r
+\r
+XRESOLUTION    equ     0x12\r
+YRESOLUTION    equ     0x14\r
+BITSPERPIXEL   equ     0x19\r
+PHYSBASEPTR    equ     0x28\r
+\r
+[BITS 16]\r
+\r
+        org     0xc200\r
+asmhead:\r
+        mov     ax, 0\r
+        mov     ss, ax\r
+        mov     sp, 0xc200\r
+        mov     ds, ax\r
+        mov     es, ax\r
+\r
+       mov     ah, 0x00\r
+       mov     al, 0x03\r
+       int     0x10\r
+\r
+       lea     di, [msg000]\r
+       call    text_putstr\r
+       call    text_newline\r
+\r
+       call    a20_try_loop\r
+       call    text_newline\r
+\r
+       call    chk_acpi_memmap\r
+\r
+       call    chk_apm\r
+       call    text_newline\r
+\r
+       call    chk_vesa\r
+\r
+       call    set_vesa\r
+       call    chk_keyled\r
+\r
+        call    pmode\r
+\r
+halt_loop:\r
+       hlt\r
+       jmp     halt_loop\r
+\r
+; \83T\83u\83\8b\81[\83`\83\93\r
+\r
+chk_acpi_memmap:\r
+       pushad\r
+       mov     edi, ACPI_MEMMAP\r
+       mov     ebx, 0\r
+chk_acpi_memmap_loop:\r
+       mov     eax, 0xe820\r
+       mov     ecx, 24\r
+       mov     edx, 0x534d4150 ; edx="SMAP"\r
+       int     0x15\r
+       jc      chk_acpi_memmap_err\r
+       add     edi, 24\r
+       or      ebx, ebx\r
+       jnz     chk_acpi_memmap_loop\r
+       sub     edi, ACPI_MEMMAP\r
+       mov     eax, edi\r
+       xor     edx, edx\r
+       mov     ecx, 24\r
+       div     ecx\r
+       mov     [ACPI_MEMMAPS], eax\r
+       lea     di, [msg017]\r
+       call    text_putstr\r
+       call    text_newline\r
+       jmp     chk_acpi_memmap_end\r
+\r
+chk_acpi_memmap_err:\r
+       lea     di, [msg016]\r
+       call    text_putstr\r
+       call    text_newline\r
+       mov     dword [ACPI_MEMMAPS], 0\r
+\r
+chk_acpi_memmap_end:\r
+       popad\r
+       ret\r
+\r
+chk_keyled:\r
+       mov     ah, 0x02\r
+       int     0x16\r
+       mov     [LEDS], al\r
+       ret\r
+\r
+A20_TEST_LOOPS         equ     32\r
+A20_ENABLE_LOOPS       equ     255\r
+A20_TEST_ADDR          equ     4*0x80\r
+\r
+\r
+a20_try_loop:\r
+a20_none:\r
+       call    a20_test\r
+       jnz     a20_done\r
+a20_bios:\r
+       mov     ax, 0x2401\r
+       pushfd\r
+       int     0x15\r
+       popfd\r
+       call    a20_test\r
+       jnz     a20_done\r
+a20_kbc:\r
+       call    empty_8042\r
+       call    a20_test\r
+       jnz     a20_done\r
+       mov     al, 0xD1\r
+       out     0x64, al\r
+       call    empty_8042\r
+       mov     al, 0xDF\r
+       out     0x60, al\r
+       call    empty_8042\r
+a20_kbc_wait:\r
+       xor     cx, cx\r
+a20_kbc_wait_loop:\r
+       call    a20_test\r
+       jnz     a20_done\r
+       loop    a20_kbc_wait_loop\r
+a20_fast:\r
+       in      al, 0x92\r
+       or      al, 0x02\r
+\r
+       and     al, 0xFE\r
+       out     0x92, al\r
+a20_fast_wait:\r
+       xor     cx, cx\r
+a20_fast_wait_loop:\r
+       call    a20_test\r
+       jnz     a20_done\r
+       loop    a20_fast_wait_loop\r
+       dec     byte [a20_tries]\r
+       jnz     a20_try_loop\r
+a20_die:\r
+       lea     di, [msg014]\r
+       call    text_putstr\r
+       jmp     halt_loop\r
+\r
+a20_tries:\r
+       db      A20_ENABLE_LOOPS\r
+\r
+a20_done:\r
+       lea     di, [msg015]\r
+       call    text_putstr\r
+       ret\r
+\r
+a20_test:\r
+       push    cx\r
+       push    ax\r
+       xor     cx, cx\r
+       mov     fs, cx\r
+       dec     cx\r
+       mov     gs, cx\r
+       mov     cx, A20_TEST_LOOPS\r
+       mov     ax, word [fs:A20_TEST_ADDR]\r
+       push    ax\r
+a20_test_wait:\r
+       inc     ax\r
+       mov     word [fs:A20_TEST_ADDR], ax\r
+       call    delay\r
+       cmp     ax, word [gs:A20_TEST_ADDR + 0x10]\r
+       loop    a20_test_wait\r
+\r
+       pop     word [fs:A20_TEST_ADDR]\r
+       pop     ax\r
+       pop     cx\r
+       ret\r
+\r
+empty_8042:\r
+       push    ecx\r
+       mov     ecx, 100000\r
+\r
+empty_8042_loop:\r
+       dec     ecx\r
+       jz      empty_8042_end_loop\r
+\r
+       call    delay\r
+\r
+       in      al, 0x64\r
+       test    al, 1                   \r
+       jz      no_output\r
+\r
+       call    delay\r
+;      in      al, 0x60\r
+\r
+       jmp     empty_8042_loop\r
+\r
+no_output:\r
+       test    al, 2\r
+       jnz     empty_8042_loop\r
+\r
+empty_8042_end_loop:\r
+       pop     ecx\r
+       ret\r
+\r
+delay:\r
+       out     0x80, al\r
+       ret\r
+\r
+set_vesa:      ; cx\82É\83\82\81[\83h\94Ô\8d\86\82ð\95Û\91¶ bx\82É\95\8e\9a\90\94\82ð\95Û\91\r
+       pusha\r
+set_vesa_start:\r
+       call    text_newline\r
+       lea     di, [msg007]\r
+       call    text_putstr\r
+       lea     di, [msg008]\r
+       call    text_putstr\r
+       lea     di, [msg009]\r
+       call    text_putstr\r
+       mov     bx, 0x0000\r
+       mov     cx, 0x0000\r
+set_vesa_key_loop:\r
+       mov     ah, 0x00\r
+       int     0x16\r
+       cmp     ah, 0x0e\r
+       je      set_vesa_key_bs\r
+       jmp     set_vesa_key_chk\r
+set_vesa_key_bs:\r
+       cmp     bx, 0\r
+       je      set_vesa_key_loop\r
+       mov     al, 0x08\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       mov     al, ' '\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       mov     al, 0x08\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       dec     bx\r
+       shr     cx, 4\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk:\r
+       cmp     bx, 4\r
+       je      set_vesa_key_chk_ent\r
+       cmp     ah, 0x0b\r
+       je      set_vesa_key_chk_0\r
+       cmp     ah, 0x02\r
+       je      set_vesa_key_chk_1\r
+       cmp     ah, 0x03\r
+       je      set_vesa_key_chk_2\r
+       cmp     ah, 0x04\r
+       je      set_vesa_key_chk_3\r
+       cmp     ah, 0x05\r
+       je      set_vesa_key_chk_4\r
+       cmp     ah, 0x06\r
+       je      set_vesa_key_chk_5\r
+       cmp     ah, 0x07\r
+       je      set_vesa_key_chk_6\r
+       cmp     ah, 0x08\r
+       je      set_vesa_key_chk_7\r
+       cmp     ah, 0x09\r
+       je      set_vesa_key_chk_8\r
+       cmp     ah, 0x0a\r
+       je      set_vesa_key_chk_9\r
+       cmp     ah, 0x1e\r
+       je      set_vesa_key_chk_A\r
+       cmp     ah, 0x30\r
+       je      set_vesa_key_chk_B\r
+       cmp     ah, 0x2e\r
+       je      set_vesa_key_chk_C\r
+       cmp     ah, 0x20\r
+       je      set_vesa_key_chk_D\r
+       cmp     ah, 0x12\r
+       je      set_vesa_key_chk_E\r
+       cmp     ah, 0x21\r
+       je      set_vesa_key_chk_F\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_0:\r
+       mov     al, '0'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x00\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_1:\r
+       mov     al, '1'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x01\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_2:\r
+       mov     al, '2'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x02\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_3:\r
+       mov     al, '3'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x03\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_4:\r
+       mov     al, '4'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x04\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_5:\r
+       mov     al, '5'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x05\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_6:\r
+       mov     al, '6'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x06\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_7:\r
+       mov     al, '7'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x07\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_8:\r
+       mov     al, '8'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x08\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_9:\r
+       mov     al, '9'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x09\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_A:\r
+       mov     al, 'A'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x0a\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_B:\r
+       mov     al, 'B'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x0b\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_C:\r
+       mov     al, 'C'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x0c\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_D:\r
+       mov     al, 'D'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x0d\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_E:\r
+       mov     al, 'E'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x0e\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_F:\r
+       mov     al, 'F'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       inc     bx\r
+       shl     cx, 4\r
+       add     cx, 0x0f\r
+       jmp     set_vesa_key_loop\r
+set_vesa_key_chk_ent:\r
+       cmp     ah, 0x1c\r
+       jne     set_vesa_key_loop\r
+       call    text_newline\r
+       jmp     set_vesa_key_end\r
+set_vesa_key_end:\r
+       lea     di, [msg010]\r
+       call    text_putstr\r
+       mov     ax, cx\r
+       call    text_puthex_str_16\r
+       call    text_newline\r
+\r
+       cmp     cx, 0x0000\r
+       je      set_VGA\r
+\r
+       mov     ax, 0x4f01\r
+       mov     di, ADR_VESA_MODE_INFO\r
+       int     0x10\r
+       cmp     al, 0x4f\r
+       jne     set_vesa_nosup\r
+       cmp     ah, 0\r
+       jne     set_vesa_func_err\r
+\r
+       lea     di, [msg012]\r
+       call    text_putstr\r
+\r
+       mov     ax, 0x0000\r
+       mov     al, [ADR_VESA_MODE_INFO + BITSPERPIXEL]\r
+       call    hex2bcd_16\r
+       call    text_puthex_str_08_no_0x\r
+\r
+       mov     al, '('\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       mov     ax, [ADR_VESA_MODE_INFO + XRESOLUTION]\r
+       call    hex2bcd_16\r
+       call    text_puthex_str_16_no_0x\r
+       mov     al, 'x'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       mov     ax, [ADR_VESA_MODE_INFO + YRESOLUTION]\r
+       call    hex2bcd_16\r
+       call    text_puthex_str_16_no_0x\r
+       mov     al, ')'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       call    text_newline\r
+\r
+       lea     di, [msg013]\r
+       call    text_putstr\r
+set_vesa_key_YN:\r
+       mov     ah, 0x00\r
+       int     0x16\r
+       cmp     ah, 0x15\r
+       je      set_vesa_key_Y\r
+       cmp     ah, 0x31\r
+       je      set_vesa_key_N\r
+\r
+set_vesa_key_N:\r
+       mov     al, 'N'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       call    text_newline\r
+       jmp     set_vesa_start\r
+set_vesa_key_Y:\r
+       mov     al, 'Y'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       call    text_newline\r
+\r
+       mov     ax, 0x4f02\r
+       mov     bx, cx\r
+       or      bx, 0x4000\r
+       int     0x10\r
+       cmp     al, 0x4f\r
+       jne     set_vesa_nosup\r
+       cmp     ah, 0\r
+       jne     set_vesa_func_err\r
+\r
+       mov     ax, [ADR_VESA_MODE_INFO + XRESOLUTION]\r
+       mov     [SCRNX], ax\r
+       mov     ax, [ADR_VESA_MODE_INFO + YRESOLUTION]\r
+       mov     [SCRNY], ax\r
+       mov     al, [ADR_VESA_MODE_INFO + BITSPERPIXEL]\r
+       mov     [VMODE], al\r
+       mov     eax, [ADR_VESA_MODE_INFO + PHYSBASEPTR]\r
+       mov     [VRAM], eax\r
+\r
+       jmp     set_vesa_end\r
+set_vesa_nosup:\r
+       lea     di, [msg001]\r
+       call    text_putstr\r
+       lea     di, [msg003]\r
+       call    text_putstr\r
+       jmp     set_vesa_start\r
+set_vesa_func_err:\r
+       lea     di, [msg001]\r
+       call    text_putstr\r
+       lea     di, [msg011]\r
+       call    text_putstr\r
+       jmp     set_vesa_start\r
+set_VGA:\r
+       mov     ah, 0x00\r
+       mov     al, 0x13\r
+       int     0x10\r
+       mov     byte [VMODE], 8\r
+       mov     word [SCRNX], 320\r
+       mov     word [SCRNY], 200\r
+       mov     dword [VRAM], 0xa0000\r
+       mov     word [ADR_VESA_MODE_INFO + XRESOLUTION], 320\r
+       mov     word [ADR_VESA_MODE_INFO + YRESOLUTION], 200\r
+       mov     byte [ADR_VESA_MODE_INFO + BITSPERPIXEL], 8\r
+       mov     dword [ADR_VESA_MODE_INFO + PHYSBASEPTR], 0xa0000\r
+set_vesa_end:\r
+       popa\r
+       ret\r
+\r
+chk_apm:\r
+       pusha\r
+       lea     di, [msg006]\r
+       call    text_putstr\r
+       lea     di, [msg002]\r
+       call    text_putstr\r
+\r
+       mov     ax, 0x5300\r
+       mov     bx, 0x0000\r
+       pusha\r
+       int     0x15\r
+       jc      chk_apm_err_nosup\r
+       mov     [APMVER], ax\r
+       mov     [APM_FLAGS], cx\r
+       popa\r
+\r
+       lea     di, [msg004]\r
+       call    text_putstr\r
+       mov     ax, [APMVER]\r
+       shr     ax, 8\r
+       call    text_puthex_char\r
+       mov     al, '.'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       mov     ax, [APMVER]\r
+       shr     ax, 4\r
+       call    text_puthex_char\r
+       mov     ax, [APMVER]\r
+       call    text_puthex_char\r
+       jmp     chk_apm_end\r
+\r
+chk_apm_err_nosup:\r
+       mov     word [APMVER], 0x0000\r
+       mov     word [APM_FLAGS], 0x0000\r
+       lea     di, [msg006]\r
+       call    text_putstr\r
+       lea     di, [msg003]\r
+       call    text_putstr\r
+chk_apm_end:\r
+       popa\r
+       ret\r
+\r
+chk_vesa:\r
+       pusha\r
+       lea     di, [msg001]\r
+       call    text_putstr\r
+       lea     di, [msg002]\r
+       call    text_putstr\r
+\r
+       mov     ax, 0x4f00\r
+       mov     di, ADR_VESA_BIOS_INFO\r
+       int     0x10\r
+       cmp     al, 0x4f\r
+       jne     chk_vesa_err_nosup\r
+       lea     di, [msg004]\r
+       call    text_putstr\r
+       mov     ax, [ADR_VESA_BIOS_INFO + 0x04]\r
+       mov     [VESAVER], ax\r
+       shr     ax, 8\r
+       call    text_puthex_char\r
+       mov     al, '.'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       mov     ax, [ADR_VESA_BIOS_INFO + 0x04]\r
+       shr     ax, 4\r
+       call    text_puthex_char\r
+       mov     ax, [ADR_VESA_BIOS_INFO + 0x04]\r
+       call    text_puthex_char\r
+\r
+       call    text_newline\r
+\r
+       mov     ax, [ADR_VESA_BIOS_INFO + 0x06 + 0x02]\r
+       mov     di, [ADR_VESA_BIOS_INFO + 0x06]\r
+       mov     bx, es\r
+       mov     es, ax\r
+       call    text_putstr\r
+       mov     es, bx\r
+\r
+       call    text_newline\r
+\r
+       lea     di, [msg005]\r
+       call    text_putstr\r
+\r
+       mov     ax, [ADR_VESA_BIOS_INFO + 0x0e + 0x02]\r
+       mov     di, [ADR_VESA_BIOS_INFO + 0x0e]\r
+       mov     bx, es\r
+       mov     es, ax\r
+chk_vesa_vmode_array_loop:\r
+       mov     ax, [es:di]\r
+       cmp     ax, 0xffff\r
+       je      chk_vesa_vmode_array_end\r
+       mov     cx, ax\r
+\r
+       mov     al, '['\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+\r
+       mov     ax, cx\r
+       call    text_puthex_str_16\r
+\r
+       mov     al, ']'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+\r
+       add     di, 2\r
+       jmp     chk_vesa_vmode_array_loop\r
+chk_vesa_vmode_array_end:\r
+       mov     es, bx\r
+       jmp     chk_vesa_end\r
+chk_vesa_err_nosup:\r
+       mov     word [VESAVER], 0x0000\r
+       lea     di, [msg001]\r
+       call    text_putstr\r
+       lea     di, [msg003]\r
+       call    text_putstr\r
+       jmp     chk_vesa_end\r
+chk_vesa_end:\r
+       call    text_newline\r
+       popa\r
+       ret\r
+\r
+hex2bcd_16:    ;ax\82ðBCD\82É\95Ï\8a·\81B\8dÅ\91å9999\82Ü\82Å\81Bcx\82É\90Vax\82ð\95Û\91\r
+       push    cx\r
+       push    bx\r
+       push    dx\r
+       and     eax, 0x0000ffff\r
+       mov     cx, 0x000000\r
+\r
+       mov     dx, 0x0000\r
+       mov     bx, 1000\r
+       div     bx\r
+       shl     ax, 12\r
+       or      cx, ax\r
+\r
+       mov     ax, dx\r
+       mov     dx, 0x0000\r
+       mov     bx, 100\r
+       div     bx\r
+       shl     ax, 8\r
+       or      cx, ax\r
+\r
+       mov     ax, dx\r
+       mov     dx, 0x0000\r
+       mov     bx, 10\r
+       div     bx\r
+       shl     ax, 4\r
+       or      cx, ax\r
+\r
+       or      cx, dx\r
+\r
+       mov     ax, cx\r
+\r
+       pop     dx\r
+       pop     bx\r
+       pop     cx\r
+       ret\r
+\r
+text_puthex_str_16:    ; ax\82ð\8fo\97Í\81B0x\82Ì\95t\89Á\82 \82è\81B\r
+       push    ax\r
+       push    cx\r
+       mov     cx, ax\r
+       mov     ah, 0x0e\r
+       mov     al, '0'\r
+       int     0x10\r
+       mov     al, 'x'\r
+       int     0x10\r
+       mov     ax, cx\r
+       shr     ax, 12\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       shr     ax, 8\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       shr     ax, 4\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       call    text_puthex_char\r
+       pop     cx\r
+       pop     ax\r
+       ret\r
+\r
+text_puthex_str_16_no_0x:      ; ax\82ð\8fo\97Í\81B0x\82Ì\95t\89Á\82È\82µ\81BBCD\95\\8e¦\97p\r
+       push    ax\r
+       push    cx\r
+       mov     cx, ax\r
+       shr     ax, 12\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       shr     ax, 8\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       shr     ax, 4\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       call    text_puthex_char\r
+       pop     cx\r
+       pop     ax\r
+       ret\r
+\r
+text_puthex_str_08_no_0x:      ; al\82ð\8fo\97Í\81B0x\82Ì\95t\89Á\82È\82µ\81BBCD\95\\8e¦\97p\r
+       push    ax\r
+       push    cx\r
+       mov     cx, ax\r
+       shr     al, 4\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       call    text_puthex_char\r
+       pop     cx\r
+       pop     ax\r
+       ret\r
+\r
+text_puthex_char:      ; al\82Ì\89º\88Ê4bit\95ª\8fo\97Í\81B0x\82Ì\95t\89Á\82Í\82È\82µ\81B\r
+       pusha\r
+       and     al, 0x0f\r
+       cmp     al, 9\r
+       ja      text_puthex_char_alphabet\r
+       add     al, 0x30\r
+       jmp     text_puthex_char_end\r
+text_puthex_char_alphabet:\r
+       add     al, 0x37\r
+text_puthex_char_end:\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       popa\r
+       ret\r
+\r
+text_putstr:   ; di=char*\r
+       pusha\r
+       mov     cx, 0\r
+       mov     ah, 0x0e\r
+text_putstr_loop:\r
+       mov     al, [es:di]\r
+       cmp     al, 0\r
+       je      text_putstr_end\r
+       inc     di\r
+       int     0x10\r
+       jmp     text_putstr_loop\r
+text_putstr_end:\r
+       popa\r
+       ret\r
+\r
+text_newline:\r
+       pusha\r
+       mov     ah, 0x0e\r
+       mov     al, 0x0d\r
+       int     0x10\r
+       mov     al, 0x0a\r
+       int     0x10\r
+       popa\r
+       ret\r
+\r
+; \88È\89º\81A\83v\83\8d\83e\83N\83g\83\82\81[\83h\88Ú\8ds\81Abootpack\8eÀ\8ds\8aÖ\90\94\8cQ\r
+\r
+pmode:\r
+       mov     al, 0xff\r
+       out     0x21, al        ; pic0-imr = 11111111\r
+       nop\r
+       out     0xa1, al        ; pic1-imr = 11111111\r
+       cli\r
+\r
+       lgdt    [GDTR0]\r
+\r
+       mov     eax, cr0\r
+       and     eax, 0x7fffffff ; PG = 0\r
+       or      eax, 0x00000001 ; PE = 1\r
+       mov     cr0, eax\r
+\r
+       jmp     pipelineflush\r
+pipelineflush:\r
+\r
+       mov     ax, 1 * 8\r
+       mov     ds, ax\r
+       mov     es, ax\r
+       mov     fs, ax\r
+       mov     gs, ax\r
+       mov     ss, ax\r
+\r
+       mov     esi, bootpack\r
+       mov     edi, BOTPAK\r
+       mov     ecx, 512 * 1024 / 4\r
+       call    memcpy\r
+\r
+       mov     esi, 0x7c00\r
+       mov     edi, DSKCAC\r
+       mov     ecx, 512 / 4\r
+       call    memcpy\r
+\r
+       mov     esi, DSKCAC0 + 512\r
+       mov     edi, DSKCAC + 512\r
+       mov     ecx, 0\r
+       mov     cl, byte[CYLS]\r
+       imul    ecx, 512 * 18 * 2 / 4\r
+       sub     ecx, 512 / 4\r
+       call    memcpy\r
+\r
+       mov     ebx, BOTPAK\r
+       mov     ecx, [ebx + 16]\r
+       add     ecx, 3\r
+       shr     ecx, 2\r
+       jz      skip\r
+       mov     esi, [ebx + 20]\r
+       add     esi, ebx\r
+       mov     edi, [ebx + 12]\r
+       call    memcpy\r
+\r
+skip:\r
+       mov     esp, [ebx + 12]\r
+       jmp     dword 2 * 8:0x0000001b\r
+\r
+memcpy:\r
+        mov     eax,[esi]\r
+        add     esi,4\r
+        mov     [edi],eax\r
+        add     edi,4\r
+        sub     ecx,1\r
+        jnz     memcpy\r
+        ret\r
+\r
+; \83f\81[\83^\r
+\r
+msg000:        db      "CHNOSProject Boot Menu...", 0x0d, 0x0a, 0x00\r
+msg001:        db      "VESA BIOS Extention ", 0x00\r
+msg002:        db      "Checking...", 0x0d, 0x0a, 0x00\r
+msg003:        db      "is not supported by this computer.", 0x0d, 0x0a, 0x00\r
+msg004:        db      "Version:", 0x00\r
+msg005:        db      "Video Mode Numbers...", 0x0d, 0x0a, 0x00\r
+msg006:        db      "Advanced Power Management BIOS ", 0x00\r
+msg007:        db      "Please select the Video Mode Number.", 0x0d, 0x0a, 0x00\r
+msg008:        db      "VGA mode is 0x0000.", 0x0d, 0x0a, 0x00\r
+msg009:        db      ">0x", 0x00\r
+msg010:        db      "ModeInfo:", 0x00\r
+msg011:        db      "Function Error...", 0x0d, 0x0a, 0x00\r
+msg012:        db      "bpp:", 0x00\r
+msg013:        db      "Do you want to start in this screen mode?[Y/N]", 0x0d, 0x0a, ">", 0x00\r
+msg014:        db      "A20GateLine Failed.", 0x0d, 0x0a, 0x00\r
+msg015:        db      "A20GateLine Passed.", 0x0d, 0x0a, 0x00\r
+msg016:        db      "ACPI 0xe820 Failed.", 0x0d, 0x0a, 0x00\r
+msg017:        db      "ACPI 0xe820 Passed.", 0x0d, 0x0a, 0x00\r
+\r
+GDTR0:\r
+       dw      8 * 3 - 1       ; GDT\83\8a\83~\83b\83g = 8 * \83Z\83\8c\83N\83^\90\94 - 1\r
+       dd      GDT0            ; GDT\8aJ\8en\83A\83h\83\8c\83X\r
+\r
+       alignb  16\r
+\r
+GDT0:  ; \89¼GDT\r
+       resb    8               ; \83k\83\8b\81E\83Z\83\8c\83N\83^\81[\r
+       dw      0xffff, 0x0000, 0x9200, 0x00cf  ; \93Ç\82Ý\8f\91\82«\89Â\94\32\83r\83b\83g\r
+       dw      0xffff, 0x0000, 0x9a28, 0x0047  ; \8eÀ\8ds\89Â\94\32\83r\83b\83g\r
+       dw      0\r
+\r
+       alignb  16\r
+\r
+bootpack:\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/bootpack.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/bootpack.c
new file mode 100644 (file)
index 0000000..d4ce40b
--- /dev/null
@@ -0,0 +1,274 @@
+\r
+#include "core.h"\r
+\r
+uchar *ACPI_MemoryMap_Type[5] = {\r
+       "  USABLE",\r
+       "RESERVED",\r
+       "    ACPI",\r
+       "ACPI_NVS",\r
+       "UNUSABLE"\r
+};\r
+\r
+System_CommonData systemdata;\r
+\r
+void CHNMain(void)\r
+{\r
+       uint i;\r
+       UI_Timer *c_timer;\r
+       UI_Sheet *taskbar, *desktop;\r
+       UI_Task *mytask;\r
+\r
+       IO_CLI();\r
+\r
+       Initialise_System(&systemdata);\r
+\r
+       IO_STI();\r
+\r
+       mytask = MultiTask_Get_NowTask();\r
+\r
+       systemdata.keyctrltask = MultiTask_Task_Get("SysKeyCtrlTask");\r
+       systemdata.keyctrltask->tss.ldtr = 0;\r
+       systemdata.keyctrltask->tss.iomap = 0x4000;\r
+       systemdata.keyctrltask->tss.eip = (uint)&CHNOS_KeyboardControlTask;\r
+       systemdata.keyctrltask->tss.eflags = 0x00000202;\r
+       systemdata.keyctrltask->tss.esp = (uint)MemoryBlock_Allocate_System(64 * 1024) + 64 * 1024;\r
+       MemoryBlock_Write_Description((void *)(systemdata.keyctrltask->tss.esp - 64 * 1024), "SysKCT-Stack");\r
+       systemdata.keyctrltask->tss.es = 1 * 8;\r
+       systemdata.keyctrltask->tss.cs = 2 * 8;\r
+       systemdata.keyctrltask->tss.ss = 1 * 8;\r
+       systemdata.keyctrltask->tss.ds = 1 * 8;\r
+       systemdata.keyctrltask->tss.fs = 1 * 8;\r
+       systemdata.keyctrltask->tss.gs = 1 * 8;\r
+       systemdata.keyctrltask->tss.cr3 = (uint)ADR_Paging_Directory;\r
+       MultiTask_Task_Run(systemdata.keyctrltask);\r
+\r
+       Mouse_Make_MouseCursor(&systemdata.mouse_cursor, 0, 0, systemdata.bootinfo->scrnx - 1, systemdata.bootinfo->scrny - 1, System_Sheet_Get_Top_Of_Height());\r
+       Mouse_Move_Absolute(&systemdata.mouse_cursor, systemdata.bootinfo->scrnx >> 1, systemdata.bootinfo->scrny >> 1);\r
+\r
+       systemdata.mousectrltask = MultiTask_Task_Get("MouseCtrlTask");\r
+       systemdata.mousectrltask->tss.ldtr = 0;\r
+       systemdata.mousectrltask->tss.iomap = 0x4000;\r
+       systemdata.mousectrltask->tss.eip = (uint)&CHNOS_MouseControlTask;\r
+       systemdata.mousectrltask->tss.eflags = 0x00000202;\r
+       systemdata.mousectrltask->tss.esp = (uint)MemoryBlock_Allocate_System(64 * 1024) + 64 * 1024;\r
+       MemoryBlock_Write_Description((void *)(systemdata.mousectrltask->tss.esp - 64 * 1024), "SysMCT-Stack");\r
+       systemdata.mousectrltask->tss.es = 1 * 8;\r
+       systemdata.mousectrltask->tss.cs = 2 * 8;\r
+       systemdata.mousectrltask->tss.ss = 1 * 8;\r
+       systemdata.mousectrltask->tss.ds = 1 * 8;\r
+       systemdata.mousectrltask->tss.fs = 1 * 8;\r
+       systemdata.mousectrltask->tss.gs = 1 * 8;\r
+       systemdata.mousectrltask->tss.cr3 = (uint)ADR_Paging_Directory;\r
+       MultiTask_Task_Run(systemdata.mousectrltask);\r
+\r
+       desktop = System_Sheet_Get(systemdata.bootinfo->scrnx, systemdata.bootinfo->scrny, 0, 0);\r
+       Sheet_Show(desktop, 0, 0, System_Sheet_Get_Top_Of_Height());\r
+       Sheet_Draw_Fill_Rectangle(desktop, 0x66ff66, 0, 0, desktop->size.x - 1, desktop->size.y - 1);\r
+\r
+       taskbar = System_Sheet_Get(systemdata.bootinfo->scrnx, 32, 0, 0);\r
+       Sheet_Show(taskbar, 0, systemdata.bootinfo->scrny - 32, System_Sheet_Get_Top_Of_Height());\r
+       Sheet_Draw_Fill_Rectangle_Gradation_Vertical(taskbar, 0xffffff, 0x6666ff, 0, 0, taskbar->size.x - 1, taskbar->size.y - 1);\r
+\r
+       c_timer = Timer_Get(&systemdata.sysfifo, 5);\r
+       Timer_Set(c_timer, 50, interval);\r
+       Timer_Run(c_timer);\r
+\r
+       FIFO32_Set_Task(&systemdata.sysfifo, mytask);\r
+\r
+       Console_Create((systemdata.bootinfo->scrnx >> 4), (systemdata.bootinfo->scrny >> 5));\r
+\r
+       for (;;) {\r
+               if(FIFO32_Status(&systemdata.sysfifo) == 0){\r
+                       MultiTask_Task_Sleep(mytask);\r
+               } else{\r
+                       i = FIFO32_Get(&systemdata.sysfifo);\r
+                       if(i < DATA_BYTE){\r
+                               if(i == 5){\r
+\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+void CHNOS_KeyboardControlTask(void)\r
+{\r
+       UI_Task *mytask;\r
+       UI_Listener *next, **now, *send;\r
+       UI_KeyInfo kinfo;\r
+       uint i, j;\r
+       uint buf[5];\r
+\r
+       mytask = MultiTask_Get_NowTask();\r
+       next = 0;\r
+       systemdata.keycmd_wait = 0;\r
+\r
+       FIFO32_Set_Task(&systemdata.keyboardfifo, mytask);\r
+\r
+       for (;;) {\r
+               if(FIFO32_Status(&systemdata.keycmdfifo) > 0 && systemdata.keycmd_wait < 0){\r
+                       systemdata.keycmd_wait = FIFO32_Get(&systemdata.keycmdfifo);\r
+                       Keyboard_Controller_Wait_SendReady();\r
+                       IO_Out8(KEYB_DATA, systemdata.keycmd_wait);\r
+               }\r
+               if(FIFO32_Status(&systemdata.keyboardfifo) == 0){\r
+                       MultiTask_Task_Sleep(mytask);\r
+               } else{\r
+                       i = FIFO32_Get(&systemdata.keyboardfifo);\r
+                       if(i < DATA_BYTE){      /*\83^\83X\83N\82Ö\82Ì\83R\83}\83\93\83h*/\r
+                               if(i == 1){     /*\83\8a\83X\83i\81[\93o\98^ FIFO32_Put_Arguments([fifo], 4, 0x01, [DATA_FIFO*], [flags], [offset]); ([0xFFFFFFFF])*/\r
+                                       buf[0] = 0x01;\r
+                                       buf[4] = 0x00;\r
+                                       for(j = 1; j < 5; j++){\r
+                                               buf[j] = FIFO32_Get(&systemdata.keyboardfifo);\r
+                                               if(buf[j] == SIGNAL_ARGUMENTS_END){\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+                                       if(buf[4] == SIGNAL_ARGUMENTS_END){     /*\82·\82×\82Ä\90³\8fí\82É\8eó\90M\82µ\82½\81B*/\r
+                                               for(now = &next; *now != 0; now = &(*now)->next){\r
+\r
+                                               }\r
+                                               *now = MemoryBlock_Allocate_System(sizeof(UI_Listener));\r
+                                               MemoryBlock_Write_Description(*now, "UI_Listener");\r
+                                               (*now)->next = 0;\r
+                                               (*now)->fifo = (DATA_FIFO *)buf[1];\r
+                                               (*now)->flags = buf[2];\r
+                                               (*now)->offset = buf[3];\r
+                                       }\r
+                               }\r
+                       } else if(DATA_BYTE <= i && i < (DATA_BYTE * 2)){       /*\83L\81[\83{\81[\83h\82©\82ç\82Ì\8eó\90M\83f\81[\83^*/\r
+                               Keyboard_Decode(&kinfo, i - DATA_BYTE);\r
+                               if(kinfo.make){\r
+                                       if(kinfo.c != 0){       /*\88ê\94Ê\95\8e\9a*/\r
+                                               for(send = next; send != 0; send = send->next){\r
+                                                       FIFO32_Put(send->fifo, kinfo.c + send->offset);\r
+                                               }\r
+                                               if(systemdata.key_focus != 0 && systemdata.key_focus->fifo != 0){       /*\83t\83H\81[\83J\83X\82Í\83L\81[\83f\81[\83^\82Ì\8eæ\93¾\82ð\8aó\96]\82µ\82Ä\82¢\82é*/\r
+                                                       FIFO32_Put(systemdata.key_focus->fifo, kinfo.c);\r
+                                               }\r
+                                       } else{ /*\93Á\8eê\95\8e\9a*/\r
+\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+void CHNOS_MouseControlTask(void)\r
+{\r
+       UI_Task *mytask;\r
+       UI_Sheet *focus;\r
+       DATA_Position2D focus_moveorg;\r
+       uint i;\r
+       int button_before;\r
+       bool key_focus_changed;\r
+       UI_Sheet *key_focus_before;\r
+\r
+       UI_MouseEventArguments e;\r
+\r
+       mytask = MultiTask_Get_NowTask();\r
+       focus = 0;\r
+       button_before = 0;\r
+       key_focus_changed = false;\r
+       key_focus_before = 0;\r
+\r
+       FIFO32_Set_Task(&systemdata.mousefifo, mytask);\r
+\r
+       for (;;) {\r
+               if(FIFO32_Status(&systemdata.mousefifo) == 0){\r
+                       if(focus != 0){\r
+                               Sheet_Slide(focus, focus->position.x + (systemdata.mouse_cursor.position.x - focus_moveorg.x), focus->position.y + (systemdata.mouse_cursor.position.y - focus_moveorg.y));\r
+                               focus_moveorg.x = systemdata.mouse_cursor.position.x;\r
+                               focus_moveorg.y = systemdata.mouse_cursor.position.y;\r
+                       }\r
+                       MultiTask_Task_Sleep(mytask);\r
+               } else{\r
+                       i = FIFO32_Get(&systemdata.mousefifo);\r
+                       if(i < DATA_BYTE){      /*\83^\83X\83N\82Ö\82Ì\83R\83}\83\93\83h*/\r
+\r
+                       } else if(DATA_BYTE <= i && i < (DATA_BYTE * 2)){       /*\83}\83E\83X\82©\82ç\82Ì\8eó\90M\83f\81[\83^*/\r
+                               if(Mouse_Decode(i - DATA_BYTE) != 0){\r
+                                       Mouse_Move_Relative(&systemdata.mouse_cursor, systemdata.mousedecode.move.x, systemdata.mousedecode.move.y);\r
+                                       if(focus == 0){\r
+                                               if(systemdata.focus != Sheet_Get_From_Position(&sys_sheet_ctrl, systemdata.mouse_cursor.position.x, systemdata.mouse_cursor.position.y)){\r
+                                                       if(systemdata.focus != 0 && systemdata.focus->MouseEventProcedure != 0){\r
+                                                               e.focus = systemdata.focus;\r
+                                                               e.move.x = 0;\r
+                                                               e.move.y = 0;\r
+                                                               e.button = 0;\r
+                                                               e.button_before = (uint)button_before;\r
+                                                               systemdata.focus->MouseEventProcedure(&e);\r
+                                                       }\r
+                                               }\r
+                                               systemdata.focus = Sheet_Get_From_Position(&sys_sheet_ctrl, systemdata.mouse_cursor.position.x, systemdata.mouse_cursor.position.y);\r
+                                       }\r
+                                       if((systemdata.mousedecode.btn & MOUSE_BUTTON_L) != 0 && (button_before & MOUSE_BUTTON_L) == 0){        /*L down*/\r
+                                               if(systemdata.key_focus != systemdata.focus){\r
+                                                       key_focus_changed = true;\r
+                                                       key_focus_before = systemdata.key_focus;\r
+                                               }\r
+                                               systemdata.key_focus = systemdata.focus;\r
+                                               focus = systemdata.focus;\r
+                                               focus_moveorg.x = systemdata.mouse_cursor.position.x;\r
+                                               focus_moveorg.y = systemdata.mouse_cursor.position.y;\r
+                                               if(!focus->mouse_movable){      /*\83}\83E\83X\82É\82æ\82é\88Ú\93®\95s\89Â*/\r
+                                                       focus = 0;\r
+                                               } else{\r
+                                                       Sheet_UpDown(focus, System_Sheet_Get_Top_Of_Height());\r
+                                               }\r
+                                       } else if((systemdata.mousedecode.btn & MOUSE_BUTTON_L) == 0 && (button_before & MOUSE_BUTTON_L) != 0){ /*L up*/\r
+                                               focus = 0;\r
+                                       }\r
+                                       if((systemdata.mousedecode.btn & MOUSE_BUTTON_R) != 0){ /*R*/\r
+\r
+                                       }\r
+                                       if((systemdata.mousedecode.btn & MOUSE_BUTTON_C) != 0){ /*C*/\r
+\r
+                                       }\r
+                                       if(key_focus_changed){\r
+                                               if(key_focus_before != 0 && key_focus_before->fifo != 0 && (key_focus_before->ksignal_flags & SIGNAL_FLAGS_FOCUSINFO) != 0){\r
+                                                       FIFO32_Put_Arguments(key_focus_before->fifo, 2, SIGNAL_WINDOW_FOCUS_LOST, (uint)key_focus_before);\r
+                                               }\r
+                                               if(systemdata.key_focus != 0 && systemdata.key_focus->fifo != 0 && (systemdata.key_focus->ksignal_flags & SIGNAL_FLAGS_FOCUSINFO) != 0){\r
+                                                       FIFO32_Put_Arguments(systemdata.key_focus->fifo, 2, SIGNAL_WINDOW_FOCUS_GET, (uint)systemdata.key_focus);\r
+                                               }\r
+                                               key_focus_changed = false;\r
+                                       }\r
+                                       if(systemdata.focus != 0 && systemdata.focus->MouseEventProcedure != 0){        /*\83t\83H\81[\83J\83X\82Í\83V\81[\83g\82Å\81A\83C\83x\83\93\83g\82Ì\8eæ\93¾\82ð\8aó\96]\82µ\82Ä\82¢\82é*/\r
+                                               e.focus = systemdata.focus;\r
+                                               e.move.x = systemdata.mousedecode.move.x;\r
+                                               e.move.y = systemdata.mousedecode.move.y;\r
+                                               e.position_local.x = systemdata.mouse_cursor.position.x - focus->position.x;\r
+                                               e.position_local.y = systemdata.mouse_cursor.position.y - focus->position.y;\r
+                                               e.button = (uint)systemdata.mousedecode.btn;\r
+                                               e.button_before = (uint)button_before;\r
+                                               systemdata.focus->MouseEventProcedure(&e);\r
+                                       }\r
+                                       key_focus_before = systemdata.key_focus;\r
+                                       button_before = systemdata.mousedecode.btn;\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+void CHNOS_UI_KeyFocus_Change(UI_Sheet *focus_new)\r
+{\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       if(systemdata.key_focus != 0 && systemdata.key_focus->fifo != 0 && (systemdata.key_focus->ksignal_flags & SIGNAL_FLAGS_FOCUSINFO) != 0){\r
+               FIFO32_Put_Arguments(systemdata.key_focus->fifo, 2, SIGNAL_WINDOW_FOCUS_LOST, systemdata.key_focus);\r
+       }\r
+       if(focus_new != 0 && focus_new->fifo != 0 && (focus_new->ksignal_flags & SIGNAL_FLAGS_FOCUSINFO) != 0){\r
+               FIFO32_Put_Arguments(focus_new->fifo, 2, SIGNAL_WINDOW_FOCUS_GET, (uint)focus_new);\r
+       }\r
+       systemdata.key_focus = focus_new;\r
+\r
+       IO_Store_EFlags(eflags);\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/chnipl.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/chnipl.nas
new file mode 100644 (file)
index 0000000..3496759
--- /dev/null
@@ -0,0 +1,185 @@
+\r
+[INSTRSET "i486p"]\r
+\r
+; BOOT_INFO_ADDR\r
+CYLS    equ             0x0ff0\r
+\r
+       org             0x7c00                  ; \82±\82Ì\83v\83\8d\83O\83\89\83\80\82ª\82Ç\82±\82É\93Ç\82Ý\8d\9e\82Ü\82ê\82é\82Ì\82©\r
+\r
+; \88È\89º\82Í\95W\8f\80\93I\82Èfat12\83t\83H\81[\83}\83b\83g\83t\83\8d\83b\83s\81[\83f\83B\83X\83N\82Ì\82½\82ß\82Ì\8bL\8fq\r
+\r
+       jmp             entry\r
+       db              0x90\r
+       db              "chnos   "              ; \83u\81[\83g\83Z\83N\83^\82Ì\96¼\91O\82ð\8e©\97R\82É\8f\91\82¢\82Ä\82æ\82¢\81i8\83o\83C\83g\81j\r
+       dw              512                     ; 1\83Z\83N\83^\82Ì\91å\82«\82³\81i512\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       db              1                       ; \83N\83\89\83X\83^\82Ì\91å\82«\82³\81i1\83Z\83N\83^\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dw              1                       ; fat\82ª\82Ç\82±\82©\82ç\8en\82Ü\82é\82©\81i\95\81\92Ê\82Í1\83Z\83N\83^\96Ú\82©\82ç\82É\82·\82é\81j\r
+       db              2                       ; fat\82Ì\8cÂ\90\94\81i2\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dw              224                     ; \83\8b\81[\83g\83f\83B\83\8c\83N\83g\83\8a\97Ì\88æ\82Ì\91å\82«\82³\81i\95\81\92Ê\82Í224\83G\83\93\83g\83\8a\82É\82·\82é\81j\r
+       dw              2880                    ; \82±\82Ì\83h\83\89\83C\83u\82Ì\91å\82«\82³\81i2880\83Z\83N\83^\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       db              0xf0                    ; \83\81\83f\83B\83A\82Ì\83^\83C\83v\81i0xf0\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dw              9                       ; fat\97Ì\88æ\82Ì\92·\82³\81i9\83Z\83N\83^\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dw              18                      ; 1\83g\83\89\83b\83N\82É\82¢\82­\82Â\82Ì\83Z\83N\83^\82ª\82 \82é\82©\81i18\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dw              2                       ; \83w\83b\83h\82Ì\90\94\81i2\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dd              0                       ; \83p\81[\83e\83B\83V\83\87\83\93\82ð\8eg\82Á\82Ä\82È\82¢\82Ì\82Å\82±\82±\82Í\95K\82¸0\r
+       dd              2880                    ; \82±\82Ì\83h\83\89\83C\83u\91å\82«\82³\82ð\82à\82¤\88ê\93x\8f\91\82­\r
+       db              0, 0, 0x29              ; \82æ\82­\82í\82©\82ç\82È\82¢\82¯\82Ç\82±\82Ì\92l\82É\82µ\82Ä\82¨\82­\82Æ\82¢\82¢\82ç\82µ\82¢\r
+       dd              0xffffffff              ; \82½\82Ô\82ñ\83{\83\8a\83\85\81[\83\80\83V\83\8a\83A\83\8b\94Ô\8d\86\r
+       db              "chnosboot  "           ; \83f\83B\83X\83N\82Ì\96¼\91O\81i11\83o\83C\83g\81j\r
+       db              "fat12   "              ; \83t\83H\81[\83}\83b\83g\82Ì\96¼\91O\81i8\83o\83C\83g\81j\r
+       resb    18                              ; \82Æ\82è\82 \82¦\82¸18\83o\83C\83g\82 \82¯\82Ä\82¨\82­\r
+\r
+; \83v\83\8d\83O\83\89\83\80\96{\91Ì\r
+\r
+entry:\r
+       mov     ax, 0                   ; \83\8c\83W\83X\83^\8f\89\8aú\89»\r
+       mov     ss, ax\r
+       mov     sp, 0x7c00\r
+       mov     ds, ax\r
+\r
+; \83f\83B\83X\83N\82ð\93Ç\82Þ\r
+\r
+        mov     ax, 0x0820\r
+        mov     es, ax\r
+        mov     ch, 0            ; \83V\83\8a\83\93\83_0\r
+        mov     dh, 0            ; \83w\83b\83h0\r
+        mov     cl, 2            ; \83Z\83N\83^2\r
+        mov     bx, 18*2-1       ; \93Ç\82Ý\8d\9e\82Ý\82½\82¢\8d\87\8cv\83Z\83N\83^\90\94 (2006.12.23 \83o\83O\8fC\90³)\r
+        call    readfast        ; \8d\82\91¬\93Ç\82Ý\8d\9e\82Ý\r
+\r
+        mov     bx, 4312+0x8200+2\r
+fatloop:\r
+        add     bx, -2\r
+        cmp     word [bx], 0\r
+        jz      fatloop\r
+        mov     ax, bx\r
+        add     ax, -0x8200-5+54+53\r
+        mov     bl, 54\r
+        div     bl              ; al = ax / bl\r
+\r
+        cmp     al, 0\r
+        jnz     fatskip1\r
+        mov     al, 1\r
+fatskip1:\r
+        cmp     al, 33\r
+        jbe     fatskip2\r
+        mov     al, 33\r
+fatskip2:\r
+        mov     [CYLS], al     ; ipl\82ª\82Ç\82±\82Ü\82Å\93Ç\82ñ\82¾\82Ì\82©\82ð\83\81\83\82\r
+        add     al, -1\r
+        jz      fatskip3\r
+        mov     ah, 0\r
+        imul    bx, ax, 18*2\r
+\r
+        mov     ax, 0x0c80\r
+        mov     es, ax\r
+        mov     ch, 1            ; \83V\83\8a\83\93\83_1\r
+        mov     dh, 0            ; \83w\83b\83h0\r
+        mov     cl, 1            ; \83Z\83N\83^1\r
+        call    readfast        ; \8d\82\91¬\93Ç\82Ý\8d\9e\82Ý\r
+fatskip3:\r
+\r
+; \93Ç\82Ý\8fI\82í\82Á\82½\82Ì\82Åharibote.sys\82ð\8eÀ\8ds\82¾\81I\r
+\r
+        jmp     0xc200\r
+\r
+\r
+error:\r
+       mov             ax, 0\r
+       mov             es, ax\r
+       mov             si, msg\r
+putloop:\r
+       mov             al, [si]\r
+       add             si, 1                   ; si\82É1\82ð\91«\82·\r
+       cmp             al, 0\r
+       je              fin\r
+       mov             ah, 0x0e                        ; \88ê\95\8e\9a\95\\8e¦\83t\83@\83\93\83N\83V\83\87\83\93\r
+       mov             bx, 15                  ; \83J\83\89\81[\83R\81[\83h\r
+       int             0x10                    ; \83r\83f\83Ibios\8cÄ\82Ñ\8fo\82µ\r
+       jmp             putloop\r
+fin:\r
+       hlt                                     ; \89½\82©\82 \82é\82Ü\82Åcpu\82ð\92â\8e~\82³\82¹\82é\r
+       jmp             fin                     ; \96³\8cÀ\83\8b\81[\83v\r
+\r
+msg:   db              0x0a, 0x0a              ; \89ü\8ds\82ð2\82Â\r
+       db              "chnipl load error"\r
+       db              0x0a                    ; \89ü\8ds\r
+       db              0\r
+\r
+readfast:      ; al\82ð\8eg\82Á\82Ä\82Å\82«\82é\82¾\82¯\82Ü\82Æ\82ß\82Ä\93Ç\82Ý\8fo\82·\r
+               ; es:\93Ç\82Ý\8d\9e\82Ý\94Ô\92n, ch:\83V\83\8a\83\93\83_, dh:\83w\83b\83h, cl:\83Z\83N\83^, bx:\93Ç\82Ý\8d\9e\82Ý\83Z\83N\83^\90\94\r
+\r
+       mov             ax, es                  ; < es\82©\82çal\82Ì\8dÅ\91å\92l\82ð\8cv\8eZ >\r
+       shl             ax, 3                   ; ax\82ð32\82Å\8a\84\82Á\82Ä\81A\82»\82Ì\8c\8b\89Ê\82ðah\82É\93ü\82ê\82½\82±\82Æ\82É\82È\82é \81ishl\82Í\8d\83V\83t\83g\96½\97ß\81j\r
+       and             ah, 0x7f                        ; ah\82Íah\82ð128\82Å\8a\84\82Á\82½\97]\82è\81i512*128=64k\81j\r
+       mov             al, 128                 ; al = 128 - ah; \88ê\94Ô\8bß\82¢64kb\8b«\8aE\82Ü\82Å\8dÅ\91å\89½\83Z\83N\83^\93ü\82é\82©\r
+       sub             al, ah\r
+\r
+       mov             ah, bl                  ; < bx\82©\82çal\82Ì\8dÅ\91å\92l\82ðah\82É\8cv\8eZ >\r
+       cmp             bh, 0                   ; if (bh != 0) { ah = 18; }\r
+       je              .skip1\r
+       mov             ah, 18\r
+.skip1:\r
+       cmp             al, ah                  ; if (al > ah) { al = ah; }\r
+       jbe             .skip2\r
+       mov             al, ah\r
+.skip2:\r
+\r
+       mov             ah, 19                  ; < cl\82©\82çal\82Ì\8dÅ\91å\92l\82ðah\82É\8cv\8eZ >\r
+       sub             ah, cl                  ; ah = 19 - cl;\r
+       cmp             al, ah                  ; if (al > ah) { al = ah; }\r
+       jbe             .skip3\r
+       mov             al, ah\r
+.skip3:\r
+\r
+       push    bx\r
+       mov             si, 0                   ; \8e¸\94s\89ñ\90\94\82ð\90\94\82¦\82é\83\8c\83W\83X\83^\r
+retry:\r
+       mov             ah, 0x02                        ; ah=0x02 : \83f\83B\83X\83N\93Ç\82Ý\8d\9e\82Ý\r
+       mov             bx, 0\r
+       mov             dl, 0x00                        ; a\83h\83\89\83C\83u\r
+       push    es\r
+       push    dx\r
+       push    cx\r
+       push    ax\r
+       int             0x13                    ; \83f\83B\83X\83Nbios\8cÄ\82Ñ\8fo\82µ\r
+       jnc             next                    ; \83G\83\89\81[\82ª\82¨\82«\82È\82¯\82ê\82Înext\82Ö\r
+       add             si, 1                   ; si\82É1\82ð\91«\82·\r
+       cmp             si, 5                   ; si\82Æ5\82ð\94ä\8ar\r
+       jae             error                   ; si >= 5 \82¾\82Á\82½\82çerror\82Ö\r
+       mov             ah, 0x00\r
+       mov             dl, 0x00                        ; a\83h\83\89\83C\83u\r
+       int             0x13                    ; \83h\83\89\83C\83u\82Ì\83\8a\83Z\83b\83g\r
+       pop             ax\r
+       pop             cx\r
+       pop             dx\r
+       pop             es\r
+       jmp             retry\r
+next:\r
+       pop             ax\r
+       pop             cx\r
+       pop             dx\r
+       pop             bx                      ; es\82Ì\93à\97e\82ðbx\82Å\8eó\82¯\8eæ\82é\r
+       shr             bx, 5                   ; bx\82ð16\83o\83C\83g\92P\88Ê\82©\82ç512\83o\83C\83g\92P\88Ê\82Ö\r
+       mov             ah, 0\r
+       add             bx, ax                  ; bx += al;\r
+       shl             bx, 5                   ; bx\82ð512\83o\83C\83g\92P\88Ê\82©\82ç16\83o\83C\83g\92P\88Ê\82Ö\r
+       mov             es, bx                  ; \82±\82ê\82Å es += al * 0x20; \82É\82È\82é\r
+       pop             bx\r
+       sub             bx, ax\r
+       jz              .ret\r
+       add             cl, al                  ; cl\82Éal\82ð\91«\82·\r
+       cmp             cl, 18                  ; cl\82Æ18\82ð\94ä\8ar\r
+       jbe             readfast                ; cl <= 18 \82¾\82Á\82½\82çreadfast\82Ö\r
+       mov             cl, 1\r
+       add             dh, 1\r
+       cmp             dh, 2\r
+       jb              readfast                ; dh < 2 \82¾\82Á\82½\82çreadfast\82Ö\r
+       mov             dh, 0\r
+       add             ch, 1\r
+       jmp             readfast\r
+.ret:\r
+       ret\r
+\r
+       resb    0x7dfe-$                ; 0x7dfe\82Ü\82Å\82ð0x00\82Å\96\84\82ß\82é\96½\97ß\r
+       db              0x55, 0xaa\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/console.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/console.c
new file mode 100644 (file)
index 0000000..d91c749
--- /dev/null
@@ -0,0 +1,749 @@
+\r
+#include "core.h"\r
+\r
+UI_Console *console_root;\r
+\r
+System_CommonData *sysdata;\r
+\r
+uchar *MIDI_Notes[12] = {\r
+       "C ",\r
+       "C#",\r
+       "D ",\r
+       "D#",\r
+       "E ",\r
+       "F ",\r
+       "F#",\r
+       "G ",\r
+       "G#",\r
+       "A ",\r
+       "A#",\r
+       "B "\r
+};\r
+\r
+ushort ToneTable[12] = {\r
+       262,\r
+       277,\r
+       294,\r
+       311,\r
+       330,\r
+       349,\r
+       370,\r
+       392,\r
+       415,\r
+       440,\r
+       466,\r
+       494\r
+};\r
+\r
+void Initialise_Console(UI_Console *consctrl, System_CommonData *systemdata)\r
+{\r
+       console_root = consctrl;\r
+       console_root->win = 0;\r
+       console_root->input = 0;\r
+       console_root->next = 0;\r
+       console_root->ctimer = 0;\r
+\r
+       sysdata = systemdata;\r
+\r
+       return;\r
+}\r
+\r
+UI_Console *Console_Create(uint xchars, uint ychars)\r
+{\r
+       UI_Console *cons, *end;\r
+       UI_Task *cons_task;\r
+\r
+       cons = MemoryBlock_Allocate_System(sizeof(UI_Console));\r
+       MemoryBlock_Write_Description(cons, "UI_Console");\r
+\r
+       cons->input = InputBox_Initialise(&sys_sheet_ctrl, &sys_mem_ctrl, 0, 0, xchars << 3, ychars << 4, 256, 0xffffff, 0x000000, Sheet_Get_Top_Of_Height(&sys_sheet_ctrl));\r
+       cons->win = Window_Create_User("Console", 0, cons->input->sheet);\r
+\r
+       for(end = console_root; end->next != 0; end = end->next){\r
+\r
+       }\r
+       cons->next = 0;\r
+       end->next = cons;\r
+\r
+       FIFO32_Initialise(&cons->fifo, CONSOLE_FIFO_SIZE);\r
+       Sheet_Set_FIFO(cons->win->client, &cons->fifo, SIGNAL_FLAGS_FOCUSINFO);\r
+\r
+       cons->ctimer = Timer_Get(&cons->fifo, 0x105);\r
+       Timer_Set(cons->ctimer, 50, once);\r
+\r
+       cons_task = MultiTask_Task_Get("ConsoleTask");\r
+       cons_task->tss.ldtr = 0;\r
+       cons_task->tss.iomap = 0x4000;\r
+       cons_task->tss.eip = (uint)&Console_MainTask;\r
+       cons_task->tss.eflags = 0x00000202;\r
+       cons_task->tss.esp = (uint)MemoryBlock_Allocate_System(64 * 1024) + 64 * 1024;\r
+       MemoryBlock_Write_Description((void *)(cons_task->tss.esp - 64 * 1024), "Console-Stack");\r
+       cons_task->tss.es = 1 * 8;\r
+       cons_task->tss.cs = 2 * 8;\r
+       cons_task->tss.ss = 1 * 8;\r
+       cons_task->tss.ds = 1 * 8;\r
+       cons_task->tss.fs = 1 * 8;\r
+       cons_task->tss.gs = 1 * 8;\r
+       cons_task->tss.cr3 = (uint)ADR_Paging_Directory;\r
+       MultiTask_Task_Arguments(cons_task, 1, cons);\r
+       MultiTask_Task_Run(cons_task);\r
+\r
+       FIFO32_Set_Task(&cons->fifo, cons_task);\r
+       Timer_Run(cons->ctimer);\r
+\r
+       CHNOS_UI_KeyFocus_Change(cons->win->client);\r
+\r
+       return cons;\r
+}\r
+\r
+void Console_MainTask(UI_Console *cons)\r
+{\r
+       UI_Task *mytask;\r
+       uint i, j;\r
+       uint buf[3];\r
+       bool clear_screen;\r
+       uchar s[64];\r
+\r
+       mytask = MultiTask_Get_NowTask();\r
+       mytask->cons = cons;\r
+       clear_screen = false;\r
+\r
+       InputBox_Put_Prompt(cons->input);\r
+\r
+       for(;;){\r
+               if(FIFO32_Status(&cons->fifo) == 0){\r
+                       MultiTask_Task_Sleep(mytask);\r
+               } else{\r
+                       i = FIFO32_Get(&cons->fifo);\r
+                       if(i < DATA_BYTE){      /*\83L\81[\83{\81[\83h\95\8e\9a\83f\81[\83^*/\r
+                               if(i == '\n'){\r
+                                       InputBox_Set_Record(cons->input, false);\r
+                                       if(cons->input->input_buf[0] != 0x00){\r
+                                               InputBox_NewLine_No_Prompt(cons->input);\r
+                                       }\r
+                                       if(strcmp(cons->input->input_buf, "cls") == 0){\r
+                                               InputBox_Clear(cons->input);\r
+                                               clear_screen = true;\r
+                                       } else if(strcmp(cons->input->input_buf, "memmap") == 0){\r
+                                               Console_Command_memmap(cons);\r
+                                       } else if(strcmp(cons->input->input_buf, "memblock") == 0){\r
+                                               Console_Command_memblock(cons);\r
+                                       } else if(strcmp(cons->input->input_buf, "mem") == 0){\r
+                                               Console_Command_mem(cons);\r
+                                       } else if(strcmp(cons->input->input_buf, "systeminfo") == 0){\r
+                                               Console_Command_systeminfo(cons);\r
+                                       } else if(strcmp(cons->input->input_buf, "task") == 0){\r
+                                               Console_Command_task(cons);\r
+                                       } else if(strcmp(cons->input->input_buf, "window") == 0){\r
+                                               Console_Command_window(cons);\r
+                                       } else if(strcmp(cons->input->input_buf, "console") == 0){\r
+                                               Console_Command_console(cons);\r
+                                       } else if(strncmp(cons->input->input_buf, "type ", 5) == 0){\r
+                                               Console_Command_type(cons, &cons->input->input_buf[5]);\r
+                                       } else if(strcmp(cons->input->input_buf, "dir") == 0){\r
+                                               Console_Command_dir(cons);\r
+                                       } else if(strcmp(cons->input->input_buf, "gdt") == 0){\r
+                                               Console_Command_gdt(cons);\r
+                                       } else if(strcmp(cons->input->input_buf, "test") == 0){\r
+                                               sprintf(s, "taskaddr:0x%08X\n", mytask);\r
+                                               InputBox_Put_String(cons->input, s);\r
+                                               IO_Beep(440, 5000000);\r
+                                       } else if(strncmp(cons->input->input_buf, "midi ", 5) == 0){\r
+                                               Console_Command_midi(cons, &cons->input->input_buf[5]);\r
+                                       } else if(cons->input->input_buf[0] != 0x00){\r
+                                               Console_Execute(cons);\r
+                                       }\r
+                                       InputBox_Set_Record(cons->input, true);\r
+                                       InputBox_Reset_Input_Buffer(cons->input);\r
+                                       if(clear_screen){\r
+                                               InputBox_Put_Prompt(cons->input);\r
+                                               clear_screen = false;\r
+                                       } else{\r
+                                               InputBox_NewLine(cons->input);\r
+                                       }\r
+                               } else{\r
+                                       InputBox_Put_Character(cons->input, i);\r
+                               }\r
+                       } else if(i == 0x105){\r
+                               InputBox_Change_Cursor_State(cons->input);\r
+                               Timer_Run(cons->ctimer);\r
+                       } else if(i > SIGNAL_START){\r
+                               buf[0] = i;\r
+                               for(j = 1; j < 3; j++){\r
+                                       buf[j] = 0x00;\r
+                               }\r
+                               for(j = 1; j < 3; j++){\r
+                                       buf[j] = FIFO32_Get(&cons->fifo);\r
+                                       if(buf[j] == SIGNAL_ARGUMENTS_END){\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if(i == SIGNAL_WINDOW_FOCUS_GET){\r
+                                       if(buf[2] == SIGNAL_ARGUMENTS_END){     /*\82·\82×\82Ä\90³\8fí\82É\8eó\90M\82µ\82½*/\r
+                                               Timer_Run(cons->ctimer);\r
+                                       }\r
+                               } else if(i == SIGNAL_WINDOW_FOCUS_LOST){\r
+                                       if(buf[2] == SIGNAL_ARGUMENTS_END){     /*\82·\82×\82Ä\90³\8fí\82É\8eó\90M\82µ\82½*/\r
+                                               Timer_Cancel(cons->ctimer);\r
+                                               if(cons->input->cursor_state){  /*\83v\83\8d\83\93\83v\83g\82ª\95\\8e¦\82³\82ê\82Ä\82¢\82½\82ç\8fÁ\82·*/\r
+                                                       InputBox_Change_Cursor_State(cons->input);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+void Console_Command_memmap(UI_Console *cons)\r
+{\r
+       DATA_BootInfo *bootinfo = (DATA_BootInfo *)ADR_BOOTINFO;\r
+       uchar s[64];\r
+       uint i;\r
+\r
+       sprintf(s, "ACPI 0xe820 MemoryMaps:%d\n", bootinfo->ACPI_MemoryMapEntries);\r
+       InputBox_Put_String(cons->input, s);\r
+       for(i = 0; i < bootinfo->ACPI_MemoryMapEntries; i++){\r
+               sprintf(s, "%02d:[0x%08X%08X](0x%08X%08X) %s 0x%08X\n", i, bootinfo->ACPI_MemoryMap[i].Base.high, bootinfo->ACPI_MemoryMap[i].Base.low, bootinfo->ACPI_MemoryMap[i].Length.high, bootinfo->ACPI_MemoryMap[i].Length.low, ACPI_MemoryMap_Type[bootinfo->ACPI_MemoryMap[i].Type], bootinfo->ACPI_MemoryMap[i].Attribute);\r
+               InputBox_Put_String(cons->input, s);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Console_Command_memblock(UI_Console *cons)\r
+{\r
+       uint memusing;\r
+       uchar s[64];\r
+       Memory *memblock;\r
+\r
+       memusing = 0;\r
+       sprintf(s, "MemoryBlocks:%d\n", SystemMemory.size);\r
+       InputBox_Put_String(cons->input, s);\r
+       for(memblock = &SystemMemory; memblock->next != 0; memblock = memblock->next){\r
+               sprintf(s, "[0x%08X](%8u Bytes):%s\n", memblock->next->addr, memblock->next->size, memblock->next->description);\r
+               InputBox_Put_String(cons->input, s);\r
+               memusing += memblock->next->size;\r
+       }\r
+       sprintf(s, "MemoryUsing:%u Bytes + (%u Bytes * %u) = %u(%uM)Bytes.", memusing, sizeof(Memory), SystemMemory.size, memusing + (sizeof(Memory) * SystemMemory.size), (memusing + (sizeof(Memory) * SystemMemory.size)) >> 20);\r
+       InputBox_Put_String(cons->input, s);\r
+\r
+       return;\r
+}\r
+\r
+void Console_Command_mem(UI_Console *cons)\r
+{\r
+       uint memusing, i;\r
+       uchar s[64];\r
+       Memory *memblock;\r
+\r
+       memusing = 0;\r
+       sprintf(s, "Memory        :%uByte:%uMB\n", System_MemoryControl_FullSize(), System_MemoryControl_FullSize() >> 20);\r
+       InputBox_Put_String(cons->input, s);\r
+       sprintf(s, "Free          :%uByte:%uMB\n", System_MemoryControl_FreeSize(), System_MemoryControl_FreeSize() >> 20);\r
+       InputBox_Put_String(cons->input, s);\r
+       InputBox_Put_String(cons->input, "Using:\n");\r
+       for(memblock = &SystemMemory; memblock->next != 0; memblock = memblock->next){\r
+               memusing += memblock->next->size;\r
+       }\r
+       sprintf(s, "\tMemoryBlock        :%uByte:%uMB\n", memusing + (sizeof(Memory) * SystemMemory.size), (memusing + (sizeof(Memory) * SystemMemory.size)) >> 20);\r
+       InputBox_Put_String(cons->input, s);\r
+       memusing = 1;\r
+       for(i = 0; i < 1024; i++){\r
+               if((ADR_Paging_Directory[i] & PG_PRESENT) != 0){\r
+                       memusing++;\r
+               }\r
+       }\r
+       sprintf(s, "\tPageDirectory+Table:%uByte:%uMB\n", i << 12, i >> 8);\r
+       InputBox_Put_String(cons->input, s);\r
+\r
+       return;\r
+}\r
+\r
+void Console_Command_systeminfo(UI_Console *cons)\r
+{\r
+       DATA_BootInfo *bootinfo = (DATA_BootInfo *)ADR_BOOTINFO;\r
+       uchar s[64];\r
+\r
+       sprintf(s, "ACPI 0xe820 MemoryMaps:%d\n", bootinfo->ACPI_MemoryMapEntries);\r
+       InputBox_Put_String(cons->input, s);\r
+       sprintf(s, "APM-Version:%X.%X\n", bootinfo->APM_Version >> 8, bootinfo->APM_Version & 0x00FF);\r
+       InputBox_Put_String(cons->input, s);\r
+       sprintf(s, "APM-Flags:0x%04X\n", bootinfo->APM_Flags);\r
+       InputBox_Put_String(cons->input, s);\r
+       sprintf(s, "VESA-Version:%X.%X\n", bootinfo->VESA_Version >> 8, bootinfo->VESA_Version & 0x00FF);\r
+       InputBox_Put_String(cons->input, s);\r
+\r
+       return;\r
+}\r
+\r
+void Console_Command_task(UI_Console *cons)\r
+{\r
+       UI_Task *task;\r
+       uchar s[64];\r
+\r
+       for(task = taskctrl->next; task != 0; task = task->next){\r
+               sprintf(s, "0x%04X (%10u):%s\n", task->selector, task->cputime, task->description);\r
+               InputBox_Put_String(cons->input, s);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Console_Command_window(UI_Console *cons)\r
+{\r
+       UI_Window *win;\r
+       uchar s[64];\r
+\r
+       for(win = sysdata->windowctrl.next; win != 0; win = win->next){\r
+               sprintf(s, "%s\n", win->title);\r
+               InputBox_Put_String(cons->input, s);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Console_Command_console(UI_Console *cons)\r
+{\r
+       DATA_BootInfo *bootinfo = (DATA_BootInfo *)ADR_BOOTINFO;\r
+\r
+       Console_Create((bootinfo->scrnx >> 4), (bootinfo->scrny >> 5));\r
+       return;\r
+}\r
+\r
+void Console_Command_type(UI_Console *cons, const uchar filename[])\r
+{\r
+       IO_File file;\r
+       int n;\r
+       uint i;\r
+\r
+       n = FloppyDisk_Search_File(sysdata->fd_boot, filename);\r
+       if(n != -1){\r
+               n = FloppyDisk_Load_File(sysdata->fd_boot, &file, n);\r
+               if(n != -1){\r
+                       for(i = 0; i < file.size; i++){\r
+                               InputBox_Put_Character(cons->input, file.data[i]);\r
+                       }\r
+               } else{\r
+                       InputBox_Put_String(cons->input, "type:File load error.\n");\r
+               }\r
+               File_Free(&file);\r
+       } else{\r
+               InputBox_Put_String(cons->input, "type:File not found.\n");\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Console_Command_dir(UI_Console *cons)\r
+{\r
+       uint i, j;\r
+       uchar s[64];\r
+\r
+       for(i = 0; i < 224; i++){\r
+               if(sysdata->fd_boot->files[i].name[0] == 0x00){\r
+                       break;\r
+               }\r
+               if(sysdata->fd_boot->files[i].name[0] != 0xe5){\r
+                       sprintf(s, "FILENAME.EXT %7d %04d/%02d/%02d %02d:%02d:%02d\n", sysdata->fd_boot->files[i].size, (sysdata->fd_boot->files[i].updatedate >> 9) + 1980, (sysdata->fd_boot->files[i].updatedate & 0x01e0) >> 5, sysdata->fd_boot->files[i].updatedate & 0x001f, sysdata->fd_boot->files[i].updatetime >> 11, (sysdata->fd_boot->files[i].updatetime & 0x07e0) >> 5, sysdata->fd_boot->files[i].updatetime & 0x1f);\r
+                       for(j = 0; j < 8; j++){\r
+                               s[j] = sysdata->fd_boot->files[i].name[j];\r
+                       }\r
+                       for(j = 9; j < 12; j++){\r
+                               s[j] = sysdata->fd_boot->files[i].name[j - 1];\r
+                       }\r
+                       InputBox_Put_String(cons->input, s);\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Console_Command_gdt(UI_Console *cons)\r
+{\r
+       uint i, ar;\r
+       uchar s[64];\r
+\r
+       for(i = 0; i < 8192; i++){\r
+               if(System_SegmentDescriptor_Get_Limit(i) != 0){\r
+                       sprintf(s, "0x%04X:[0x%08X](0x%08X) ", i, System_SegmentDescriptor_Get_Base(i), System_SegmentDescriptor_Get_Limit(i));\r
+                       InputBox_Put_String(cons->input, s);\r
+                       ar = System_SegmentDescriptor_Get_AccessRight(i);\r
+                       if((ar & AR_CODE_OR_DATA) != 0){        /*code or data*/\r
+                               if((ar & 0x08) != 0){   /*code*/\r
+                                       InputBox_Put_String(cons->input, "Code Execute");\r
+                                       if((ar & 0x02) != 0){   /*Read*/\r
+                                               InputBox_Put_String(cons->input, "/Read ");\r
+                                       } else{\r
+                                               InputBox_Put_String(cons->input, " Only ");\r
+                                       }\r
+                                       if((ar & 0x04) != 0){   /*Read*/\r
+                                               InputBox_Put_String(cons->input, "Conforming");\r
+                                       }\r
+                               } else{ /*data*/\r
+                                       InputBox_Put_String(cons->input, "Data Read");\r
+                                       if((ar & 0x02) != 0){   /*Read*/\r
+                                               InputBox_Put_String(cons->input, "/Write ");\r
+                                       } else{\r
+                                               InputBox_Put_String(cons->input, " Only ");\r
+                                       }\r
+                                       if((ar & 0x04) != 0){   /*Read*/\r
+                                               InputBox_Put_String(cons->input, "Expand Down");\r
+                                       }\r
+                               }\r
+                       } else{ /*SystemDescriptor*/\r
+                               if((ar & 0x0f) == 0x02){        /*LDT*/\r
+                                       InputBox_Put_String(cons->input, "LDT");\r
+                               } else if((ar & 0x0f) == 0x05){ /*TaskGate*/\r
+                                       InputBox_Put_String(cons->input, "TaskGate");\r
+                               } else{\r
+                                       if((ar & 0x07) == 0x01){\r
+                                               InputBox_Put_String(cons->input, "TSS-Ready");\r
+                                       } else if((ar & 0x07) == 0x03){\r
+                                               InputBox_Put_String(cons->input, "TSS-Busy");\r
+                                       } else if((ar & 0x07) == 0x04){\r
+                                               InputBox_Put_String(cons->input, "CallGate");\r
+                                       } else if((ar & 0x07) == 0x06){\r
+                                               InputBox_Put_String(cons->input, "INTGate");\r
+                                       } else if((ar & 0x07) == 0x07){\r
+                                               InputBox_Put_String(cons->input, "TrapGate");\r
+                                       }\r
+                                       if((ar & 0x08) != 0){   /*32bit*/\r
+                                               InputBox_Put_String(cons->input, "(32bit)");\r
+                                       } else{ /*16bit*/\r
+                                               InputBox_Put_String(cons->input, "(16bit)");\r
+                                       }\r
+                               }\r
+                       }\r
+                       InputBox_Put_String(cons->input, "\n");\r
+               }\r
+       }\r
+}\r
+\r
+void Console_Command_midi(UI_Console *cons, const uchar filename[])\r
+{\r
+       IO_File file;\r
+       int n;\r
+       uint p, q, tracksize, r, datalength, delta;\r
+       uchar s[128];\r
+       uint DeltaTimePerQuarterNote, microsTimePerQuarterNote, microsTimePerDeltaTime;\r
+\r
+       DeltaTimePerQuarterNote = 480;\r
+       microsTimePerQuarterNote = 500000;\r
+       microsTimePerDeltaTime = microsTimePerQuarterNote / DeltaTimePerQuarterNote;\r
+       \r
+       n = FloppyDisk_Search_File(sysdata->fd_boot, filename);\r
+       if(n != -1){\r
+               n = FloppyDisk_Load_File(sysdata->fd_boot, &file, n);\r
+               if(n != -1){\r
+                       p = 0;\r
+                       if(strncmp(&file.data[p + 0], "MThd", 4) == 0){\r
+                               p += 4;\r
+                               p += 4;\r
+\r
+                               sprintf(s, "SMF Format%d ", (file.data[p + 0] << 8) | file.data[p + 1]);\r
+                               InputBox_Put_String(cons->input, s);\r
+                               p += 2;\r
+\r
+                               sprintf(s, "Tracks:%d\n", (file.data[p + 0] << 8) | file.data[p + 1]);\r
+                               InputBox_Put_String(cons->input, s);\r
+                               p += 2;\r
+\r
+                               DeltaTimePerQuarterNote = (file.data[p + 0] << 8) | file.data[p + 1];\r
+                               microsTimePerDeltaTime = microsTimePerQuarterNote / DeltaTimePerQuarterNote;\r
+                               sprintf(s, "DeltaTime(per quarter note):%d\n", DeltaTimePerQuarterNote);\r
+                               InputBox_Put_String(cons->input, s);\r
+                               p += 2;\r
+\r
+                               for(; p < file.size; ){\r
+                                       if(strncmp(&file.data[p + 0], "MTrk", 4) == 0){\r
+                                               InputBox_Put_String(cons->input, "Track:\n");\r
+                                               p += 4;\r
+\r
+                                               tracksize = (file.data[p + 0] << 24) | (file.data[p + 1] << 16) | (file.data[p + 2] << 8) | file.data[p + 3];\r
+                                               sprintf(s, "\tsize:0x%X\n", tracksize);\r
+                                               InputBox_Put_String(cons->input, s);\r
+                                               p += 4;\r
+\r
+                                               for(q = 0; q < tracksize; ){\r
+                                                       delta = Console_Command_midi_Convert_VariableLengthValue(&file.data[p + 0], &q);\r
+                                                       sprintf(s, "\t%8d:", delta);\r
+                                                       InputBox_Put_String(cons->input, s);\r
+\r
+                                                       IO_Wait(microsTimePerDeltaTime * delta);\r
+\r
+                                                       if(file.data[p + q + 0] == 0xff){\r
+                                                               InputBox_Put_String(cons->input, "Meta ");\r
+                                                               q++;\r
+                                                               r = file.data[p + q + 0];\r
+                                                               q++;\r
+                                                               datalength = Console_Command_midi_Convert_VariableLengthValue(&file.data[p + 0], &q);\r
+                                                               if(r == 0x00){          //\83V\81[\83P\83\93\83X\94Ô\8d\86\r
+                                                                       sprintf(s, "SequenceNumber size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x01){   //\83e\83L\83X\83g\r
+                                                                       sprintf(s, "TEXT size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x02){   //\92\98\8dì\8c \95\\8e¦\r
+                                                                       sprintf(s, "Copyright size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x03){   //\83g\83\89\83b\83N\96¼\r
+                                                                       sprintf(s, "TrackName size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x04){   //\8ay\8aí\96¼\r
+                                                                       sprintf(s, "InstrumentName size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x05){   //\89Ì\8e\8c\r
+                                                                       sprintf(s, "Lyrics size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x06){   //\83}\81[\83J\81[\r
+                                                                       sprintf(s, "Marker size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x07){   //\83L\83\85\81[\83|\83C\83\93\83g\r
+                                                                       sprintf(s, "QueuePoint size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x08){   //\89¹\90F\81i\83v\83\8d\83O\83\89\83\80\81j\96¼\r
+                                                                       sprintf(s, "ProgramName size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x09){   //\89¹\8c¹\81i\83f\83o\83C\83X\81j\96¼\r
+                                                                       sprintf(s, "DeviceName size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x20){   //MIDI\83`\83\83\83\93\83l\83\8b\83v\83\8a\83t\83B\83b\83N\83X\r
+                                                                       sprintf(s, "MIDIChannelPrefix size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x21){   //\83|\81[\83g\8ew\92è\r
+                                                                       sprintf(s, "OutPutPort size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x2f){   //End of Track\r
+                                                                       sprintf(s, "End of Track size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x51){   //\83e\83\93\83|\90Ý\92è\81i4\95ª\89¹\95\84\82 \82½\82è\82Ì\83}\83C\83N\83\8d\95b\81j\r
+                                                                       microsTimePerQuarterNote = (file.data[p + q + 0] << 16) | (file.data[p + q + 1] << 8) | file.data[p + q + 2];\r
+                                                                       sprintf(s, "Tempo %dmicrosec per quarter note.\n", datalength);\r
+                                                                       microsTimePerDeltaTime = microsTimePerQuarterNote / DeltaTimePerQuarterNote;\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x54){   //SMPTE\83I\83t\83Z\83b\83g\r
+                                                                       sprintf(s, "SMPTE_Offset size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x58){   //\94\8f\8eq\82Ì\90Ý\92è\r
+                                                                       sprintf(s, "Beat size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x59){   //\92²\82Ì\90Ý\92è\r
+                                                                       sprintf(s, "Tone size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else if(r == 0x7f){   //\83V\81[\83P\83\93\83T\93Á\92è\83\81\83^\83C\83x\83\93\83g\r
+                                                                       sprintf(s, "SequencerSpecialMetaEvent size:%d\n", datalength);\r
+                                                                       InputBox_Put_String(cons->input, s);\r
+                                                                       q += datalength;\r
+                                                               } else{\r
+                                                                       InputBox_Put_String(cons->input, "midi:Unknown Meta Event.\n");\r
+                                                                       break;\r
+                                                               }\r
+                                                       } else if((file.data[p + q + 0] & 0xf0) == 0x80){       //note off\r
+                                                               sprintf(s, "Note:Off ch:%d note:%d%s\n", (file.data[p + q + 0] & 0x0f), (int)(file.data[p + q + 1] / 12) - 1, MIDI_Notes[file.data[p + q + 1] % 12]);\r
+                                                               InputBox_Put_String(cons->input, s);\r
+                                                               PIT_Beep_Off();\r
+                                                               q += 3;\r
+                                                       } else if((file.data[p + q + 0] & 0xf0) == 0x90){       //note on or off\r
+                                                               if(file.data[p + q + 2] == 0x00){       //note off\r
+                                                                       sprintf(s, "Note:Off ch:%d note:%d%s\n", (file.data[p + q + 0] & 0x0f), (int)(file.data[p + q + 1] / 12) - 1, MIDI_Notes[file.data[p + q + 1] % 12]);\r
+                                                                       PIT_Beep_Off();\r
+                                                               } else{\r
+                                                                       sprintf(s, "Note:On  ch:%d note:%d%s vel:%d\n", (file.data[p + q + 0] & 0x0f), (int)(file.data[p + q + 1] / 12) - 1, MIDI_Notes[file.data[p + q + 1] % 12], file.data[p + q + 2]);\r
+                                                                       PIT_Beep_On();\r
+                                                                       Console_Command_midi_Beep_Set_NoteNumber(file.data[p + q + 1]);\r
+                                                               }\r
+                                                               InputBox_Put_String(cons->input, s);\r
+                                                               q += 3;\r
+                                                       } else if((file.data[p + q + 0] & 0xf0) == 0xa0){       //Polyphonic Key Pressure\r
+                                                               q += 3;\r
+                                                       } else if((file.data[p + q + 0] & 0xf0) == 0xb0){       //Control Change\r
+                                                               q += 3;\r
+                                                       } else if((file.data[p + q + 0] & 0xf0) == 0xc0){       //Program Change\r
+                                                               q += 2;\r
+                                                       } else if((file.data[p + q + 0] & 0xf0) == 0xd0){       //Channel Pressure\r
+                                                               q += 2;\r
+                                                       } else if((file.data[p + q + 0] & 0xf0) == 0xe0){       //Pitch Bend\r
+                                                               q += 3;\r
+                                                       } else{\r
+                                                               break;\r
+                                                       }\r
+                                               }\r
+                                               PIT_Beep_Off();\r
+                                               p += tracksize;\r
+                                       } else{\r
+                                               InputBox_Put_String(cons->input, "midi:Unknown Track.\n");\r
+                                       }\r
+                               }       \r
+                       } else{\r
+                               InputBox_Put_String(cons->input, "midi:Unknown header.\n");\r
+                       }\r
+               } else{\r
+                       InputBox_Put_String(cons->input, "midi:File load error.\n");\r
+               }\r
+               File_Free(&file);\r
+       } else{\r
+               InputBox_Put_String(cons->input, "midi:File not found.\n");\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+uint Console_Command_midi_Convert_VariableLengthValue(uchar *base, uint *offset)\r
+{\r
+       uint i, r;\r
+\r
+       r = 0;\r
+\r
+       for(i = 0; i < 4; i++){\r
+               r = r << 7;\r
+               r += (base[*offset + i] & 0x7f);\r
+               if((base[*offset + i] & 0x80) == 0){\r
+                       i++;\r
+                       break;\r
+               }\r
+       }\r
+\r
+       *offset += i;\r
+\r
+       return r;\r
+}\r
+\r
+void Console_Command_midi_Beep_Set_NoteNumber(uchar n)\r
+{\r
+       uint fq, oct;\r
+\r
+       fq = 0;\r
+       oct = 0;\r
+\r
+       fq = ToneTable[n % 12];\r
+       oct = n / 12;\r
+\r
+       if(n > 71){     //4\83I\83N\83^\81[\83u\82æ\82è\8fã\r
+               oct = oct - 5;\r
+               fq = fq << oct;\r
+       } else if(n < 60){      //4\83I\83N\83^\81[\83u\82æ\82è\89º\r
+               oct = 5 - oct;\r
+               fq = fq >> oct;\r
+       }\r
+\r
+       PIT_Beep_Set(fq);\r
+\r
+       return;\r
+}\r
+\r
+void Console_Execute(UI_Console *cons)\r
+{\r
+       int n;\r
+       uchar *ext, appname[11];\r
+       uint i;\r
+\r
+       ext = 0;\r
+       for(i = 0; cons->input->input_buf[i] != 0x00; i++){\r
+               if(cons->input->input_buf[i] == '.'){\r
+                       ext = &cons->input->input_buf[i];\r
+               }\r
+       }\r
+\r
+       n = FloppyDisk_Search_File(sysdata->fd_boot, cons->input->input_buf);\r
+       if(n != -1){\r
+               if(ext != 0){\r
+                       if(strcmp(ext, ".chn") == 0){\r
+                               Console_Execute_CHNOSProject(cons, n);\r
+                       } else if(strcmp(ext, ".hrb") == 0){\r
+                               Console_Execute_haribote(cons, n);\r
+                       } else{\r
+                               InputBox_Put_String(cons->input, "Console:Unknown file type.\n");\r
+                       }\r
+               } else{\r
+                       InputBox_Put_String(cons->input, "Console:Unknown file type.\n");\r
+               }\r
+       } else{\r
+               if(ext == 0){   /*\83t\83@\83C\83\8b\82ª\91\8dÝ\82¹\82¸\81A\82©\82Â\8ag\92£\8eq\82ª\82È\82©\82Á\82½\8fê\8d\87\81A.chn\82Å\82 \82é\82Æ\89¼\92è\82·\82é\81B*/\r
+                       sprintf(appname, "        .CHN");\r
+                       for(i = 0; i < 8; i++){\r
+                               if(cons->input->input_buf[i] == 0x00){\r
+                                       break;\r
+                               }\r
+                               appname[i] = cons->input->input_buf[i];\r
+                       }\r
+               }\r
+               n = FloppyDisk_Search_File(sysdata->fd_boot, appname);\r
+               if(n != -1){\r
+                       Console_Execute_CHNOSProject(cons, n);\r
+               } else{\r
+                       InputBox_Put_String(cons->input, "Console:No such File or Application.\n");\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Console_Execute_CHNOSProject(UI_Console *cons, int n)\r
+{\r
+       UI_Task *mytask;\r
+\r
+       mytask = MultiTask_Get_NowTask();\r
+       n = FloppyDisk_Load_File(sysdata->fd_boot, &cons->app_codefile, n);\r
+       if(n != -1){\r
+               cons->app_cs = System_SegmentDescriptor_Set(cons->app_codefile.size - 1, (uint)cons->app_codefile.data, AR_CODE32_ER | AR_USER);\r
+               cons->app_ds = System_SegmentDescriptor_Set(64 * 1024 - 1, (uint)MemoryBlock_Allocate_System(64 * 1024), AR_DATA32_RW | AR_USER);\r
+               if(cons->app_codefile.size >= 8 && strncmp(cons->app_codefile.data + 4, "CHNP", 4) == 0){\r
+                       cons->app_codefile.data[0] = 0xe8;\r
+                       cons->app_codefile.data[1] = 0x16;\r
+                       cons->app_codefile.data[2] = 0x00;\r
+                       cons->app_codefile.data[3] = 0x00;\r
+                       cons->app_codefile.data[4] = 0x00;\r
+                       cons->app_codefile.data[5] = 0xcb;\r
+               }\r
+               APP_Run(0, cons->app_cs << 3, System_SegmentDescriptor_Get_Limit(cons->app_ds) + 1, cons->app_ds << 3, &(mytask->tss.esp0));\r
+               System_SegmentDescriptor_Set_Absolute(cons->app_ds, 0, 0, 0);\r
+               cons->app_ds = 0;\r
+               MemoryBlock_Free((void *)System_SegmentDescriptor_Get_Base(cons->app_ds));\r
+               System_SegmentDescriptor_Set_Absolute(cons->app_cs, 0, 0, 0);\r
+               cons->app_cs = 0;\r
+       } else{\r
+               InputBox_Put_String(cons->input, "Console:Execute.chn:File load error.\n");\r
+       }\r
+       File_Free(&cons->app_codefile);\r
+       return;\r
+}\r
+\r
+void Console_Execute_haribote(UI_Console *cons, int n)\r
+{\r
+       n = FloppyDisk_Load_File(sysdata->fd_boot, &cons->app_codefile, n);\r
+       if(n != -1){\r
+               cons->app_cs = System_SegmentDescriptor_Set(cons->app_codefile.size - 1, (uint)cons->app_codefile.data, AR_CODE32_ER);\r
+               if(cons->app_codefile.size >= 8 && strncmp(cons->app_codefile.data + 4, "Hari", 4) == 0){\r
+                       cons->app_codefile.data[0] = 0xe8;\r
+                       cons->app_codefile.data[1] = 0x16;\r
+                       cons->app_codefile.data[2] = 0x00;\r
+                       cons->app_codefile.data[3] = 0x00;\r
+                       cons->app_codefile.data[4] = 0x00;\r
+                       cons->app_codefile.data[5] = 0xcb;\r
+               }\r
+               FarCall(0, cons->app_cs << 3);\r
+               System_SegmentDescriptor_Set_Absolute(cons->app_cs, 0, 0, 0);\r
+               cons->app_cs = 0;\r
+       } else{\r
+               InputBox_Put_String(cons->input, "Console:Execute.hrb:File load error.\n");\r
+       }\r
+       File_Free(&cons->app_codefile);\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/core.h b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/core.h
new file mode 100644 (file)
index 0000000..91f09ba
--- /dev/null
@@ -0,0 +1,793 @@
+\r
+/*include files*/\r
+#include <stdio.h>\r
+#include <stdarg.h>\r
+#include <math.h>\r
+#include <string.h>\r
+\r
+int rand(void);\r
+#define srand(seed)    (void) (rand_seed = (seed))\r
+extern unsigned int rand_seed;\r
+\r
+/*definemacros*/\r
+#define RGB16(r,g,b) ((r)<<11|(g)<<5|(b))\r
+\r
+/*settings*/\r
+\r
+#include "core_set.h"\r
+\r
+/*new object types*/\r
+typedef enum _bool { false, true} bool;\r
+typedef enum _state_alloc { none, initialized, allocated, configured, inuse} state_alloc;\r
+typedef enum _col_text { black, blue, green, skyblue, red, purple, brown, white} col_text;\r
+typedef enum _timer_mode { once, interval} timer_mode;\r
+typedef enum _mouse_type { threebtn, threebtn_scroll} mouse_type;\r
+typedef enum _mcursor_state { normal, wait} mcursor_state;\r
+typedef unsigned char uchar;\r
+typedef unsigned short ushort;\r
+typedef unsigned int uint;\r
+typedef struct { uint low, high; } uint64;\r
+typedef uchar sector[512];\r
+\r
+/*structures*/\r
+struct SEGMENT_DESCRIPTOR { \r
+       ushort limit_low, base_low;\r
+       uchar base_mid, access_right;\r
+       uchar limit_high, base_high;\r
+};\r
+\r
+struct GATE_DESCRIPTOR { \r
+       ushort offset_low, selector;\r
+       uchar dw_count, access_right;\r
+       ushort offset_high;\r
+};\r
+\r
+struct ACPI_MemoryMapEntry {\r
+       uint64 Base;\r
+       uint64 Length;\r
+       uint Type;\r
+       uint Attribute;\r
+};\r
+\r
+struct BOOTINFO { \r
+       uchar cyls; \r
+       uchar leds; \r
+       uchar vmode; \r
+       uchar reserve;\r
+       ushort scrnx, scrny;\r
+       uchar *vram;\r
+       ushort VESA_Version;\r
+       ushort APM_Version;\r
+       uint ACPI_MemoryMapEntries;\r
+       struct ACPI_MemoryMapEntry ACPI_MemoryMap[16];\r
+       ushort APM_Flags;\r
+};\r
+\r
+struct VESAINFO {/*0xe00--->512byte*/\r
+       ushort  ModeAttributes;\r
+       uchar   WinAAttributes;\r
+       uchar   WinBAttributes;\r
+       ushort  WinGranularity;\r
+       ushort  WinSize;\r
+       ushort  WinASegment;\r
+       ushort  WinBSegment;\r
+       uint    WinFuncPtr;\r
+       ushort  BytesPerScanLine;\r
+       ushort  XResolution;\r
+       ushort  YResolution;\r
+       uchar   XCharSize;\r
+       uchar   YCharSize;\r
+       uchar   NumberOfPlanes;\r
+       uchar   BitsPerPixel;\r
+       uchar   NumberOfBanks;\r
+       uchar   MemoryModel;\r
+       uchar   BankSize;\r
+       uchar   NumberOfImagePages;\r
+       uchar   Reserved;\r
+       uchar   RedMaskSize;\r
+       uchar   RedFieldPosition;\r
+       uchar   GreenMaskSize;\r
+       uchar   GreenFieldPosition;\r
+       uchar   BlueMaskSize;\r
+       uchar   BlueFieldPosition;\r
+       uchar   RsvdMaskSize;\r
+       uchar   RsvdFieldPodition;\r
+       uchar   DirectColorModeInfo;\r
+       uint*   PhysBasePtr;\r
+};\r
+\r
+struct FIFO32 {\r
+       uint *buf;\r
+       uint p, q, size, free, flags;\r
+       struct TASK *task;\r
+};\r
+\r
+struct MEMORY_CONTROL_TAG {\r
+       uint size;\r
+       void *next;\r
+};\r
+\r
+struct MEMORY_CONTROL {\r
+       void *start;\r
+       uint size;\r
+       void *next;\r
+};\r
+\r
+struct POSITION_2D {\r
+       int x, y;\r
+};\r
+\r
+struct KEYINFO {\r
+       uchar c;\r
+       uint keycode;\r
+       bool make;\r
+       bool alphabet;\r
+};\r
+\r
+struct TIMER {\r
+       struct TIMER *next;\r
+       struct TIMER *tree;\r
+       uint timeout;\r
+       uint count;\r
+       struct FIFO32 *fifo;\r
+       uint data;\r
+       state_alloc state;\r
+       timer_mode mode;\r
+};\r
+\r
+struct TIMER_CONTROL {\r
+       uint count;\r
+       struct TIMER *next;\r
+       struct TIMER *ts;\r
+};\r
+\r
+struct MOUSE_EVENT_ARGUMENTS {\r
+       struct SHEET *focus;\r
+       struct POSITION_2D move;\r
+       struct POSITION_2D position_local;\r
+       uint button;\r
+       uint button_before;\r
+};\r
+\r
+struct SHEET {\r
+       void *vram;\r
+       struct POSITION_2D position;\r
+       struct POSITION_2D size;\r
+       uint bpp;\r
+       uint invcol;\r
+       struct SHEET *next;\r
+       struct SHEET *before;\r
+       void (*Refresh)(struct SHEET *sheet, int px0, int py0, int px1, int py1);\r
+       void (*WriteMap)(struct SHEET *sheet, int x0, int y0, int x1, int y1);\r
+       bool visible;\r
+       bool mouse_movable;\r
+       struct SHEET_CONTROL *myctrl;\r
+       void (*MouseEventProcedure)(struct MOUSE_EVENT_ARGUMENTS *e);\r
+       uint msignal_flags;\r
+       struct FIFO32 *fifo;\r
+       uint ksignal_flags;\r
+};\r
+\r
+struct SHEET_CONTROL {\r
+       void *mainvram;\r
+       uint *map;\r
+       struct POSITION_2D mainvramsize;\r
+       uint mainvrambpp;\r
+       struct SHEET base;\r
+       uint sheets;\r
+       struct MEMORY_CONTROL *memctrl;\r
+};\r
+\r
+struct UI_INPUTBOX {\r
+       struct SHEET *sheet;\r
+       uint forecol, backcol;\r
+       uchar *input_buf;\r
+       uint input_buf_size;\r
+       uint input_count;\r
+       struct POSITION_2D cursor;\r
+       struct POSITION_2D prompt;\r
+       bool cursor_state;\r
+       bool record;\r
+};\r
+\r
+struct MOUSE_DECODE {\r
+       uint buf[4], scroll;\r
+       struct POSITION_2D move;\r
+       int btn;\r
+       mouse_type type;\r
+       uchar phase; \r
+};\r
+\r
+struct UI_MOUSE_CURSOR {\r
+       struct SHEET *sheet;\r
+       struct POSITION_2D position;\r
+       struct POSITION_2D move_range0;\r
+       struct POSITION_2D move_range1;\r
+       mcursor_state state;\r
+};\r
+\r
+struct DATA_CPU_IDENTITY {\r
+       bool enable;\r
+       uint max;\r
+       uchar vendor[13];\r
+       bool ext_enable;\r
+       uint ext_max;\r
+       uchar brand_string[48];\r
+       bool FPU;\r
+       bool VME;\r
+       bool DE;\r
+       bool PSE;\r
+       bool TSC;\r
+       bool MSR;\r
+       bool PAE;\r
+       bool MCE;\r
+       bool CX8;\r
+       bool APIC;\r
+       bool SEP;\r
+       bool MTRR;\r
+       bool PGE;\r
+       bool MCA;\r
+       bool CMOV;\r
+       bool PAT;\r
+       bool PSE36;\r
+       bool PSN;\r
+       bool CLFSH;\r
+       bool DS;\r
+       bool ACPI;\r
+       bool MMX;\r
+       bool FXSR;\r
+       bool SSE;\r
+       bool SSE2;\r
+       bool SS;\r
+       bool HTT;\r
+       bool TM;\r
+       bool PBE;\r
+\r
+       bool SSE3;\r
+       bool MONITOR;\r
+       bool DSCPL;\r
+       bool EST;\r
+       bool TM2;\r
+       bool CID;\r
+       bool CX16;\r
+       bool xTPR;\r
+       \r
+};\r
+\r
+struct MEMORY_BLOCK {\r
+       void *addr;\r
+       uint size;\r
+       struct MEMORY_BLOCK *next;\r
+       struct MEMORY_CONTROL *ctrl;\r
+       uchar description[MEMORY_DESCRIPTION_LENGTH];\r
+};\r
+\r
+struct TASK_STATUS_SEGMENT {\r
+       ushort backlink, reserve00;\r
+       uint esp0;\r
+       ushort ss0, reserve01;\r
+       uint esp1;\r
+       ushort ss1, reserve02;\r
+       uint esp2;\r
+       ushort ss2, reserve03;\r
+       uint cr3;\r
+       uint eip;\r
+       uint eflags;\r
+       uint eax;\r
+       uint ecx;\r
+       uint edx;\r
+       uint ebx;\r
+       uint esp;\r
+       uint ebp;\r
+       uint esi;\r
+       uint edi;\r
+       ushort es, reserve04;\r
+       ushort cs, reserve05;\r
+       ushort ss, reserve06;\r
+       ushort ds, reserve07;\r
+       ushort fs, reserve08;\r
+       ushort gs, reserve09;\r
+       ushort ldtr, reserve10;\r
+       ushort flags, iomap;\r
+};\r
+\r
+struct TASK_CONTROL {\r
+       struct TASK *now, *main, *idle, *next;\r
+       struct TIMER *ts;\r
+};\r
+\r
+struct TASK {\r
+       struct TASK_STATUS_SEGMENT tss;\r
+       uint selector;\r
+       uchar description[TASK_DESCRIPTION_LENGTH];\r
+       uint quantum;\r
+       uint cputime;\r
+       struct TASK *next;\r
+       state_alloc state;\r
+       struct CONSOLE *cons;\r
+};\r
+\r
+struct LISTENER {\r
+       struct LISTENER *next;\r
+       struct FIFO32 *fifo;\r
+       uint flags;\r
+       uint offset;\r
+};\r
+\r
+struct DEVICE_FLOPPYDISK {\r
+       uchar *img;\r
+       struct DEVICE_FLOPPYDISK_RDE {\r
+               uchar name[8];          //0x00:empty\r
+                                       //0x05:=0xe5\r
+                                       //0x2e:(only directory)\r
+                                       //.     0x2e:current directory\r
+                                       //..    0x2e, 0x2e:parent directory\r
+                                       //0xe5:deleted(usable)\r
+               uchar ext[3];\r
+               uchar attribute;        //bit0:readonly\r
+                                       //bit1:hidden\r
+                                       //bit2:system\r
+                                       //bit3:volumelabel\r
+                                       //bit4:directory\r
+                                       //bit5:archive\r
+                                       //0x0f=LongFileNameEntry\r
+               uchar reserve;\r
+               uchar VFAT_createTimeMs;\r
+               ushort VFAT_createTime;\r
+               ushort VFAT_createDate;\r
+               ushort VFAT_accessDate;\r
+               ushort VFAT_clusterHighWord;\r
+               ushort updatetime;      //0 -4 bit:second/2\r
+                                       //5 -10bit:minute\r
+                                       //11-15bit:hour\r
+               ushort updatedate;      //0 -4 bit:day(1-31) \r
+                                       //5 -8 bit:month(1-12)\r
+                                       //9 -15bit:year(from 1980)\r
+               ushort cluster;\r
+               uint size;\r
+       } *files;\r
+       sector *userdataarea;\r
+       void *fat;\r
+};\r
+\r
+struct FILEINFO {\r
+       uchar *data;\r
+       uint size;\r
+       uchar name[13];\r
+};\r
+\r
+struct WINDOW {\r
+       struct SHEET *client;\r
+       struct SHEET *control;\r
+       uchar title[WINDOW_TITLE_LENGTH];\r
+       struct WINDOW *next;\r
+};\r
+\r
+struct CONSOLE {\r
+       struct WINDOW *win;\r
+       struct UI_INPUTBOX *input;\r
+       struct CONSOLE *next;\r
+       struct FIFO32 fifo;\r
+       struct TIMER *ctimer;\r
+       struct FILEINFO app_codefile;\r
+       ushort app_cs;\r
+       ushort app_ds;\r
+};\r
+\r
+struct SYSTEM_COMMON_DATA {\r
+       struct BOOTINFO *bootinfo;\r
+       struct VESAINFO *vesainfo;\r
+       struct TASK *maintask;\r
+       struct FIFO32 sysfifo;\r
+       struct TASK *keyctrltask;\r
+       struct FIFO32 keyboardfifo;\r
+       struct FIFO32 keycmdfifo;\r
+       int keycmd_wait;\r
+       struct TASK *mousectrltask;\r
+       struct FIFO32 mousefifo;\r
+       struct MOUSE_DECODE mousedecode;\r
+       struct UI_MOUSE_CURSOR mouse_cursor;\r
+       struct SHEET *focus;\r
+       struct SHEET *key_focus;\r
+       struct WINDOW windowctrl;\r
+       struct CONSOLE consctrl;\r
+       struct DEVICE_FLOPPYDISK *fd_boot;\r
+};\r
+\r
+/*typedef structures*/\r
+typedef struct SEGMENT_DESCRIPTOR      IO_SegmentDescriptor;\r
+typedef struct GATE_DESCRIPTOR         IO_GateDescriptor;\r
+typedef struct BOOTINFO                        DATA_BootInfo;\r
+typedef struct VESAINFO                        DATA_VESAInfo;\r
+typedef struct FIFO32                  DATA_FIFO;\r
+typedef struct MEMORY_CONTROL_TAG      IO_MemoryControlTag;\r
+typedef struct MEMORY_CONTROL          IO_MemoryControl;\r
+typedef struct POSITION_2D             DATA_Position2D;\r
+typedef struct UI_INPUTBOX             UI_InputBox;\r
+typedef struct KEYINFO                 UI_KeyInfo;\r
+typedef struct TIMER_CONTROL           UI_TimerControl;\r
+typedef struct TIMER                   UI_Timer;\r
+typedef struct SHEET_CONTROL           UI_Sheet_Control;\r
+typedef struct SHEET                   UI_Sheet;\r
+typedef struct MOUSE_DECODE            UI_MouseInfo;\r
+typedef struct UI_MOUSE_CURSOR         UI_MouseCursor;\r
+typedef struct DATA_CPU_IDENTITY       DATA_CPUID;\r
+typedef struct MEMORY_BLOCK            Memory;\r
+typedef struct TASK_STATUS_SEGMENT     IO_TaskStatusSegment;\r
+typedef struct TASK_CONTROL            UI_TaskControl;\r
+typedef struct TASK                    UI_Task;\r
+typedef struct LISTENER                        UI_Listener;\r
+typedef struct DEVICE_FLOPPYDISK_RDE   IO_FloppyDisk_RootDirectoryEntry;\r
+typedef struct DEVICE_FLOPPYDISK       IO_FloppyDisk;\r
+typedef struct FILEINFO                        IO_File;\r
+typedef struct WINDOW                  UI_Window;\r
+typedef struct MOUSE_EVENT_ARGUMENTS   UI_MouseEventArguments;\r
+typedef struct CONSOLE                 UI_Console;\r
+typedef struct SYSTEM_COMMON_DATA      System_CommonData;\r
+\r
+/*virtual classes*/\r
+\r
+/*externs*/\r
+extern uchar hankaku[4096];\r
+extern UI_Sheet_Control sys_sheet_ctrl;\r
+extern IO_MemoryControl sys_mem_ctrl;\r
+extern Memory SystemMemory;\r
+extern UI_TaskControl *taskctrl;\r
+extern uint *ADR_Paging_Directory;\r
+extern uchar *ACPI_MemoryMap_Type[5];\r
+\r
+/*functions*/\r
+/*api.c API\8f\88\97\9d*/\r
+uint *API_Execute(uint edi, uint esi, uint ebp, uint esp, uint ebx, uint edx, uint ecx, uint eax);\r
+\r
+/*bootpack.c \8aî\8a²\95\94\95ª*/\r
+void CHNOS_KeyboardControlTask(void);\r
+void CHNOS_MouseControlTask(void);\r
+void CHNOS_UI_KeyFocus_Change(UI_Sheet *focus_new);\r
+\r
+/*console.c*/\r
+void Initialise_Console(UI_Console *consctrl, System_CommonData *systemdata);\r
+UI_Console *Console_Create(uint xchars, uint ychars);\r
+void Console_MainTask(UI_Console *cons);\r
+void Console_Command_memmap(UI_Console *cons);\r
+void Console_Command_memblock(UI_Console *cons);\r
+void Console_Command_mem(UI_Console *cons);\r
+void Console_Command_systeminfo(UI_Console *cons);\r
+void Console_Command_task(UI_Console *cons);\r
+void Console_Command_window(UI_Console *cons);\r
+void Console_Command_console(UI_Console *cons);\r
+void Console_Command_type(UI_Console *cons, const uchar filename[]);\r
+void Console_Command_dir(UI_Console *cons);\r
+void Console_Command_gdt(UI_Console *cons);\r
+void Console_Command_midi(UI_Console *cons, const uchar filename[]);\r
+uint Console_Command_midi_Convert_VariableLengthValue(uchar *base, uint *offset);\r
+void Console_Command_midi_Beep_Set_NoteNumber(uchar n);\r
+void Console_Execute(UI_Console *cons);\r
+void Console_Execute_CHNOSProject(UI_Console *cons, int n);\r
+void Console_Execute_haribote(UI_Console *cons, int n);\r
+\r
+/*cpuid.c*/\r
+void CPU_Identify(DATA_CPUID *id);\r
+\r
+/*dsctbl.c \83f\83B\83X\83N\83\8a\83v\83^\81[\81E\83e\81[\83u\83\8b\8aÖ\98A*/\r
+void Initialise_GlobalDescriptorTable(void);\r
+void Initialise_InterruptDescriptorTable(void);\r
+void SegmentDescriptor_Set(IO_SegmentDescriptor *seg_desc, uint limit, uint base, uint ar);\r
+uint SegmentDescriptor_Get_Base(IO_SegmentDescriptor *seg_desc);\r
+uint SegmentDescriptor_Get_Limit(IO_SegmentDescriptor *seg_desc);\r
+uint SegmentDescriptor_Get_AccessRight(IO_SegmentDescriptor *seg_desc);\r
+void GateDescriptor_Set(IO_GateDescriptor *gate_desc, uint offset, uint selector, uint ar);\r
+void System_SegmentDescriptor_Set_Absolute(uint selector, uint limit, uint base, uint ar);\r
+uint System_SegmentDescriptor_Get_Base(uint selector);\r
+uint System_SegmentDescriptor_Get_Limit(uint selector);\r
+uint System_SegmentDescriptor_Get_AccessRight(uint selector);\r
+uint System_SegmentDescriptor_Set(uint limit, int base, int ar);\r
+void System_GateDescriptor_Set(uint irq, uint offset, uint selector, uint ar);\r
+\r
+/*fifo.c FIFO\83o\83b\83t\83@\8aÖ\98A*/\r
+int FIFO32_Initialise(DATA_FIFO *fifo, uint size);\r
+int FIFO32_Put(DATA_FIFO *fifo, uint data);\r
+int FIFO32_Put_Arguments(DATA_FIFO *fifo, uint args, ...);\r
+void FIFO32_Set_Task(DATA_FIFO *fifo, UI_Task *task);\r
+uint FIFO32_Get(DATA_FIFO *fifo);\r
+uint FIFO32_Status(DATA_FIFO *fifo);\r
+int FIFO32_Free(DATA_FIFO *fifo);\r
+\r
+/*file.c \83t\83@\83C\83\8b\8aÖ\98A*/\r
+IO_FloppyDisk *FloppyDisk_Initialise(void *img);\r
+int FloppyDisk_Search_File(IO_FloppyDisk *fd, const uchar *name);\r
+int FloppyDisk_Load_File(IO_FloppyDisk *fd, IO_File *fileinfo, int fileno);\r
+int File_Free(IO_File *fileinfo);\r
+void FloppyDisk_Decode_FAT16(uchar *img, ushort *fat, bool backup);\r
+\r
+/*grap_08.c*/\r
+void Draw_Put_Font_08(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);\r
+void Draw_Put_String_08(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);\r
+void Draw_Fill_Rectangle_08(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void Draw_Slide_Line_08(void *vram, uint xsize, uint ysize, uint vxsize, uint px, uint py);\r
+void Draw_Initialise_Palette(void);\r
+void Draw_Set_Palette(int start, int end, uchar *rgb);\r
+/*grap_16.c*/\r
+void Draw_Put_Font_16(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);\r
+void Draw_Put_String_16(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);\r
+void Draw_Fill_Rectangle_16(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void Draw_Slide_Line_16(void *vram, uint xsize, uint ysize, uint vxsize, uint px, uint py);\r
+/*grap_32.c*/\r
+void Draw_Put_Font_32(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);\r
+void Draw_Put_String_32(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);\r
+void Draw_Fill_Rectangle_32(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void Draw_Slide_Line_32(void *vram, uint xsize, uint ysize, uint vxsize, uint px, uint py);\r
+/*graphic.c*/\r
+void Initialise_Graphic(uint bpp);\r
+uchar RGB_32_To_08(uint c32);\r
+uchar RGB_32_To_08_xy(uint c32, int x, int y);\r
+ushort RGB_32_To_16(uint c32);\r
+extern void (*Draw_Put_String)(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);\r
+extern void (*Draw_Fill_Rectangle)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+extern void (*Draw_Slide_Line)(void *vram, uint xsize, uint ysize, uint vxsize, uint px, uint py);\r
+void Emergency_Out_Reset(void);\r
+int Emergency_Out(const uchar *format, ...);\r
+\r
+/*init.c*/\r
+void Initialise_System(System_CommonData *systemdata);\r
+\r
+/*inputbox.c*/\r
+UI_InputBox *InputBox_Initialise(UI_Sheet_Control *sheetctrl, IO_MemoryControl *memctrl, uint x, uint y, uint xsize, uint ysize, uint txtbufsize, uint forecol, uint backcol, uint height);\r
+int InputBox_Put_String(UI_InputBox *box, const uchar *s);\r
+int InputBox_Put_Character(UI_InputBox *box, uchar c);\r
+void InputBox_Put_String_Main(UI_InputBox *box, const uchar *str);\r
+void InputBox_Check_NewLine(UI_InputBox *box);\r
+void InputBox_NewLine_No_Prompt(UI_InputBox *box);\r
+void InputBox_NewLine(UI_InputBox *box);\r
+void InputBox_Slide_Line(UI_InputBox *box);\r
+void InputBox_Slide_Line(UI_InputBox *box);\r
+void InputBox_Put_Prompt(UI_InputBox *box);\r
+void InputBox_Reset_Input_Buffer(UI_InputBox *box);\r
+void InputBox_Change_Cursor_State(UI_InputBox *box);\r
+void InputBox_Clear(UI_InputBox *box);\r
+void InputBox_Set_Record(UI_InputBox *box, bool record);\r
+\r
+/*intrpt.c \8a\84\82è\8d\9e\82Ý\90Ý\92è\82Æ\82Ç\82±\82É\82à\91®\82³\82È\82¢\8a\84\82è\8d\9e\82Ý\83n\83\93\83h\83\89\81[*/\r
+void Initialise_ProgrammableInterruptController(void);\r
+void InterruptHandler27(int *esp);\r
+\r
+/*io.c*/\r
+uchar IO_Read_CMOS(uchar addr);\r
+void IO_Beep(uint fq, uint microsec);\r
+void IO_Wait(uint microsec);\r
+\r
+/*keyboard.c*/\r
+void Initialise_Keyboard(DATA_FIFO *sendto, DATA_FIFO *keycmd, uint offset, uint leds, int *keycmd_wait);\r
+void InterruptHandler21(int *esp);\r
+void Keyboard_Decode(UI_KeyInfo *info, uint data);\r
+void Keyboard_KeyLock(uint led);\r
+void Keyboard_Controller_Wait_SendReady(void);\r
+uint Keyboard_Get_KeyShift(void);\r
+\r
+/*memblock.c \83\81\83\82\83\8a\8aÖ\98A*/\r
+void Initialise_MemoryBlock(IO_MemoryControl *mainctrl);\r
+void *MemoryBlock_Allocate_System(uint size);\r
+void *MemoryBlock_Allocate_User(uint size, IO_MemoryControl *ctrl);\r
+Memory *MemoryBlock_Verify(void *addr);\r
+int MemoryBlock_Write_Description(void *addr, const uchar *description);\r
+int MemoryBlock_Free(void *addr);\r
+\r
+\r
+/*memory.c \83\81\83\82\83\8a\8aÖ\98A*/\r
+uint Memory_Test(uint start, uint end);\r
+void MemoryControl_Initialise(IO_MemoryControl *ctrl, void *start, uint size);\r
+uint MemoryControl_FreeSize(IO_MemoryControl *ctrl);\r
+void *MemoryControl_Allocate(IO_MemoryControl *ctrl, uint size);\r
+int MemoryControl_Free(IO_MemoryControl *ctrl, void *addr0, uint size);\r
+void *MemoryControl_Allocate_Page(IO_MemoryControl *ctrl);\r
+void MemoryControl_Output_Info(IO_MemoryControl *ctrl);\r
+void System_MemoryControl_Initialise(void);\r
+uint System_MemoryControl_FullSize(void);\r
+uint System_MemoryControl_FreeSize(void);\r
+void *System_MemoryControl_Allocate(uint size);\r
+int System_MemoryControl_Free(void *addr0, uint size);\r
+void *System_MemoryControl_Allocate_Page(void);\r
+void System_MemoryControl_Output_Info(void);\r
+\r
+/*mouse.c \83}\83E\83X\8aÖ\98A*/\r
+extern uchar mcursor_pattern0[24][24];\r
+void Initialise_Mouse(DATA_FIFO *sendto, uint offset, UI_MouseInfo *decode);\r
+void InterruptHandler2c(int *esp);\r
+int Mouse_Decode(uint data);\r
+void Mouse_Send_Command(uint data);\r
+void Mouse_Make_MouseCursor(UI_MouseCursor *cursor, int rangex0, int rangey0, int rangex1, int rangey1, uint height);\r
+void Mouse_Draw_MouseCursor(UI_MouseCursor *cursor, mcursor_state state);\r
+void Mouse_Move_Relative(UI_MouseCursor *cursor, int movex, int movey);\r
+void Mouse_Move_Absolute(UI_MouseCursor *cursor, int px, int py);\r
+\r
+/*mtask.c \83}\83\8b\83`\83^\83X\83N\8aÖ\98A*/\r
+void Initialise_MultiTask(void);\r
+UI_Task *MultiTask_Task_Get(const uchar *description);\r
+void MultiTask_Task_Change_Quantum(UI_Task *task, uint quantum);\r
+void MultiTask_Task_Run(UI_Task *task);\r
+void MultiTask_Task_Sleep(UI_Task *task);\r
+void MultiTask_Task_Remove(UI_Task *task);\r
+void MultiTask_Task_Arguments(UI_Task *task, int args, ...);\r
+void MultiTask_TaskSwitch(void);\r
+UI_Task *MultiTask_Get_NowTask(void);\r
+void MultiTask_IdleTask(void);\r
+\r
+/*paging.c \83y\81[\83W\83\93\83O\8aÖ\98A*/\r
+void Initialise_Paging(void *vram, uint xsize, uint ysize, uint bpp);\r
+void Paging_Set_Entry_Directory(uint *dir_entry, uint *table_base, uint attribute, uint available);\r
+void Paging_Set_Entry_Table(uint *table_entry, uint *page_base, uint attribute, uint available);\r
+uint *Paging_Get_Entry_Setting_Address(uint entry);\r
+\r
+/*serial.c \83V\83\8a\83A\83\8b\92Ê\90M\8aÖ\98A*/\r
+void Initialise_SerialPort(void);\r
+void Send_SerialPort(uchar *s);\r
+int debug(const uchar *format, ...);\r
+\r
+/*sheet.c \83V\81[\83g\8aÖ\98A*/\r
+void Sheet_Initialise(UI_Sheet_Control *sheetctrl, IO_MemoryControl *memctrl, void *vram, uint xsize, uint ysize, uint bpp);\r
+UI_Sheet *Sheet_Get(UI_Sheet_Control *ctrl, uint xsize, uint ysize, uint bpp, uint invcol);\r
+uint Sheet_Show(UI_Sheet *sheet, int px, int py, uint height);\r
+void Sheet_Set_Movable(UI_Sheet *sheet, bool movable);\r
+void Sheet_Set_MouseEventProcedure(UI_Sheet *sheet, void (*procedure)(UI_MouseEventArguments *e), uint flags);\r
+void Sheet_Set_FIFO(UI_Sheet *sheet, DATA_FIFO *fifo, uint flags);\r
+void Sheet_Slide(UI_Sheet *sheet, int px, int py);\r
+uint Sheet_UpDown(UI_Sheet *sheet, uint height);\r
+void Sheet_Remove(UI_Sheet *sheet);\r
+void Sheet_Refresh_Map(UI_Sheet *sheet, int x0, int y0, int x1, int y1);\r
+void Sheet_Write_Map_32(UI_Sheet *sheet, int x0, int y0, int x1, int y1);\r
+void Sheet_Write_Map_16(UI_Sheet *sheet, int x0, int y0, int x1, int y1);\r
+void Sheet_Write_Map_08(UI_Sheet *sheet, int x0, int y0, int x1, int y1);\r
+void Sheet_Write_Map_NoInvisible(UI_Sheet *sheet, int x0, int y0, int x1, int y1);\r
+void Sheet_Refresh_All(UI_Sheet *sheet0, UI_Sheet *sheet1, int x0, int y0, int x1, int y1);\r
+void Sheet_Refresh_32from32(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+void Sheet_Refresh_16from32(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+void Sheet_Refresh_08from32(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+void Sheet_Refresh_16from16(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+void Sheet_Refresh_08from08(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+void Sheet_Refresh_Invalid(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+void Sheet_Draw_Put_String(UI_Sheet *sheet, uint x, uint y, uint c, const uchar *s);\r
+void Sheet_Draw_Put_String_With_BackColor(UI_Sheet *sheet, uint x, uint y, uint c, uint bc, const uchar *s);\r
+void Sheet_Draw_Fill_Rectangle(UI_Sheet *sheet, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void Sheet_Draw_Fill_Rectangle_Gradation_Vertical(UI_Sheet *sheet, uint c0, uint c1, uint x0, uint y0, uint x1, uint y1);\r
+void Sheet_Draw_Point(UI_Sheet *sheet, uint c, uint x, uint y);\r
+void System_Sheet_Initialise(void *vram, uint xsize, uint ysize, uint bpp);\r
+UI_Sheet *System_Sheet_Get(uint xsize, uint ysize, uint bpp, uint invcol);\r
+UI_Sheet *Sheet_Get_From_Position(UI_Sheet_Control *ctrl, int x, int y);\r
+uint Sheet_Get_Top_Of_Height(UI_Sheet_Control *ctrl);\r
+uint System_Sheet_Get_Top_Of_Height(void);\r
+\r
+/*timer.c \83^\83C\83}\81[\8aÖ\98A*/\r
+void Initialise_ProgrammableIntervalTimer(void);\r
+void InterruptHandler20(int *esp);\r
+uint Timer_Get_Tick(void);\r
+UI_Timer *Timer_Get(DATA_FIFO *fifo, uint data);\r
+void Timer_Set(UI_Timer *timer, uint count, timer_mode mode);\r
+void Timer_Run(UI_Timer *timer);\r
+void Timer_Cancel(UI_Timer *timer);\r
+void Timer_TaskSwitch_Set(UI_Timer *ts);\r
+\r
+/*window.c \83E\83B\83\93\83h\83E\8aÖ\98A*/\r
+void Initialise_Window(UI_Window *windowctrl);\r
+UI_Window *Window_Create(const uchar *title, uint flags, uint xsize, uint ysize);\r
+UI_Window *Window_Create_User(const uchar *title, uint flags, UI_Sheet *client);\r
+UI_Window *Window_Get_From_Sheet(UI_Sheet *sheet);\r
+void Window_Control_MouseEventProcedure(UI_MouseEventArguments *e);\r
+void Window_Draw_CloseButton(UI_Window *win, bool pressed);\r
+\r
+/*xception.c CPU\97á\8aO\8aÖ\98A*/\r
+void CPU_Exception_Abort(int exception, int *esp);\r
+uint *CPU_Exception_Fault(int exception, int *esp);\r
+void CPU_ExceptionHandler00(int *esp);\r
+void CPU_ExceptionHandler01(int *esp);\r
+void CPU_ExceptionHandler02(int *esp);\r
+void CPU_ExceptionHandler03(int *esp);\r
+void CPU_ExceptionHandler04(int *esp);\r
+void CPU_ExceptionHandler05(int *esp);\r
+void CPU_ExceptionHandler06(int *esp);\r
+void CPU_ExceptionHandler07(int *esp);\r
+void CPU_ExceptionHandler08(int *esp);\r
+void CPU_ExceptionHandler09(int *esp);\r
+void CPU_ExceptionHandler0a(int *esp);\r
+void CPU_ExceptionHandler0b(int *esp);\r
+void CPU_ExceptionHandler0c(int *esp);\r
+uint *CPU_ExceptionHandler0d(int *esp);\r
+void CPU_ExceptionHandler0e(int *esp);\r
+void CPU_ExceptionHandler0f(int *esp);\r
+void CPU_ExceptionHandler10(int *esp);\r
+void CPU_ExceptionHandler11(int *esp);\r
+void CPU_ExceptionHandler12(int *esp);\r
+void CPU_ExceptionHandler13(int *esp);\r
+void CPU_ExceptionHandler14(int *esp);\r
+void CPU_ExceptionHandler15(int *esp);\r
+void CPU_ExceptionHandler16(int *esp);\r
+void CPU_ExceptionHandler17(int *esp);\r
+void CPU_ExceptionHandler18(int *esp);\r
+void CPU_ExceptionHandler19(int *esp);\r
+void CPU_ExceptionHandler1a(int *esp);\r
+void CPU_ExceptionHandler1b(int *esp);\r
+void CPU_ExceptionHandler1c(int *esp);\r
+void CPU_ExceptionHandler1d(int *esp);\r
+void CPU_ExceptionHandler1e(int *esp);\r
+void CPU_ExceptionHandler1f(int *esp);\r
+\r
+/*nasfunc0.nas \91¼\82Ì\8aÖ\90\94\82É\91S\82­\88Ë\91\82µ\82È\82¢\83A\83Z\83\93\83u\83\89\8aÖ\90\94\8cQ*/\r
+void IO_HLT(void);                     //CPU\82ð\92â\8e~\82³\82¹\82é\81B\8a\84\82è\8d\9e\82Ý\82ª\82 \82é\82Æ\8dÄ\8aJ\82·\82é\81B\93Á\8c \96½\97ß\81B\r
+void IO_CLI(void);                     //CPU\82Ö\82Ì\8aO\95\94\8a\84\82è\8d\9e\82Ý\82ð\92â\8e~\82³\82¹\82é\81B\93Á\8c \96½\97ß\81BNMI\82Æ\97á\8aO\82É\82Í\8cø\82©\82È\82¢\81B\r
+void IO_STI(void);                     //CPU\82Ö\82Ì\8aO\95\94\8a\84\82è\8d\9e\82Ý\82ð\8dÄ\8aJ\82³\82¹\82é\81B\93Á\8c \96½\97ß\81B\r
+void IO_STIHLT(void);                  //CPU\82Ö\82Ì\8aO\95\94\8a\84\82è\8d\9e\82Ý\82ð\8dÄ\8aJ\82³\82¹\82½\8cã\81ACPU\82ð\92â\8e~\82³\82¹\82é\81Bsti\82Æhlt\82Ì\8aÔ\82É\94­\90\82·\82é\8a\84\82è\8d\9e\82Ý\82Ö\82Ì\91Î\8dô\81B\81B\r
+uint IO_In8(uint port);                        //port\94Ô\82ÌI/O\83|\81[\83g\82©\82ç\83f\81[\83^\82ð\83o\83C\83g\92P\88Ê\82Å\8eó\82¯\8eæ\82é\81B\96ß\82è\92l\82Í\8eó\82¯\8eæ\82Á\82½\83f\81[\83^\81BI/O\93Á\8c \96½\97ß\81B\r
+void IO_Out8(uint port, uint data);    //port\94Ô\82ÌI/O\83|\81[\83g\82Édata\82ð\83o\83C\83g\92P\88Ê\82Å\8fo\97Í\82·\82é\81BI/O\93Á\8c \96½\97ß\81B\r
+uint IO_In16(uint port);               //port\94Ô\82ÌI/O\83|\81[\83g\82©\82ç\83f\81[\83^\82ð\83\8f\81[\83h\92P\88Ê\82Å\8eó\82¯\8eæ\82é\81B\96ß\82è\92l\82Í\8eó\82¯\8eæ\82Á\82½\83f\81[\83^\81BI/O\93Á\8c \96½\97ß\81B\r
+void IO_Out16(uint port, uint data);   //port\94Ô\82ÌI/O\83|\81[\83g\82Édata\82ð\83\8f\81[\83h\92P\88Ê\82Å\8fo\97Í\82·\82é\81BI/O\93Á\8c \96½\97ß\81B\r
+uint IO_In32(uint port);               //port\94Ô\82ÌI/O\83|\81[\83g\82©\82ç\83f\81[\83^\82ð\83_\83u\83\8b\83\8f\81[\83h\92P\88Ê\82Å\8eó\82¯\8eæ\82é\81B\96ß\82è\92l\82Í\8eó\82¯\8eæ\82Á\82½\83f\81[\83^\81BI/O\93Á\8c \96½\97ß\81B\r
+void IO_Out32(uint port, uint data);   //port\94Ô\82ÌI/O\83|\81[\83g\82Édata\82ð\83_\83u\83\8b\83\8f\81[\83h\92P\88Ê\82Å\8fo\97Í\82·\82é\81BI/O\93Á\8c \96½\97ß\81B\r
+uint IO_Load_EFlags(void);             //EFLAGS\83\8c\83W\83X\83^\82ð\93Ç\82Ý\8d\9e\82Þ\81B\r
+void IO_Store_EFlags(uint eflags);     //EFLAGS\83\8c\83W\83X\83^\82ðeflags\82É\95Ï\8dX\82·\82é\81B\r
+uint Load_CR0(void);                   //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^0\82ð\93Ç\82Ý\8d\9e\82Þ\81B\93Á\8c \96½\97ß\81B\r
+void Store_CR0(uint cr0);              //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^0\82ðcr0\82É\95Ï\8dX\82·\82é\81B\93Á\8c \96½\97ß\81B\r
+uint Load_CR2(void);                   //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^2\82ð\93Ç\82Ý\8d\9e\82Þ\81B\93Á\8c \96½\97ß\81B\r
+void Store_CR2(uint cr2);              //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^2\82ðcr2\82É\95Ï\8dX\82·\82é\81B\93Á\8c \96½\97ß\81B\r
+uint Load_CR3(void);                   //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^3\82ð\93Ç\82Ý\8d\9e\82Þ\81B\93Á\8c \96½\97ß\81B\r
+void Store_CR3(uint cr3);              //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^3\82ðcr3\82É\95Ï\8dX\82·\82é\81B\93Á\8c \96½\97ß\81B\r
+uint Load_CR4(void);                   //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^4\82ð\93Ç\82Ý\8d\9e\82Þ\81B\93Á\8c \96½\97ß\81B\r
+void Store_CR4(uint cr4);              //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^4\82ðcr4\82É\95Ï\8dX\82·\82é\81B\93Á\8c \96½\97ß\81B\r
+void Load_GDTR(uint limit, uint addr); //\83O\83\8d\81[\83o\83\8b\81E\83f\83B\83X\83N\83\8a\83v\83^\81E\83e\81[\83u\83\8b\81E\83\8c\83W\83X\83^(GDTR)\82É\81Aaddr\82©\82çlimit\82Ì\94Í\88Í\82ðGDT\82Æ\82µ\82Ä\83\8d\81[\83h\82³\82¹\82é\81B\93Á\8c \96½\97ß\81B\r
+void Load_IDTR(uint limit, uint addr); //\83C\83\93\83^\83\89\83v\83g\81E\83f\83B\83X\83N\83\8a\83v\83^\81E\83e\81[\83u\83\8b\81E\83\8c\83W\83X\83^(IDTR)\82É\81Aaddr\82©\82çlimit\82Ì\94Í\88Í\82ðIDT\82Æ\82µ\82Ä\83\8d\81[\83h\82³\82¹\82é\81B\93Á\8c \96½\97ß\81B\r
+void Load_TR(uint tr);                 //\83Z\83O\83\81\83\93\83g\81E\83Z\83\8c\83N\83^tr\82ð\81A\83^\83X\83N\83\8c\83W\83X\83^\82É\8c»\8dÝ\82Ì\83^\83X\83N\82Æ\82µ\82Ä\83\8d\81[\83h\82³\82¹\82é\81B\93Á\8c \96½\97ß\81B\r
+void FarJMP(uint eip, uint cs);                //\8c»\8dÝ\82Ì\83Z\83O\83\81\83\93\83g\82Æ\82Í\88Ù\82È\82é\83Z\83O\83\81\83\93\83gcs\82Ì\83I\83t\83Z\83b\83geip\82É\83v\83\8d\83O\83\89\83\80\82Ì\90§\8cä\82ð\88Ú\82·\81B\r
+void FarCall(uint eip, uint cs);       //\8c»\8dÝ\82Ì\83Z\83O\83\81\83\93\83g\82Æ\82Í\88Ù\82È\82é\83Z\83O\83\81\83\93\83gcs\82Ì\83I\83t\83Z\83b\83geip\82É\83v\83\8d\83O\83\89\83\80\82Ì\90§\8cä\82ð\95ª\8aò\82³\82¹\82é\81B\r
+void CLTS(void);                       //\83R\83\93\83g\83\8d\81[\83\8b\81E\83\8c\83W\83X\83^0\93à\82É\82 \82é\81ATask-Switched\83t\83\89\83O\82ð\83N\83\8a\83A\82·\82é\81BFPU\82Ì\90§\8cä\82É\97\98\97p\81B\93Á\8c \96½\97ß\81B\r
+void FNSave(uint *addr);               //FPU\93®\8dì\8aÂ\8b«\82ðaddr\82©\82ç\8en\82Ü\82é108\83o\83C\83g\82É\8ai\94[\82µ\81AFPU\82ð\8f\89\8aú\89»\82·\82é\81B\8fÚ\8d×\82È\83`\83F\83b\83N\82Í\8ds\82í\82È\82¢\81B\r
+void FRStore(uint *addr);              //FPU\93®\8dì\8aÂ\8b«\82ðaddr\82©\82ç\8en\82Ü\82é108\83o\83C\83g\82©\82ç\95\9c\8c³\82·\82é\81B\r
+void PIT_Beep_On(void);                        //\83r\81[\83v\89¹\82ð\8aJ\8en\82·\82é\81B\r
+void PIT_Beep_Off(void);               //\83r\81[\83v\89¹\82ð\92â\8e~\82·\82é\81B\r
+void PIT_Beep_Set(uint fq);            //\83r\81[\83v\89¹\82Ì\8eü\94g\90\94\82ð\81AfqHz\82É\95Ï\8dX\82·\82é\81B\r
+                                       //fq\82Ì\92l\r
+                                       //C:262 C#:277 D:294 D#:311 E:330 F:349 F#:370 G:392 G#:415 A:440 A#:466 B:494 C:523\r
+void CPUID(void *addr, uint id);       //addr\94Ô\92n\82Ìuint[4]\82É\81ACPU\82Ì\8e¯\95Ê\8fî\95ñid\94Ô\82ðEAX\81EEBX\81EEDX\81EECX\82Ì\8f\87\94Ô\82Å\8ai\94[\82·\82é\81B\r
+void CPUID2(void *addr, uint id);      //addr\94Ô\92n\82Ìuint[4]\82É\81ACPU\82Ì\8e¯\95Ê\8fî\95ñid\94Ô\82ðEAX\81EEBX\81EECX\81EEDX\82Ì\8f\87\94Ô\82Å\8ai\94[\82·\82é\81B\r
+                                       //\8fã\8bL\93ñ\82Â\82Ì\8aÖ\90\94\82Í\81AEFLAGS\93à\82ÌID\83t\83\89\83O(\83r\83b\83g21)\82ª\95Ï\8dX\89Â\94\\82È\8fê\8d\87\82Ì\82Ý\8eÀ\8ds\82Å\82«\82é\81B\r
+void Read_TSC(uint *addr);             //addr\94Ô\92n\82Ìuint[2]\82É\81A\83}\83V\83\93\8cÅ\97L\83\8c\83W\83X\83^(MSR)\93à\82É\82 \82é\81A\83^\83C\83\80\81E\83X\83^\83\93\83v\81E\83J\83E\83\93\83^\82Ì\8fã\88Ê\81E\89º\88Ê\82»\82ê\82¼\82ê32\83r\83b\83g\82ð\93Ç\82Ý\8d\9e\82Þ\81B\r
+                                       //\82±\82Ì\8aÖ\90\94\82Í\81Acpuid\82ÌTSC\83r\83b\83g\82ª\97L\8cø\82Å\82È\82¯\82ê\82Î\8eg\97p\82Å\82«\82È\82¢\81B\r
+uint Memory_Test_Sub(uint start, uint end);\r
+void INT_3(void);                      //\83u\83\8c\81[\83N\83|\83C\83\93\83g\97á\8aO\82ð\94­\90\82³\82¹\82é\81B\r
+void APP_Run(uint eip, uint cs, uint esp, uint ds, uint *esp0);\r
+\r
+/*nasfunc1.nas C\8c¾\8cê\82Ì\8aÖ\90\94\82É\88Ë\91\82·\82é\8aÖ\90\94\8cQ\81B\82¨\82à\82É\8a\84\82è\8d\9e\82Ý\8aÖ\8cW\81B*/\r
+void asm_CPU_ExceptionHandler00(void);\r
+void asm_CPU_ExceptionHandler01(void);\r
+void asm_CPU_ExceptionHandler02(void);\r
+void asm_CPU_ExceptionHandler03(void);\r
+void asm_CPU_ExceptionHandler04(void);\r
+void asm_CPU_ExceptionHandler05(void);\r
+void asm_CPU_ExceptionHandler06(void);\r
+void asm_CPU_ExceptionHandler07(void);\r
+void asm_CPU_ExceptionHandler08(void);\r
+void asm_CPU_ExceptionHandler09(void);\r
+void asm_CPU_ExceptionHandler0a(void);\r
+void asm_CPU_ExceptionHandler0b(void);\r
+void asm_CPU_ExceptionHandler0c(void);\r
+void asm_CPU_ExceptionHandler0d(void);\r
+void asm_CPU_ExceptionHandler0e(void);\r
+void asm_CPU_ExceptionHandler0f(void);\r
+void asm_CPU_ExceptionHandler10(void);\r
+void asm_CPU_ExceptionHandler11(void);\r
+void asm_CPU_ExceptionHandler12(void);\r
+void asm_CPU_ExceptionHandler13(void);\r
+void asm_CPU_ExceptionHandler14(void);\r
+void asm_CPU_ExceptionHandler15(void);\r
+void asm_CPU_ExceptionHandler16(void);\r
+void asm_CPU_ExceptionHandler17(void);\r
+void asm_CPU_ExceptionHandler18(void);\r
+void asm_CPU_ExceptionHandler19(void);\r
+void asm_CPU_ExceptionHandler1a(void);\r
+void asm_CPU_ExceptionHandler1b(void);\r
+void asm_CPU_ExceptionHandler1c(void);\r
+void asm_CPU_ExceptionHandler1d(void);\r
+void asm_CPU_ExceptionHandler1e(void);\r
+void asm_CPU_ExceptionHandler1f(void);\r
+void asm_InterruptHandler20(void);\r
+void asm_InterruptHandler21(void);\r
+void asm_InterruptHandler27(void);\r
+void asm_InterruptHandler2c(void);\r
+void asm_API_Execute(void);\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/core_set.h b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/core_set.h
new file mode 100644 (file)
index 0000000..e3f3db8
--- /dev/null
@@ -0,0 +1,227 @@
+\r
+/* MemoryMap */\r
+//00 00 0d 00  VESA_BIOS_INFO                  0x100(256)Bytes\r
+\r
+//00 00 0e 00  VESA_MODE_INFO                  0x100(256)Bytes\r
+\r
+//00 00 0f f0  BootInfo        CYLS            uchar\r
+//00 00 0f f1                  LEDS            uchar\r
+//00 00 0f f2                  VMODE           uchar\r
+//00 00 0f f3                  (Padding)       uchar\r
+//00 00 0f f4                  SCRNX           ushort\r
+//00 00 0f f6                  SCRNY           ushort\r
+//00 00 0f f8                  VRAM            *uchar\r
+//00 00 0f fc                  VESAVER         ushort\r
+//00 00 0f fe                  APMVER          ushort\r
+//00 00 10 00                  ACPI_MEMMAPS    uint\r
+//00 00 10 04                  ACPI_MEMMAP     0x18(24)*16=0x180(384)Bytes\r
+//00 00 11 84                  APM_FLAGS       ushort\r
+\r
+//00 00 7c 00  IPL                             0x200(512)Bytes\r
+\r
+//00 00 80 00  DSKCAC0                         0x168000(1.44M)Bytes\r
+\r
+//00 10 00 00  DSKCAC                          0x168000(1.44M)Bytes\r
+\r
+//00 26 f8 00  IDT                             0x800(2K)Bytes\r
+\r
+//00 27 00 00  GDT                             0x10000(64K)Bytes\r
+\r
+//00 28 00 00  bootpack.chn                    0x80000(512K)Bytes\r
+\r
+//00 40 00 00  \83\81\83\82\83\8a\97Ì\88æ\8aJ\8en\r
+\r
+#define ADR_BOOTINFO   0x00000ff0\r
+#define ADR_VESAINFO   0x00000e00\r
+#define ADR_DISKIMG    0x00100000\r
+\r
+#define EFLAGS_AC_BIT  0x00040000\r
+\r
+#define CR0_PROTECTIONENABLE   0x00000001\r
+#define CR0_MONITORCOPROCESSOR 0x00000002\r
+#define CR0_EMULATION          0x00000004\r
+#define CR0_TASKSWITCH         0x00000008\r
+#define CR0_EXTENDEDTYPE       0x00000010\r
+#define CR0_NUMERICERROR       0x00000020\r
+#define CR0_WRITEPROTECT       0x00010000\r
+#define CR0_ALIGNMENTMASK      0x00040000\r
+#define CR0_NOTWRITETHROUGH    0x20000000\r
+#define CR0_CACHE_DISABLE      0x40000000\r
+#define CR0_PAGING             0x80000000\r
+\r
+#define CR0_ALL_CACHE_DISABLE  CR0_NOTWRITETHROUGH + CR0_CACHE_DISABLE\r
+\r
+#define PG_NOTPRESENT  0x00000000\r
+#define PG_PRESENT     0x00000001\r
+#define PG_READONLY    0x00000000\r
+#define PG_WRITABLE    0x00000002\r
+#define PG_SUPERVISOR  0x00000000\r
+#define PG_USER                0x00000004\r
+#define PG_WRITEBACK   0x00000000\r
+#define PG_WRITETHROUGH        0x00000008\r
+#define PG_CACHE_ENABLE        0x00000000\r
+#define PG_CACHE_DISABLE       0x00000010\r
+#define PG_NOTACCESSED 0x00000000\r
+#define PG_ACCESSED    0x00000020\r
+#define PG_NOTWRITTEN  0x00000000\r
+#define PG_WRITTEN     0x00000040\r
+#define PG_4KBPAGE     0x00000000\r
+#define PG_4MBPAGE     0x00000080\r
+#define PG_NOTGLOBAL   0x00000000\r
+#define        PG_GLOBAL       0x00000100\r
+\r
+#define ADR_IDT                0x0026f800\r
+#define LIMIT_IDT      0x000007ff\r
+#define ADR_GDT                0x00270000\r
+#define LIMIT_GDT      0x0000ffff\r
+#define ADR_BOOTPACK   0x00280000\r
+#define LIMIT_BOOTPACK 0x0007ffff\r
+\r
+#define AR_DATA32_RW   0x4092  //AR_32+AR_PRESENT+AR_CODE_OR_DATA+AR_TYPE_DATA_RW\r
+#define AR_CODE32_ER   0x409a  //AR_32+AR_PRESENT+AR_CODE_OR_DATA+AR_TYPE_CODE_ER\r
+#define AR_LDT         0x0082  //AR_PRESENT+AR_SYSTEM_DESCRIPTOR+AR_TYPE_LDT\r
+#define AR_TSS32       0x0089  //AR_PRESENT+AR_SYSTEM_DESCRIPTOR+AR_TYPE_TSS32_READY\r
+#define AR_INTGATE32   0x008e  //AR_PRESENT+AR_SYSTEM_DESCRIPTOR+AR_TYPE_INTGATE32\r
+\r
+#define AR_GRANULARITY_BYTE    0x0000  //G=0   \8aÖ\90\94\82Å\8e©\93®\90Ý\92è\82·\82é\82Ì\82Å\82±\82Ì\83r\83b\83g\82Í\8fí\82É0\r
+#define AR_GRANULARITY_4KB     0x8000  //G=1\r
+#define AR_16                  0x0000  //D/B=0\r
+#define AR_32                  0x4000  //D/B=1\r
+#define AR_NOTPRESENT          0x0000  //P=0\r
+#define AR_PRESENT             0x0080  //P=1\r
+#define AR_SYSTEM              0x0000  //DPL=0\r
+#define AR_USER                        0x0060  //DPL=3\r
+#define        AR_SYSTEM_DESCRIPTOR    0x0000  //S=0\r
+#define AR_CODE_OR_DATA                0x0010  //S=1\r
+//S=0\r
+#define AR_TYPE_TSS16_READY    0x0001\r
+#define AR_TYPE_LDT            0x0002\r
+#define AR_TYPE_TSS16_BUSY     0x0003\r
+#define AR_TYPE_CALLGATE16     0x0004\r
+#define AR_TYPE_TASKGATE       0x0005\r
+#define AR_TYPE_INTGATE16      0x0006\r
+#define AR_TYPE_TRAPGATE16     0x0007\r
+#define AR_TYPE_TSS32_READY    0x0009\r
+#define AR_TYPE_TSS32_BUSY     0x000b\r
+#define AR_TYPE_CALLGATE32     0x000c\r
+#define AR_TYPE_INTGATE32      0x000e\r
+#define AR_TYPE_TRAPGATE32     0x000f\r
+//S=1\r
+#define AR_TYPE_ACCESSED       0x0001  //\8aÖ\90\94\90Ý\92è\8e\9e\82É\82Í\83N\83\8a\83A\81A\93Ç\82Ý\8fo\82µ\8e\9e\82Í\83A\83N\83Z\83X\8dÏ\82Ý\82È\82ç\83Z\83b\83g\r
+//DATA\r
+#define AR_TYPE_DATA_R                 0x0000\r
+#define AR_TYPE_DATA_RW                        0x0002\r
+#define AR_TYPE_DATA_R_EXPAND_DOWN     0x0004\r
+#define AR_TYPE_DATA_RW_EXPAND_DOWN    0x0006\r
+//CODE\r
+#define AR_TYPE_CODE_E                 0x0008\r
+#define AR_TYPE_CODE_ER                        0x000a\r
+#define AR_TYPE_CODE_E_CONFORMING      0x000c\r
+#define AR_TYPE_CODE_ER_CONFORMING     0x000e\r
+\r
+#define COL8_000000            0\r
+#define COL8_FF0000            1\r
+#define COL8_00FF00            2\r
+#define COL8_FFFF00            3\r
+#define COL8_0000FF            4\r
+#define COL8_FF00FF            5\r
+#define COL8_00FFFF            6\r
+#define COL8_FFFFFF            7\r
+#define COL8_C6C6C6            8\r
+#define COL8_840000            9\r
+#define COL8_008400            10\r
+#define COL8_848400            11\r
+#define COL8_000084            12\r
+#define COL8_840084            13\r
+#define COL8_008484            14\r
+#define COL8_848484            15\r
+\r
+#define MEMORY_DESCRIPTION_LENGTH      16      //32 - (4 * 4) = 16\r
+#define TASK_DESCRIPTION_LENGTH                20      //128 - (104 + 4) = 20\r
+\r
+#define WINDOW_TITLE_LENGTH            32\r
+#define WINDOW_CONTROL_XSIZE           24\r
+\r
+#define PIC0_ICW1      0x0020\r
+#define PIC0_OCW2      0x0020\r
+#define PIC0_IMR       0x0021\r
+#define PIC0_ICW2      0x0021\r
+#define PIC0_ICW3      0x0021\r
+#define PIC0_ICW4      0x0021\r
+#define PIC1_ICW1      0x00a0\r
+#define PIC1_OCW2      0x00a0\r
+#define PIC1_IMR       0x00a1\r
+#define PIC1_ICW2      0x00a1\r
+#define PIC1_ICW3      0x00a1\r
+#define PIC1_ICW4      0x00a1\r
+\r
+#define FIFO32_PUT_OVERFLOW    0x0001\r
+\r
+#define SYS_FIFOSIZE   256\r
+#define KEYCTRL_FIFOSIZE       128\r
+#define MOUSECTRL_FIFOSIZE     128\r
+#define KEYCMD_FIFOSIZE        128\r
+#define CONSOLE_FIFO_SIZE 128\r
+\r
+#define PIT_CTRL       0x0043\r
+#define PIT_CNT0       0x0040\r
+\r
+#define KEYB_DATA      0x0060\r
+#define PORT_KEYSTA    0x0064\r
+#define KEYSTA_SEND_NOTREADY   0x02\r
+#define KEYCMD_WRITE_MODE      0x60\r
+#define KBC_MODE       0x47\r
+#define PORT_KEYCMD    0x0064\r
+#define KEYCMD_SENDTO_MOUSE    0xd4\r
+#define KEYCMD_LED     0xed\r
+\r
+#define MOUSECMD_RESET 0xff\r
+#define MOUSECMD_RESEND        0xfe\r
+#define MOUSECMD_SET_DEFAULTS  0xf6\r
+#define MOUSECMD_DISABLE_DATA_REPORTING        0xf5\r
+#define MOUSECMD_ENABLE_DATA_REPORTING 0xf4\r
+#define MOUSECMD_SET_SAMPLE_RATE       0xf3\r
+#define MOUSECMD_GET_DEVICE_ID 0xf2\r
+\r
+#define MOUSE_BUTTON_L 0x01\r
+#define MOUSE_BUTTON_R 0x02\r
+#define MOUSE_BUTTON_C 0x04\r
+\r
+//#define MAX_WINDOWS  256\r
+//#define WIN_COL8_ACTIVE              0x000084\r
+//#define WIN_COL8_INACTIVE    0x848484\r
+//#define WIN_COL16_ACTIVE     0x60F8f0\r
+//#define WIN_COL16_INACTIVE   0xBCFCF8\r
+//#define WIN_COL32_ACTIVE     0x93D9FF\r
+//#define WIN_COL32_INACTIVE   0xD0EFFF\r
+\r
+//#define CONSOLE_FIFO_BUF_SIZE        128\r
+//#define CONSOLE_FIFO_START_KEYB      128\r
+//#define CONSOLE_FIFO_CURSOR_START    2\r
+//#define CONSOLE_FIFO_CURSOR_STOP     3\r
+//#define CONSOLE_COLOR_BACKGROUND     0x000000\r
+//#define CONSOLE_COLOR_CHAR   0xFFFFFF\r
+//#define CONSOLE_CMDLINE_BUF_SIZE     128\r
+//#define MAX_CONSOLES 16\r
+\r
+#define DATA_BYTE      0x100\r
+\r
+#define COM1_RX                0x03f8\r
+#define COM1_TX                0x03f8\r
+#define COM1_BAUD_LSB  0x03f8\r
+#define COM1_BAUD_MSB  0x03f9\r
+#define COM1_INTR_ENBL 0x03f9\r
+#define COM1_INTR_ID   0x03fa\r
+#define COM1_CTRL_FIFO 0x03fa\r
+#define COM1_CTRL_LINE 0x03fb\r
+#define COM1_CTRL_MODEM        0x03fc\r
+#define COM1_STA_LINE  0x03fd\r
+#define COM1_STA_MODEM 0x03fe\r
+\r
+#define SIGNAL_FLAGS_FOCUSINFO         0x00000001\r
+\r
+#define SIGNAL_START                   0xff000000\r
+#define SIGNAL_WINDOW_FOCUS_GET                0xff000001\r
+#define SIGNAL_WINDOW_FOCUS_LOST       0xff000002\r
+#define SIGNAL_ARGUMENTS_END           0xffffffff\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/cpuid.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/cpuid.c
new file mode 100644 (file)
index 0000000..7a20d75
--- /dev/null
@@ -0,0 +1,234 @@
+\r
+#include "core.h"\r
+\r
+void CPU_Identify(DATA_CPUID *id)\r
+{\r
+       uint eflags0, eflags1;\r
+       uint cpuidbuf[5];       //EAX-EBX-EDX-ECX-0x00000000\r
+       uchar s[64];\r
+\r
+       cpuidbuf[4] = 0x00000000;\r
+\r
+       eflags0 = IO_Load_EFlags();\r
+       IO_Store_EFlags(eflags0 | 0x00200000);\r
+       eflags1 = IO_Load_EFlags();\r
+       IO_Store_EFlags(eflags0);\r
+\r
+       if((eflags1 | 0xffdfffff) == 0xffffffff){\r
+               id->enable = true;\r
+               CPUID(cpuidbuf, 0);\r
+               id->max = cpuidbuf[0];\r
+               sprintf(id->vendor, "%s", &cpuidbuf[1]);\r
+\r
+               if(id->max >= 1){\r
+                       CPUID(cpuidbuf, 1);\r
+                       if((cpuidbuf[2] & ~1 << 0) != 0){\r
+                               id->FPU = true;\r
+                       } else{\r
+                               id->FPU = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 1)) != 0){\r
+                               id->VME = true;\r
+                       } else{\r
+                               id->VME = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 2)) != 0){\r
+                               id->DE = true;\r
+                       } else{\r
+                               id->DE = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 3)) != 0){\r
+                               id->PSE = true;\r
+                       } else{\r
+                               id->PSE = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 4)) != 0){\r
+                               id->TSC = true;\r
+                       } else{\r
+                               id->TSC = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 5)) != 0){\r
+                               id->MSR = true;\r
+                       } else{\r
+                               id->MSR = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 6)) != 0){\r
+                               id->PAE = true;\r
+                       } else{\r
+                               id->PAE = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 7)) != 0){\r
+                               id->MCE = true;\r
+                       } else{\r
+                               id->MCE = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 8)) != 0){\r
+                               id->CX8 = true;\r
+                       } else{\r
+                               id->CX8 = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 9)) != 0){\r
+                               id->APIC = true;\r
+                       } else{\r
+                               id->APIC = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 11)) != 0){\r
+                               id->SEP = true;\r
+                       } else{\r
+                               id->SEP = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 12)) != 0){\r
+                               id->MTRR = true;\r
+                       } else{\r
+                               id->MTRR = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 13)) != 0){\r
+                               id->PGE = true;\r
+                       } else{\r
+                               id->PGE = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 14)) != 0){\r
+                               id->MCA = true;\r
+                       } else{\r
+                               id->MCA = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 15)) != 0){\r
+                               id->CMOV = true;\r
+                       } else{\r
+                               id->CMOV = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 16)) != 0){\r
+                               id->PAT = true;\r
+                       } else{\r
+                               id->PAT = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 17)) != 0){\r
+                               id->PSE36 = true;\r
+                       } else{\r
+                               id->PSE36 = false;\r
+                               }\r
+                       if((cpuidbuf[2] & ~(1 << 18)) != 0){\r
+                               id->PSN = true;\r
+                       } else{\r
+                               id->PSN = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 19)) != 0){\r
+                               id->CLFSH = true;\r
+                       } else{\r
+                               id->CLFSH = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 21)) != 0){\r
+                               id->DS = true;\r
+                       } else{\r
+                               id->DS = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 22)) != 0){\r
+                               id->ACPI = true;\r
+                       } else{\r
+                               id->ACPI = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 23)) != 0){\r
+                               id->MMX = true;\r
+                       } else{\r
+                               id->MMX = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 24)) != 0){\r
+                               id->FXSR = true;\r
+                       } else{\r
+                               id->FXSR = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 25)) != 0){\r
+                               id->SSE = true;\r
+                       } else{\r
+                               id->SSE = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 26)) != 0){\r
+                               id->SSE2 = true;\r
+                       } else{\r
+                               id->SSE2 = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 27)) != 0){\r
+                               id->SS = true;\r
+                       } else{\r
+                               id->SS = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 28)) != 0){\r
+                               id->HTT = true;\r
+                       } else{\r
+                               id->HTT = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 29)) != 0){\r
+                               id->TM = true;\r
+                       } else{\r
+                               id->TM = false;\r
+                       }\r
+                       if((cpuidbuf[2] & ~(1 << 31)) != 0){\r
+                               id->PBE = true;\r
+                       } else{\r
+                               id->PBE = false;\r
+                       }\r
+\r
+                       if((cpuidbuf[3] & ~(1 << 0)) != 0){\r
+                               id->SSE3 = true;\r
+                       } else{\r
+                               id->SSE3 = false;\r
+                       }\r
+                       if((cpuidbuf[3] & ~(1 << 3)) != 0){\r
+                               id->MONITOR = true;\r
+                       } else{\r
+                               id->MONITOR = false;\r
+                       }\r
+                       if((cpuidbuf[3] & ~(1 << 4)) != 0){\r
+                               id->DSCPL = true;\r
+                       } else{\r
+                               id->DSCPL = false;\r
+                       }\r
+                       if((cpuidbuf[3] & ~(1 << 7)) != 0){\r
+                               id->EST = true;\r
+                       } else{\r
+                               id->EST = false;\r
+                       }\r
+                       if((cpuidbuf[3] & ~(1 << 8)) != 0){\r
+                               id->TM2 = true;\r
+                       } else{\r
+                               id->TM2 = false;\r
+                       }\r
+                       if((cpuidbuf[3] & ~(1 << 10)) != 0){\r
+                               id->CID = true;\r
+                       } else{\r
+                               id->CID = false;\r
+                       }\r
+                       if((cpuidbuf[3] & ~(1 << 13)) != 0){\r
+                               id->CX16 = true;\r
+                       } else{\r
+                               id->CX16 = false;\r
+                       }\r
+                       if((cpuidbuf[3] & ~(1 << 14)) != 0){\r
+                               id->xTPR = true;\r
+                       } else{\r
+                               id->xTPR = false;\r
+                       }\r
+               }\r
+               CPUID(cpuidbuf, 0x80000000);\r
+               if(cpuidbuf[0] >= 0x80000000){\r
+                       id->ext_enable = true;\r
+                       id->ext_max = cpuidbuf[0];\r
+                       if(cpuidbuf[0] >= 0x80000004){\r
+                               CPUID2(&s[0], 0x80000002);\r
+                               CPUID2(&s[16], 0x80000003);\r
+                               CPUID2(&s[32], 0x80000004);\r
+                               sprintf(id->brand_string, "%s", s);\r
+                       } else{\r
+                               sprintf(id->brand_string, "Null");\r
+                       }\r
+               } else{\r
+                       id->ext_enable = false;\r
+                       id->ext_max = 0;\r
+               }\r
+       } else{\r
+               id->enable = false;\r
+               id->max = 0;\r
+               sprintf(id->vendor, "Null");\r
+       }\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/dsctbl.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/dsctbl.c
new file mode 100644 (file)
index 0000000..5b41149
--- /dev/null
@@ -0,0 +1,190 @@
+\r
+#include "core.h"\r
+\r
+void Initialise_GlobalDescriptorTable(void)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; i < 8192; i++){\r
+               System_SegmentDescriptor_Set_Absolute(i, 0, 0, 0);\r
+       }\r
+\r
+       System_SegmentDescriptor_Set_Absolute(0x01, 0xffffffff, 0x00000000, AR_DATA32_RW);\r
+       System_SegmentDescriptor_Set_Absolute(0x02, LIMIT_BOOTPACK, ADR_BOOTPACK, AR_CODE32_ER);\r
+\r
+       Load_GDTR(LIMIT_GDT, ADR_GDT);\r
+\r
+       return;\r
+}\r
+\r
+void Initialise_InterruptDescriptorTable(void)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; i < 256; i++) {\r
+               System_GateDescriptor_Set(i, 0, 0, 0);\r
+       }\r
+\r
+       Load_IDTR(LIMIT_IDT, ADR_IDT);\r
+\r
+       System_GateDescriptor_Set(0x00, (uint)asm_CPU_ExceptionHandler00, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x01, (uint)asm_CPU_ExceptionHandler01, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x02, (uint)asm_CPU_ExceptionHandler02, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x03, (uint)asm_CPU_ExceptionHandler03, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x04, (uint)asm_CPU_ExceptionHandler04, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x05, (uint)asm_CPU_ExceptionHandler05, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x06, (uint)asm_CPU_ExceptionHandler06, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x07, (uint)asm_CPU_ExceptionHandler07, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x08, (uint)asm_CPU_ExceptionHandler08, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x09, (uint)asm_CPU_ExceptionHandler09, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0a, (uint)asm_CPU_ExceptionHandler0a, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0b, (uint)asm_CPU_ExceptionHandler0b, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0c, (uint)asm_CPU_ExceptionHandler0c, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0d, (uint)asm_CPU_ExceptionHandler0d, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0e, (uint)asm_CPU_ExceptionHandler0e, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0f, (uint)asm_CPU_ExceptionHandler0f, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x10, (uint)asm_CPU_ExceptionHandler10, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x11, (uint)asm_CPU_ExceptionHandler11, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x12, (uint)asm_CPU_ExceptionHandler12, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x13, (uint)asm_CPU_ExceptionHandler13, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x14, (uint)asm_CPU_ExceptionHandler14, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x15, (uint)asm_CPU_ExceptionHandler15, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x16, (uint)asm_CPU_ExceptionHandler16, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x17, (uint)asm_CPU_ExceptionHandler17, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x18, (uint)asm_CPU_ExceptionHandler18, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x19, (uint)asm_CPU_ExceptionHandler19, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1a, (uint)asm_CPU_ExceptionHandler1a, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1b, (uint)asm_CPU_ExceptionHandler1b, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1c, (uint)asm_CPU_ExceptionHandler1c, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1d, (uint)asm_CPU_ExceptionHandler1d, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1e, (uint)asm_CPU_ExceptionHandler1e, 0x02, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1f, (uint)asm_CPU_ExceptionHandler1f, 0x02, AR_INTGATE32);\r
+\r
+       System_GateDescriptor_Set(0x40, (uint)asm_API_Execute, 0x02, AR_INTGATE32 | AR_USER);\r
+\r
+       return;\r
+}\r
+\r
+void SegmentDescriptor_Set(IO_SegmentDescriptor *seg_desc, uint limit, uint base, uint ar)\r
+{\r
+       if(limit > 0xfffff){\r
+               ar |= 0x8000;\r
+               limit = limit >> 12;\r
+       }\r
+       seg_desc->limit_low     = limit & 0xffff;\r
+       seg_desc->base_low      = base & 0xffff;\r
+       seg_desc->base_mid      = (base >> 16) & 0xff;\r
+       seg_desc->access_right  = ar & 0xff;\r
+       seg_desc->limit_high    = ((limit >> 16) & 0x0f) | ((ar >> 8) & 0xf0);\r
+       seg_desc->base_high     = (base >> 24) & 0xff;\r
+\r
+       return;\r
+}\r
+\r
+uint SegmentDescriptor_Get_Base(IO_SegmentDescriptor *seg_desc)\r
+{\r
+       return (seg_desc->base_low | (seg_desc->base_mid << 16) | (seg_desc->base_high << 24));\r
+}\r
+\r
+uint SegmentDescriptor_Get_Limit(IO_SegmentDescriptor *seg_desc)\r
+{\r
+       if((seg_desc->limit_high & 0x80) != 0){\r
+               return ((((seg_desc->limit_low | ((seg_desc->limit_high & 0x0f) << 16))) << 12) | 0xFFF);\r
+       }\r
+\r
+       return (seg_desc->limit_low | ((seg_desc->limit_high & 0x0f) << 16));\r
+}\r
+\r
+uint SegmentDescriptor_Get_AccessRight(IO_SegmentDescriptor *seg_desc)\r
+{\r
+       return (seg_desc->access_right | ((seg_desc->limit_high & 0xf0) << 8)) & 0x7FFF;\r
+}\r
+\r
+void GateDescriptor_Set(IO_GateDescriptor *gate_desc, uint offset, uint selector, uint ar)\r
+{\r
+       gate_desc->offset_low           = offset & 0xffff;\r
+       gate_desc->selector             = selector << 3;\r
+       gate_desc->dw_count             = (ar >> 8) & 0xff;\r
+       gate_desc->access_right = ar & 0xff;\r
+       gate_desc->offset_high          = (offset >> 16) & 0xffff;\r
+\r
+       return;\r
+}\r
+\r
+void System_SegmentDescriptor_Set_Absolute(uint selector, uint limit, uint base, uint ar)\r
+{\r
+       IO_SegmentDescriptor *gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       if(selector >= 8192){\r
+               return;\r
+       }\r
+\r
+       SegmentDescriptor_Set(&gdt[selector], limit, base, ar);\r
+\r
+       return;\r
+}\r
+\r
+uint System_SegmentDescriptor_Get_Base(uint selector)\r
+{\r
+       IO_SegmentDescriptor *gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       if(selector >= 8192){\r
+               return 0;\r
+       }\r
+\r
+       return SegmentDescriptor_Get_Base(&gdt[selector]);\r
+}\r
+\r
+uint System_SegmentDescriptor_Get_Limit(uint selector)\r
+{\r
+       IO_SegmentDescriptor *gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       if(selector >= 8192){\r
+               return 0;\r
+       }\r
+\r
+       return SegmentDescriptor_Get_Limit(&gdt[selector]);\r
+}\r
+\r
+uint System_SegmentDescriptor_Get_AccessRight(uint selector)\r
+{\r
+       IO_SegmentDescriptor *gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       if(selector >= 8192){\r
+               return 0;\r
+       }\r
+\r
+       return SegmentDescriptor_Get_AccessRight(&gdt[selector]);\r
+}\r
+\r
+uint System_SegmentDescriptor_Set(uint limit, int base, int ar)\r
+{\r
+       uint *retaddr;\r
+       uint i;\r
+\r
+       retaddr = &limit;\r
+\r
+       for(i = 1; i < 8192; i++){\r
+               if(System_SegmentDescriptor_Get_Limit(i) == 0){\r
+                       System_SegmentDescriptor_Set_Absolute(i, limit, base, ar);\r
+                       return i;\r
+               }\r
+       }\r
+\r
+       Emergency_Out("[0x%08X]SegDesc_Set Failed.", *(retaddr - 1));\r
+       debug("[0x%08X]SegDesc_Set Failed.", *(retaddr - 1));\r
+       for(;;){\r
+               IO_HLT();\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+void System_GateDescriptor_Set(uint irq, uint offset, uint selector, uint ar)\r
+{\r
+       IO_GateDescriptor *idt = (IO_GateDescriptor *)ADR_IDT;\r
+\r
+       GateDescriptor_Set(&idt[irq], offset, selector, ar);\r
+\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/fifo.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/fifo.c
new file mode 100644 (file)
index 0000000..323d329
--- /dev/null
@@ -0,0 +1,108 @@
+\r
+#include "core.h"\r
+\r
+int FIFO32_Initialise(DATA_FIFO *fifo, uint size)\r
+{\r
+       fifo->size = size;\r
+       fifo->buf = MemoryBlock_Allocate_System(size * 4);\r
+       MemoryBlock_Write_Description(fifo->buf, "FIFO_BUFFER");\r
+       fifo->free = size;      /*freesize*/\r
+       fifo->flags = 0;\r
+       fifo->p = 0;    /*write*/\r
+       fifo->q = 0;    /*read*/\r
+       fifo->task = 0;\r
+       return 0;\r
+}\r
+\r
+int FIFO32_Put(DATA_FIFO *fifo, uint data)\r
+{\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       if (fifo->free == 0 ) {\r
+               fifo->flags |= FIFO32_PUT_OVERFLOW;\r
+               return -1;\r
+               }\r
+       fifo->buf[fifo->p] = data;\r
+       fifo->p++;\r
+       if(fifo->p == fifo->size) {\r
+               fifo->p = 0;\r
+               }\r
+       fifo->free--;\r
+       if(fifo->task != 0){\r
+               if(fifo->task->state != inuse){\r
+                       MultiTask_Task_Run(fifo->task);\r
+               }\r
+       }\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return 0;\r
+}\r
+\r
+int FIFO32_Put_Arguments(DATA_FIFO *fifo, uint args, ...)\r
+{\r
+       int i;\r
+       va_list ap;\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       va_start(ap, args);\r
+\r
+       for(i = 0; i < args; i++){\r
+               if(fifo->free <= 1){\r
+                       i = -1;\r
+                       break;\r
+               }\r
+               FIFO32_Put(fifo, va_arg(ap, uint));\r
+       }\r
+       FIFO32_Put(fifo, SIGNAL_ARGUMENTS_END);\r
+\r
+       va_end(ap);\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return i; \r
+}\r
+\r
+void FIFO32_Set_Task(DATA_FIFO *fifo, UI_Task *task)\r
+{\r
+       fifo->task = task;\r
+       return;\r
+}\r
+\r
+uint FIFO32_Get(DATA_FIFO *fifo)\r
+{\r
+       int data;\r
+       if (fifo->free == fifo->size) {\r
+               if(fifo->q == 0) return fifo->buf[fifo->size];\r
+               return fifo->buf[fifo->q - 1];\r
+       }\r
+       data = fifo->buf[fifo->q];\r
+       fifo->q++;\r
+       if (fifo->q == fifo->size) {\r
+               fifo->q = 0;\r
+       }\r
+       fifo->free++;\r
+       return data;\r
+}\r
+\r
+uint FIFO32_Status(DATA_FIFO *fifo)\r
+{\r
+       return fifo->size - fifo->free;\r
+}\r
+\r
+int FIFO32_Free(DATA_FIFO *fifo)\r
+{\r
+       if(fifo->buf == 0){\r
+               return -1;\r
+       }\r
+       fifo->size = 0;\r
+       fifo->free = 0;\r
+       fifo->flags = 0;\r
+       fifo->p = 0;\r
+       fifo->q = 0;\r
+       return MemoryBlock_Free(fifo->buf);\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/file.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/file.c
new file mode 100644 (file)
index 0000000..23a09f3
--- /dev/null
@@ -0,0 +1,136 @@
+\r
+#include "core.h"\r
+\r
+IO_FloppyDisk *FloppyDisk_Initialise(void *img)\r
+{\r
+       IO_FloppyDisk *fd;\r
+\r
+       fd = MemoryBlock_Allocate_System(sizeof(IO_FloppyDisk));\r
+       MemoryBlock_Write_Description(fd, "IO_FloppyDisk");\r
+\r
+       fd->img = img;\r
+       fd->files = (IO_FloppyDisk_RootDirectoryEntry *)(fd->img + 0x002600);\r
+       fd->userdataarea = (sector *)(fd->img + 0x002600 + 32 * 224);\r
+\r
+       fd->fat = MemoryBlock_Allocate_System(2 * 2880);\r
+       MemoryBlock_Write_Description(fd->fat, "IO_FD_FAT");\r
+       FloppyDisk_Decode_FAT16(fd->img, fd->fat, false);\r
+\r
+       return fd;\r
+}\r
+\r
+int FloppyDisk_Search_File(IO_FloppyDisk *fd, const uchar *name)\r
+{\r
+       uint i, j;\r
+       uchar filename[11];\r
+\r
+       for(i = 0; i < 11; i++){\r
+               filename[i] = ' ';\r
+       }\r
+\r
+       j = 0;\r
+       for(i = 0; i < 11; ){\r
+               if(name[j] == 0x00){\r
+                       i++;\r
+               } else{\r
+                       if(name[j] == '.'){\r
+                               i = 8;\r
+                       } else{\r
+                               filename[i] = name[j];\r
+                               if('a' <= filename[i] && filename[i] <= 'z'){\r
+                                       filename[i] -= 0x20;\r
+                               }\r
+                               i++;\r
+                       }\r
+                       j++;\r
+               }\r
+       }\r
+\r
+       for(j = 0; j < 224; j++){\r
+               if(fd->files[j].name[0] == 0x00){\r
+                       break;\r
+               }\r
+               if(fd->files[j].name[0] != 0xe5){\r
+                       for(i = 0; i < 11; i++){\r
+                               if(filename[i] != fd->files[j].name[i]){\r
+                                       break;\r
+                               }\r
+                       }\r
+                       if(i == 11){\r
+                               return j;\r
+                       }\r
+               }\r
+       }\r
+\r
+       return -1;\r
+}\r
+\r
+int FloppyDisk_Load_File(IO_FloppyDisk *fd, IO_File *fileinfo, int fileno)\r
+{\r
+       uint i, j, now_cluster, now_size;\r
+\r
+       fileinfo->name[12] = 0x00;\r
+\r
+       if(fileno < 0 || 224 <= fileno){\r
+               return -1;\r
+       }\r
+\r
+       fileinfo->data = MemoryBlock_Allocate_System(fd->files[fileno].size);\r
+       fileinfo->size = fd->files[fileno].size;\r
+\r
+       sprintf(fileinfo->name, "FILENAME.EXT");\r
+       for(i = 0; i < 8; i++){\r
+               fileinfo->name[i] = fd->files[fileno].name[i];\r
+       }\r
+       for(i = 9; i < 12; i++){\r
+               fileinfo->name[i] = fd->files[fileno].name[i - 1];\r
+       }\r
+       MemoryBlock_Write_Description(fileinfo->data, fileinfo->name);\r
+\r
+       now_cluster = fd->files[fileno].cluster;\r
+       now_size = fileinfo->size;\r
+       for(j = 0; ; j++){\r
+               if(now_size <= 512){\r
+                       for(i = 0; i < now_size; i++){\r
+                               fileinfo->data[(j << 9) + i] = fd->userdataarea[now_cluster - 2][i];\r
+                       }\r
+                       break;\r
+               }\r
+               for(i = 0; i < 512; i++){\r
+                       fileinfo->data[(j << 9) + i] = fd->userdataarea[now_cluster - 2][i];\r
+               }\r
+               now_size -= 512;\r
+               now_cluster = ((ushort *)fd->fat)[now_cluster];\r
+       }\r
+\r
+       return i;\r
+}\r
+\r
+int File_Free(IO_File *fileinfo)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; i < 13; i++){\r
+               fileinfo->name[i] = 0x00;\r
+       }\r
+       fileinfo->size = 0;\r
+       return MemoryBlock_Free(fileinfo->data);\r
+}\r
+\r
+void FloppyDisk_Decode_FAT16(uchar *img, ushort *fat, bool backup)\r
+{\r
+       int i, j = 0;\r
+\r
+       if(backup){\r
+               img += 0x00001400;\r
+       } else{\r
+               img += 0x00000200;\r
+       }\r
+\r
+       for(i = 0; i < 2880; i += 2){\r
+               fat[i + 0] = (img[j + 0]        | img[j + 1] << 8) & 0xfff;\r
+               fat[i + 1] = (img[j + 1] >> 4   | img[j + 2] << 4) & 0xfff;\r
+               j += 3;\r
+       }\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/grap_08.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/grap_08.c
new file mode 100644 (file)
index 0000000..fc1d78b
--- /dev/null
@@ -0,0 +1,114 @@
+\r
+#include "core.h"\r
+\r
+void Draw_Put_Font_08(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)\r
+{\r
+       int i;\r
+       uchar d;\r
+       uchar *p;\r
+       for (i = 0; i < 16; i++) {\r
+               p = (uchar *)(vram + (y + i) * xsize + x);\r
+               d = font[i];\r
+               if ((d & 0x80) != 0) { p[0] = (uchar)c; }\r
+               if ((d & 0x40) != 0) { p[1] = (uchar)c; }\r
+               if ((d & 0x20) != 0) { p[2] = (uchar)c; }\r
+               if ((d & 0x10) != 0) { p[3] = (uchar)c; }\r
+               if ((d & 0x08) != 0) { p[4] = (uchar)c; }\r
+               if ((d & 0x04) != 0) { p[5] = (uchar)c; }\r
+               if ((d & 0x02) != 0) { p[6] = (uchar)c; }\r
+               if ((d & 0x01) != 0) { p[7] = (uchar)c; }\r
+       }\r
+       return;\r
+}\r
+\r
+void Draw_Put_String_08(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s)\r
+{\r
+       c = RGB_32_To_08(c);\r
+       for(; *s != 0x00; s++){\r
+               if(x > xsize - 8){\r
+                       break;\r
+               }\r
+               Draw_Put_Font_08(vram, xsize, x, y, c, hankaku + *s * 16);\r
+               x += 8;\r
+       }\r
+       return;\r
+}\r
+\r
+void Draw_Fill_Rectangle_08(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)\r
+{\r
+       uint x, y;\r
+       c = RGB_32_To_08(c);\r
+       for(y = y0; y <= y1; y++){\r
+               for(x = x0; x <= x1; x++){\r
+                       ((uchar *)vram)[y * xsize + x] = (uchar)c;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Draw_Slide_Line_08(void *vram, uint xsize, uint ysize, uint vxsize, uint px, uint py)\r
+{\r
+       uint x, y;\r
+\r
+       for(y = py; y < ysize + py - 16; y++){\r
+               for(x = px; x < xsize + px; x++){\r
+                       ((uchar *)vram)[y * vxsize + x] = ((uchar *)vram)[(y + 16) * vxsize + x];\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Draw_Initialise_Palette(void)\r
+{\r
+       static uchar table_rgb[16 * 3] = {\r
+               0x00, 0x00, 0x00,\r
+               0xff, 0x00, 0x00,\r
+               0x00, 0xff, 0x00,\r
+               0xff, 0xff, 0x00,\r
+               0x00, 0x00, 0xff,\r
+               0xff, 0x00, 0xff,\r
+               0x00, 0xff, 0xff,\r
+               0xff, 0xff, 0xff,\r
+               0xc6, 0xc6, 0xc6,\r
+               0x84, 0x00, 0x00,\r
+               0x00, 0x84, 0x00,\r
+               0x84, 0x84, 0x00,\r
+               0x00, 0x00, 0x84,\r
+               0x84, 0x00, 0x84,\r
+               0x00, 0x84, 0x84,\r
+               0x84, 0x84, 0x84\r
+       };\r
+       uchar table2[216 * 3];\r
+       int r, g, b;\r
+\r
+       Draw_Set_Palette(0, 15, table_rgb);\r
+       for (b = 0; b < 6; b++) {\r
+               for (g = 0; g < 6; g++) {\r
+                       for (r = 0; r < 6; r++) {\r
+                               table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;\r
+                               table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;\r
+                               table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;\r
+                       }\r
+               }\r
+       }\r
+       Draw_Set_Palette(16, 231, table2);\r
+\r
+       return;\r
+}\r
+\r
+void Draw_Set_Palette(int start, int end, uchar *rgb)\r
+{\r
+       int i, eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI(); \r
+       IO_Out8(0x03c8, start);\r
+       for (i = start; i <= end; i++) {\r
+               IO_Out8(0x03c9, rgb[0] >> 2);\r
+               IO_Out8(0x03c9, rgb[1] >> 2);\r
+               IO_Out8(0x03c9, rgb[2] >> 2);\r
+               rgb += 3;\r
+       }\r
+       IO_Store_EFlags(eflags);\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/grap_16.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/grap_16.c
new file mode 100644 (file)
index 0000000..b644ef6
--- /dev/null
@@ -0,0 +1,59 @@
+\r
+#include "core.h"\r
+\r
+void Draw_Put_Font_16(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)\r
+{\r
+       int i;\r
+       uchar d;\r
+       ushort *p;\r
+       for (i = 0; i < 16; i++) {\r
+               p = (ushort *)vram + (y + i) * xsize + x;\r
+               d = font[i];\r
+               if ((d & 0x80) != 0) { p[0] = (ushort)c; }\r
+               if ((d & 0x40) != 0) { p[1] = (ushort)c; }\r
+               if ((d & 0x20) != 0) { p[2] = (ushort)c; }\r
+               if ((d & 0x10) != 0) { p[3] = (ushort)c; }\r
+               if ((d & 0x08) != 0) { p[4] = (ushort)c; }\r
+               if ((d & 0x04) != 0) { p[5] = (ushort)c; }\r
+               if ((d & 0x02) != 0) { p[6] = (ushort)c; }\r
+               if ((d & 0x01) != 0) { p[7] = (ushort)c; }\r
+       }\r
+       return;\r
+}\r
+\r
+void Draw_Put_String_16(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s)\r
+{\r
+       c = RGB_32_To_16(c);\r
+       for(; *s != 0x00; s++){\r
+               if(x > xsize - 8){\r
+                       break;\r
+               }\r
+               Draw_Put_Font_16(vram, xsize, x, y, c, hankaku + *s * 16);\r
+               x += 8;\r
+       }\r
+       return;\r
+}\r
+\r
+void Draw_Fill_Rectangle_16(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)\r
+{\r
+       uint x, y;\r
+       c = RGB_32_To_16(c);\r
+       for(y = y0; y <= y1; y++){\r
+               for(x = x0; x <= x1; x++){\r
+                       ((ushort *)vram)[y * xsize + x] = (ushort)c;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Draw_Slide_Line_16(void *vram, uint xsize, uint ysize, uint vxsize, uint px, uint py)\r
+{\r
+       uint x, y;\r
+\r
+       for(y = py; y < ysize + py - 16; y++){\r
+               for(x = px; x < xsize + px; x++){\r
+                       ((ushort *)vram)[y * vxsize + x] = ((ushort *)vram)[(y + 16) * vxsize + x];\r
+               }\r
+       }\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/grap_32.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/grap_32.c
new file mode 100644 (file)
index 0000000..4ccf5d1
--- /dev/null
@@ -0,0 +1,57 @@
+\r
+#include "core.h"\r
+\r
+void Draw_Put_Font_32(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)\r
+{\r
+       int i;\r
+       uchar d;\r
+       uint *p;\r
+       for (i = 0; i < 16; i++) {\r
+               p = (uint *)vram + (y + i) * xsize + x;\r
+               d = font[i];\r
+               if ((d & 0x80) != 0) { p[0] = (uint)c; }\r
+               if ((d & 0x40) != 0) { p[1] = (uint)c; }\r
+               if ((d & 0x20) != 0) { p[2] = (uint)c; }\r
+               if ((d & 0x10) != 0) { p[3] = (uint)c; }\r
+               if ((d & 0x08) != 0) { p[4] = (uint)c; }\r
+               if ((d & 0x04) != 0) { p[5] = (uint)c; }\r
+               if ((d & 0x02) != 0) { p[6] = (uint)c; }\r
+               if ((d & 0x01) != 0) { p[7] = (uint)c; }\r
+       }\r
+       return;\r
+}\r
+\r
+void Draw_Put_String_32(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s)\r
+{\r
+       for(; *s != 0x00; s++){\r
+               if(x > xsize - 8){\r
+                       break;\r
+               }\r
+               Draw_Put_Font_32(vram, xsize, x, y, c, hankaku + *s * 16);\r
+               x += 8;\r
+       }\r
+       return;\r
+}\r
+\r
+void Draw_Fill_Rectangle_32(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)\r
+{\r
+       uint x, y;\r
+       for(y = y0; y <= y1; y++){\r
+               for(x = x0; x <= x1; x++){\r
+                       ((uint *)vram)[y * xsize + x] = c;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Draw_Slide_Line_32(void *vram, uint xsize, uint ysize, uint vxsize, uint px, uint py)\r
+{\r
+       uint x, y;\r
+\r
+       for(y = py; y < ysize + py - 16; y++){\r
+               for(x = px; x < xsize + px; x++){\r
+                       ((uint *)vram)[y * vxsize + x] = ((uint *)vram)[(y + 16) * vxsize + x];\r
+               }\r
+       }\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/graphic.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/graphic.c
new file mode 100644 (file)
index 0000000..86aec2b
--- /dev/null
@@ -0,0 +1,117 @@
+\r
+#include "core.h"\r
+\r
+void (*Draw_Put_String)(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);\r
+void (*Draw_Fill_Rectangle)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void (*Draw_Slide_Line)(void *vram, uint xsize, uint ysize, uint vxsize, uint px, uint py);\r
+\r
+void Initialise_Graphic(uint bpp)\r
+{\r
+       if(bpp == 8){\r
+               Draw_Initialise_Palette();\r
+               Draw_Put_String = Draw_Put_String_08;\r
+               Draw_Fill_Rectangle = Draw_Fill_Rectangle_08;\r
+               Draw_Slide_Line = Draw_Slide_Line_08;\r
+       } else if(bpp == 16){\r
+               Draw_Put_String = Draw_Put_String_16;\r
+               Draw_Fill_Rectangle = Draw_Fill_Rectangle_16;\r
+               Draw_Slide_Line = Draw_Slide_Line_16;\r
+       } else if(bpp == 32){\r
+               Draw_Put_String = Draw_Put_String_32;\r
+               Draw_Fill_Rectangle = Draw_Fill_Rectangle_32;\r
+               Draw_Slide_Line = Draw_Slide_Line_32;\r
+       }\r
+       return;\r
+}\r
+\r
+uchar RGB_32_To_08(uint c32)\r
+{\r
+       uchar c8;\r
+       uchar c[4];\r
+\r
+       c[3] = (c32 << 24) >> 24;\r
+       c[2] = (c32 << 16) >> 24;\r
+       c[1] = (c32 <<  8) >> 24;\r
+       c[0] = (c32 >> 24);\r
+\r
+       c[1] = c[1] / 51;\r
+       c[2] = c[2] / 51;\r
+       c[3] = c[3] / 51;\r
+\r
+       c8 = (c[1] + c[2] * 6 + c[3] * 36) + 16;\r
+\r
+       return c8;\r
+}\r
+\r
+uchar RGB_32_To_08_xy(uint c32, int x, int y)\r
+{\r
+       static int table[4] = { 3, 1, 0, 2 };\r
+       uchar c8;\r
+       uchar c[4];\r
+       int i;\r
+\r
+       c[3] = (c32 << 24) >> 24;\r
+       c[2] = (c32 << 16) >> 24;\r
+       c[1] = (c32 <<  8) >> 24;\r
+       c[0] = (c32 >> 24);\r
+\r
+       x &= 1; /* \8bô\90\94\82©\8aï\90\94\82© */\r
+       y &= 1;\r
+\r
+       i = table[x + y * 2];   /* \92\86\8aÔ\90F\82ð\8dì\82é\82½\82ß\82Ì\92è\90\94 */\r
+       c[1] = (c[1] * 21) / 256;       /* \82±\82ê\82Å 0\81`20 \82É\82È\82é */\r
+       c[2] = (c[2] * 21) / 256;\r
+       c[3] = (c[3] * 21) / 256;\r
+       c[1] = (c[1] + i) / 4;  /* \82±\82ê\82Å 0\81`5 \82É\82È\82é */\r
+       c[2] = (c[2] + i) / 4;\r
+       c[3] = (c[3] + i) / 4;\r
+\r
+       c8 = 16 + c[1] + c[2] * 6 + c[3] * 36;\r
+\r
+       return c8;\r
+}\r
+\r
+ushort RGB_32_To_16(uint c32)\r
+{\r
+       ushort c16;\r
+       uchar c[4];\r
+\r
+       c[3] = (c32 << 24) >> 24;\r
+       c[2] = (c32 << 16) >> 24;\r
+       c[1] = (c32 <<  8) >> 24;\r
+       c[0] = (c32 >> 24);\r
+\r
+       c16 = ((c[1] >> 3) << 11 | (c[2] >> 2) << 5 | (c[3] >> 3));\r
+       \r
+       return c16;\r
+}\r
+\r
+uchar Emergency_Out_Count;\r
+\r
+void Emergency_Out_Reset(void)\r
+{\r
+       Emergency_Out_Count = 0;\r
+       return;\r
+}\r
+\r
+int Emergency_Out(const uchar *format, ...)\r
+{\r
+       int i;\r
+       va_list ap;\r
+       uchar s[256];\r
+       DATA_VESAInfo *vesa = (DATA_VESAInfo *) ADR_VESAINFO;\r
+       DATA_BootInfo *boot = (DATA_BootInfo *) ADR_BOOTINFO;\r
+\r
+       va_start(ap, format);\r
+       i = vsprintf(s, format, ap);\r
+       va_end(ap);\r
+\r
+       Draw_Fill_Rectangle(vesa->PhysBasePtr, boot->scrnx, 0x000000, 0, Emergency_Out_Count << 4, boot->scrnx - 1, (Emergency_Out_Count << 4) + 15);\r
+       Draw_Put_String(vesa->PhysBasePtr, boot->scrnx, 0, Emergency_Out_Count << 4, 0xFFFFFF, s);\r
+\r
+       if(Emergency_Out_Count < 12){\r
+               Emergency_Out_Count++;\r
+       }\r
+\r
+       return i;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/hankaku.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/hankaku.txt
new file mode 100644 (file)
index 0000000..6d5bb91
--- /dev/null
@@ -0,0 +1,4653 @@
+\r
+char 0x00\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x01\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.....*.\r
+*.....*.\r
+*.*.*.*.\r
+*..*..*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+........\r
+\r
+char 0x02\r
+........\r
+........\r
+..***...\r
+.*****..\r
+*******.\r
+**.*.**.\r
+**.*.**.\r
+*******.\r
+*******.\r
+**.*.**.\r
+***.***.\r
+.*****..\r
+..***...\r
+........\r
+........\r
+........\r
+\r
+char 0x03\r
+........\r
+........\r
+........\r
+........\r
+.**.**..\r
+*******.\r
+*******.\r
+*******.\r
+.*****..\r
+..***...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x04\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*****..\r
+*******.\r
+.*****..\r
+..***...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x05\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*******.\r
+.*.*.*..\r
+...*....\r
+..***...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x06\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*****..\r
+*******.\r
+**.*.**.\r
+...*....\r
+..***...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x07\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+..****..\r
+..****..\r
+...**...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x08\r
+********\r
+********\r
+********\r
+********\r
+********\r
+********\r
+***..***\r
+**....**\r
+**....**\r
+***..***\r
+********\r
+********\r
+********\r
+********\r
+********\r
+********\r
+\r
+char 0x09\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..****..\r
+.**..**.\r
+.*....*.\r
+.*....*.\r
+.**..**.\r
+..****..\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x0a\r
+********\r
+********\r
+********\r
+********\r
+********\r
+**....**\r
+*..**..*\r
+*.****.*\r
+*.****.*\r
+*..**..*\r
+**....**\r
+********\r
+********\r
+********\r
+********\r
+********\r
+\r
+char 0x0b\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x0c\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x0d\r
+........\r
+........\r
+....**..\r
+....***.\r
+....*.**\r
+....*.**\r
+....*.*.\r
+....*...\r
+....*...\r
+...**...\r
+.****...\r
+*****...\r
+.***....\r
+........\r
+........\r
+........\r
+\r
+char 0x0e\r
+........\r
+........\r
+...*****\r
+...*****\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+.***.***\r
+********\r
+.**..**.\r
+........\r
+........\r
+........\r
+\r
+char 0x0f\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+.*.*.*..\r
+..***...\r
+..*.*...\r
+..***...\r
+.*.*.*..\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x10\r
+........\r
+*.......\r
+**......\r
+***.....\r
+****....\r
+*****...\r
+******..\r
+*******.\r
+******..\r
+*****...\r
+****....\r
+***.....\r
+**......\r
+*.......\r
+........\r
+........\r
+\r
+char 0x11\r
+........\r
+......*.\r
+.....**.\r
+....***.\r
+...****.\r
+..*****.\r
+.******.\r
+*******.\r
+.******.\r
+..*****.\r
+...****.\r
+....***.\r
+.....**.\r
+......*.\r
+........\r
+........\r
+\r
+char 0x12\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+...*....\r
+........\r
+........\r
+........\r
+\r
+char 0x13\r
+........\r
+........\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+........\r
+........\r
+.*...*..\r
+.*...*..\r
+........\r
+........\r
+\r
+char 0x14\r
+........\r
+..*****.\r
+.*..*.*.\r
+*...*.*.\r
+*...*.*.\r
+*...*.*.\r
+*...*.*.\r
+.*..*.*.\r
+..***.*.\r
+....*.*.\r
+....*.*.\r
+....*.*.\r
+....*.*.\r
+....*.*.\r
+........\r
+........\r
+\r
+char 0x15\r
+.*****..\r
+*.....*.\r
+.*......\r
+..*.....\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+....*...\r
+.....*..\r
+*.....*.\r
+.*****..\r
+........\r
+\r
+char 0x16\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+*******.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x17\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x18\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x19\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+...*....\r
+........\r
+........\r
+\r
+char 0x1a\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+....*...\r
+.....*..\r
+*******.\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1b\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..*.....\r
+.*......\r
+*******.\r
+.*......\r
+..*.....\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1c\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*.......\r
+*.......\r
+*******.\r
+........\r
+........\r
+\r
+char 0x1d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..*.*...\r
+.*...*..\r
+*******.\r
+.*...*..\r
+..*.*...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1e\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+...*....\r
+..***...\r
+..***...\r
+.*****..\r
+.*****..\r
+*******.\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1f\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+*******.\r
+.*****..\r
+.*****..\r
+..***...\r
+..***...\r
+...*....\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x20\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x21\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x22\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x23\r
+........\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+*******.\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+*******.\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+........\r
+........\r
+\r
+char 0x24\r
+...*....\r
+..***.*.\r
+.*.*.**.\r
+*..*..*.\r
+*..*..*.\r
+*..*....\r
+.*.*....\r
+..***...\r
+...*.*..\r
+...*..*.\r
+*..*..*.\r
+*..*..*.\r
+**.*.*..\r
+*.***...\r
+...*....\r
+...*....\r
+\r
+char 0x25\r
+.**...*.\r
+*..*..*.\r
+*..*.*..\r
+*..*.*..\r
+.**.*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.**..\r
+.*.*..*.\r
+.*.*..*.\r
+*..*..*.\r
+*...**..\r
+........\r
+........\r
+\r
+char 0x26\r
+........\r
+.***....\r
+*...*...\r
+*...*...\r
+*...*...\r
+*..*....\r
+.**.....\r
+.*...***\r
+*.*...*.\r
+*..*..*.\r
+*...*.*.\r
+*....*..\r
+.*...**.\r
+..***..*\r
+........\r
+........\r
+\r
+char 0x27\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x28\r
+......*.\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+....*...\r
+.....*..\r
+......*.\r
+........\r
+\r
+char 0x29\r
+*.......\r
+.*......\r
+..*.....\r
+..*.....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+*.......\r
+........\r
+\r
+char 0x2a\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x2b\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x2c\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+....*...\r
+....*...\r
+...*....\r
+\r
+char 0x2d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x2e\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x2f\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*......\r
+.*......\r
+*.......\r
+*.......\r
+\r
+char 0x30\r
+........\r
+...**...\r
+..*..*..\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x31\r
+........\r
+....*...\r
+...**...\r
+..*.*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x32\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*......\r
+.******.\r
+........\r
+........\r
+\r
+char 0x33\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+......*.\r
+......*.\r
+.....*..\r
+...**...\r
+.....*..\r
+......*.\r
+......*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x34\r
+........\r
+....**..\r
+....**..\r
+....**..\r
+...*.*..\r
+...*.*..\r
+...*.*..\r
+..*..*..\r
+..*..*..\r
+.*...*..\r
+.******.\r
+.....*..\r
+.....*..\r
+...****.\r
+........\r
+........\r
+\r
+char 0x35\r
+........\r
+.*****..\r
+.*......\r
+.*......\r
+.*......\r
+.*.**...\r
+.**..*..\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x36\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*......\r
+.*.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x37\r
+........\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..***...\r
+........\r
+........\r
+\r
+char 0x38\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x39\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..**.\r
+...**.*.\r
+......*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x3a\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x3b\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+....*...\r
+....*...\r
+...*....\r
+\r
+char 0x3c\r
+........\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*......\r
+*.......\r
+*.......\r
+.*......\r
+..*.....\r
+...*....\r
+....*...\r
+.....*..\r
+......*.\r
+........\r
+\r
+char 0x3d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+........\r
+........\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x3e\r
+........\r
+*.......\r
+.*......\r
+..*.....\r
+...*....\r
+....*...\r
+.....*..\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*......\r
+*.......\r
+........\r
+\r
+char 0x3f\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.....*..\r
+....*...\r
+...*....\r
+...*....\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x40\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*..**.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*..***..\r
+*.......\r
+.*...**.\r
+..***...\r
+........\r
+........\r
+\r
+char 0x41\r
+........\r
+...**...\r
+...**...\r
+...**...\r
+...**...\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x42\r
+........\r
+****....\r
+.*..*...\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*..*...\r
+.****...\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...*..\r
+*****...\r
+........\r
+........\r
+\r
+char 0x43\r
+........\r
+..***.*.\r
+.*...**.\r
+.*....*.\r
+*.....*.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.....*.\r
+.*....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x44\r
+........\r
+*****...\r
+.*...*..\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...*..\r
+.*...*..\r
+*****...\r
+........\r
+........\r
+\r
+char 0x45\r
+........\r
+*******.\r
+.*....*.\r
+.*....*.\r
+.*......\r
+.*......\r
+.*...*..\r
+.*****..\r
+.*...*..\r
+.*......\r
+.*......\r
+.*....*.\r
+.*....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x46\r
+........\r
+*******.\r
+.*....*.\r
+.*....*.\r
+.*......\r
+.*......\r
+.*...*..\r
+.*****..\r
+.*...*..\r
+.*...*..\r
+.*......\r
+.*......\r
+.*......\r
+****....\r
+........\r
+........\r
+\r
+char 0x47\r
+........\r
+..***.*.\r
+.*...**.\r
+.*....*.\r
+*.....*.\r
+*.......\r
+*.......\r
+*..****.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+.*...**.\r
+..***...\r
+........\r
+........\r
+\r
+char 0x48\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x49\r
+........\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x4a\r
+........\r
+...*****\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+*....*..\r
+.*..*...\r
+..**....\r
+........\r
+\r
+char 0x4b\r
+........\r
+***..***\r
+.*....*.\r
+.*...*..\r
+.*..*...\r
+.*.*....\r
+.*.*....\r
+.**.....\r
+.*.*....\r
+.*.*....\r
+.*..*...\r
+.*...*..\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x4c\r
+........\r
+****....\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*....*.\r
+.*....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x4d\r
+........\r
+**....**\r
+.*....*.\r
+.**..**.\r
+.**..**.\r
+.**..**.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x4e\r
+........\r
+**...***\r
+.*....*.\r
+.**...*.\r
+.**...*.\r
+.*.*..*.\r
+.*.*..*.\r
+.*.*..*.\r
+.*..*.*.\r
+.*..*.*.\r
+.*..*.*.\r
+.*...**.\r
+.*...**.\r
+***...*.\r
+........\r
+........\r
+\r
+char 0x4f\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x50\r
+........\r
+*****...\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...*..\r
+.****...\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+****....\r
+........\r
+........\r
+\r
+char 0x51\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*..*..*.\r
+*...*.*.\r
+.*...*..\r
+..***.*.\r
+........\r
+........\r
+\r
+char 0x52\r
+........\r
+******..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*****..\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x53\r
+........\r
+..***.*.\r
+.*...**.\r
+*.....*.\r
+*.....*.\r
+*.......\r
+.*......\r
+..***...\r
+.....*..\r
+......*.\r
+*.....*.\r
+*.....*.\r
+**...*..\r
+*.***...\r
+........\r
+........\r
+\r
+char 0x54\r
+........\r
+*******.\r
+*..*..*.\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x55\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..****..\r
+........\r
+........\r
+\r
+char 0x56\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+...**...\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x57\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+........\r
+........\r
+\r
+char 0x58\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x59\r
+........\r
+***.***.\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x5a\r
+........\r
+*******.\r
+*....*..\r
+*....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*....*.\r
+*.....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x5b\r
+........\r
+..*****.\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*****.\r
+........\r
+\r
+char 0x5c\r
+*.......\r
+*.......\r
+.*......\r
+.*......\r
+..*.....\r
+..*.....\r
+..*.....\r
+...*....\r
+...*....\r
+....*...\r
+....*...\r
+.....*..\r
+.....*..\r
+.....*..\r
+......*.\r
+......*.\r
+\r
+char 0x5d\r
+........\r
+.*****..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.*****..\r
+........\r
+\r
+char 0x5e\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+*.....*.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x5f\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+........\r
+\r
+char 0x60\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x61\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.***....\r
+....*...\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+*...**..\r
+.***.**.\r
+........\r
+........\r
+\r
+char 0x62\r
+**......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.**..*..\r
+.*.**...\r
+........\r
+........\r
+\r
+char 0x63\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..**....\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*.......\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x64\r
+....**..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+..**.*..\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+.*..**..\r
+..**.**.\r
+........\r
+........\r
+\r
+char 0x65\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+******..\r
+*.......\r
+*.....*.\r
+.*....*.\r
+..****..\r
+........\r
+........\r
+\r
+char 0x66\r
+....***.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x67\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..**.**.\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+.*..**..\r
+..**.*..\r
+.....*..\r
+.....*..\r
+.****...\r
+\r
+char 0x68\r
+**......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***...**\r
+........\r
+........\r
+\r
+char 0x69\r
+........\r
+...*....\r
+...*....\r
+........\r
+........\r
+..**....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..***...\r
+........\r
+........\r
+\r
+char 0x6a\r
+........\r
+.....*..\r
+.....*..\r
+........\r
+........\r
+....**..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+..**....\r
+\r
+char 0x6b\r
+**......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*..***.\r
+.*...*..\r
+.*..*...\r
+.*.*....\r
+.**.....\r
+.*.*....\r
+.*..*...\r
+.*...*..\r
+***..**.\r
+........\r
+........\r
+\r
+char 0x6c\r
+..**....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..***...\r
+........\r
+........\r
+\r
+char 0x6d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+****.**.\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+**.**.**\r
+........\r
+........\r
+\r
+char 0x6e\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***...**\r
+........\r
+........\r
+\r
+char 0x6f\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x70\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.**..*..\r
+.*.**...\r
+.*......\r
+***.....\r
+\r
+char 0x71\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..**.*..\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+.*..**..\r
+..**.*..\r
+.....*..\r
+....***.\r
+\r
+char 0x72\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**.***..\r
+.**...*.\r
+.*....*.\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+***.....\r
+........\r
+........\r
+\r
+char 0x73\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.****.*.\r
+*....**.\r
+*.....*.\r
+**......\r
+..***...\r
+.....**.\r
+*.....*.\r
+**....*.\r
+*.****..\r
+........\r
+........\r
+\r
+char 0x74\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....***.\r
+........\r
+........\r
+\r
+char 0x75\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**...**.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...**.\r
+..***.**\r
+........\r
+........\r
+\r
+char 0x76\r
+........\r
+........\r
+........\r
+........\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x77\r
+........\r
+........\r
+........\r
+........\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+........\r
+........\r
+\r
+char 0x78\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**...**.\r
+.*...*..\r
+..*.*...\r
+..*.*...\r
+...*....\r
+..*.*...\r
+..*.*...\r
+.*...*..\r
+**...**.\r
+........\r
+........\r
+\r
+char 0x79\r
+........\r
+........\r
+........\r
+........\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+...**...\r
+...*....\r
+...*....\r
+.**.....\r
+\r
+char 0x7a\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+*.....*.\r
+*....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*....*.\r
+*.....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x7b\r
+........\r
+.....**.\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.**.....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+.....**.\r
+........\r
+........\r
+\r
+char 0x7c\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+\r
+char 0x7d\r
+........\r
+.**.....\r
+...*....\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+.....**.\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+.**.....\r
+........\r
+........\r
+\r
+char 0x7e\r
+........\r
+.***..*.\r
+*...**..\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x7f\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+*.....*.\r
+*******.\r
+*.....*.\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x80\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+...*....\r
+..*.....\r
+\r
+char 0x81\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x82\r
+....**..\r
+....*...\r
+...*....\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x83\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x84\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x85\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x86\r
+........\r
+...**...\r
+..*..*..\r
+...**...\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x87\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..****..\r
+.*....*.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+.*....*.\r
+..****..\r
+....*...\r
+...*....\r
+\r
+char 0x88\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x89\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x8a\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x8b\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x8c\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x8d\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x8e\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+........\r
+........\r
+\r
+char 0x8f\r
+........\r
+..***...\r
+.*...*..\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+........\r
+........\r
+\r
+char 0x90\r
+....**..\r
+....*...\r
+...*....\r
+*******.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*****...\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*******.\r
+........\r
+........\r
+\r
+char 0x91\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.**.....\r
+...***..\r
+...*..*.\r
+.***..*.\r
+*..****.\r
+*..*....\r
+*..*....\r
+*..*..*.\r
+.**.**..\r
+........\r
+........\r
+\r
+char 0x92\r
+....**..\r
+...*....\r
+..*.....\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+*******.\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+........\r
+........\r
+\r
+char 0x93\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x94\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x95\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x96\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x97\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x98\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+.*...*..\r
+..*.*...\r
+..*.*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+\r
+char 0x99\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x9a\r
+..*..*..\r
+..*..*..\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x9b\r
+........\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..****..\r
+.**.*.*.\r
+*.*.*...\r
+*.*.*...\r
+*.*.*...\r
+*.*.*...\r
+*.*.*...\r
+.**.*.*.\r
+..****..\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+\r
+char 0x9c\r
+........\r
+....**..\r
+...*..*.\r
+..*.....\r
+..*.....\r
+..*.....\r
+******..\r
+..*.....\r
+..*.....\r
+..*.....\r
+.**.....\r
+*.*.....\r
+*.**..*.\r
+.*..**..\r
+........\r
+........\r
+\r
+char 0x9d\r
+........\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..*.*...\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x9e\r
+........\r
+***.....\r
+*..*....\r
+*...*...\r
+*...*...\r
+*...*...\r
+*..*.*..\r
+***..*..\r
+*..*****\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+........\r
+........\r
+\r
+char 0x9f\r
+........\r
+....**..\r
+...*..*.\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+*..*....\r
+.**.....\r
+........\r
+........\r
+\r
+char 0xa0\r
+....**..\r
+....*...\r
+...*....\r
+........\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0xa1\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.**.....\r
+*..*....\r
+*..*....\r
+.**.....\r
+\r
+char 0xa2\r
+****....\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xa3\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+....****\r
+\r
+char 0xa4\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*.......\r
+*.......\r
+.*......\r
+..*.....\r
+...*....\r
+\r
+char 0xa5\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xa6\r
+........\r
+********\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+*******.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+.**.....\r
+........\r
+\r
+char 0xa7\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.*******\r
+.......*\r
+....*.*.\r
+....*...\r
+...*....\r
+..*.....\r
+........\r
+\r
+char 0xa8\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+......**\r
+....**..\r
+..**....\r
+**..*...\r
+....*...\r
+....*...\r
+........\r
+\r
+char 0xa9\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+********\r
+*......*\r
+......*.\r
+.....*..\r
+....*...\r
+........\r
+\r
+char 0xaa\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+........\r
+........\r
+\r
+char 0xab\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+....*...\r
+*******.\r
+...**...\r
+..*.*...\r
+.*..*...\r
+*...*...\r
+....*...\r
+\r
+char 0xac\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..*.....\r
+..*.****\r
+****..*.\r
+..*..*..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+\r
+char 0xad\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.****...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+********\r
+........\r
+\r
+char 0xae\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+.......*\r
+********\r
+.......*\r
+.......*\r
+********\r
+\r
+char 0xaf\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.*..*..*\r
+.*..*..*\r
+.......*\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+\r
+char 0xb0\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.......*\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xb1\r
+........\r
+........\r
+********\r
+.......*\r
+...*..*.\r
+...*.*..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*......\r
+*.......\r
+........\r
+\r
+char 0xb2\r
+........\r
+........\r
+.......*\r
+......**\r
+....**..\r
+..**....\r
+**..*...\r
+*...*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+........\r
+........\r
+\r
+char 0xb3\r
+........\r
+........\r
+...*....\r
+...*....\r
+********\r
+*......*\r
+*......*\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+..*.....\r
+........\r
+\r
+\r
+char 0xb4\r
+........\r
+........\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+........\r
+........\r
+\r
+\r
+char 0xb5\r
+........\r
+........\r
+........\r
+....*...\r
+....*...\r
+********\r
+...**...\r
+...**...\r
+..*.*...\r
+..*.*...\r
+.*..*...\r
+.*..*...\r
+*...*...\r
+...**...\r
+....*...\r
+........\r
+\r
+\r
+char 0xb6\r
+........\r
+........\r
+...*....\r
+...*....\r
+********\r
+...*...*\r
+..*....*\r
+..*....*\r
+..*....*\r
+..*....*\r
+.*.....*\r
+.*....*.\r
+*..*..*.\r
+....**.\r
+.....*..\r
+........\r
+\r
+\r
+char 0xb7\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*.***\r
+..***...\r
+**.*....\r
+....*.**\r
+...***..\r
+***.*...\r
+....*...\r
+....*...\r
+....*...\r
+.....*..\r
+.....*..\r
+........\r
+\r
+\r
+char 0xb8\r
+........\r
+........\r
+........\r
+...*****\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+..*....*.\r
+..*....*.\r
+.*....*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+........\r
+\r
+\r
+char 0xb9\r
+........\r
+........\r
+..*.....\r
+..*.....\r
+..******\r
+..*...*.\r
+.*....*.\r
+.*....*.\r
+*....*..\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+..*.....\r
+........\r
+\r
+\r
+char 0xba\r
+........\r
+........\r
+........\r
+........\r
+.*******\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.*******\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xbb\r
+........\r
+........\r
+.*...*..\r
+.*...*..\r
+********\r
+.*...*..\r
+*....*..\r
+*....*..\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+........\r
+\r
+\r
+char 0xbc\r
+........\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.......*\r
+.**....*\r
+...**..*\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xbd\r
+........\r
+........\r
+........\r
+******..\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.*...\r
+..*.*...\r
+.*...*..\r
+.*...*..\r
+*.....*.\r
+........\r
+\r
+\r
+char 0xbe\r
+........\r
+........\r
+........\r
+..*.....\r
+..*.....\r
+..*.....\r
+..******\r
+***....*\r
+..*...*.\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+...*****\r
+........\r
+........\r
+\r
+\r
+char 0xbf\r
+........\r
+........\r
+........\r
+.*.....*\r
+..*....*\r
+..*....*\r
+...*...*\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+\r
+char 0xc0\r
+........\r
+........\r
+..******\r
+..*....*\r
+..*....*\r
+.*.....*\r
+.*.**..*\r
+*....**.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+........\r
+\r
+\r
+char 0xc1\r
+........\r
+........\r
+........\r
+....**..\r
+..***...\r
+....*...\r
+....*...\r
+********\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xc2\r
+........\r
+........\r
+........\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.......*\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+\r
+\r
+char 0xc3\r
+........\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+********\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xc4\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...**...\r
+...*.*..\r
+...*.*..\r
+...*..*.\r
+...*..*.\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+\r
+\r
+char 0xc5\r
+........\r
+........\r
+........\r
+....*...\r
+....*...\r
+....*...\r
+********\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xc6\r
+........\r
+........\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+********\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xc7\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+......*.\r
+......*.\r
+..*..*..\r
+...*.*..\r
+....*...\r
+....**..\r
+...*..*.\r
+...*....\r
+..*.....\r
+..*.....\r
+........\r
+\r
+\r
+\r
+char 0xc8\r
+........\r
+........\r
+...*....\r
+...*....\r
+.******.\r
+......*.\r
+.....*..\r
+....*...\r
+...***..\r
+..*.*.*.\r
+.*..*..*\r
+*...*...\r
+....*...\r
+....*...\r
+....*...\r
+........\r
+\r
+\r
+char 0xc9\r
+........\r
+........\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+........\r
+\r
+\r
+\r
+char 0xca\r
+........\r
+........\r
+........\r
+........\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+*......*\r
+*......*\r
+*......*\r
+*......*\r
+*......*\r
+*......*\r
+........\r
+........\r
+\r
+\r
+char 0xcb\r
+........\r
+........\r
+........\r
+..*.....\r
+..*.....\r
+..*..***\r
+..***...\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+...*....\r
+....****\r
+........\r
+\r
+\r
+char 0xcc\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+\r
+\r
+char 0xcd\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+*....*..\r
+......*.\r
+......*.\r
+.......*\r
+.......*\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xce\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+********\r
+...*....\r
+...*....\r
+.*.*.*..\r
+.*.*.*..\r
+*..*..*.\r
+*..*..*.\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+\r
+char 0xcf\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+.*...*..\r
+..*.*...\r
+...**...\r
+....*...\r
+.....*..\r
+......*.\r
+.......*\r
+........\r
+\r
+\r
+char 0xd0\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.....**.\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.....**.\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.....**.\r
+........\r
+\r
+\r
+char 0xd1\r
+........\r
+........\r
+........\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*...*..\r
+.*....*.\r
+.*..**.*\r
+****...*\r
+........\r
+........\r
+\r
+\r
+char 0xd2\r
+........\r
+........\r
+.....*..\r
+.....*..\r
+.*..*...\r
+..*.*...\r
+...*....\r
+...**...\r
+...*.*..\r
+..*...*.\r
+..*.....\r
+.*......\r
+.*......\r
+*.......\r
+*.......\r
+........\r
+\r
+\r
+char 0xd3\r
+........\r
+........\r
+........\r
+........\r
+********\r
+...*....\r
+...*....\r
+...*....\r
+********\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+.....***\r
+........\r
+\r
+\r
+char 0xd4\r
+........\r
+........\r
+.*......\r
+.*....**\r
+.*..**.*\r
+..**..*.\r
+***.....\r
+..*.....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+....*...\r
+....*...\r
+.....*..\r
+........\r
+\r
+\r
+char 0xd5\r
+........\r
+........\r
+........\r
+........\r
+.******.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+********\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xd6\r
+........\r
+........\r
+.******.\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.******.\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.******.\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xd7\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+********\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+........\r
+\r
+\r
+char 0xd8\r
+........\r
+........\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+........\r
+\r
+\r
+char 0xd9\r
+........\r
+........\r
+....*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+.*..*...\r
+.*..*...\r
+.*..*...\r
+*...*..*\r
+*...*.*.\r
+*...**..\r
+....*...\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xda\r
+........\r
+........\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*.....*\r
+.*....*.\r
+.*...*..\r
+.*..*...\r
+.*.*....\r
+.**.....\r
+........\r
+........\r
+\r
+\r
+char 0xdb\r
+........\r
+........\r
+........\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.******.\r
+.*....*.\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xdc\r
+........\r
+........\r
+........\r
+.*******\r
+.*.....*\r
+.*.....*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+........\r
+\r
+\r
+char 0xdd\r
+........\r
+........\r
+........\r
+***....*\r
+...**..*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+.**.....\r
+........\r
+\r
+\r
+\r
+char 0xde\r
+........\r
+..*.....\r
+*..*....\r
+.*......\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xdf\r
+........\r
+.*......\r
+*.*.....\r
+.*......\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe0\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe1\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe2\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe3\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe4\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe5\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe6\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe7\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe8\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe9\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xea\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xeb\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xec\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xed\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xee\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xef\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf0\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf1\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf2\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf3\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf4\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf5\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf6\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf7\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf8\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf9\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfa\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfb\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfc\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfd\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfe\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xff\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/init.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/init.c
new file mode 100644 (file)
index 0000000..189d523
--- /dev/null
@@ -0,0 +1,53 @@
+\r
+#include "core.h"\r
+\r
+void Initialise_System(System_CommonData *systemdata)\r
+{\r
+       uint eflags;\r
+\r
+       systemdata->vesainfo = (DATA_VESAInfo *) ADR_VESAINFO;\r
+       systemdata->bootinfo = (DATA_BootInfo *) ADR_BOOTINFO;\r
+       systemdata->focus = 0;\r
+       systemdata->key_focus = 0;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       Initialise_SerialPort();\r
+\r
+       Initialise_Graphic(systemdata->vesainfo->BitsPerPixel);\r
+       Draw_Fill_Rectangle(systemdata->vesainfo->PhysBasePtr, systemdata->bootinfo->scrnx - 1, 0x00000000, 0, 0, systemdata->bootinfo->scrnx - 1, systemdata->bootinfo->scrny - 1);\r
+\r
+       Initialise_GlobalDescriptorTable();\r
+       Initialise_InterruptDescriptorTable();\r
+\r
+       System_MemoryControl_Initialise();\r
+       Initialise_Paging(systemdata->vesainfo->PhysBasePtr, systemdata->bootinfo->scrnx, systemdata->bootinfo->scrny, systemdata->vesainfo->BitsPerPixel);\r
+Emergency_Out("Mem-Block is going to Initialise");\r
+       Initialise_MemoryBlock(&sys_mem_ctrl);\r
+Emergency_Out("Mem-Block Initialised");\r
+       FIFO32_Initialise(&systemdata->sysfifo, SYS_FIFOSIZE);\r
+       FIFO32_Initialise(&systemdata->keyboardfifo, KEYCTRL_FIFOSIZE);\r
+       FIFO32_Initialise(&systemdata->mousefifo, MOUSECTRL_FIFOSIZE);\r
+       FIFO32_Initialise(&systemdata->keycmdfifo, KEYCMD_FIFOSIZE);\r
+Emergency_Out("FIFOs Initialised");\r
+       Initialise_ProgrammableInterruptController();\r
+       Initialise_ProgrammableIntervalTimer();\r
+Emergency_Out("Interrupts Initialised");\r
+       Initialise_MultiTask();\r
+       systemdata->maintask = taskctrl->main;\r
+Emergency_Out("MultiTask Initialised");\r
+       Initialise_Keyboard(&systemdata->keyboardfifo, &systemdata->keycmdfifo, DATA_BYTE, systemdata->bootinfo->leds, &systemdata->keycmd_wait);\r
+Emergency_Out("Keyboard Initialised");\r
+       Initialise_Mouse(&systemdata->mousefifo, DATA_BYTE, &systemdata->mousedecode);\r
+Emergency_Out("Mouse Initialised");\r
+       System_Sheet_Initialise(systemdata->vesainfo->PhysBasePtr, systemdata->bootinfo->scrnx, systemdata->bootinfo->scrny, systemdata->vesainfo->BitsPerPixel);\r
+       Initialise_Window(&systemdata->windowctrl);\r
+       Initialise_Console(&systemdata->consctrl, systemdata);\r
+Emergency_Out("Desktop Initialised");\r
+       systemdata->fd_boot = FloppyDisk_Initialise((uchar *)ADR_DISKIMG);\r
+\r
+       IO_Store_EFlags(eflags);\r
+Emergency_Out("Going to return...");\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/inputbox.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/inputbox.c
new file mode 100644 (file)
index 0000000..abe3e7a
--- /dev/null
@@ -0,0 +1,239 @@
+\r
+#include "core.h"\r
+\r
+UI_InputBox *InputBox_Initialise(UI_Sheet_Control *sheetctrl, IO_MemoryControl *memctrl, uint x, uint y, uint xsize, uint ysize, uint txtbufsize, uint forecol, uint backcol, uint height)\r
+{\r
+       UI_InputBox *box;\r
+\r
+       box = MemoryBlock_Allocate_System(sizeof(UI_InputBox));\r
+       MemoryBlock_Write_Description(box, "UI_InputBox");\r
+\r
+       xsize = xsize & ~7;\r
+       ysize = ysize & ~15;\r
+       box->sheet = Sheet_Get(sheetctrl, xsize, ysize, 0, 0);\r
+       box->input_buf_size = txtbufsize;\r
+       box->input_buf = (uchar *)MemoryBlock_Allocate_User(box->input_buf_size, memctrl);\r
+       MemoryBlock_Write_Description(box->input_buf, "INPBOX_TXTBUF");\r
+       box->input_count = 0;\r
+       box->cursor.x = 0;\r
+       box->cursor.y = 0;\r
+       box->prompt.x = -8;\r
+       box->prompt.y = 0;\r
+       box->forecol = forecol;\r
+       box->backcol = backcol;\r
+       box->cursor_state = false;\r
+       box->record = true;\r
+       Draw_Fill_Rectangle(box->sheet->vram, box->sheet->size.x, box->backcol, 0, 0, box->sheet->size.x - 1, box->sheet->size.y - 1);\r
+       Sheet_Show(box->sheet, x, y, height);\r
+       return box;\r
+}\r
+\r
+int InputBox_Put_String(UI_InputBox *box, const uchar *s)\r
+{\r
+       uint i;\r
+       int count, old;\r
+\r
+       if(!box->record){\r
+               InputBox_Put_String_Main(box, s);\r
+               return 0;\r
+       }\r
+\r
+       count = 0;\r
+\r
+       for(i = 0; s[i] != 0x00; i++){\r
+               if(s[i] == '\b'){\r
+                       if(count != 0){\r
+                               count--;\r
+                       }\r
+               } else{\r
+                       count++;\r
+               }\r
+       }\r
+\r
+       if(count > (box->input_buf_size - box->input_count)){\r
+               return -1;\r
+       }\r
+\r
+       InputBox_Put_String_Main(box, s);\r
+\r
+       old = count;\r
+       count = 0;\r
+\r
+       for(i = 0; count < old; i++){\r
+               if(s[i] == '\b'){\r
+                       if(count != 0) count--;\r
+               } else{\r
+                       box->input_buf[box->input_count + count] = s[i];\r
+                       count++;\r
+               }\r
+       }\r
+       box->input_buf[box->input_count + count] = 0x00;\r
+       box->input_count += count;\r
+\r
+       return count;   \r
+}\r
+\r
+int InputBox_Put_Character(UI_InputBox *box, uchar c)\r
+{\r
+       uchar str[2];\r
+\r
+       str[0] = c;\r
+       str[1] = 0x00;\r
+       return InputBox_Put_String(box, str);\r
+}\r
+\r
+void InputBox_Put_String_Main(UI_InputBox *box, const uchar *str)\r
+{\r
+       int i;\r
+       uchar s[3];\r
+\r
+       InputBox_Check_NewLine(box);\r
+\r
+       for(i = 0; ; i++){\r
+               if(str[i] == 0x00){\r
+                       break;\r
+               } else if(str[i] == '\r'){\r
+\r
+               } else if(str[i] == '\n'){\r
+                       InputBox_NewLine_No_Prompt(box);\r
+               } else if(str[i] == '\t'){\r
+                       for(;;){\r
+                               Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, box->cursor.x, box->cursor.y, box->cursor.x + 8 - 1, box->cursor.y + 16 - 1);\r
+                               box->cursor.x += 8;\r
+                               InputBox_Check_NewLine(box);\r
+                               if((box->cursor.x & 0x1f) == 0 && box->cursor.x != 0) break;\r
+                       }\r
+               } else if(str[i] == '\b'){\r
+                       Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, box->cursor.x, box->cursor.y, box->cursor.x + 8 - 1, box->cursor.y + 16 - 1);\r
+                       box->cursor.x -= 8;\r
+                       InputBox_Check_NewLine(box);\r
+                       Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, box->cursor.x, box->cursor.y, box->cursor.x + 8 - 1, box->cursor.y + 16 - 1);\r
+                       if(box->input_count != 0 && box->record){\r
+                               box->input_count--;\r
+                               box->input_buf[box->input_count] = 0x00;\r
+                       }\r
+               } else{\r
+                       s[0] = str[i];\r
+                       s[1] = 0x00;\r
+                       Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, box->cursor.x, box->cursor.y, box->cursor.x + 8 - 1, box->cursor.y + 16 - 1);\r
+                       Sheet_Draw_Put_String(box->sheet, box->cursor.x, box->cursor.y, box->forecol, s);\r
+                       box->cursor.x += 8;\r
+                       InputBox_Check_NewLine(box);\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void InputBox_Check_NewLine(UI_InputBox *box)\r
+{\r
+       if(box->cursor.x <= box->prompt.x || box->cursor.x < 0){        /*\83v\83\8d\83\93\83v\83g\82Ü\82½\82Í\89æ\96Ê\82æ\82è\8d\82É\88Ú\93®\82µ\82æ\82¤\82Æ\82µ\82½*/\r
+               if(box->cursor.y != box->prompt.y){     /*\83v\83\8d\83\93\83v\83g\82Æ\93¯\82\8ds\82Å\82Í\82È\82¢*/\r
+                               box->cursor.y -= 16;\r
+                               box->cursor.x = box->sheet->size.x - 8;\r
+               } else{/*\83v\83\8d\83\93\83v\83g\82Æ\93¯\82\8ds*/\r
+                       box->cursor.y = box->prompt.y;\r
+                       box->cursor.x = box->prompt.x + 8;\r
+               }\r
+       } else if(box->cursor.x >= box->sheet->size.x){\r
+               if(box->cursor.y <= box->sheet->size.y - 17){\r
+                       box->cursor.x = box->prompt.x + 8;\r
+                       box->cursor.y += 16;\r
+               } else{\r
+                       InputBox_Slide_Line(box);\r
+                       box->cursor.x = box->prompt.x + 8;\r
+                       if(box->prompt.y > 0){\r
+                               box->prompt.y -= 16;\r
+                       } else{\r
+                               box->prompt.y = 0;\r
+                       }\r
+               }\r
+       }\r
+       if(box->cursor.y < box->prompt.y){\r
+               box->cursor.y = box->prompt.y;\r
+       }\r
+       return;\r
+}\r
+\r
+void InputBox_NewLine_No_Prompt(UI_InputBox *box)\r
+{\r
+       if(box->cursor.y <= box->sheet->size.y - 17){\r
+               Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, box->cursor.x, box->cursor.y, box->cursor.x + 8 - 1, box->cursor.y + 16 - 1);\r
+               box->cursor.x = box->prompt.x + 8;\r
+               box->cursor.y = box->cursor.y + 16;\r
+       } else{\r
+               Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, box->cursor.x, box->cursor.y, box->cursor.x + 8 - 1, box->cursor.y + 16 - 1);\r
+               InputBox_Slide_Line(box);\r
+               box->cursor.x = box->prompt.x + 8;\r
+       }\r
+       InputBox_Check_NewLine(box);\r
+       return;\r
+}\r
+\r
+void InputBox_NewLine(UI_InputBox *box)\r
+{\r
+       if(box->cursor.y <= box->sheet->size.y - 17){\r
+               box->prompt.y = box->cursor.y + 16;\r
+               InputBox_Put_Prompt(box);\r
+       } else{\r
+               Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, box->cursor.x, box->cursor.y, box->cursor.x + 16 - 1, box->cursor.y + 16 - 1);\r
+               InputBox_Slide_Line(box);\r
+               box->prompt.y = box->sheet->size.y - 16;\r
+               InputBox_Put_Prompt(box);\r
+       }\r
+       return;\r
+}\r
+\r
+void InputBox_Slide_Line(UI_InputBox *box)\r
+{\r
+//     Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, box->cursor.x, box->cursor.y, box->cursor.x + 8 - 1, box->cursor.y + 16 - 1);\r
+       Draw_Slide_Line(box->sheet->vram, box->sheet->size.x, box->sheet->size.y, box->sheet->size.x, 0, 0);\r
+       Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, 0, box->sheet->size.y - 16, box->sheet->size.x - 1, box->sheet->size.y - 1);\r
+       box->sheet->Refresh(box->sheet, 0, 0, box->sheet->size.x - 1, box->sheet->size.y - 1);\r
+       return;\r
+}\r
+\r
+void InputBox_Put_Prompt(UI_InputBox *box)\r
+{\r
+       Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, box->cursor.x, box->cursor.y, box->cursor.x + 16 - 1, box->cursor.y + 16 - 1);\r
+       box->prompt.x = 0;\r
+       Sheet_Draw_Put_String(box->sheet, box->prompt.x, box->prompt.y, box->forecol, ">");\r
+       box->cursor.x = box->prompt.x + 8;\r
+       box->cursor.y = box->prompt.y;\r
+       return;\r
+}\r
+\r
+void InputBox_Reset_Input_Buffer(UI_InputBox *box)\r
+{\r
+       box->input_buf[0] = 0x00;\r
+       box->input_count = 0;\r
+       return;\r
+}\r
+\r
+void InputBox_Change_Cursor_State(UI_InputBox *box)\r
+{\r
+       if(box->cursor_state){\r
+               Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, box->cursor.x, box->cursor.y, box->cursor.x + 8 - 1, box->cursor.y + 16 - 1);\r
+               box->cursor_state = false;\r
+       } else{\r
+               Sheet_Draw_Fill_Rectangle(box->sheet, box->forecol, box->cursor.x, box->cursor.y, box->cursor.x + 8 - 1, box->cursor.y + 16 - 1);\r
+               box->cursor_state = true;\r
+       }\r
+       return;\r
+}\r
+\r
+void InputBox_Clear(UI_InputBox *box)\r
+{\r
+       InputBox_Reset_Input_Buffer(box);\r
+       box->cursor.x = 0;\r
+       box->cursor.y = 0;\r
+       box->prompt.x = -8;\r
+       box->prompt.y = 0;\r
+       Sheet_Draw_Fill_Rectangle(box->sheet, box->backcol, 0, 0, box->sheet->size.x - 1, box->sheet->size.y - 1);\r
+       return;\r
+}\r
+\r
+void InputBox_Set_Record(UI_InputBox *box, bool record)\r
+{\r
+       box->record = record;\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/intrpt.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/intrpt.c
new file mode 100644 (file)
index 0000000..0a6b13c
--- /dev/null
@@ -0,0 +1,42 @@
+\r
+#include "core.h"\r
+\r
+void Initialise_ProgrammableInterruptController(void)\r
+{\r
+       /*\r
+       IRR\81F\83C\83\93\83^\83\89\83v\83g\83\8a\83N\83G\83X\83g\83\8c\83W\83X\83\r
+               .IRQ\83s\83\93\82Ì\8fó\91Ô\82ð\95\\82·\81B\83|\81[\83g\82ð\93Ç\82ñ\82¾\82Æ\82«\82É\81AIRR\82É\82È\82é\82©ISR\82É\82È\82é\82©\82Í\81AOCW3\82Å\91I\91ð\82·\82é\81B\r
+               .1\82É\82È\82Á\82Ä\82¢\82é\83r\83b\83g\82Í\81A\8c»\8dÝ\97v\8b\81\82ª\97\88\82Ä\82¢\82é\81i\82à\82µ\82­\82Í\8f\88\97\9d\92\86\82Ì\81j\8a\84\82è\8d\9e\82Ý\81B\r
+       ISR\81F\83C\83\93\83T\81[\83r\83X\83\8c\83W\83X\83\r
+               .\8c»\8dÝ\8f\88\97\9d\92\86\82Ì\8a\84\82è\8d\9e\82Ý\82ª\82Ç\82ê\82Å\82 \82é\82©\82ð\8e¦\82·\81B\83|\81[\83g\82ð\93Ç\82ñ\82¾\82Æ\82«\82É\81AIRR\82É\82È\82é\82©ISR\82É\82È\82é\82©\82Í\81AOCW3\82Å\91I\91ð\82·\82é\81B\r
+               .1\82É\82È\82Á\82Ä\82¢\82é\83r\83b\83g\82Í\81A\8c»\8dÝ\8f\88\97\9d\92\86\82Ì\8a\84\82è\8d\9e\82Ý\81B\8f\88\97\9d\92\86\82Æ\82¢\82¤\82Ì\82Í\81ACPU\82É\91Î\82µ\82ÄINT\96½\97ß\82ð\94­\8ds\82µ\82½\82ª\81AEOI\81i\8a\84\82è\8d\9e\82Ý\8fI\97¹\96½\97ß\81j\82ð\8eó\82¯\8eæ\82Á\82Ä\82¢\82È\82¢\8a\84\82è\8d\9e\82Ý\81B\r
+       IMR\81F\83C\83\93\83^\83\89\83v\83g\83}\83X\83N\83\8c\83W\83X\83\r
+               .\82±\82ê\82ª1\82É\82È\82Á\82Ä\82¢\82é\8a\84\82è\8d\9e\82Ý\82Í\81AIRR\82ª1\82É\82È\82Á\82Ä\82¢\82Ä\82à\81A\94½\89\9e\82µ\82È\82¢\81\r
+       */\r
+\r
+       IO_Out8(PIC0_IMR, 0xff);        /*\8a\84\82è\8d\9e\82Ý\91S\95\94\96³\8e\8b\81i\83}\83X\83^\81j*/\r
+       IO_Out8(PIC1_IMR, 0xff);        /*\8a\84\82è\8d\9e\82Ý\91S\95\94\96³\8e\8b\81i\83X\83\8c\81[\83u\81j*/\r
+\r
+       IO_Out8(PIC0_ICW1, 0x11);       /*\83G\83b\83W\83g\83\8a\83K\83\82\81[\83h\82É\90Ý\92è\81i\83}\83X\83^\81j*/\r
+       IO_Out8(PIC0_ICW2, 0x20);       /*\8a\84\82è\8d\9e\82Ý\94Ô\8d\86\82ð\81A20~27\82É\90Ý\92è\81B\81i\83}\83X\83^\81j*/\r
+       IO_Out8(PIC0_ICW3, 1 << 2);     /*00000100 \82Â\82Ü\82è\81A\83X\83\8c\81[\83u\82ÍIRQ2\82É\82Â\82È\82ª\82Á\82Ä\82Ü\82·\82æ\82Æ\82¢\82¤\82±\82Æ\81B*/\r
+       IO_Out8(PIC0_ICW4, 0x01);       /*\83m\83\93\83o\83b\83t\83@\83\82\81[\83h\81i\83}\83X\83^\81j*/\r
+\r
+       IO_Out8(PIC1_ICW1, 0x11);       /*\83G\83b\83W\83g\83\8a\83K\83\82\81[\83h\82É\90Ý\92è\81i\83X\83\8c\81[\83u\81j*/\r
+       IO_Out8(PIC1_ICW2, 0x28);       /*\8a\84\82è\8d\9e\82Ý\94Ô\8d\86\82ð\81A28~2f\82É\90Ý\92è\81B\81i\83X\83\8c\81[\83u\81j*/\r
+       IO_Out8(PIC1_ICW3, 2);          /*\8e©\95ª\82Í\83}\83X\83^\82ÌIRQ2\94Ô\82É\82Â\82È\82ª\82Á\82Ä\82Ü\82·\82Æ\82¢\82¤\82±\82Æ\81B*/\r
+       IO_Out8(PIC1_ICW4, 0x01);       /*\83m\83\93\83o\83b\83t\83@\83\82\81[\83h\81i\83X\83\8c\81[\83u\81j*/\r
+\r
+       IO_Out8(PIC0_IMR, 0xfb);        /*11111011\82Â\82Ü\82è\81AIRQ2\94Ô\81i\83X\83\8c\81[\83u\81j\82¾\82¯\8b\96\89Â\81B\82 \82Æ\82Í\96³\8e\8b\81B\81i\83}\83X\83^\81j*/  \r
+       IO_Out8(PIC1_IMR, 0xff);        /*11111111\82Â\82Ü\82è\81A\91S\82Ä\96³\8e\8b*/\r
+\r
+       System_GateDescriptor_Set(0x27, (uint)asm_InterruptHandler27, 0x02, AR_INTGATE32);      /*IRQ-07\91Î\8dô*/\r
+\r
+       return;\r
+}\r
+\r
+void InterruptHandler27(int *esp)\r
+{\r
+       IO_Out8(PIC0_OCW2, 0x67);       /* IRQ-07\8eó\95t\8a®\97¹\82ðPIC\82É\92Ê\92\81B0x60+\94Ô\8d\86\81B*/\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/io.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/io.c
new file mode 100644 (file)
index 0000000..7b93a6b
--- /dev/null
@@ -0,0 +1,33 @@
+\r
+#include "core.h"\r
+\r
+uchar IO_Read_CMOS(uchar addr)\r
+{\r
+       IO_Out8(0x70, addr);\r
+       return IO_In8(0x71);\r
+}\r
+\r
+void IO_Beep(uint fq, uint microsec)\r
+{\r
+       uint timebase;\r
+\r
+       PIT_Beep_Off();\r
+       PIT_Beep_Set(fq);\r
+       PIT_Beep_On();\r
+       timebase = Timer_Get_Tick();    //1sec = 100\r
+       IO_Wait(microsec);\r
+       return;\r
+}\r
+\r
+void IO_Wait(uint microsec)\r
+{\r
+       uint timebase;\r
+\r
+       timebase = Timer_Get_Tick();    //1sec = 100\r
+       for(;;){\r
+               if(microsec < (Timer_Get_Tick() - timebase) * 10000){\r
+                       break;\r
+               }\r
+       }\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/keyboard.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/keyboard.c
new file mode 100644 (file)
index 0000000..66c0a10
--- /dev/null
@@ -0,0 +1,127 @@
+\r
+#include "core.h"\r
+\r
+uchar keytable0[0x80] = {\r
+       0  , 0  , '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^',0x08,0x09,\r
+       'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '@', '[',0x0a, 0  , 'A', 'S', \r
+       'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', ':', 0  , 0  , ']', 'Z', 'X', 'C', 'V',\r
+       'B', 'N', 'M', ',', '.', '/', 0  , '*', 0  , ' ', 0  , 0  , 0  , 0  , 0  , 0  ,      \r
+       0  , 0  , 0  , 0  , 0  , 0  , 0  , '7', '8', '9', '-', '4', '5', '6', '+', '1',\r
+       '2', '3', '0', '.', 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , \r
+       0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , \r
+       0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  \r
+};\r
+\r
+uchar keytable1[0x80] = {\r
+       0  , 0  , '!',0x22, '#', '$', '%', '&',0x27, '(', ')', '~', '=', '~',0x08,0x09,\r
+       'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '`', '{',0x0a, 0  , 'A', 'S', \r
+       'D', 'F', 'G', 'H', 'J', 'K', 'L', '+', '*', 0  , 0  , '}', 'Z', 'X', 'C', 'V',\r
+       'B', 'N', 'M', '<', '>', '?', 0  , '*', 0  , ' ', 0  , 0  , 0  , 0  , 0  , 0  ,      \r
+       0  , 0  , 0  , 0  , 0  , 0  , 0  , '7', '8', '9', '-', '4', '5', '6', '+', '1',\r
+       '2', '3', '0', '.', 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , \r
+       0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , \r
+       0  , 0  , 0  , '_', 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , '|', 0  , 0  \r
+};\r
+\r
+uint key_shift = 0, key_leds;\r
+uint offset_data_k;\r
+DATA_FIFO *sendto_k, *keycmd_k;\r
+int *keycmd_wait_k;\r
+\r
+void Initialise_Keyboard(DATA_FIFO *sendto, DATA_FIFO *keycmd, uint offset, uint leds, int *keycmd_wait)\r
+{\r
+       sendto_k = sendto;\r
+       keycmd_k = keycmd;\r
+       offset_data_k = offset;\r
+       keycmd_wait_k = keycmd_wait;\r
+Emergency_Out("KBD Initialise Start");\r
+       Keyboard_Controller_Wait_SendReady();\r
+       IO_Out8(PORT_KEYCMD, KEYCMD_WRITE_MODE);\r
+       Keyboard_Controller_Wait_SendReady();\r
+       IO_Out8(KEYB_DATA, KBC_MODE);\r
+Emergency_Out("KBD Set Mode");\r
+       System_GateDescriptor_Set(0x21, (uint)asm_InterruptHandler21, 0x02, AR_INTGATE32);\r
+       IO_Out8(PIC0_IMR, IO_In8(PIC0_IMR) & 0xfd);\r
+Emergency_Out("KBD Set INT");\r
+       key_leds = (leds >> 4) & 7;\r
+       FIFO32_Put(keycmd_k, KEYCMD_LED);\r
+       FIFO32_Put(keycmd_k, key_leds);\r
+Emergency_Out("KBD Set LED");\r
+\r
+       return;\r
+}\r
+\r
+void InterruptHandler21(int *esp)\r
+{\r
+       int data;\r
+\r
+       data = IO_In8(KEYB_DATA);\r
+       FIFO32_Put(sendto_k, data + offset_data_k);\r
+       IO_Out8(PIC0_OCW2, 0x61);       /* IRQ-01\8eó\95t\8a®\97¹\82ðPIC\82É\92Ê\92m\81B0x60+\94Ô\8d\86\81B*/\r
+       return;\r
+}\r
+\r
+void Keyboard_Decode(UI_KeyInfo *info, uint data)\r
+{\r
+       if(data == 0xfa){\r
+               *keycmd_wait_k = -1;\r
+       } else if(data == 0xfe){\r
+               Keyboard_Controller_Wait_SendReady();\r
+               IO_Out8(KEYB_DATA, *keycmd_wait_k);\r
+       }\r
+\r
+       if(data >= 0x00 && data <= 0x7f){\r
+               info->make = true;\r
+               if(data == 0x2a) key_shift |= 1;/*LShift on*/\r
+               else if(data == 0x36) key_shift |= 2;/*Rshift on*/\r
+               else if(data == 0x3a) Keyboard_KeyLock(4);/*CapsLock*/\r
+               else if(data == 0x45) Keyboard_KeyLock(2);/*NumLock*/\r
+               else if(data == 0x46) Keyboard_KeyLock(1);/*ScrollLock*/\r
+       } else if(data >= 0x80 && data <= 0xff){\r
+               info->make = false;\r
+               data -= 0x80;\r
+               if(data == 0x2a) key_shift &= ~1;/*LShift off*/\r
+               else if(data == 0x36) key_shift &= ~2;/*Rshift off*/\r
+       }\r
+\r
+       if(key_shift == 0){\r
+               info->c = keytable0[data];\r
+       } else{\r
+               info->c = keytable1[data];\r
+       }\r
+\r
+       if('A' <= info->c && info->c <= 'Z'){\r
+               if(((key_leds & 4) == 0 && key_shift == 0) || ((key_leds & 4) != 0 && key_shift != 0)) info->c += 0x20;\r
+               info->alphabet = true;\r
+       } else {\r
+               info->alphabet = false;\r
+       }\r
+       info->keycode = data;\r
+\r
+       return;\r
+}\r
+\r
+void Keyboard_KeyLock(uint led)\r
+{\r
+       if(key_leds == (key_leds ^ led)) key_leds &= ~led;\r
+       else key_leds ^= led;\r
+       FIFO32_Put(keycmd_k, KEYCMD_LED);\r
+       FIFO32_Put(keycmd_k, key_leds);\r
+       return;\r
+}\r
+\r
+void Keyboard_Controller_Wait_SendReady(void)\r
+{\r
+       /* \83L\81[\83{\81[\83h\83R\83\93\83g\83\8d\81[\83\89\82ª\83f\81[\83^\91\97\90M\89Â\94\\82É\82È\82é\82Ì\82ð\91Ò\82 */\r
+       for (;;) {\r
+               if ((IO_In8(PORT_KEYSTA) & KEYSTA_SEND_NOTREADY) == 0) {\r
+                       break;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+uint Keyboard_Get_KeyShift(void)\r
+{\r
+       return key_shift;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/memblock.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/memblock.c
new file mode 100644 (file)
index 0000000..636f193
--- /dev/null
@@ -0,0 +1,139 @@
+\r
+#include "core.h"\r
+\r
+Memory SystemMemory;\r
+\r
+void Initialise_MemoryBlock(IO_MemoryControl *mainctrl)\r
+{\r
+       SystemMemory.addr = 0;\r
+       SystemMemory.size = 0;\r
+       SystemMemory.next = 0;\r
+       SystemMemory.ctrl = mainctrl;\r
+       SystemMemory.description[0] = 0x00;\r
+       return;\r
+}\r
+\r
+void *MemoryBlock_Allocate_System(uint size)\r
+{\r
+       Memory *block = MemoryControl_Allocate(SystemMemory.ctrl, sizeof(Memory));\r
+       uint *retaddr;\r
+\r
+       retaddr = &size;\r
+\r
+       if(block == 0){\r
+               Emergency_Out("[0x%08X]SysMemAlloc0 Failed.(%dBytes)", *(retaddr - 1), size);\r
+               debug("[0x%08X]SysMemAlloc0 Failed.(%dBytes)", *(retaddr - 1), size);\r
+               for(;;){\r
+                       IO_HLT();\r
+               }\r
+       }\r
+\r
+       block->addr = MemoryControl_Allocate(SystemMemory.ctrl, size);\r
+\r
+       if(block->addr == 0){\r
+               Emergency_Out("[0x%08X]SysMemAlloc1 Failed.(%dBytes)", *(retaddr - 1), size);\r
+               debug("[0x%08X]SysmMemAlloc1 Failed.(%dBytes)", *(retaddr - 1), size);\r
+               for(;;){\r
+                       IO_HLT();\r
+               }\r
+       }\r
+\r
+       block->size = size;\r
+       block->next = SystemMemory.next;\r
+       SystemMemory.next = block;\r
+       SystemMemory.size++;\r
+       block->ctrl = SystemMemory.ctrl;\r
+       block->description[0] = 0x00;\r
+       return block->addr;\r
+}\r
+\r
+void *MemoryBlock_Allocate_User(uint size, IO_MemoryControl *ctrl)\r
+{\r
+       Memory *block = MemoryControl_Allocate(SystemMemory.ctrl, sizeof(Memory));\r
+       uint *retaddr;\r
+\r
+       retaddr = &size;\r
+\r
+       if(block == 0){\r
+               Emergency_Out("[0x%08X]UsrMemAlloc0 Failed.(%dBytes)", *(retaddr - 1), size);\r
+               debug("[0x%08X]UsrMemAlloc0 Failed.(%dBytes)", *(retaddr - 1), size);\r
+               for(;;){\r
+                       IO_HLT();\r
+               }\r
+       }\r
+\r
+       block->addr = MemoryControl_Allocate(ctrl, size);\r
+\r
+       if(block->addr == 0){\r
+               Emergency_Out("[0x%08X]UsrMemAlloc1 Failed.(%dBytes)", *(retaddr - 1), size);\r
+               debug("[0x%08X]UsrMemAlloc1 Failed.(%dBytes)", *(retaddr - 1), size);\r
+               for(;;){\r
+                       IO_HLT();\r
+               }\r
+       }\r
+\r
+       block->size = (size + 7) & ~7;\r
+       block->next = SystemMemory.next;\r
+       SystemMemory.next = block;\r
+       SystemMemory.size++;\r
+       block->ctrl = ctrl;\r
+       block->description[0] = 0x00;\r
+       return block->addr;\r
+}\r
+\r
+Memory *MemoryBlock_Verify(void *addr)\r
+{\r
+       Memory *next;\r
+\r
+       for(next = &SystemMemory; next->next != 0; next = next->next){\r
+               if(next->next->addr == addr){\r
+                       return next->next;\r
+               }\r
+       }\r
+       return 0;\r
+}\r
+\r
+int MemoryBlock_Write_Description(void *addr, const uchar *description)\r
+{\r
+       uint i;\r
+       Memory *block;\r
+\r
+       block = MemoryBlock_Verify(addr);\r
+\r
+       if(block){\r
+               for(i = 0; i < (MEMORY_DESCRIPTION_LENGTH - 1); i++){\r
+                       if(description[i] == 0x00){\r
+                               break;\r
+                       }\r
+                       block->description[i] = description[i];\r
+               }\r
+               block->description[i] = 0x00;\r
+               return i;\r
+       }\r
+       return -1;\r
+}\r
+\r
+int MemoryBlock_Free(void *addr)\r
+{\r
+       Memory *next, *block;\r
+\r
+       if(addr == 0){\r
+               return -1;\r
+       }\r
+\r
+       for(next = &SystemMemory; next->next != 0; next = next->next){\r
+               if(next->next->addr == addr){\r
+                       block = next->next;\r
+                       next->next = block->next;\r
+                       if(MemoryControl_Free(block->ctrl, block->addr, block->size) != 0){\r
+                               return -2;\r
+                       }\r
+                       if(MemoryControl_Free(SystemMemory.ctrl, block, sizeof(Memory)) != 0){\r
+                               return -3;\r
+                       }\r
+                       SystemMemory.size--;\r
+                       return 0;\r
+               }\r
+       }\r
+       return -1;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/memory.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/memory.c
new file mode 100644 (file)
index 0000000..ce24a7c
--- /dev/null
@@ -0,0 +1,192 @@
+\r
+#include "core.h"\r
+\r
+IO_MemoryControl sys_mem_ctrl;\r
+uint sys_mem_size;\r
+\r
+uint Memory_Test(uint start, uint end)\r
+{\r
+       uchar flg486 = 0;\r
+       uint eflg, cr0, i;\r
+\r
+       eflg = IO_Load_EFlags();\r
+       eflg |= EFLAGS_AC_BIT;\r
+       IO_Store_EFlags(eflg);\r
+\r
+       eflg = IO_Load_EFlags();\r
+       if((eflg & EFLAGS_AC_BIT) != 0){\r
+               flg486 = 1;\r
+       }\r
+       eflg &= ~EFLAGS_AC_BIT;\r
+       IO_Store_EFlags(eflg);\r
+\r
+       if(flg486 != 0){\r
+               cr0 = Load_CR0();\r
+               cr0 |= CR0_ALL_CACHE_DISABLE;\r
+               Store_CR0(cr0);\r
+       }\r
+       i = Memory_Test_Sub(start, end);\r
+       if(flg486 != 0){\r
+               cr0 = Load_CR0();\r
+               cr0 &= ~CR0_ALL_CACHE_DISABLE;\r
+               Store_CR0(cr0);         \r
+       }\r
+       return i;\r
+}\r
+\r
+void MemoryControl_Initialise(IO_MemoryControl *ctrl, void *start, uint size)\r
+{\r
+       ctrl->start = start;\r
+       ctrl->size = size;\r
+       ctrl->next = start;\r
+       ((IO_MemoryControlTag *)ctrl->next)->size = ctrl->size;\r
+       ((IO_MemoryControlTag *)ctrl->next)->next = 0;\r
+       return;\r
+}\r
+\r
+uint MemoryControl_FreeSize(IO_MemoryControl *ctrl)\r
+{\r
+       void *tag;\r
+       uint size;\r
+\r
+       size = 0;\r
+       tag = ctrl->next;\r
+\r
+       for(;;){\r
+               size += ((IO_MemoryControlTag *)tag)->size;\r
+               if(((IO_MemoryControlTag *)tag)->next == 0){\r
+                       break;\r
+               }\r
+               tag = ((IO_MemoryControlTag *)tag)->next;\r
+       }\r
+       return size;\r
+}\r
+\r
+void *MemoryControl_Allocate(IO_MemoryControl *ctrl, uint size)\r
+{\r
+       void **before;\r
+\r
+       size = (size + 7) & ~7;\r
+\r
+       before = &ctrl->next;\r
+       for(;;){\r
+               if((((IO_MemoryControlTag *)*before)->size - 8) > size){\r
+                       break;\r
+               }\r
+               if(((IO_MemoryControlTag *)*before)->next == 0){\r
+                       return 0;\r
+               }\r
+               before = &((IO_MemoryControlTag *)*before)->next;\r
+       }\r
+       ((IO_MemoryControlTag *)(*before + size))->size = ((IO_MemoryControlTag *)*before)->size - size;\r
+       ((IO_MemoryControlTag *)(*before + size))->next = ((IO_MemoryControlTag *)*before)->next;\r
+       *before = *before + size;\r
+\r
+       return *before - size;\r
+}\r
+\r
+int MemoryControl_Free(IO_MemoryControl *ctrl, void *addr0, uint size)\r
+{\r
+       void **before;\r
+\r
+       size = (size + 7) & ~7;\r
+\r
+       before = &ctrl->next;\r
+       for(; before != 0;){\r
+               if((uint)((IO_MemoryControlTag *)*before) == (uint)(addr0 + size)){             //\89ð\95ú\82µ\82½\82¢\83\81\83\82\83\8a\82Ì\8cã\91±\82É\8bó\82«\82ª\82 \82é\8fê\8d\87\81B\r
+                       ((IO_MemoryControlTag *)addr0)->size = ((IO_MemoryControlTag *)(*before))->size + size;\r
+                       ((IO_MemoryControlTag *)addr0)->next = ((IO_MemoryControlTag *)(*before))->next;\r
+                       *before = addr0;\r
+                       return 0;\r
+               }\r
+               if((uint)((IO_MemoryControlTag *)*before)->next >= (uint)(addr0 + size)){\r
+                       Send_SerialPort("Have to Free!1 or 2\r\n");\r
+                       return -1;\r
+               }\r
+               if(((IO_MemoryControlTag *)*before)->next == 0){\r
+                       Send_SerialPort("Have to Free!0\r\n");\r
+                       return -1;\r
+               }\r
+               before = ((IO_MemoryControlTag *)*before)->next;\r
+       }\r
+       return -1;\r
+}\r
+\r
+void *MemoryControl_Allocate_Page(IO_MemoryControl *ctrl)\r
+{\r
+       void *addr, *mem_head_4k, *offset;\r
+\r
+       addr = MemoryControl_Allocate(ctrl, 0x2000);\r
+       if(addr == 0) return 0;\r
+       mem_head_4k = (void *)(((uint)addr + 0xfff) & 0xfffff000);\r
+       (uint)offset = (uint)mem_head_4k - (uint)addr;\r
+       if (offset > 0) {\r
+               MemoryControl_Free(ctrl, addr, (uint)offset);\r
+       }\r
+       MemoryControl_Free(ctrl, mem_head_4k + 0x1000, 0x1000 - (uint)offset);\r
+\r
+       return mem_head_4k;\r
+}\r
+\r
+void MemoryControl_Output_Info(IO_MemoryControl *ctrl)\r
+{\r
+       void *tag;\r
+\r
+       debug("Memory Free Info.\n");\r
+       tag = ctrl->next;\r
+       for(;;){\r
+               debug("Addr:0x%08X Size:0x%08X\n", (uint)tag, ((IO_MemoryControlTag *)tag)->size);\r
+               if(((IO_MemoryControlTag *)tag)->next == 0){\r
+                       break;\r
+               }\r
+               tag = ((IO_MemoryControlTag *)tag)->next;\r
+       }\r
+       return;\r
+}\r
+\r
+void System_MemoryControl_Initialise(void)\r
+{\r
+       sys_mem_size = Memory_Test(0x00400000, 0xbfffffff) & 0xFFFFF000;\r
+       MemoryControl_Initialise(&sys_mem_ctrl, (void *)0x00400000, sys_mem_size - 0x00400000);\r
+       return;\r
+}\r
+\r
+uint System_MemoryControl_FullSize(void)\r
+{\r
+       return sys_mem_size;\r
+}\r
+\r
+uint System_MemoryControl_FreeSize(void)\r
+{\r
+       return MemoryControl_FreeSize(&sys_mem_ctrl);\r
+}\r
+\r
+void *System_MemoryControl_Allocate(uint size)\r
+{\r
+       void *addr;\r
+       uint *retaddr;\r
+\r
+       retaddr = &size;\r
+\r
+       addr = MemoryControl_Allocate(&sys_mem_ctrl, size);\r
+\r
+       debug("[0x%08X]Memory Allocate Request.[0x%08X](%dByte)\n", *(retaddr - 1), addr, size);\r
+\r
+       return addr;\r
+}\r
+\r
+int System_MemoryControl_Free(void *addr0, uint size)\r
+{\r
+       return MemoryControl_Free(&sys_mem_ctrl, addr0, size);\r
+}\r
+\r
+void *System_MemoryControl_Allocate_Page(void)\r
+{\r
+       return MemoryControl_Allocate_Page(&sys_mem_ctrl);\r
+}\r
+\r
+void System_MemoryControl_Output_Info(void)\r
+{\r
+       MemoryControl_Output_Info(&sys_mem_ctrl);\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/mouse.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/mouse.c
new file mode 100644 (file)
index 0000000..894ab55
--- /dev/null
@@ -0,0 +1,294 @@
+\r
+#include "core.h"\r
+\r
+uint offset_data_m;\r
+DATA_FIFO *sendto_m;\r
+UI_MouseInfo *decode_m;\r
+\r
+uchar mcursor_pattern0[24][24] = {\r
+       ".**.....................",\r
+       "*O**....................",\r
+       "*OO**...................",\r
+       "*OOO**..................",\r
+       "*OOOO**.................",\r
+       "*OOOOO**................",\r
+       "*OOOOOO**...............",\r
+       "*OOOOOOO**..............",\r
+       "*OOOOOOOO**.............",\r
+       "*OOOOOOOOO**............",\r
+       "*OOOOOOOOOO**...........",\r
+       "*OOOOOOOOOOO**..........",\r
+       "*OOOOOOOOOOOO**.........",\r
+       "*OOOOOOOOOOOOO**........",\r
+       "*OOOOOOOOOOOOOO**.......",\r
+       "*OOOOOOOOOOOOOOO**......",\r
+       "*OOOOOOOOOOOOOOOO**.....",\r
+       "*OOOOOO*************....",\r
+       "*OOOOO**................",\r
+       "*OOOO**.................",\r
+       "*OOO**..................",\r
+       "*OO**...................",\r
+       "*O**....................",\r
+       "***.....................",\r
+};\r
+\r
+void Initialise_Mouse(DATA_FIFO *sendto, uint offset, UI_MouseInfo *decode)\r
+{\r
+       sendto_m = sendto;\r
+       offset_data_m = offset;\r
+       decode_m = decode;\r
+Emergency_Out("Mouse Initialise Start");\r
+       decode->phase = 0;\r
+       Mouse_Send_Command(MOUSECMD_RESET);\r
+Emergency_Out("Mouse Send Command");\r
+       System_GateDescriptor_Set(0x2c, (uint)asm_InterruptHandler2c, 0x02, AR_INTGATE32);\r
+       IO_Out8(PIC1_IMR, IO_In8(PIC1_IMR) & 0xef);\r
+Emergency_Out("Mouse Set INT");\r
+\r
+       return;\r
+}\r
+\r
+void InterruptHandler2c(int *esp)\r
+{\r
+       int data;\r
+\r
+       data = IO_In8(KEYB_DATA);\r
+       IO_Out8(PIC1_OCW2, 0x64);\r
+       IO_Out8(PIC0_OCW2, 0x62);\r
+       FIFO32_Put(sendto_m, data + offset_data_m);\r
+       return;\r
+}\r
+\r
+int Mouse_Decode(uint data)\r
+{\r
+       switch (decode_m->phase){\r
+               case 0:\r
+                       if(data == 0xfa){\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 1:\r
+                       if(data == 0xaa){\r
+                               Mouse_Send_Command(MOUSECMD_SET_SAMPLE_RATE);\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 2:\r
+                       if(data == 0xfa){\r
+                               Mouse_Send_Command(200);\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 3:\r
+                       if(data == 0xfa){\r
+                               Mouse_Send_Command(MOUSECMD_SET_SAMPLE_RATE);\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 4:\r
+                       if(data == 0xfa){\r
+                               Mouse_Send_Command(100);\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 5:\r
+                       if(data == 0xfa){\r
+                               Mouse_Send_Command(MOUSECMD_SET_SAMPLE_RATE);\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 6:\r
+                       if(data == 0xfa){\r
+                               Mouse_Send_Command(80);\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 7:\r
+                       if(data == 0xfa){\r
+                               Mouse_Send_Command(MOUSECMD_GET_DEVICE_ID);\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 8:\r
+                       if(data == 0xfa){\r
+                               break;\r
+                       }\r
+                       if(data == 0x00){\r
+                               decode_m->type = threebtn;\r
+                               Mouse_Send_Command(MOUSECMD_ENABLE_DATA_REPORTING);\r
+                               decode_m->phase = 10;\r
+                       } else if(data == 0x03){\r
+                               decode_m->type = threebtn_scroll;\r
+                               Mouse_Send_Command(MOUSECMD_ENABLE_DATA_REPORTING);\r
+                               decode_m->phase = 20;\r
+                       } else{\r
+                               Mouse_Send_Command(MOUSECMD_RESET);\r
+                               decode_m->phase = 0;\r
+                       }\r
+                       break;\r
+\r
+               case 10:\r
+                       if(data == 0xfa){\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 11:\r
+                       if((data & 0xc8) == 0x08) {\r
+                               decode_m->buf[0] = data;\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 12:\r
+                       decode_m->buf[1] = data;\r
+                       decode_m->phase++;\r
+                       break;\r
+               case 13:\r
+                       decode_m->buf[2] = data;\r
+                       decode_m->phase -= 2;\r
+                       decode_m->btn = decode_m->buf[0];\r
+                       decode_m->move.x = decode_m->buf[1];\r
+                       decode_m->move.y = decode_m->buf[2];\r
+                       if(decode_m->buf[0] & 0x10){\r
+                               decode_m->move.x |= 0xffffff00;\r
+                       }\r
+                       if(decode_m->buf[0] & 0x20){\r
+                               decode_m->move.y |= 0xffffff00;\r
+                       }\r
+                       decode_m->move.y = - decode_m->move.y;\r
+                       return 1;\r
+\r
+               case 20:\r
+                       if(data == 0xfa){\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 21:\r
+                       if((data & 0xc8) == 0x08) {\r
+                               decode_m->buf[0] = data;\r
+                               decode_m->phase++;\r
+                       }\r
+                       break;\r
+               case 22:\r
+                       decode_m->buf[1] = data;\r
+                       decode_m->phase++;\r
+                       break;\r
+               case 23:\r
+                       decode_m->buf[2] = data;\r
+                       decode_m->btn = decode_m->buf[0];\r
+                       decode_m->move.x = decode_m->buf[1];\r
+                       decode_m->move.y = decode_m->buf[2];\r
+                       if(decode_m->buf[0] & 0x10){\r
+                               decode_m->move.x |= 0xffffff00;\r
+                       }\r
+                       if(decode_m->buf[0] & 0x20){\r
+                               decode_m->move.y |= 0xffffff00;\r
+                       }\r
+                       decode_m->move.y = - decode_m->move.y;\r
+                       decode_m->phase++;\r
+                       break;\r
+               case 24:\r
+                       decode_m->phase -= 3;\r
+                       decode_m->buf[3] = data;\r
+                       decode_m->scroll = decode_m->buf[3] & 0x0f;\r
+                       if(decode_m->scroll & 0x08) {\r
+                               decode_m->scroll |= 0xfffffff0;\r
+                       }\r
+                       return 1;\r
+       }\r
+       return 0;\r
+}\r
+\r
+void Mouse_Send_Command(uint data)\r
+{\r
+       Keyboard_Controller_Wait_SendReady();\r
+       IO_Out8(PORT_KEYCMD, KEYCMD_SENDTO_MOUSE);\r
+       Keyboard_Controller_Wait_SendReady();\r
+       IO_Out8(KEYB_DATA, data);\r
+       return;\r
+}\r
+\r
+void Mouse_Make_MouseCursor(UI_MouseCursor *cursor, int rangex0, int rangey0, int rangex1, int rangey1, uint height)\r
+{\r
+       cursor->move_range0.x = rangex0;\r
+       cursor->move_range0.y = rangey0;\r
+       cursor->move_range1.x = rangex1;\r
+       cursor->move_range1.y = rangey1;\r
+       cursor->position.x = rangex0;\r
+       cursor->position.y = rangey0;\r
+       cursor->sheet = System_Sheet_Get(24, 24, 0, 0x000000FF);\r
+       Mouse_Draw_MouseCursor(cursor, normal);\r
+       Sheet_Show(cursor->sheet, cursor->position.x, cursor->position.y, height);\r
+       return;\r
+}\r
+\r
+void Mouse_Draw_MouseCursor(UI_MouseCursor *cursor, mcursor_state state)\r
+{\r
+       uint x, y;\r
+       uchar *pattern;\r
+\r
+       pattern = &mcursor_pattern0[0][0];\r
+\r
+       if(state == normal){\r
+               cursor->state = normal;\r
+       } else if(state == wait){\r
+               cursor->state = wait;\r
+       }\r
+\r
+       for (y = 0; y < 24; y++) {\r
+               for (x = 0; x < 24; x++) {\r
+                       if (pattern[y * 24 + x] == '*') {\r
+                               Sheet_Draw_Point(cursor->sheet, 0x000000, x, y);\r
+                       }\r
+                       if (pattern[y * 24 + x] == 'O') {\r
+                               Sheet_Draw_Point(cursor->sheet, 0xFFFFFF, x, y);\r
+                       }\r
+                       if (pattern[y * 24 + x] == '.') {\r
+                               Sheet_Draw_Point(cursor->sheet, 0x0000FF, x, y);\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Mouse_Move_Relative(UI_MouseCursor *cursor, int movex, int movey)\r
+{\r
+       cursor->position.x += movex;\r
+       cursor->position.y += movey;\r
+\r
+       if(cursor->position.x < cursor->move_range0.x){\r
+               cursor->position.x = cursor->move_range0.x;\r
+       } else if(cursor->position.x > cursor->move_range1.x){\r
+               cursor->position.x = cursor->move_range1.x;\r
+       }\r
+       if(cursor->position.y < cursor->move_range0.y){\r
+               cursor->position.y = cursor->move_range0.y;\r
+       } else if(cursor->position.y > cursor->move_range1.y){\r
+               cursor->position.y = cursor->move_range1.y;\r
+       }\r
+\r
+       Sheet_Slide(cursor->sheet, cursor->position.x, cursor->position.y);\r
+\r
+       return;\r
+}\r
+\r
+void Mouse_Move_Absolute(UI_MouseCursor *cursor, int px, int py)\r
+{\r
+       cursor->position.x = px;\r
+       cursor->position.y = py;\r
+\r
+       if(cursor->position.x < cursor->move_range0.x){\r
+               cursor->position.x = cursor->move_range0.x;\r
+       } else if(cursor->position.x > cursor->move_range1.x){\r
+               cursor->position.x = cursor->move_range1.x;\r
+       }\r
+       if(cursor->position.y < cursor->move_range0.y){\r
+               cursor->position.y = cursor->move_range0.y;\r
+       } else if(cursor->position.y > cursor->move_range1.y){\r
+               cursor->position.y = cursor->move_range1.y;\r
+       }\r
+\r
+       Sheet_Slide(cursor->sheet, cursor->position.x, cursor->position.y);\r
+\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/mtask.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/mtask.c
new file mode 100644 (file)
index 0000000..c31ace2
--- /dev/null
@@ -0,0 +1,258 @@
+\r
+#include "core.h"\r
+\r
+UI_TaskControl *taskctrl;\r
+\r
+void Initialise_MultiTask(void)\r
+{\r
+       taskctrl = MemoryBlock_Allocate_System(sizeof(UI_TaskControl));\r
+       MemoryBlock_Write_Description(taskctrl, "SystemTaskCtrl");\r
+\r
+       taskctrl->next = 0;\r
+\r
+       taskctrl->main = MultiTask_Task_Get("SystemMainTask");\r
+       taskctrl->main->tss.ldtr = 0;\r
+       taskctrl->idle->tss.iomap = 0x4000;\r
+       taskctrl->main->tss.cr3 = (uint)ADR_Paging_Directory;\r
+       Load_TR(taskctrl->main->selector << 3);\r
+       taskctrl->now = taskctrl->main;\r
+\r
+       taskctrl->idle = MultiTask_Task_Get("SystemIdleTask");\r
+       taskctrl->idle->tss.ldtr = 0;\r
+       taskctrl->idle->tss.iomap = 0x4000;\r
+       taskctrl->idle->tss.eip = (uint)&MultiTask_IdleTask;\r
+       taskctrl->idle->tss.eflags = 0x00000202;\r
+       taskctrl->idle->tss.esp = (uint)MemoryBlock_Allocate_System(64 * 1024) + 64 * 1024;\r
+       MemoryBlock_Write_Description((void *)(taskctrl->idle->tss.esp - 64 * 1024), "IdleTaskStack");\r
+       taskctrl->idle->tss.es = 1 * 8;\r
+       taskctrl->idle->tss.cs = 2 * 8;\r
+       taskctrl->idle->tss.ss = 1 * 8;\r
+       taskctrl->idle->tss.ds = 1 * 8;\r
+       taskctrl->idle->tss.fs = 1 * 8;\r
+       taskctrl->idle->tss.gs = 1 * 8;\r
+       taskctrl->idle->tss.cr3 = (uint)ADR_Paging_Directory;\r
+\r
+       MultiTask_Task_Run(taskctrl->idle);\r
+       MultiTask_Task_Run(taskctrl->main);\r
+\r
+       taskctrl->ts = Timer_Get(0, 0);\r
+       Timer_Set(taskctrl->ts, 2, once);\r
+       Timer_TaskSwitch_Set(taskctrl->ts);\r
+       Timer_Run(taskctrl->ts);\r
+\r
+       return;\r
+}\r
+\r
+UI_Task *MultiTask_Task_Get(const uchar *description)\r
+{\r
+       uint i;\r
+       UI_Task *task;\r
+\r
+       task = MemoryBlock_Allocate_System(sizeof(UI_Task));\r
+       MemoryBlock_Write_Description(task, "UI_Task");\r
+\r
+       task->tss.backlink      = 0;\r
+       task->tss.reserve00     = 0;\r
+       task->tss.esp0          = 0;\r
+       task->tss.ss0           = 0;\r
+       task->tss.reserve01     = 0;\r
+       task->tss.esp1          = 0;\r
+       task->tss.ss1           = 0;\r
+       task->tss.reserve02     = 0;\r
+       task->tss.esp2          = 0;\r
+       task->tss.ss2           = 0;\r
+       task->tss.reserve03     = 0;\r
+       task->tss.cr3           = 0;\r
+       task->tss.eip           = 0;\r
+       task->tss.eflags        = 0;\r
+       task->tss.eax           = 0;\r
+       task->tss.ecx           = 0;\r
+       task->tss.edx           = 0;\r
+       task->tss.ebx           = 0;\r
+       task->tss.esp           = 0;\r
+       task->tss.ebp           = 0;\r
+       task->tss.esi           = 0;\r
+       task->tss.edi           = 0;\r
+       task->tss.es            = 0;\r
+       task->tss.reserve04     = 0;\r
+       task->tss.cs            = 0;\r
+       task->tss.reserve05     = 0;\r
+       task->tss.ss            = 0;\r
+       task->tss.reserve06     = 0;\r
+       task->tss.ds            = 0;\r
+       task->tss.reserve07     = 0;\r
+       task->tss.fs            = 0;\r
+       task->tss.reserve08     = 0;\r
+       task->tss.gs            = 0;\r
+       task->tss.reserve09     = 0;\r
+       task->tss.ldtr          = 0;\r
+       task->tss.reserve10     = 0;\r
+       task->tss.flags         = 0;\r
+       task->tss.iomap         = 0;\r
+\r
+       task->selector = System_SegmentDescriptor_Set(sizeof(IO_TaskStatusSegment) - 1, (int)&task->tss, AR_TSS32);\r
+\r
+       task->quantum = 2; /*0.02sec Default*/\r
+\r
+       task->cputime = 0;\r
+\r
+       task->state = initialized;\r
+\r
+       task->cons = 0;\r
+\r
+       for(i = 0; i < (TASK_DESCRIPTION_LENGTH - 1); i++){\r
+               if(description[i] == 0x00){\r
+                       break;\r
+               }\r
+               task->description[i] = description[i];\r
+       }\r
+       task->description[i] = 0x00;\r
+       return task;\r
+}\r
+\r
+void MultiTask_Task_Change_Quantum(UI_Task *task, uint quantum)\r
+{\r
+       if(1 <= quantum && quantum <= 25){      /*0.01-0.25sec*/\r
+               task->quantum = quantum;\r
+       }\r
+       return;\r
+}\r
+\r
+void MultiTask_Task_Run(UI_Task *task)\r
+{\r
+       uint eflags;\r
+\r
+       if(!(1 <= task->quantum && task->quantum <= 25)){\r
+               task->quantum = 2;\r
+       }\r
+       if(task->state == inuse){\r
+               return;\r
+       } else if(task->state == configured){\r
+               task->state = inuse;\r
+               return;\r
+       }\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       task->next = taskctrl->next;\r
+       taskctrl->next = task;\r
+       task->state = inuse;\r
+\r
+       IO_Store_EFlags(eflags);\r
+       return;\r
+}\r
+\r
+void MultiTask_Task_Sleep(UI_Task *task)\r
+{\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       task->state = configured;\r
+       if(taskctrl->now == task){\r
+               Timer_Cancel(taskctrl->ts);\r
+               MultiTask_TaskSwitch();\r
+       }\r
+\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return;\r
+}\r
+\r
+void MultiTask_Task_Remove(UI_Task *task)\r
+{\r
+       UI_Task **next, *newnow;\r
+       uint eflags;\r
+       bool ts;\r
+\r
+       ts = false;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       if(taskctrl->now == task){\r
+               ts = true;\r
+       }\r
+\r
+       for(newnow = taskctrl->next; newnow->next != 0; newnow = newnow->next){\r
+\r
+       }\r
+\r
+       for(next = &taskctrl->next; (*next)->next != 0; next = &(*next)->next){\r
+               if((*next) == task){\r
+                       (*next) = task->next;\r
+                       task->next = 0;\r
+                       task->state = initialized;\r
+                       break;\r
+               }\r
+               newnow = (*next);\r
+       }\r
+       if(ts){\r
+               taskctrl->now = newnow;\r
+               MultiTask_TaskSwitch();\r
+       }\r
+       IO_Store_EFlags(eflags);\r
+       return;\r
+}\r
+\r
+void MultiTask_Task_Arguments(UI_Task *task, int args, ...)\r
+{\r
+       int i;\r
+       va_list ap;\r
+\r
+       va_start(ap, args);\r
+       \r
+       task->tss.esp -= 4 * (args + 1);\r
+\r
+       for(i = 1; i < args + 1; i++){\r
+               *((int *)(task->tss.esp + (i * 4))) = va_arg(ap, int);\r
+       }\r
+       va_end(ap);\r
+       return; \r
+}\r
+\r
+void MultiTask_TaskSwitch(void)\r
+{\r
+       UI_Task *old, *new;\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       old = taskctrl->now;\r
+\r
+       for(new = taskctrl->now->next; ; new = new->next){\r
+               if(new == 0){\r
+                       new = taskctrl->next;\r
+               }\r
+               if(new->state == inuse){        /*configured = sleep*/\r
+                       taskctrl->now = new;\r
+                       break;\r
+               }\r
+       }\r
+       if(old == taskctrl->now){\r
+               taskctrl->now = old;\r
+               old = 0;\r
+       }\r
+       Timer_Set(taskctrl->ts, taskctrl->now->quantum, once);\r
+       Timer_Run(taskctrl->ts);\r
+       taskctrl->now->cputime += taskctrl->now->quantum;\r
+       if(old){\r
+               FarJMP(0, taskctrl->now->selector << 3);\r
+       }\r
+       IO_Store_EFlags(eflags);\r
+       return;\r
+}\r
+\r
+UI_Task *MultiTask_Get_NowTask(void)\r
+{\r
+       return taskctrl->now;\r
+}\r
+\r
+void MultiTask_IdleTask(void)\r
+{\r
+       for(;;){\r
+               IO_HLT();\r
+       }\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/nasfunc0.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/nasfunc0.nas
new file mode 100644 (file)
index 0000000..83ecddc
--- /dev/null
@@ -0,0 +1,285 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+[FILE "nasfunc0.nas"]\r
+       GLOBAL  _IO_HLT\r
+       GLOBAL  _IO_CLI, _IO_STI, _IO_STIHLT\r
+       GLOBAL  _IO_In8, _IO_Out8\r
+       GLOBAL  _IO_In16, _IO_Out16\r
+       GLOBAL  _IO_In32, _IO_Out32\r
+       GLOBAL  _IO_Load_EFlags, _IO_Store_EFlags\r
+       GLOBAL  _Load_CR0, _Store_CR0\r
+       GLOBAL  _Load_CR2, _Store_CR2\r
+       GLOBAL  _Load_CR3, _Store_CR3\r
+       GLOBAL  _Load_CR4, _Store_CR4\r
+       GLOBAL  _Load_GDTR\r
+       GLOBAL  _Load_IDTR\r
+       GLOBAL  _Load_TR\r
+       GLOBAL  _FarJMP\r
+       GLOBAL  _FarCall\r
+       GLOBAL  _CLTS\r
+       GLOBAL  _FNSave, _FRStore\r
+       GLOBAL  _PIT_Beep_On, _PIT_Beep_Off, _PIT_Beep_Set\r
+       GLOBAL  _CPUID, _CPUID2\r
+       GLOBAL  _Read_TSC\r
+       GLOBAL  _Memory_Test_Sub\r
+       GLOBAL  _INT_3\r
+       GLOBAL  _APP_Run\r
+\r
+[SECTION .text]\r
+\r
+_IO_HLT:\r
+       hlt\r
+       ret\r
+\r
+_IO_CLI:\r
+       cli\r
+       ret\r
+\r
+_IO_STI:\r
+       sti\r
+       ret\r
+\r
+_IO_STIHLT:\r
+       sti\r
+       hlt\r
+       ret\r
+\r
+_IO_In8:\r
+       mov     edx,[esp+4]\r
+       mov     eax,0\r
+       in      al,dx\r
+       ret\r
+\r
+_IO_Out8:\r
+       mov     edx,[esp+4]\r
+       mov     al,[esp+8]\r
+       out     dx,al\r
+       ret\r
+\r
+_IO_In16:\r
+       mov     edx,[esp+4]\r
+       mov     eax,0\r
+       in      ax,dx\r
+       ret\r
+\r
+_IO_Out16:\r
+       mov     edx,[esp+4]\r
+       mov     ax,[esp+8]\r
+       out     dx,ax\r
+       ret\r
+\r
+_IO_In32:\r
+       mov     edx,[esp+4]\r
+       in      eax,dx\r
+       ret\r
+\r
+_IO_Out32:\r
+       mov     edx,[esp+4]\r
+       mov     eax,[esp+8]\r
+       out     dx,eax\r
+       ret\r
+\r
+_IO_Load_EFlags:\r
+       pushfd\r
+       pop     eax\r
+       ret\r
+\r
+_IO_Store_EFlags:\r
+       mov     eax,[esp+4]\r
+       push    eax\r
+       popfd\r
+       ret\r
+\r
+_Load_CR0:\r
+       mov     eax,cr0\r
+       ret\r
+\r
+_Store_CR0:\r
+       mov     eax,[esp+4]\r
+       mov     cr0,eax\r
+       ret\r
+\r
+_Load_CR2:\r
+       mov     eax,cr2\r
+       ret\r
+\r
+_Store_CR2:\r
+       mov     eax,[esp+4]\r
+       mov     cr2,eax\r
+       ret\r
+\r
+_Load_CR3:\r
+       mov     eax,cr3\r
+       ret\r
+\r
+_Store_CR3:\r
+       mov     eax,[esp+4]\r
+       mov     cr3,eax\r
+       ret\r
+\r
+_Load_CR4:\r
+       mov     eax,cr3\r
+       ret\r
+\r
+_Store_CR4:\r
+       mov     eax,[esp+4]\r
+       mov     cr4,eax\r
+       ret\r
+\r
+_Load_GDTR:\r
+       mov     ax,[esp+4]\r
+       mov     [esp+6],ax\r
+       lgdt    [esp+6]\r
+       ret\r
+\r
+_Load_IDTR:\r
+       mov     ax,[esp+4]\r
+       mov     [esp+6],ax\r
+       lidt    [esp+6]\r
+       ret\r
+\r
+_Load_TR:\r
+       ltr     [esp+4]\r
+       ret\r
+\r
+_FarJMP:\r
+       jmp     far     [esp+4]\r
+       ret\r
+\r
+_FarCall:\r
+       call    far     [esp+4]\r
+       ret\r
+\r
+_CLTS:\r
+        clts\r
+        ret\r
+\r
+_FNSave:\r
+        mov     eax,[esp+4]     ; addr\r
+        fnsave  [eax]\r
+        ret\r
+\r
+_FRStore:\r
+        mov     eax,[esp+4]     ; addr\r
+        frstor  [eax]\r
+        ret\r
+\r
+_PIT_Beep_On:\r
+       in      al,0x61\r
+       or      al,0x03\r
+       and     al,0x0f\r
+       out     0x61,al\r
+       ret\r
+\r
+_PIT_Beep_Off:\r
+       in      al,0x61\r
+       and     al,0xd\r
+       out     0x61,al\r
+       ret\r
+\r
+_PIT_Beep_Set:\r
+       mov     eax,1193180\r
+       mov     edx,0x00000000\r
+       mov     ecx,[esp+4]\r
+       div     ecx\r
+       mov     edx,eax\r
+       mov     al,0xb6\r
+       out     0x43,al\r
+       mov     eax,edx\r
+       out     0x42,al\r
+       shr     eax,8\r
+       out     0x42,al\r
+       ret\r
+\r
+_CPUID:\r
+       pushad\r
+       mov     esi,[esp+36]\r
+       mov     eax,[esp+40]\r
+       db      0x0f,0xa2\r
+       mov     [esi   ],eax\r
+       mov     [esi+ 4],ebx\r
+       mov     [esi+ 8],edx\r
+       mov     [esi+12],ecx\r
+       popad\r
+       ret\r
+\r
+_CPUID2:\r
+       pushad\r
+       mov     esi,[esp+36]\r
+       mov     eax,[esp+40]\r
+       db      0x0f,0xa2\r
+       mov     [esi   ],eax\r
+       mov     [esi+ 4],ebx\r
+       mov     [esi+ 8],ecx\r
+       mov     [esi+12],edx\r
+       popad\r
+       ret\r
+\r
+_Read_TSC:\r
+       pushad\r
+       mov     ebx,[esp+36]\r
+       db      0x0f,0x31\r
+       mov     [ebx],edx\r
+       mov     [ebx+4],eax\r
+       popad\r
+       ret\r
+\r
+_Memory_Test_Sub:\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     esi,0xaa55aa55\r
+       mov     edi,0x55aa55aa\r
+       mov     eax,[esp+12+4]\r
+mts_loop:\r
+       mov     ebx,eax\r
+       add     ebx,0xffc\r
+       mov     edx,[ebx]\r
+       mov     [ebx],esi\r
+       xor     dword [ebx],0xffffffff\r
+       cmp     edi,[ebx]\r
+       jne     mts_fin\r
+       xor     dword [ebx],0xffffffff\r
+       cmp     esi,[ebx]\r
+       jne     mts_fin\r
+       mov     [ebx],edx\r
+       add     eax,0x1000\r
+       cmp     eax,[esp+12+8]\r
+       jbe     mts_loop\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
+mts_fin:\r
+       mov     [ebx],edx\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
+\r
+_INT_3:\r
+       int     3\r
+       ret\r
+\r
+_APP_Run:\r
+       pushad\r
+       mov     eax,[esp+36]\r
+       mov     ecx,[esp+40]\r
+       mov     edx,[esp+44]\r
+       mov     ebx,[esp+48]\r
+       mov     ebp,[esp+52]\r
+       mov     [ebp  ],esp\r
+       mov     [ebp+4],ss\r
+       mov     es,bx\r
+       mov     ds,bx\r
+       mov     fs,bx\r
+       mov     gs,bx\r
+\r
+       or      ecx,3\r
+       or      ebx,3\r
+       push    ebx\r
+       push    edx\r
+       push    ecx\r
+       push    eax\r
+       retf\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/nasfunc1.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/nasfunc1.nas
new file mode 100644 (file)
index 0000000..e100d06
--- /dev/null
@@ -0,0 +1,732 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+[FILE "nasfunc1.nas"]\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler00\r
+       EXTERN  _CPU_ExceptionHandler00\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler01\r
+       EXTERN  _CPU_ExceptionHandler01\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler02\r
+       EXTERN  _CPU_ExceptionHandler02\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler03\r
+       EXTERN  _CPU_ExceptionHandler03\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler04\r
+       EXTERN  _CPU_ExceptionHandler04\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler05\r
+       EXTERN  _CPU_ExceptionHandler05\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler06\r
+       EXTERN  _CPU_ExceptionHandler06\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler07\r
+       EXTERN  _CPU_ExceptionHandler07\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler08\r
+       EXTERN  _CPU_ExceptionHandler08\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler09\r
+       EXTERN  _CPU_ExceptionHandler09\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0a\r
+       EXTERN  _CPU_ExceptionHandler0a\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0b\r
+       EXTERN  _CPU_ExceptionHandler0b\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0c\r
+       EXTERN  _CPU_ExceptionHandler0c\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0d\r
+       EXTERN  _CPU_ExceptionHandler0d\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0e\r
+       EXTERN  _CPU_ExceptionHandler0e\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0f\r
+       EXTERN  _CPU_ExceptionHandler0f\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler10\r
+       EXTERN  _CPU_ExceptionHandler10\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler11\r
+       EXTERN  _CPU_ExceptionHandler11\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler12\r
+       EXTERN  _CPU_ExceptionHandler12\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler13\r
+       EXTERN  _CPU_ExceptionHandler13\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler14\r
+       EXTERN  _CPU_ExceptionHandler14\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler15\r
+       EXTERN  _CPU_ExceptionHandler15\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler16\r
+       EXTERN  _CPU_ExceptionHandler16\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler17\r
+       EXTERN  _CPU_ExceptionHandler17\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler18\r
+       EXTERN  _CPU_ExceptionHandler18\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler19\r
+       EXTERN  _CPU_ExceptionHandler19\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1a\r
+       EXTERN  _CPU_ExceptionHandler1a\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1b\r
+       EXTERN  _CPU_ExceptionHandler1b\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1c\r
+       EXTERN  _CPU_ExceptionHandler1c\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1d\r
+       EXTERN  _CPU_ExceptionHandler1d\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1e\r
+       EXTERN  _CPU_ExceptionHandler1e\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1f\r
+       EXTERN  _CPU_ExceptionHandler1f\r
+\r
+       GLOBAL  _asm_InterruptHandler20\r
+       EXTERN  _InterruptHandler20\r
+\r
+       GLOBAL  _asm_InterruptHandler21\r
+       EXTERN  _InterruptHandler21\r
+\r
+       GLOBAL  _asm_InterruptHandler27\r
+       EXTERN  _InterruptHandler27\r
+\r
+       GLOBAL  _asm_InterruptHandler2c\r
+       EXTERN  _InterruptHandler2c\r
+\r
+       GLOBAL  _asm_API_Execute\r
+       EXTERN  _API_Execute\r
+\r
+       GLOBAL  APP_Terminate\r
+\r
+\r
+[SECTION .text]\r
+\r
+_asm_CPU_ExceptionHandler00:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler00\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler01:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler01\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler02:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler02\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler03:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler03\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler04:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler04\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler05:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler05\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler06:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler06\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler07:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler07\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler08:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler08\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler09:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler09\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0a:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0a\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0b:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0b\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0c:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0c\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0d:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0d\r
+;If returned value is not zero, terminate application. EAX is address of ESP0 value.\r
+       cmp     eax,0\r
+       jne     APP_Terminate\r
+;End of terminate code.\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0e:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0e\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0f:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0f\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler10:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler10\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler11:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler11\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler12:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler12\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler13:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler13\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler14:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler14\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler15:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler15\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler16:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler16\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler17:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler17\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler18:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler18\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler19:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler19\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1a:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1a\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1b:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1b\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1c:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1c\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1d:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1d\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1e:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1e\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1f:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1f\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_InterruptHandler20:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _InterruptHandler20\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_InterruptHandler21:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _InterruptHandler21\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_InterruptHandler27:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _InterruptHandler27\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_InterruptHandler2c:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _InterruptHandler2c\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_API_Execute:\r
+       sti\r
+       push    ds\r
+       push    es\r
+       pushad\r
+       pushad\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       mov     fs,ax\r
+       mov     gs,ax\r
+       call    _API_Execute\r
+;If returned value is not zero, terminate application. EAX is address of ESP0 value.\r
+       cmp     eax,0\r
+       jne     APP_Terminate\r
+;End of terminate code.\r
+       add     esp,32\r
+       popad\r
+       pop     es\r
+       pop     ds\r
+       iretd\r
+\r
+APP_Terminate: ;eax is address of esp0.\r
+       mov     bx,ss\r
+       mov     ds,bx\r
+       mov     es,bx\r
+       mov     fs,bx\r
+       mov     gs,bx\r
+       mov     esp,[eax]\r
+       popad\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/paging.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/paging.c
new file mode 100644 (file)
index 0000000..6cf00aa
--- /dev/null
@@ -0,0 +1,109 @@
+\r
+#include "core.h"\r
+\r
+uint *ADR_Paging_Directory;\r
+\r
+void Initialise_Paging(void *vram, uint xsize, uint ysize, uint bpp)\r
+{\r
+       uint i, j, k, l, m, n, o, cr0;\r
+       uint *page;\r
+\r
+       j = (System_MemoryControl_FullSize() + 0x003FFFFF) >> 22;\r
+       l = (((j << 22) - System_MemoryControl_FullSize()) + 0xFFF) >> 12;\r
+       ADR_Paging_Directory = (uint *)System_MemoryControl_Allocate_Page();\r
+\r
+       for(i = 0; i < 1024; i++){\r
+               page = (uint *)System_MemoryControl_Allocate_Page();\r
+               Paging_Set_Entry_Directory(&ADR_Paging_Directory[i], page, PG_NOTPRESENT, 0x00000000);\r
+               for(k = 0; k < 1024; k++){\r
+                       Paging_Set_Entry_Table(&(Paging_Get_Entry_Setting_Address(ADR_Paging_Directory[i])[k]), (uint *)((i << 22) + (k * 1024 * 4)), PG_NOTPRESENT, 0x00000000);\r
+               }\r
+       }\r
+\r
+Emergency_Out("Mem-Paging:Tables-Initialized");\r
+\r
+       for(i = 0; i < j; i++){\r
+               Paging_Set_Entry_Directory(&ADR_Paging_Directory[i], Paging_Get_Entry_Setting_Address(ADR_Paging_Directory[i]), PG_PRESENT | PG_WRITABLE | PG_USER | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+               if(i == j - 1 && l != 0){\r
+                       for(k = 0; k < l; k++){\r
+                               Paging_Set_Entry_Table(&(Paging_Get_Entry_Setting_Address(ADR_Paging_Directory[i])[k]), (uint *)((i << 22) + (k * 1024 * 4)), PG_PRESENT | PG_WRITABLE | PG_USER | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+                       }\r
+               } else{\r
+                       for(k = 0; k < 1024; k++){\r
+                               Paging_Set_Entry_Table(&(Paging_Get_Entry_Setting_Address(ADR_Paging_Directory[i])[k]), (uint *)((i << 22) + (k * 1024 * 4)), PG_PRESENT | PG_WRITABLE | PG_USER | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+                       }\r
+               }\r
+       }\r
+\r
+Emergency_Out("Mem-Paging:PhisMemory-Initialized");\r
+\r
+       m = (uint)vram >> 22;\r
+       n = xsize * ysize * (bpp >> 3);\r
+       o = n >> 12;\r
+       if(n != (o << 12)) o++;\r
+       j = (o + 1023) >> 10;\r
+       l = o - ((j - 1) << 10);\r
+\r
+       for(i = 0; i < j; i++){\r
+               Paging_Set_Entry_Directory(&ADR_Paging_Directory[m + i], Paging_Get_Entry_Setting_Address(ADR_Paging_Directory[m + i]), PG_PRESENT | PG_WRITABLE | PG_SUPERVISOR | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+               if(i == j - 1 && l != 0){\r
+                       for(k = 0; k < l; k++){\r
+                               Paging_Set_Entry_Table(&(Paging_Get_Entry_Setting_Address(ADR_Paging_Directory[m + i])[k]), (uint *)(((m + i) << 22) + (k * 1024 * 4)), PG_PRESENT | PG_WRITABLE | PG_SUPERVISOR | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+                       }\r
+               } else{\r
+                       for(k = 0; k < 1024; k++){\r
+                               Paging_Set_Entry_Table(&(Paging_Get_Entry_Setting_Address(ADR_Paging_Directory[m + i])[k]), (uint *)(((m + i) << 22) + (k * 1024 * 4)), PG_PRESENT | PG_WRITABLE | PG_SUPERVISOR | PG_WRITEBACK | PG_CACHE_ENABLE | PG_NOTACCESSED | PG_NOTWRITTEN | PG_4KBPAGE | PG_NOTGLOBAL, 0x00000000);\r
+                       }\r
+               }\r
+       }\r
+\r
+Emergency_Out("Mem-Paging:VideoMemory-Initialized");\r
+\r
+       Store_CR3((uint)ADR_Paging_Directory);\r
+       cr0 = Load_CR0();\r
+       cr0 |= CR0_PAGING + CR0_PROTECTIONENABLE;\r
+       Store_CR0(cr0);\r
+\r
+Emergency_Out("Mem-Paging:Paging-Enabled");\r
+\r
+       return;\r
+}\r
+\r
+void Paging_Set_Entry_Directory(uint *dir_entry, uint *table_base, uint attribute, uint available)\r
+{\r
+       uint entry;\r
+\r
+       if(attribute & PG_PRESENT){\r
+               entry = ((uint)table_base & 0xfffff000);\r
+               entry |= (attribute & 0x000001ff);\r
+               entry |= ((available & 0x00000007) << 9);\r
+       } else{\r
+               entry = ((uint)table_base & 0xfffff000);\r
+               entry |= ((available & 0x00000007) << 9);\r
+               entry &= 0xfffffffe;\r
+       }\r
+       *dir_entry = entry;\r
+\r
+       return;\r
+}\r
+\r
+void Paging_Set_Entry_Table(uint *table_entry, uint *page_base, uint attribute, uint available)\r
+{\r
+       uint entry;\r
+\r
+       if(attribute & PG_PRESENT){\r
+               entry = ((uint)page_base & 0xfffff000);\r
+               entry |= (attribute & 0x000001ff);\r
+               entry |= ((available & 0x00000007) << 9);       \r
+       } else{\r
+               entry = (available << 1);\r
+               entry &= 0xfffffffe;\r
+       }\r
+       *table_entry = entry;\r
+       return;\r
+}\r
+\r
+uint *Paging_Get_Entry_Setting_Address(uint entry)\r
+{\r
+       return (uint *)(entry & 0xFFFFF000);\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/serial.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/serial.c
new file mode 100644 (file)
index 0000000..80cd15a
--- /dev/null
@@ -0,0 +1,47 @@
+\r
+#include "core.h"\r
+\r
+void Initialise_SerialPort(void)\r
+{\r
+       IO_Out8(COM1_CTRL_LINE, 0x80);  //\83{\81[\83\8c\81[\83g\90Ý\92è\8aJ\8en\r
+       IO_Out8(COM1_BAUD_LSB, 0x06);   //0x06 = 19.2bps\r
+       IO_Out8(COM1_CTRL_LINE, 0x03);  //\83{\81[\83\8c\81[\83g\90Ý\92è\8fI\97¹\81A\91\97\8eó\90M\83f\81[\83^8bit\r
+       IO_Out8(COM1_CTRL_MODEM, 0x0b); //\8a\84\82è\8d\9e\82Ý\97L\8cø\81ARTS\81ADTR\83s\83\93\82ð\83A\83N\83e\83B\83u\89»\r
+//     IO_Out8(COM1_INTR_ENBL, 0x04);  //\83\89\83C\83\93\83X\83e\81[\83^\83X\8a\84\82è\8d\9e\82Ý\r
+       IO_Out8(COM1_INTR_ENBL, 0x00);  //\8a\84\82è\8d\9e\82Ý\82È\82µ\r
+\r
+       return;\r
+}\r
+\r
+void Send_SerialPort(uchar *s)\r
+{\r
+       for (; *s != 0x00; s++) {\r
+               if(*s == '\n'){\r
+                       IO_Out8(COM1_TX, '\r');\r
+                       for(; (IO_In8(COM1_STA_LINE) & 0x40) == 0; ){\r
+\r
+                       }\r
+               }\r
+               IO_Out8(COM1_TX, *s);\r
+               for(; (IO_In8(COM1_STA_LINE) & 0x40) == 0; ){\r
+\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+int debug(const uchar *format, ...)\r
+{\r
+       int i;\r
+       va_list ap;\r
+       uchar s[256];\r
+\r
+       va_start(ap, format);\r
+       i = vsprintf(s, format, ap);\r
+       va_end(ap);\r
+\r
+       Send_SerialPort(s);\r
+\r
+       return i;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/sheet.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/sheet.c
new file mode 100644 (file)
index 0000000..5c8cf5e
--- /dev/null
@@ -0,0 +1,795 @@
+\r
+#include "core.h"\r
+\r
+extern IO_MemoryControl sys_mem_ctrl;\r
+\r
+UI_Sheet_Control sys_sheet_ctrl;\r
+\r
+void Sheet_Initialise(UI_Sheet_Control *sheetctrl, IO_MemoryControl *memctrl, void *vram, uint xsize, uint ysize, uint bpp)\r
+{\r
+       uint x, y;\r
+\r
+       sheetctrl->memctrl = memctrl;\r
+\r
+       sheetctrl->mainvram = vram;\r
+       sheetctrl->map = MemoryBlock_Allocate_User(xsize * ysize * 4, sheetctrl->memctrl);\r
+       MemoryBlock_Write_Description(sheetctrl->map, "SHTCTRL_MAP");\r
+       for(y = 0; y < ysize; y++){\r
+               for(x = 0; x < xsize; x++){\r
+                       sheetctrl->map[(y * xsize) + x] = 0;\r
+               }\r
+       }\r
+       sheetctrl->mainvramsize.x = xsize;\r
+       sheetctrl->mainvramsize.y = ysize;\r
+       sheetctrl->mainvrambpp = bpp;\r
+\r
+       sheetctrl->base.vram = 0;\r
+       sheetctrl->base.position.x = 0;\r
+       sheetctrl->base.position.y = 0;\r
+       sheetctrl->base.size.x = 0;\r
+       sheetctrl->base.size.y = 0;\r
+       sheetctrl->base.bpp = 0;\r
+       sheetctrl->base.invcol = 0;\r
+       sheetctrl->base.next = 0;\r
+       sheetctrl->base.before = 0;\r
+       sheetctrl->base.Refresh = 0;\r
+       sheetctrl->base.WriteMap = 0;\r
+       sheetctrl->base.visible = false;\r
+       sheetctrl->base.mouse_movable = false;\r
+       sheetctrl->base.myctrl = sheetctrl;\r
+       sheetctrl->base.fifo = 0;\r
+       sheetctrl->base.msignal_flags = 0;\r
+       sheetctrl->base.ksignal_flags = 0;\r
+\r
+       sheetctrl->sheets = 0;\r
+       return;\r
+}\r
+\r
+UI_Sheet *Sheet_Get(UI_Sheet_Control *ctrl, uint xsize, uint ysize, uint bpp, uint invcol)\r
+{\r
+       UI_Sheet *sheet;\r
+\r
+       if(bpp == 0){\r
+               bpp = ctrl->mainvrambpp;\r
+       }\r
+\r
+       sheet = MemoryBlock_Allocate_User(sizeof(UI_Sheet), ctrl->memctrl);\r
+       MemoryBlock_Write_Description(sheet, "UI_Sheet");\r
+       sheet->vram = MemoryBlock_Allocate_User(xsize * ysize * (bpp >> 3), ctrl->memctrl);\r
+       MemoryBlock_Write_Description(sheet->vram, "UI_Sheet_VRAM");\r
+       sheet->position.x = 0;\r
+       sheet->position.y = 0;\r
+       sheet->size.x = xsize;\r
+       sheet->size.y = ysize;\r
+       sheet->bpp = bpp;\r
+       sheet->invcol = invcol;\r
+       if(sheet->invcol == 0){\r
+               sheet->WriteMap = Sheet_Write_Map_NoInvisible;\r
+       } else if(sheet->bpp == 32){\r
+               sheet->WriteMap = Sheet_Write_Map_32;\r
+       } else if(sheet->bpp == 16){\r
+               sheet->WriteMap = Sheet_Write_Map_16;\r
+               sheet->invcol = RGB_32_To_16(sheet->invcol);\r
+       } else if(sheet->bpp == 8){\r
+               sheet->WriteMap = Sheet_Write_Map_08;\r
+               sheet->invcol = RGB_32_To_08(sheet->invcol);\r
+       }\r
+       sheet->next = 0;\r
+       sheet->before = 0;\r
+\r
+       sheet->Refresh = Sheet_Refresh_Invalid;\r
+       sheet->myctrl = ctrl;\r
+\r
+       sheet->visible = false;\r
+       sheet->mouse_movable = false;\r
+       sheet->MouseEventProcedure = 0;\r
+       sheet->fifo = 0;\r
+       sheet->msignal_flags = 0;\r
+       sheet->ksignal_flags = 0;\r
+\r
+       return sheet;\r
+}\r
+\r
+uint Sheet_Show(UI_Sheet *sheet, int px, int py, uint height)\r
+{\r
+       uint i;\r
+       UI_Sheet *now;\r
+       UI_Sheet_Control *ctrl;\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       ctrl = sheet->myctrl;\r
+\r
+       now = &ctrl->base;\r
+       for(i = 0; i <= height; i++){\r
+               if(now->next == 0){\r
+                       break;\r
+               }\r
+               if(i == height){\r
+                       break;\r
+               }\r
+               now = now->next;\r
+       }\r
+       now->next->before = sheet;\r
+       sheet->next = now->next;\r
+       sheet->before = now;\r
+       now->next = sheet;\r
+\r
+       ctrl->sheets++;\r
+       sheet->position.x = px;\r
+       sheet->position.y = py;\r
+       sheet->visible = true;\r
+\r
+       if(ctrl->mainvrambpp == 32){\r
+               if(sheet->bpp == 32){\r
+                       sheet->Refresh = Sheet_Refresh_32from32;\r
+//             } else if(sheet->bpp == 16){\r
+\r
+//             } else if(sheet->bpp == 8){\r
+\r
+               }\r
+       } else if(ctrl->mainvrambpp == 16){\r
+               if(sheet->bpp == 32){\r
+                       sheet->Refresh = Sheet_Refresh_16from32;\r
+               } else if(sheet->bpp == 16){\r
+                       sheet->Refresh = Sheet_Refresh_16from16;\r
+//             } else if(sheet->bpp == 8){\r
+\r
+               }\r
+       } else if(ctrl->mainvrambpp == 8){\r
+               if(sheet->bpp == 32){\r
+                       sheet->Refresh = Sheet_Refresh_08from32;\r
+//             } else if(sheet->bpp == 16){\r
+\r
+               } else if(sheet->bpp == 8){\r
+                       sheet->Refresh = Sheet_Refresh_08from08;\r
+               }\r
+       }\r
+       IO_Store_EFlags(eflags);\r
+\r
+       Sheet_Refresh_Map(sheet, sheet->position.x, sheet->position.y, sheet->position.x + sheet->size.x - 1, sheet->position.y + sheet->size.y - 1);\r
+       sheet->Refresh(sheet, 0, 0, sheet->size.x - 1, sheet->size.y - 1);\r
+\r
+       return i;\r
+}\r
+\r
+void Sheet_Set_Movable(UI_Sheet *sheet, bool movable)\r
+{\r
+       sheet->mouse_movable = movable;\r
+       return;\r
+}\r
+\r
+void Sheet_Set_MouseEventProcedure(UI_Sheet *sheet, void (*procedure)(UI_MouseEventArguments *e), uint flags)\r
+{\r
+       sheet->MouseEventProcedure = procedure;\r
+       sheet->msignal_flags = flags;\r
+       return;\r
+}\r
+\r
+void Sheet_Set_FIFO(UI_Sheet *sheet, DATA_FIFO *fifo, uint flags)\r
+{\r
+       sheet->fifo = fifo;\r
+       sheet->ksignal_flags = flags;\r
+       return;\r
+}\r
+\r
+void Sheet_Slide(UI_Sheet *sheet, int px, int py)\r
+{\r
+       int movex, movey;\r
+       DATA_Position2D target0, target1;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       movex = px - sheet->position.x;\r
+       movey = py - sheet->position.y;\r
+\r
+       if(movex == 0 && movey == 0){   //\93®\82©\82È\82¢\r
+               return;\r
+       }\r
+       if(movey == 0){ //\89¡\82É\83X\83\89\83C\83h\82·\82é\82¾\82¯\r
+               target0.y = sheet->position.y;\r
+               target1.y = sheet->position.y + sheet->size.y - 1;\r
+               if(movex > 0){  //\89E\95û\8cü\r
+                       target0.x = sheet->position.x;\r
+                       target1.x = sheet->position.x + sheet->size.x - 1 + movex;\r
+               } else{ //\8d\95û\8cü\r
+                       target0.x = sheet->position.x + movex;\r
+                       target1.x = sheet->position.x + sheet->size.x - 1;\r
+               }\r
+       } else if(movex == 0){  //\8fc\82É\83X\83\89\83C\83h\82·\82é\82¾\82¯\r
+               target0.x = sheet->position.x;\r
+               target1.x = sheet->position.x + sheet->size.x - 1;\r
+               if(movey > 0){  //\89º\95û\8cü\r
+                       target0.y = sheet->position.y;\r
+                       target1.y = sheet->position.y + sheet->size.y - 1 + movey;\r
+               } else{ //\8fã\95û\8cü\r
+                       target0.y = sheet->position.y + movey;\r
+                       target1.y = sheet->position.y + sheet->size.y - 1;\r
+               }\r
+       } else if(movex > 0 && movey > 0){      //\89E\89º\82Ö\83X\83\89\83C\83h\r
+               target0.x = sheet->position.x;\r
+               target0.y = sheet->position.y;\r
+               target1.x = sheet->position.x + sheet->size.x - 1 + movex;\r
+               target1.y = sheet->position.y + sheet->size.y - 1 + movey;\r
+       } else if(movex > 0 && movey < 0){      //\89E\8fã\82Ö\83X\83\89\83C\83h\r
+               target0.x = sheet->position.x;\r
+               target0.y = sheet->position.y + movey;\r
+               target1.x = sheet->position.x + sheet->size.x - 1 + movex;\r
+               target1.y = sheet->position.y + sheet->size.y - 1;\r
+       } else if(movex < 0 && movey > 0){      //\8d\89º\82Ö\83X\83\89\83C\83h\r
+               target0.x = sheet->position.x + movex;\r
+               target0.y = sheet->position.y;\r
+               target1.x = sheet->position.x + sheet->size.x - 1;\r
+               target1.y = sheet->position.y + sheet->size.y - 1 + movey;\r
+       } else if(movex < 0 && movey < 0){      //\8d\8fã\82Ö\83X\83\89\83C\83h\r
+               target0.x = sheet->position.x + movex;\r
+               target0.y = sheet->position.y + movey;\r
+               target1.x = sheet->position.x + sheet->size.x - 1;\r
+               target1.y = sheet->position.y + sheet->size.y - 1;\r
+       }\r
+\r
+       sheet->visible = false;\r
+       Sheet_Refresh_Map(sheet, sheet->position.x, sheet->position.y, sheet->position.x + sheet->size.x - 1, sheet->position.y + sheet->size.y - 1);\r
+       sheet->position.x = px;\r
+       sheet->position.y = py;\r
+       sheet->visible = true;\r
+       Sheet_Refresh_Map(sheet, sheet->position.x, sheet->position.y, sheet->position.x + sheet->size.x - 1, sheet->position.y + sheet->size.y - 1);\r
+       Sheet_Refresh_All(ctrl->base.next, sheet->next, target0.x, target0.y, target1.x, target1.y);\r
+       return;\r
+}\r
+\r
+uint Sheet_UpDown(UI_Sheet *sheet, uint height)\r
+{\r
+       uint i;\r
+       UI_Sheet *now;\r
+\r
+       if(sheet->before == 0){\r
+               return 0;\r
+       }\r
+\r
+       now = &sheet->myctrl->base;\r
+\r
+       for(i = 0; now != sheet; i++){\r
+               now = now->next;\r
+       }\r
+       if(i == height){\r
+               return i;\r
+       }\r
+       Sheet_Remove(sheet);\r
+       return Sheet_Show(sheet, sheet->position.x, sheet->position.y, height - 1);\r
+}\r
+\r
+void Sheet_Remove(UI_Sheet *sheet)\r
+{\r
+       UI_Sheet_Control *ctrl;\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       ctrl = sheet->myctrl;\r
+\r
+       ctrl->sheets--;\r
+       sheet->visible = false;\r
+       Sheet_Refresh_Map(sheet, sheet->position.x, sheet->position.y, sheet->position.x + sheet->size.x - 1, sheet->position.y + sheet->size.y - 1);\r
+       sheet->before->next = sheet->next;\r
+       sheet->next->before = sheet->before;\r
+       Sheet_Refresh_All(ctrl->base.next, sheet->next, sheet->position.x, sheet->position.y, sheet->position.x + sheet->size.x - 1, sheet->position.y + sheet->size.y - 1);\r
+       sheet->next = 0;\r
+       sheet->before = 0;\r
+\r
+       IO_Store_EFlags(eflags);\r
+       return;\r
+}\r
+\r
+void Sheet_Refresh_Map(UI_Sheet *sheet, int x0, int y0, int x1, int y1)\r
+{\r
+       UI_Sheet **before;\r
+       uint i, x, y;\r
+       DATA_Position2D target0, target1;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       if(x0 >= ctrl->mainvramsize.x || y0 >= ctrl->mainvramsize.y || x1 < 0 || y1 < 0){\r
+               return;\r
+       }\r
+       if(x0 < 0){\r
+               x0 = 0;\r
+       }\r
+       if(y0 < 0){\r
+               y0 = 0;\r
+       }\r
+       if(x1 >= ctrl->mainvramsize.x){\r
+               x1 = ctrl->mainvramsize.x - 1;\r
+       }\r
+       if(y1 >= ctrl->mainvramsize.y){\r
+               y1 = ctrl->mainvramsize.y - 1;\r
+       }\r
+\r
+       before = &ctrl->base.next;\r
+       for(i = 0; i < ctrl->sheets; i++){\r
+               for(y = y0; y <= y1; y++){\r
+                       for(x = x0; x <= x1; x++){\r
+                               if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)*before){\r
+                                       ctrl->map[(y * ctrl->mainvramsize.x) + x] = 0;\r
+                               }\r
+                       }\r
+               }\r
+               if(*before == sheet){\r
+                       break;\r
+               }\r
+               before = &(*before)->next;\r
+       }\r
+\r
+       i++;\r
+\r
+       for(; i > 0; i--){\r
+               target0.x = (*before)->position.x;\r
+               target0.y = (*before)->position.y;\r
+               target1.x = (*before)->position.x + (*before)->size.x - 1;\r
+               target1.y = (*before)->position.y + (*before)->size.y - 1;\r
+\r
+               if(target0.x <= x1 && target0.y <= y1 && target1.x >= x0 && target1.y >= y0 && (*before)->visible){\r
+                       if(target0.x < x0){\r
+                               target0.x = x0;\r
+                       }\r
+                       if(target0.y < y0){\r
+                               target0.y = y0;\r
+                       }\r
+                       if(target1.x > x1){\r
+                               target1.x = x1;\r
+                       }\r
+                       if(target1.y > y1){\r
+                               target1.y = y1;\r
+                       }\r
+                       (*before)->WriteMap(*before, target0.x, target0.y, target1.x, target1.y);\r
+               }\r
+               before = &(*before)->before;\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Write_Map_32(UI_Sheet *sheet, int x0, int y0, int x1, int y1)\r
+{\r
+       int x, y;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       for(y = y0; y <= y1; y++){\r
+               for(x = x0; x <= x1; x++){\r
+                       if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == 0 && ((uint *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)] != sheet->invcol){\r
+                               ctrl->map[(y * ctrl->mainvramsize.x) + x] = (uint)sheet;\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Write_Map_16(UI_Sheet *sheet, int x0, int y0, int x1, int y1)\r
+{\r
+       int x, y;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       for(y = y0; y <= y1; y++){\r
+               for(x = x0; x <= x1; x++){\r
+                       if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == 0 && ((ushort *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)] != (ushort)sheet->invcol){\r
+                               ctrl->map[(y * ctrl->mainvramsize.x) + x] = (uint)sheet;\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Write_Map_08(UI_Sheet *sheet, int x0, int y0, int x1, int y1)\r
+{\r
+       int x, y;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       for(y = y0; y <= y1; y++){\r
+               for(x = x0; x <= x1; x++){\r
+                       if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == 0 && ((uchar *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)] != (uchar)sheet->invcol){\r
+                               ctrl->map[(y * ctrl->mainvramsize.x) + x] = (uint)sheet;\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Write_Map_NoInvisible(UI_Sheet *sheet, int x0, int y0, int x1, int y1)\r
+{\r
+       int x, y;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       for(y = y0; y <= y1; y++){\r
+               for(x = x0; x <= x1; x++){\r
+                       if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == 0){\r
+                               ctrl->map[(y * ctrl->mainvramsize.x) + x] = (uint)sheet;\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Refresh_All(UI_Sheet *sheet0, UI_Sheet *sheet1, int x0, int y0, int x1, int y1)\r
+{\r
+       UI_Sheet *now;\r
+       uint i;\r
+       DATA_Position2D target0, target1;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet0->myctrl;\r
+       now = sheet0;\r
+       for(i = 0; i < ctrl->sheets; i++){\r
+               target0.x = now->position.x;\r
+               target0.y = now->position.y;\r
+               target1.x = now->position.x + now->size.x - 1;\r
+               target1.y = now->position.y + now->size.y - 1;\r
+\r
+               if(target0.x <= x1 && target0.y <= y1 && target1.x >= x0 && target1.y >= y0 && now->visible){\r
+                       if(target0.x < x0){\r
+                               target0.x = x0;\r
+                       }\r
+                       if(target0.y < y0){\r
+                               target0.y = y0;\r
+                       }\r
+                       if(target1.x > x1){\r
+                               target1.x = x1;\r
+                       }\r
+                       if(target1.y > y1){\r
+                               target1.y = y1;\r
+                       }\r
+                       now->Refresh(now, target0.x - now->position.x, target0.y - now->position.y, target1.x - now->position.x, target1.y - now->position.y);\r
+               }\r
+               if(now->next == sheet1 || now->next == 0){\r
+                       break;\r
+               }\r
+               now = now->next;\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Refresh_32from32(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       int x, y;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       px0 = px0 + sheet->position.x;\r
+       py0 = py0 + sheet->position.y;\r
+       px1 = px1 + sheet->position.x;\r
+       py1 = py1 + sheet->position.y;\r
+\r
+       if(px0 >= ctrl->mainvramsize.x || py0 >= ctrl->mainvramsize.y || px1 < 0 || py1 < 0){\r
+               return;\r
+       }\r
+       if(px0 < 0){\r
+               px0 = 0;\r
+       }\r
+       if(py0 < 0){\r
+               py0 = 0;\r
+       }\r
+       if(px1 >= ctrl->mainvramsize.x){\r
+               px1 = ctrl->mainvramsize.x - 1;\r
+       }\r
+       if(py1 >= ctrl->mainvramsize.y){\r
+               py1 = ctrl->mainvramsize.y - 1;\r
+       }\r
+\r
+       for(y = py0; y <= py1; y++){\r
+               for(x = px0; x <= px1; x++){\r
+                       if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)sheet){\r
+                               ((uint *)ctrl->mainvram)[(y * ctrl->mainvramsize.x) + x] = ((uint *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)];\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Refresh_16from32(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       int x, y;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       px0 = px0 + sheet->position.x;\r
+       py0 = py0 + sheet->position.y;\r
+       px1 = px1 + sheet->position.x;\r
+       py1 = py1 + sheet->position.y;\r
+\r
+       if(px0 >= ctrl->mainvramsize.x || py0 >= ctrl->mainvramsize.y || px1 < 0 || py1 < 0){\r
+               return;\r
+       }\r
+       if(px0 < 0){\r
+               px0 = 0;\r
+       }\r
+       if(py0 < 0){\r
+               py0 = 0;\r
+       }\r
+       if(px1 >= ctrl->mainvramsize.x){\r
+               px1 = ctrl->mainvramsize.x - 1;\r
+       }\r
+       if(py1 >= ctrl->mainvramsize.y){\r
+               py1 = ctrl->mainvramsize.y - 1;\r
+       }\r
+\r
+       for(y = py0; y <= py1; y++){\r
+               for(x = px0; x <= px1; x++){\r
+                       if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)sheet){\r
+                               ((ushort *)ctrl->mainvram)[(y * ctrl->mainvramsize.x) + x] = RGB_32_To_16(((uint *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)]);\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Refresh_08from32(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       int x, y;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       px0 = px0 + sheet->position.x;\r
+       py0 = py0 + sheet->position.y;\r
+       px1 = px1 + sheet->position.x;\r
+       py1 = py1 + sheet->position.y;\r
+\r
+       if(px0 >= ctrl->mainvramsize.x || py0 >= ctrl->mainvramsize.y || px1 < 0 || py1 < 0){\r
+               return;\r
+       }\r
+       if(px0 < 0){\r
+               px0 = 0;\r
+       }\r
+       if(py0 < 0){\r
+               py0 = 0;\r
+       }\r
+       if(px1 >= ctrl->mainvramsize.x){\r
+               px1 = ctrl->mainvramsize.x - 1;\r
+       }\r
+       if(py1 >= ctrl->mainvramsize.y){\r
+               py1 = ctrl->mainvramsize.y - 1;\r
+       }\r
+\r
+       for(y = py0; y <= py1; y++){\r
+               for(x = px0; x <= px1; x++){\r
+                       if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)sheet){\r
+                               ((uchar *)ctrl->mainvram)[(y * ctrl->mainvramsize.x) + x] = RGB_32_To_08_xy(((uint *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)], x, y);\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Refresh_16from16(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       int x, y;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       px0 = px0 + sheet->position.x;\r
+       py0 = py0 + sheet->position.y;\r
+       px1 = px1 + sheet->position.x;\r
+       py1 = py1 + sheet->position.y;\r
+\r
+       if(px0 >= ctrl->mainvramsize.x || py0 >= ctrl->mainvramsize.y || px1 < 0 || py1 < 0){\r
+               return;\r
+       }\r
+       if(px0 < 0){\r
+               px0 = 0;\r
+       }\r
+       if(py0 < 0){\r
+               py0 = 0;\r
+       }\r
+       if(px1 >= ctrl->mainvramsize.x){\r
+               px1 = ctrl->mainvramsize.x - 1;\r
+       }\r
+       if(py1 >= ctrl->mainvramsize.y){\r
+               py1 = ctrl->mainvramsize.y - 1;\r
+       }\r
+\r
+       for(y = py0; y <= py1; y++){\r
+               for(x = px0; x <= px1; x++){\r
+                       if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)sheet){\r
+                               ((ushort *)ctrl->mainvram)[(y * ctrl->mainvramsize.x) + x] = ((ushort *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)];\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Refresh_08from08(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       int x, y;\r
+       UI_Sheet_Control *ctrl;\r
+\r
+       ctrl = sheet->myctrl;\r
+       px0 = px0 + sheet->position.x;\r
+       py0 = py0 + sheet->position.y;\r
+       px1 = px1 + sheet->position.x;\r
+       py1 = py1 + sheet->position.y;\r
+\r
+       if(px0 >= ctrl->mainvramsize.x || py0 >= ctrl->mainvramsize.y || px1 < 0 || py1 < 0){\r
+               return;\r
+       }\r
+       if(px0 < 0){\r
+               px0 = 0;\r
+       }\r
+       if(py0 < 0){\r
+               py0 = 0;\r
+       }\r
+       if(px1 >= ctrl->mainvramsize.x){\r
+               px1 = ctrl->mainvramsize.x - 1;\r
+       }\r
+       if(py1 >= ctrl->mainvramsize.y){\r
+               py1 = ctrl->mainvramsize.y - 1;\r
+       }\r
+\r
+       for(y = py0; y <= py1; y++){\r
+               for(x = px0; x <= px1; x++){\r
+                       if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)sheet){\r
+                               ((uchar *)ctrl->mainvram)[(y * ctrl->mainvramsize.x) + x] = ((uchar *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)];\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Sheet_Refresh_Invalid(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       return;\r
+}\r
+\r
+void Sheet_Draw_Put_String(UI_Sheet *sheet, uint x, uint y, uint c, const uchar *s)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; s[i] != 0x00; i++){\r
+\r
+       }\r
+\r
+       if(y > sheet->size.y - 16){\r
+               return;\r
+       }\r
+\r
+       if(sheet->bpp == 32){\r
+               Draw_Put_String_32(sheet->vram, sheet->size.x, x, y, c, s);\r
+       } else if(sheet->bpp == 16){\r
+               Draw_Put_String_16(sheet->vram, sheet->size.x, x, y, c, s);\r
+       } else if(sheet->bpp == 8){\r
+               Draw_Put_String_08(sheet->vram, sheet->size.x, x, y, c, s);\r
+       }\r
+\r
+       sheet->Refresh(sheet, x, y, x + (i * 8), y + 16);\r
+       return;\r
+}\r
+\r
+void Sheet_Draw_Put_String_With_BackColor(UI_Sheet *sheet, uint x, uint y, uint c, uint bc, const uchar *s)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; s[i] != 0x00; i++){\r
+\r
+       }\r
+\r
+       Sheet_Draw_Fill_Rectangle(sheet, bc, x, y, x + (i * 8) - 1,  y + 16 - 1);\r
+\r
+       if(y > sheet->size.y - 16){\r
+               return;\r
+       }\r
+\r
+       if(sheet->bpp == 32){\r
+               Draw_Put_String_32(sheet->vram, sheet->size.x, x, y, c, s);\r
+       } else if(sheet->bpp == 16){\r
+               Draw_Put_String_16(sheet->vram, sheet->size.x, x, y, c, s);\r
+       } else if(sheet->bpp == 8){\r
+               Draw_Put_String_08(sheet->vram, sheet->size.x, x, y, c, s);\r
+       }\r
+\r
+       sheet->Refresh(sheet, x, y, x + (i * 8), y + 16);\r
+       return;\r
+}\r
+\r
+void Sheet_Draw_Fill_Rectangle(UI_Sheet *sheet, uint c, uint x0, uint y0, uint x1, uint y1)\r
+{\r
+       if(x1 >= sheet->size.x || y1 >= sheet->size.y){\r
+               return;\r
+       }\r
+\r
+       if(sheet->bpp == 32){\r
+               Draw_Fill_Rectangle_32(sheet->vram, sheet->size.x, c, x0, y0, x1, y1);\r
+       } else if(sheet->bpp == 16){\r
+               Draw_Fill_Rectangle_16(sheet->vram, sheet->size.x, c, x0, y0, x1, y1);\r
+       } else if(sheet->bpp == 8){\r
+               Draw_Fill_Rectangle_08(sheet->vram, sheet->size.x, c, x0, y0, x1, y1);\r
+       }\r
+       sheet->Refresh(sheet, x0, y0, x1, y1);\r
+       return;\r
+}\r
+\r
+void Sheet_Draw_Fill_Rectangle_Gradation_Vertical(UI_Sheet *sheet, uint c0, uint c1, uint x0, uint y0, uint x1, uint y1)\r
+{\r
+       int nowcol, nowcol_R, nowcol_G, nowcol_B, add_R, add_G, add_B;\r
+       uint x, y;\r
+\r
+       if(x1 >= sheet->size.x || y1 >= sheet->size.y){\r
+               return;\r
+       }\r
+\r
+       if(y1 == y0){\r
+               return;\r
+       }\r
+\r
+       c0 &= 0x00ffffff;\r
+       c1 &= 0x00ffffff;\r
+\r
+       add_R = (((int)((c1 & 0x00ff0000) >> 16) << 10) - ((int)((c0 & 0x00ff0000) >> 16) << 10)) / (int)(y1 - y0);\r
+       add_G = (((int)((c1 & 0x0000ff00) >> 8) << 10) - ((int)((c0 & 0x0000ff00) >> 8) << 10)) / (int)(y1 - y0);\r
+       add_B = (((int)(c1 & 0x000000ff) << 10) - ((int)(c0 & 0x000000ff) << 10)) / (int)(y1 - y0);\r
+\r
+       nowcol_R = ((c0 & 0x00ff0000) >> 16) << 10;\r
+       nowcol_G = ((c0 & 0x0000ff00) >> 8) << 10;\r
+       nowcol_B = (c0 & 0x000000ff) << 10;\r
+\r
+       for(y = y0; y <= y1; y++){\r
+               nowcol = ((nowcol_R >> 10) << 16) | ((nowcol_G >> 10) << 8) | (nowcol_B >> 10);\r
+               for(x = x0; x <= x1; x++){\r
+                       Sheet_Draw_Point(sheet, (uint)nowcol, x, y);\r
+               }\r
+               nowcol_R += add_R;\r
+               nowcol_G += add_G;\r
+               nowcol_B += add_B;\r
+       }\r
+\r
+       return;\r
+}\r
+void Sheet_Draw_Point(UI_Sheet *sheet, uint c, uint x, uint y)\r
+{\r
+       if(sheet->bpp == 32){\r
+               ((uint *)sheet->vram)[y * sheet->size.x + x] = c;\r
+       } else if(sheet->bpp == 16){\r
+               c = RGB_32_To_16(c);\r
+               ((ushort *)sheet->vram)[y * sheet->size.x + x] = (ushort)c;\r
+       } else if(sheet->bpp == 8){\r
+//             c = RGB_32_To_08(c);\r
+               c = RGB_32_To_08_xy(c, x, y);\r
+               ((uchar *)sheet->vram)[y * sheet->size.x + x] = (uchar)c;\r
+       }\r
+       sheet->Refresh(sheet, x, y, x, y);\r
+       return;\r
+}\r
+\r
+void System_Sheet_Initialise(void *vram, uint xsize, uint ysize, uint bpp)\r
+{\r
+       Sheet_Initialise(&sys_sheet_ctrl, &sys_mem_ctrl, vram, xsize, ysize, bpp);\r
+       return;\r
+}\r
+\r
+UI_Sheet *System_Sheet_Get(uint xsize, uint ysize, uint bpp, uint invcol)\r
+{\r
+       return Sheet_Get(&sys_sheet_ctrl, xsize, ysize, bpp, invcol);\r
+}\r
+\r
+UI_Sheet *Sheet_Get_From_Position(UI_Sheet_Control *ctrl, int x, int y)\r
+{\r
+       if(x < 0 || y < 0 || x > ctrl->mainvramsize.x || y > ctrl->mainvramsize.y){\r
+               return 0;\r
+       }\r
+       return (UI_Sheet *)ctrl->map[(y * ctrl->mainvramsize.x) + x];\r
+}\r
+\r
+uint Sheet_Get_Top_Of_Height(UI_Sheet_Control *ctrl)\r
+{\r
+       if(ctrl->sheets < 1){\r
+               return 0;\r
+       }\r
+       return ctrl->sheets - 1;\r
+}\r
+\r
+uint System_Sheet_Get_Top_Of_Height(void)\r
+{\r
+       return Sheet_Get_Top_Of_Height(&sys_sheet_ctrl);\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/test.mid b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/test.mid
new file mode 100644 (file)
index 0000000..bf9237b
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/test.mid differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/timer.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/timer.c
new file mode 100644 (file)
index 0000000..312cb36
--- /dev/null
@@ -0,0 +1,190 @@
+\r
+#include "core.h"\r
+\r
+UI_TimerControl timerctrl;\r
+\r
+void Initialise_ProgrammableIntervalTimer(void)\r
+{\r
+       UI_Timer *watch;\r
+\r
+       IO_Out8(PIT_CTRL, 0x34);\r
+       IO_Out8(PIT_CNT0, 0x9c);\r
+       IO_Out8(PIT_CNT0, 0x2e);\r
+       System_GateDescriptor_Set(0x20, (uint)asm_InterruptHandler20, 0x02, AR_INTGATE32);\r
+       IO_Out8(PIC0_IMR, IO_In8(PIC0_IMR) & 0xfe);\r
+       timerctrl.count = 0;\r
+       watch = Timer_Get(0, 0);\r
+       watch->timeout = 0xFFFFFFFF;\r
+       watch->count = 0xFFFFFFFF;\r
+       watch->state = inuse;\r
+       timerctrl.next = watch;\r
+       timerctrl.ts = 0;\r
+\r
+       return;\r
+}\r
+\r
+void InterruptHandler20(int *esp)\r
+{\r
+       UI_Timer *tree, *old;\r
+       bool taskswitch;\r
+\r
+       IO_Out8(PIC0_OCW2, 0x60);       /* IRQ-00\8eó\95t\8a®\97¹\82ðPIC\82É\92Ê\92\81B0x60+\94Ô\8d\86\81B*/\r
+       timerctrl.count++;\r
+       taskswitch = false;\r
+\r
+       if(timerctrl.count == timerctrl.next->timeout){ //\8e\9e\8aÔ\82É\82È\82Á\82½\r
+               tree = timerctrl.next;\r
+               timerctrl.next = timerctrl.next->next;\r
+               for(;;){        //\93¯\88ê\83^\83C\83\80\83A\83E\83g\82ð\92T\82·\81B\r
+                       if(tree->fifo != 0){    //FIFO\82Ì\91\97\90M\90æ\82ª\97L\8cø\82©\83`\83F\83b\83N\r
+                               FIFO32_Put(tree->fifo, tree->data);\r
+                       } else if(tree == timerctrl.ts){\r
+                               taskswitch = true;\r
+                       }\r
+                       old = tree;\r
+                       tree = old->tree;\r
+                       old->tree = 0;  //\93¯\88ê\83^\83C\83\80\83A\83E\83g\82È\82µ\r
+                       old->state = configured;        //\90Ý\92è\8dÏ\82Ý\r
+                       if(old->mode == interval){      //\8cJ\82è\95Ô\82·\82È\82ç\r
+                               Timer_Run(old);\r
+                       }\r
+                       if(tree == 0){  //\82à\82¤\93¯\88ê\83^\83C\83\80\83A\83E\83g\82Í\82È\82¢\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+       if(taskswitch){\r
+               MultiTask_TaskSwitch();\r
+       }\r
+       return;\r
+}\r
+\r
+uint Timer_Get_Tick(void)\r
+{\r
+       return timerctrl.count;\r
+}\r
+\r
+UI_Timer *Timer_Get(DATA_FIFO *fifo, uint data)\r
+{\r
+       UI_Timer *timer;\r
+\r
+       timer = MemoryBlock_Allocate_System(sizeof(UI_Timer));\r
+       MemoryBlock_Write_Description(timer, "UI_Timer");\r
+\r
+       timer->next = 0;\r
+       timer->tree = 0;\r
+       timer->timeout = 0;\r
+       timer->count = 0;\r
+       timer->fifo = fifo;\r
+       timer->data = data;\r
+       timer->state = initialized;\r
+       return timer;\r
+}\r
+\r
+void Timer_Set(UI_Timer *timer, uint count, timer_mode mode)\r
+{\r
+       timer->count = count;\r
+       timer->mode = mode;\r
+       timer->state = configured;\r
+       return;\r
+}\r
+\r
+void Timer_Run(UI_Timer *timer)\r
+{\r
+       UI_Timer **target;\r
+       uint eflags;\r
+\r
+       if(timer->count == 0){\r
+               return;\r
+       }\r
+\r
+       if(timer->state == inuse){\r
+               return;\r
+       }\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       timer->timeout = timer->count + timerctrl.count;\r
+       target = &timerctrl.next;\r
+       for(;;){\r
+               if((*target)->timeout > timer->timeout){\r
+                       timer->next = *target;  //\8e©\95ª\82Ì\8e\9f\82Ì\83^\83C\83}\81[\82ð\8ew\82·\r
+                       *target = timer;        //\8e©\95ª\82ð\91O\82Ì\83^\83C\83}\81[\82É\98A\8c\8b\r
+                       timer->tree = 0;        //\8e©\95ª\82ªroot\r
+                       timer->state = inuse;   //\93®\8dì\92\86\r
+                       break;\r
+               }\r
+               if((*target)->timeout == timer->timeout){\r
+                       target = &(*target)->tree;\r
+                       for(;;){\r
+                               if(*target == 0){\r
+                                       break;  //\93¯\8e\9e\8d\8f\82Ì\8dÅ\8cã\82ð\92T\82·\r
+                               }\r
+                               target = &(*target)->tree;\r
+                       }\r
+                       timer->next = 0;        //\8fí\82É0\r
+                       *target = timer;//\8e©\95ª\82ð\91O\82Ì\83^\83C\83}\81[\82É\98A\8c\8b\r
+                       timer->tree = 0;        //\8e©\95ª\82ª\8fI\92[\r
+                       timer->state = inuse;   //\93®\8dì\92\86\r
+                       break;\r
+               }\r
+               target = &(*target)->next;\r
+       }\r
+       IO_Store_EFlags(eflags);\r
+       return;\r
+}\r
+\r
+void Timer_Cancel(UI_Timer *timer)\r
+{\r
+       UI_Timer **root, **tree;\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       root = &timerctrl.next;\r
+\r
+       for(;;){\r
+               if((*root) == 0){       /*\83\8b\81[\83g\82Ì\8fI\92[*/\r
+                       return;\r
+               }\r
+               if((*root) == timer){   /*\83\8b\81[\83g\83^\83C\83}\81[\82ð\83L\83\83\83\93\83Z\83\8b*/\r
+                       if((*root)->tree == 0){ /*\83c\83\8a\81[\82È\82µ*/\r
+                               *root = timer->next;\r
+                       } else{ /*\83c\83\8a\81[\82 \82è*/\r
+                               *root = timer->tree;\r
+                               timer->tree->next = timer->next;\r
+                       }\r
+                       goto cancel;\r
+               } else{\r
+                       tree = &(*root)->tree;\r
+                       for(;;){\r
+                               if((*tree) == 0){       /*\83c\83\8a\81[\82Ì\8fI\92[*/\r
+                                       break;\r
+                               }\r
+                               if((*tree) == timer){   /*\83c\83\8a\81[\83^\83C\83}\81[\82ð\83L\83\83\83\93\83Z\83\8b*/\r
+                                       *tree = timer->tree;\r
+                                       goto cancel;\r
+                               }\r
+                               tree = &(*tree)->tree;\r
+                       }\r
+               }\r
+               root = &(*root)->next;\r
+       }\r
+\r
+cancel:\r
+       timer->next = 0;\r
+       timer->tree = 0;\r
+       timer->timeout = 0;\r
+       timer->state = configured;\r
+\r
+       IO_Store_EFlags(eflags);\r
+       return;\r
+}\r
+\r
+void Timer_TaskSwitch_Set(UI_Timer *ts)\r
+{\r
+       timerctrl.ts = ts;\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/window.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/window.c
new file mode 100644 (file)
index 0000000..a62ec24
--- /dev/null
@@ -0,0 +1,228 @@
+\r
+#include "core.h"\r
+\r
+uchar closebutton[16][40] = {\r
+       "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",\r
+       "OQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQJJQQQQQQQQJJQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQJJJQQQQQQJJJQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQJJJQQQQJJJQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQJJJQQJJJQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQQJJJJJJQQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQQQJJJJQQQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQQQJJJJQQQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQQJJJJJJQQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQJJJQQJJJQQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQJJJQQQQJJJQQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQJJJQQQQQQJJJQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQJJQQQQQQQQJJQQQQQQQQQQQQ$@",\r
+       "OQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ$@",\r
+       "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"\r
+};\r
+\r
+UI_Window *window_root;\r
+\r
+void Initialise_Window(UI_Window *windowctrl)\r
+{\r
+       window_root = windowctrl;\r
+       window_root->client = 0;\r
+       window_root->control = 0;\r
+       window_root->title[0] = 0x00;\r
+       window_root->next = 0;\r
+       return;\r
+}\r
+\r
+UI_Window *Window_Create(const uchar *title, uint flags, uint xsize, uint ysize)\r
+{\r
+       DATA_BootInfo *boot = (DATA_BootInfo *)ADR_BOOTINFO;\r
+       UI_Window *win, *end;\r
+       uint i;\r
+       int x, y;\r
+\r
+       win = MemoryBlock_Allocate_System(sizeof(UI_Window));\r
+       MemoryBlock_Write_Description(win, "UI_Window");\r
+\r
+       for(i = 0; i < (WINDOW_TITLE_LENGTH - 1); i++){\r
+               if(title[i] == 0x00){\r
+                       break;\r
+               }\r
+               win->title[i] = title[i];\r
+       }\r
+       win->title[i] = 0x00;\r
+\r
+       win->control = System_Sheet_Get((i + 8) << 3, WINDOW_CONTROL_XSIZE, 0, 0);\r
+       win->client = System_Sheet_Get(xsize, ysize, 0, 0);\r
+       Sheet_Set_Movable(win->control, true);\r
+\r
+       Sheet_Draw_Fill_Rectangle_Gradation_Vertical(win->control, 0xffffff, 0x7cfc00, 0, 0, win->control->size.x - 1, win->control->size.y - 1);\r
+\r
+       Sheet_Draw_Fill_Rectangle(win->client, 0xffffff, 0, 0, win->client->size.x - 1, win->client->size.y - 1);\r
+\r
+       Window_Draw_CloseButton(win, false);\r
+\r
+//     Sheet_Draw_Fill_Rectangle(win->control, 0xffffff, 0, 0, win->control->size.x - 1, 0);\r
+//     Sheet_Draw_Fill_Rectangle(win->control, 0xffffff, 0, 0, 0, win->control->size.y - 1);\r
+//     Sheet_Draw_Fill_Rectangle(win->control, 0x32cd32, win->control->size.x - 1, 0, win->control->size.x - 1, win->control->size.y - 1);\r
+//     Sheet_Draw_Fill_Rectangle(win->control, 0x32cd32, 0, win->control->size.y - 1, win->control->size.x - 1, win->control->size.y - 1);\r
+\r
+       x = (boot->scrnx >> 1) - (win->client->size.x >> 1);\r
+       y = (boot->scrny >> 1) - (win->client->size.y >> 1) - (win->control->size.y >> 1);\r
+\r
+       if(x < 0){\r
+               x = 0;\r
+       }\r
+       if(y < 0){\r
+               y = 0;\r
+       }\r
+       Sheet_Draw_Put_String(win->control, 4 + 8, 4, 0x00000000, win->title);\r
+\r
+       Sheet_Set_MouseEventProcedure(win->control, &Window_Control_MouseEventProcedure, 0);\r
+\r
+       Sheet_Show(win->control, x, y, System_Sheet_Get_Top_Of_Height());\r
+       Sheet_Show(win->client, x, y + win->control->size.y, System_Sheet_Get_Top_Of_Height());\r
+\r
+       for(end = window_root; end->next != 0; end = end->next){\r
+\r
+       }\r
+       win->next = 0;\r
+       end->next = win;\r
+\r
+       CHNOS_UI_KeyFocus_Change(win->client);\r
+\r
+       return win;\r
+}\r
+\r
+UI_Window *Window_Create_User(const uchar *title, uint flags, UI_Sheet *client)\r
+{\r
+       DATA_BootInfo *boot = (DATA_BootInfo *)ADR_BOOTINFO;\r
+       UI_Window *win, *end;\r
+       uint i;\r
+       int x, y;\r
+\r
+       win = MemoryBlock_Allocate_System(sizeof(UI_Window));\r
+       MemoryBlock_Write_Description(win, "UI_Window");\r
+\r
+       for(i = 0; i < (WINDOW_TITLE_LENGTH - 1); i++){\r
+               if(title[i] == 0x00){\r
+                       break;\r
+               }\r
+               win->title[i] = title[i];\r
+       }\r
+       win->title[i] = 0x00;\r
+\r
+       win->control = System_Sheet_Get((i + 8) << 3, WINDOW_CONTROL_XSIZE, 0, 0);\r
+       win->client = client;\r
+       Sheet_Set_Movable(win->control, true);\r
+\r
+       Sheet_Draw_Fill_Rectangle_Gradation_Vertical(win->control, 0xffffff, 0x7cfc00, 0, 0, win->control->size.x - 1, win->control->size.y - 1);\r
+\r
+       Window_Draw_CloseButton(win, false);\r
+\r
+//     Sheet_Draw_Fill_Rectangle(win->control, 0xffffff, 0, 0, win->control->size.x - 1, 0);\r
+//     Sheet_Draw_Fill_Rectangle(win->control, 0xffffff, 0, 0, 0, win->control->size.y - 1);\r
+//     Sheet_Draw_Fill_Rectangle(win->control, 0x32cd32, win->control->size.x - 1, 0, win->control->size.x - 1, win->control->size.y - 1);\r
+//     Sheet_Draw_Fill_Rectangle(win->control, 0x32cd32, 0, win->control->size.y - 1, win->control->size.x - 1, win->control->size.y - 1);\r
+\r
+       x = (boot->scrnx >> 1) - (win->client->size.x >> 1);\r
+       y = (boot->scrny >> 1) - (win->client->size.y >> 1) - (win->control->size.y >> 1);\r
+\r
+       if(x < 0){\r
+               x = 0;\r
+       }\r
+       if(y < 0){\r
+               y = 0;\r
+       }\r
+       Sheet_Draw_Put_String(win->control, 4 + 8, 4, 0x00000000, win->title);\r
+\r
+       Sheet_Set_MouseEventProcedure(win->control, &Window_Control_MouseEventProcedure, 0);\r
+\r
+       Sheet_Show(win->control, x, y, System_Sheet_Get_Top_Of_Height());\r
+\r
+       if(!win->client->visible){\r
+               Sheet_Show(win->client, x, y + win->control->size.y, System_Sheet_Get_Top_Of_Height());\r
+       } else{\r
+               Sheet_Slide(win->client, x, y + win->control->size.y);\r
+               Sheet_UpDown(win->client, System_Sheet_Get_Top_Of_Height());\r
+       }\r
+\r
+       for(end = window_root; end->next != 0; end = end->next){\r
+\r
+       }\r
+       win->next = 0;\r
+       end->next = win;\r
+\r
+       CHNOS_UI_KeyFocus_Change(win->client);\r
+\r
+       return win;\r
+}\r
+\r
+UI_Window *Window_Get_From_Sheet(UI_Sheet *sheet)\r
+{\r
+       UI_Window *now;\r
+\r
+       for(now = window_root->next; now != 0; now = now->next){\r
+               if(now->control == sheet || now->client == sheet){\r
+                       return now;\r
+               }\r
+       }\r
+       return 0;\r
+}\r
+\r
+void Window_Control_MouseEventProcedure(UI_MouseEventArguments *e)\r
+{\r
+       UI_Window *focus_win;\r
+\r
+       focus_win = Window_Get_From_Sheet(e->focus);\r
+\r
+       if(focus_win == 0){\r
+               return;\r
+       }\r
+\r
+       if((e->button & MOUSE_BUTTON_L) != 0 && (e->button_before & MOUSE_BUTTON_L) == 0){      /*L down*/\r
+               CHNOS_UI_KeyFocus_Change(focus_win->client);\r
+               Sheet_UpDown(focus_win->client, System_Sheet_Get_Top_Of_Height() - 1);\r
+               if(focus_win->control->size.x - 44 <= e->position_local.x && e->position_local.x <= focus_win->control->size.x - 4 - 1 && 0 <= e->position_local.y && e->position_local.y <= 16 - 1){\r
+                       Window_Draw_CloseButton(focus_win, true);\r
+               }\r
+       }\r
+       if((e->button & MOUSE_BUTTON_L) == 0 && (e->button_before & MOUSE_BUTTON_L) != 0){      /*L release*/\r
+               Sheet_Slide(focus_win->client, focus_win->control->position.x, focus_win->control->position.y + focus_win->control->size.y);\r
+               Window_Draw_CloseButton(focus_win, false);\r
+       }\r
+       return;\r
+}\r
+\r
+void Window_Draw_CloseButton(UI_Window *win, bool pressed)\r
+{\r
+       uint x, y, color;\r
+       uchar c;\r
+\r
+       if(pressed){\r
+               Sheet_Draw_Fill_Rectangle_Gradation_Vertical(win->control, 0xff0000, 0xffffff, win->control->size.x - 44, 0, win->control->size.x - 4 - 1, 16 - 1);\r
+       } else{\r
+               Sheet_Draw_Fill_Rectangle_Gradation_Vertical(win->control, 0xffffff, 0xff0000, win->control->size.x - 44, 0, win->control->size.x - 4 - 1, 16 - 1);\r
+       }\r
+\r
+       for(y = 0; y < 16; y++){\r
+               for(x = 0; x < 40; x++){\r
+                       c = closebutton[y][x];\r
+                       color = 0x000000;\r
+                       if(c == '@'){\r
+                               //color = 0x8b0000;\r
+                       } else if(c == '$'){\r
+                               //color = 0xff0000;\r
+                       } else if(c == 'Q'){\r
+                               //color = 0xff0000;\r
+                       } else if(c == 'J'){\r
+                               color = 0xffffff;\r
+                       } else if(c == 'O'){\r
+                               //color = 0xffffff;\r
+                       }\r
+                       if(color != 0x000000){\r
+                               Sheet_Draw_Point(win->control, color, win->control->size.x - 44 + x, y);\r
+                       }\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/xception.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/xception.c
new file mode 100644 (file)
index 0000000..dcd1d03
--- /dev/null
@@ -0,0 +1,274 @@
+\r
+#include "core.h"\r
+\r
+/*CPU Exceptions*/\r
+uchar *cpu_exceptions[0x20] = {\r
+       "Divided by zero.",\r
+       "Reserved.",\r
+       "Nonmaskable interrupt.",\r
+       "Breakpoint.",\r
+       "Overflow.",\r
+       "Outside BOUND.",\r
+       "Invalid opcode.",\r
+       "Disable Device.",\r
+       "Double fault.",\r
+       "Coprocessor Segment Overrun.",\r
+       "Invalid task status segment.",\r
+       "Segment not present.",\r
+       "Stack Segment Fault.",\r
+       "General Protection Exception.",\r
+       "Page fault.",\r
+       "Reserved.",\r
+       "Floating point error.",\r
+       "Alignment Check.",\r
+       "Machine Check.",\r
+       "SIMD floating-point exception.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved."\r
+};\r
+\r
+uchar *cpu_exception_infos[16] = {\r
+       "EDI      ",\r
+       "ESI      ",\r
+       "EBP      ",\r
+       "ESP      ",\r
+       "EBX      ",\r
+       "EDX      ",\r
+       "ECX      ",\r
+       "EAX      ",\r
+       "DS       ",\r
+       "ES       ",\r
+       "ERRORCODE",\r
+       "EIP      ",\r
+       "CS       ",\r
+       "EFLAGS   ",\r
+       "APP's ESP",\r
+       "APP's SS "\r
+};\r
+\r
+void CPU_Exception_Abort(int exception, int *esp)\r
+{\r
+       int i;\r
+\r
+Emergency_Out_Reset();\r
+Emergency_Out("Exception 0x%02X:%s", exception, cpu_exceptions[exception]);\r
+for(i = 0; i < 8; i++){\r
+       Emergency_Out("%s0x%08X %s0x%08X", cpu_exception_infos[i << 1], esp[i << 1], cpu_exception_infos[(i << 1) + 1], esp[(i << 1) + 1]);\r
+}\r
+Emergency_Out("CR0 = 0x%08X", Load_CR0());\r
+Emergency_Out("CR2 = 0x%08X", Load_CR2());\r
+Emergency_Out("CR3 = 0x%08X", Load_CR3());\r
+\r
+       debug("Exception 0x%02X:\n%s\n", exception, cpu_exceptions[exception]);\r
+\r
+       debug("#PUSHAD by _asm_CPU_ExceptionHandler\n");\r
+       for(i = 0; i <= 7; i++){\r
+               debug("%s:0x%08X\n", cpu_exception_infos[i], esp[i]);\r
+       }\r
+\r
+       debug("#PUSH by _asm_CPU_ExceptionHandler\n");\r
+       for(i = 8; i <= 9; i++){\r
+               debug("%s:0x%08X\n", cpu_exception_infos[i], esp[i]);\r
+       }\r
+\r
+       debug("#PUSH by CPU\n");\r
+       for(i = 10; i <= 15; i++){\r
+               debug("%s:0x%08X\n", cpu_exception_infos[i], esp[i]);\r
+       }\r
+\r
+       debug("#Control Registers\n");\r
+       debug("CR0 = 0x%08X\n", Load_CR0());\r
+       debug("CR2 = 0x%08X\n", Load_CR2());\r
+       debug("CR3 = 0x%08X\n", Load_CR3());\r
+\r
+       for(;;){\r
+               IO_HLT();\r
+       }\r
+}\r
+\r
+uint *CPU_Exception_Fault(int exception, int *esp)\r
+{\r
+       UI_Task *nowtask;\r
+       uchar s[128];\r
+\r
+       nowtask = MultiTask_Get_NowTask();\r
+       if(nowtask->cons != 0 && nowtask->cons->app_cs != 0){\r
+               sprintf(s, "\nException 0x%02X:\n\t%s\n", exception, (uchar *)cpu_exceptions[exception]);\r
+               InputBox_Put_String(nowtask->cons->input, s);\r
+               sprintf(s, "\t%s:0x%08X\n", cpu_exception_infos[11], esp[11]);  //EIP\r
+               InputBox_Put_String(nowtask->cons->input, s);\r
+       } else{\r
+               CPU_Exception_Abort(exception, esp);\r
+       }\r
+       return &nowtask->tss.esp0;\r
+}\r
+\r
+void CPU_ExceptionHandler00(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x00, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler01(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x01, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler02(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x02, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler03(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x03, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler04(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x04, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler05(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x05, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler06(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x06, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler07(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x07, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler08(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x08, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler09(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x09, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler0a(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x0a, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler0b(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x0b, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler0c(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x0c, esp);\r
+}\r
+\r
+uint *CPU_ExceptionHandler0d(int *esp)\r
+{\r
+       return CPU_Exception_Fault(0x0d, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler0e(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x0e, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler0f(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x0f, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler10(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x10, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler11(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x11, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler12(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x12, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler13(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x13, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler14(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x14, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler15(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x15, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler16(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x16, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler17(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x17, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler18(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x18, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler19(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x19, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1a(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x1a, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1b(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x1b, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1c(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x1c, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1d(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x1d, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1e(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x1e, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1f(int *esp)\r
+{\r
+       CPU_Exception_Abort(0x1f, esp);\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/Makefile
new file mode 100644 (file)
index 0000000..6e1d790
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = crack1\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/crack1.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/crack1.c
new file mode 100644 (file)
index 0000000..415300d
--- /dev/null
@@ -0,0 +1,9 @@
+\r
+#include "../chnapi.h"\r
+\r
+void CHNMain(void)\r
+{\r
+       api_putchar('C');\r
+       *((uchar *)0x00102600) = 0;\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack1/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/Makefile
new file mode 100644 (file)
index 0000000..0953369
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = crack2\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/crack2.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/crack2.nas
new file mode 100644 (file)
index 0000000..4d74abd
--- /dev/null
@@ -0,0 +1,15 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+\r
+       GLOBAL  _CHNMain\r
+\r
+[SECTION .text]\r
+\r
+_CHNMain:\r
+       mov     eax,1*8\r
+       mov     ds,ax\r
+       mov     byte[0x102600],0\r
+       mov     edx, 4\r
+       int     0x40\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack2/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/Makefile
new file mode 100644 (file)
index 0000000..5719e2d
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = crack3\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/crack3.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/crack3.nas
new file mode 100644 (file)
index 0000000..82c7dec
--- /dev/null
@@ -0,0 +1,18 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+\r
+       GLOBAL  _CHNMain\r
+\r
+[SECTION .text]\r
+\r
+_CHNMain:\r
+       mov     al,0x34\r
+       out     0x43,al\r
+       mov     al,0xff\r
+       out     0x40,al\r
+       mov     al,0xff\r
+       out     0x40,al\r
+       mov     edx, 4\r
+       int     0x40\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack3/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/Makefile
new file mode 100644 (file)
index 0000000..230e505
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = crack4\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/crack4.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/crack4.nas
new file mode 100644 (file)
index 0000000..c503275
--- /dev/null
@@ -0,0 +1,14 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+\r
+       GLOBAL  _CHNMain\r
+\r
+[SECTION .text]\r
+\r
+_CHNMain:\r
+       cli\r
+fin:\r
+       hlt\r
+       jmp     fin\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/crack4/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/Makefile
new file mode 100644 (file)
index 0000000..d31c4a5
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = ctest\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/ctest.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/ctest.c
new file mode 100644 (file)
index 0000000..b115ebf
--- /dev/null
@@ -0,0 +1,9 @@
+\r
+#include "../chnapi.h"\r
+\r
+void CHNMain(void)\r
+{\r
+       api_putchar('C');\r
+       api_putstr("TESTtest...\nNewLine.");\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/ctest/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_009/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_009/make.bat
new file mode 100644 (file)
index 0000000..e489766
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_010/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/!clean.bat
new file mode 100644 (file)
index 0000000..260443d
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean_full\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/!comment.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_010/!comment.txt
new file mode 100644 (file)
index 0000000..fb8ac21
--- /dev/null
@@ -0,0 +1,16 @@
+//\8aJ\94­\82Ì\93r\92\86\82Å\8bC\95t\82¢\82½\82±\82Æ\82È\82Ç\82Ì\83\81\83\82\8f\91\82«\81B\r
+//\89º\82Ì\82Ù\82¤\82ª\90V\82µ\82¢\82à\82Ì\81B\r
+#17:28 2010/12/26\r
+\82±\82Ì\83t\83@\83C\83\8b\82ð\92Ç\89Á\81B\r
+\82Ç\82¤\82â\82ç\81A\83\81\83\82\83\8a\82Ì\83T\83C\83Y\82ª\92\86\93r\94¼\92[\82¾\82Æ\83y\81[\83W\83\93\83O\82Ì\8f\89\8aú\89»\82É\8e¸\94s\82·\82é\82ç\82µ\82¢\81B\97v\91Î\8f\88\81B\r
+\r
+#8:35 2011/02/12\r
+chnos_008->chnos_009\r
+008\82Å\82â\82é\82±\82Æ\82Ì\96Ú\95W\r
+naskfunc.nas\82ð\82¢\82­\82Â\82©\82É\95ª\97£\81B\r
+nasfunc0.nas:\91¼\82Ì\8aÖ\90\94\82É\88Ë\91\82¹\82¸\81A\92P\93Æ\82Å\93®\82­\82à\82Ì\81B\r
+nasfunc1.nas:C\8c¾\8cê\82Ì\8aÖ\90\94\82É\88Ë\91\82·\82é\82à\82Ì\81B\8a\84\82è\8d\9e\82Ý\8aÖ\8cW\82Æ\82©\81B\r
+nasfunc2.nas:nasfunc0.nas\82É\88Ë\91\81BC\82Å\8f\91\82­\82Ù\82Ç\82Å\82Í\82È\82¢\82à\82Ì\82È\82Ç\81B\83r\81[\83v\82Ì\8aî\96{\90§\8cä\82Æ\82©\81B\r
+\82Æ\82è\82 \82¦\82¸\96Ú\91O\82Í\82±\82ñ\82È\8a´\82\81B\r
+\82¢\82Ü\82Íbootpack.c\82Åhlt\83\8b\81[\83v\82Å\8e~\82ß\82Ä\82¢\82é\81B\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_010/Makefile
new file mode 100644 (file)
index 0000000..5807972
--- /dev/null
@@ -0,0 +1,124 @@
+\r
+#\83A\83v\83\8a\92Ç\89Á\8e\9e\82É\8f\91\82«\91«\82·\82×\82«\89Ó\8f\8a        \r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥ 2\89Ó\8f\8a\r
+# \83R\83}\83\93\83h\r
+#  full, clan_full, src_only_full\r
+\r
+TOOLPATH = ../z_tools/\r
+INCPATH  = ../z_tools/CHNOSProject/\r
+\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+EDIMG    = $(TOOLPATH)edimg.exe\r
+IMGTOL   = $(TOOLPATH)RWFD.EXE\r
+COPY     = copy\r
+DEL      = del\r
+\r
+# \83f\83t\83H\83\8b\83g\93®\8dì\r
+\r
+default :\r
+       $(MAKE) chnos.img\r
+\r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥\r
+\r
+chnos.img : chnos/chnipl.bin chnos/chnos.sys chnos/chnipl.nas \\r
+               asmtest/asmtest.chn \\r
+               bug1/bug1.chn \\r
+               crack1/crack1.chn \\r
+               crack2/crack2.chn \\r
+               crack3/crack3.chn \\r
+               crack4/crack4.chn \\r
+               ctest/ctest.chn\r
+       $(EDIMG)   imgin:../z_tools/fdimg0at.tek \\r
+               wbinimg src:chnos/chnipl.bin len:512 from:0 to:0 \\r
+               copy from:chnos/chnos.sys to:@: \\r
+               copy from:chnos/chnipl.nas to:@: \\r
+               copy from:chnos/test.mid to:@: \\r
+               copy from:asmtest/asmtest.chn to:@: \\r
+               copy from:bug1/bug1.chn to:@: \\r
+               copy from:crack1/crack1.chn to:@: \\r
+               copy from:crack2/crack2.chn to:@: \\r
+               copy from:crack3/crack3.chn to:@: \\r
+               copy from:crack4/crack4.chn to:@: \\r
+               copy from:ctest/ctest.chn to:@: \\r
+               imgout:chnos.img\r
+\r
+# \83R\83}\83\93\83h\r
+\r
+run :\r
+       $(MAKE) chnos.img\r
+       $(COPY) chnos.img ..\z_tools\qemu\fdimage0.bin\r
+       $(MAKE) -C ../z_tools/qemu\r
+\r
+run_b :\r
+       $(MAKE) chnos.img\r
+       $(COPY) chnos.img ..\z_tools\bochs\fdimage0.bin\r
+       $(MAKE) -C ../z_tools/bochs\r
+\r
+iso :\r
+       $(MAKE) chnos.img\r
+       ..\z_tools\mkisofs.exe -v -iso-level 1 -b chnos.img -o ..\z_tools\qemu_iso\chnos.iso .\r
+\r
+run_cd :\r
+       $(MAKE) iso\r
+       $(MAKE) -C ../z_tools/qemu_iso\r
+\r
+install :\r
+       $(MAKE) chnos.img\r
+       $(IMGTOL) chnos.img a:\r
+\r
+full :\r
+       $(MAKE) -C chnos\r
+       $(MAKE) -C asmtest\r
+       $(MAKE) -C bug1\r
+       $(MAKE) -C crack1\r
+       $(MAKE) -C crack2\r
+       $(MAKE) -C crack3\r
+       $(MAKE) -C crack4\r
+       $(MAKE) -C ctest\r
+       $(MAKE) chnos.img\r
+\r
+run_full :\r
+       $(MAKE) full\r
+       $(COPY) chnos.img ..\z_tools\qemu\fdimage0.bin\r
+       $(MAKE) -C ../z_tools/qemu\r
+\r
+install_full :\r
+       $(MAKE) full\r
+       $(IMGTOL) chnos.img a:\r
+\r
+run_os :\r
+       $(MAKE) -C chnos\r
+       $(MAKE) run\r
+\r
+clean :\r
+# \89½\82à\82µ\82È\82¢\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DEL) chnos.img\r
+\r
+clean_full :\r
+       $(MAKE) -C asmtest              clean\r
+       $(MAKE) -C bug1                 clean\r
+       $(MAKE) -C crack1               clean\r
+       $(MAKE) -C crack2               clean\r
+       $(MAKE) -C crack3               clean\r
+       $(MAKE) -C crack4               clean\r
+       $(MAKE) -C ctest                clean\r
+       $(MAKE) -C chnos                clean\r
+\r
+src_only_full :\r
+       $(MAKE) -C asmtest              src_only\r
+       $(MAKE) -C bug1                 src_only\r
+       $(MAKE) -C crack1               src_only\r
+       $(MAKE) -C crack2               src_only\r
+       $(MAKE) -C crack3               src_only\r
+       $(MAKE) -C crack4               src_only\r
+       $(MAKE) -C ctest                src_only\r
+       $(MAKE) -C chnos                src_only\r
+       -$(DEL) chnos.img\r
+\r
+refresh :\r
+       $(MAKE) full\r
+       $(MAKE) clean_full\r
+       -$(DEL) chnos.img\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/Makefile
new file mode 100644 (file)
index 0000000..d6d9f2f
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = asmtest\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/asmtest.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/asmtest.nas
new file mode 100644 (file)
index 0000000..7cb3d51
--- /dev/null
@@ -0,0 +1,16 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+\r
+       GLOBAL  _CHNMain\r
+\r
+[SECTION .text]\r
+\r
+_CHNMain:\r
+       mov     edx, 2\r
+       mov     ebx, msg\r
+       int     0x40\r
+       mov     edx, 4\r
+       int     0x40\r
+msg:\r
+       db      "hello", 0\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/asmtest/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/Makefile
new file mode 100644 (file)
index 0000000..252940e
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = bug1\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/bug1.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/bug1.c
new file mode 100644 (file)
index 0000000..d233e7a
--- /dev/null
@@ -0,0 +1,15 @@
+\r
+#include "../chnapi.h"\r
+\r
+void CHNMain(void)\r
+{\r
+       uchar a[100];\r
+\r
+       a[10] = 'A';\r
+       api_putchar(a[10]);\r
+       a[102] = 'B';\r
+       api_putchar(a[102]);\r
+       a[123] = 'C';\r
+       api_putchar(a[123]);\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/bug1/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi.h b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi.h
new file mode 100644 (file)
index 0000000..c249438
--- /dev/null
@@ -0,0 +1,8 @@
+\r
+typedef unsigned char uchar;\r
+typedef unsigned short ushort;\r
+typedef unsigned int uint;\r
+\r
+void api_putchar(uchar c);     //hariboteOS\8cÝ\8a·: void api_putchar(int c);\r
+void api_putstr(uchar *s);     //hariboteOS\8cÝ\8a·: void api_putstr0(char *s);\r
+void api_end(void);            //hariboteOS\8cÝ\8a·: void api_end(void);\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/Makefile
new file mode 100644 (file)
index 0000000..a8d324b
--- /dev/null
@@ -0,0 +1,5 @@
+DEL      = del\r
+\r
+clean :\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.obj\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000001_api_putchar.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000001_api_putchar.nas
new file mode 100644 (file)
index 0000000..463e160
--- /dev/null
@@ -0,0 +1,14 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_putchar\r
+\r
+[SECTION .text]\r
+\r
+_api_putchar:\r
+       mov     edx,1\r
+       mov     al,[esp+4]\r
+       int     0x40\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000002_api_putstr.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000002_api_putstr.nas
new file mode 100644 (file)
index 0000000..b95f3ba
--- /dev/null
@@ -0,0 +1,16 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_putstr\r
+\r
+[SECTION .text]\r
+\r
+_api_putstr:\r
+       push    ebx\r
+       mov     edx,2\r
+       mov     ebx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000004_api_end.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000004_api_end.nas
new file mode 100644 (file)
index 0000000..ea4e695
--- /dev/null
@@ -0,0 +1,12 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_end\r
+\r
+[SECTION .text]\r
+\r
+_api_end:\r
+       mov     edx,4\r
+       int     0x40\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000005_api_openwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000005_api_openwin.nas
new file mode 100644 (file)
index 0000000..08ee698
--- /dev/null
@@ -0,0 +1,25 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_openwin\r
+\r
+[SECTION .text]\r
+\r
+_api_openwin:\r
+;col_inv\82Í\96³\8e\8b\82³\82ê\82Ü\82·\81Bbuf\82Íunsigned char\82Ì\82Ý\8b\96\89Â\81B\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,5\r
+       mov     ebx,[esp+16]\r
+       mov     esi,[esp+20]\r
+       mov     edi,[esp+24]\r
+       mov     eax,[esp+28]\r
+       mov     ecx,[esp+32]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000006_api_putstrwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000006_api_putstrwin.nas
new file mode 100644 (file)
index 0000000..9e62052
--- /dev/null
@@ -0,0 +1,28 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_putstrwin\r
+\r
+[SECTION .text]\r
+\r
+_api_putstrwin:\r
+;len\82Í\96³\8e\8b\82³\82ê\82Ü\82·\81B\95\8e\9a\97ñ\82Í\8fI\92[\82Énull\82ð\92u\82­\82±\82Æ\81B\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,6\r
+       mov     ebx,[esp+20]\r
+       mov     esi,[esp+24]\r
+       mov     edi,[esp+28]\r
+       mov     eax,[esp+32]\r
+       mov     ecx,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000007_api_boxfilwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000007_api_boxfilwin.nas
new file mode 100644 (file)
index 0000000..0cd91c2
--- /dev/null
@@ -0,0 +1,27 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_boxfilwin\r
+\r
+[SECTION .text]\r
+\r
+_api_boxfilwin:\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,7\r
+       mov     ebx,[esp+20]\r
+       mov     eax,[esp+24]\r
+       mov     ecx,[esp+28]\r
+       mov     esi,[esp+32]\r
+       mov     edi,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000008_api_initmalloc.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000008_api_initmalloc.nas
new file mode 100644 (file)
index 0000000..3643071
--- /dev/null
@@ -0,0 +1,20 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_initmalloc\r
+\r
+[SECTION .text]\r
+\r
+_api_initmalloc:\r
+       push    ebx\r
+       mov     edx,8\r
+       mov     ebx,[cs:0x0020]\r
+       mov     eax,ebx\r
+       add     eax,32*1024\r
+       mov     ecx,[cs:0x0000]\r
+       sub     ecx,eax\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000009_api_malloc.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000009_api_malloc.nas
new file mode 100644 (file)
index 0000000..e0b33a1
--- /dev/null
@@ -0,0 +1,17 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_malloc\r
+\r
+[SECTION .text]\r
+\r
+_api_malloc:\r
+       push    ebx\r
+       mov     edx,9\r
+       mov     ebx,[cs:0x0020]\r
+       mov     ecx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000010_api_free.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000010_api_free.nas
new file mode 100644 (file)
index 0000000..c90a3fe
--- /dev/null
@@ -0,0 +1,19 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_free\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_free:\r
+       push    ebx\r
+       mov     edx,10\r
+       mov     ebx,[cs:0x0020]\r
+       mov     eax,[esp+8]\r
+       mov     ecx,[esp+12]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000011_api_point.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000011_api_point.nas
new file mode 100644 (file)
index 0000000..01dc536
--- /dev/null
@@ -0,0 +1,24 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_point\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_point:\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,11\r
+       mov     ebx,[esp+16]\r
+       mov     esi,[esp+20]\r
+       mov     edi,[esp+24]\r
+       mov     eax,[esp+28]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000012_api_refreshwin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000012_api_refreshwin.nas
new file mode 100644 (file)
index 0000000..b2f4f08
--- /dev/null
@@ -0,0 +1,25 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_refreshwin\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_refreshwin:\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     edx,12\r
+       mov     ebx,[esp+16]\r
+       mov     eax,[esp+20]\r
+       mov     ecx,[esp+24]\r
+       mov     esi,[esp+28]\r
+       mov     edi,[esp+32]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000013_api_linewin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000013_api_linewin.nas
new file mode 100644 (file)
index 0000000..0fc9ae1
--- /dev/null
@@ -0,0 +1,28 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_linewin\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_linewin:\r
+       push    edi\r
+       push    esi\r
+       push    ebp\r
+       push    ebx\r
+       mov     edx,13\r
+       mov     ebx,[esp+20]\r
+       mov     eax,[esp+24]\r
+       mov     ecx,[esp+28]\r
+       mov     esi,[esp+32]\r
+       mov     edi,[esp+36]\r
+       mov     ebp,[esp+40]\r
+       int     0x40\r
+       pop     ebx\r
+       pop     ebp\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000014_api_closewin.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000014_api_closewin.nas
new file mode 100644 (file)
index 0000000..1882dc3
--- /dev/null
@@ -0,0 +1,17 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_closewin\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_closewin:\r
+       push    ebx\r
+       mov     edx,14\r
+       mov     ebx,[esp+8]\r
+       int     0x40\r
+       pop     ebx\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000015_api_getkey.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/api_00000015_api_getkey.nas
new file mode 100644 (file)
index 0000000..717f4af
--- /dev/null
@@ -0,0 +1,15 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[OPTIMIZE 1]\r
+[OPTION 1]\r
+[BITS 32]\r
+       GLOBAL  _api_getkey\r
+\r
+[SECTION .text]\r
+\r
+\r
+_api_getkey:\r
+       mov     edx,15\r
+       mov     eax,[esp+4]\r
+       int     0x40\r
+       ret\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/apilist.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/apilist.txt
new file mode 100644 (file)
index 0000000..32d85c5
--- /dev/null
@@ -0,0 +1,16 @@
+APIPATH  = ../chnapi/\r
+\r
+OBJS_API =     $(APIPATH)api_00000001_api_putchar.obj \\r
+               $(APIPATH)api_00000002_api_putstr.obj \\r
+               $(APIPATH)api_00000004_api_end.obj \\r
+               $(APIPATH)api_00000005_api_openwin.obj \\r
+               $(APIPATH)api_00000006_api_putstrwin.obj \\r
+               $(APIPATH)api_00000007_api_boxfilwin.obj \\r
+               $(APIPATH)api_00000008_api_initmalloc.obj \\r
+               $(APIPATH)api_00000009_api_malloc.obj \\r
+               $(APIPATH)api_00000010_api_free.obj \\r
+               $(APIPATH)api_00000011_api_point.obj \\r
+               $(APIPATH)api_00000012_api_refreshwin.obj \\r
+               $(APIPATH)api_00000013_api_linewin.obj \\r
+               $(APIPATH)api_00000014_api_closewin.obj \\r
+               $(APIPATH)api_00000015_api_getkey.obj 
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnapi/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnmake.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnmake.txt
new file mode 100644 (file)
index 0000000..12c721c
--- /dev/null
@@ -0,0 +1,69 @@
+# .chn\83A\83v\83\8a\97p\8b¤\92ÊMakefile\r
+\r
+# APP      = \83A\83v\83\8a\96¼\r
+\r
+# OBJS_APP = \83A\83v\83\8a\82É\95K\97v\82È\83I\83u\83W\83F\83N\83g.obj\r
+\r
+TOOLPATH = ../../z_tools/\r
+INCPATH  = ../../z_tools/CHNOSProject/\r
+\r
+include ../chnapi/apilist.txt\r
+\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+NASK     = $(TOOLPATH)nask.exe\r
+CC1      = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet\r
+BIN2OBJ  = $(TOOLPATH)bin2obj.exe\r
+GAS2NASK = $(TOOLPATH)gas2nask.exe -a\r
+OBJ2BIM  = $(TOOLPATH)obj2bim.exe\r
+BIM2CHN  = $(TOOLPATH)bim2chn.exe\r
+RULEFILE = $(INCPATH)CHNOSP.rul\r
+EDIMG    = $(TOOLPATH)edimg.exe bias:9\r
+IMGTOL   = $(TOOLPATH)RWFD.EXE\r
+MAKEFONT = $(TOOLPATH)makefont.exe\r
+COPY     = copy\r
+DEL      = del\r
+SJISCONV = $(TOOLPATH)sjisconv.exe -s\r
+\r
+# \83f\83t\83H\83\8b\83g\93®\8dì\r
+\r
+default :\r
+       $(MAKE) $(APP).chn\r
+\r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥\r
+\r
+$(APP).bim : $(OBJS_APP) $(OBJS_API) Makefile\r
+       $(OBJ2BIM) @$(RULEFILE) out:$(APP).bim map:$(APP).map $(OBJS_APP) $(OBJS_API)\r
+\r
+$(APP).chn : $(APP).bim Makefile\r
+       $(BIM2CHN) $(APP).bim $(APP).chn 0\r
+\r
+#\88ê\94Ê\8bK\91¥\r
+\r
+%.ca : %.c Makefile\r
+       $(SJISCONV) $*.c $*.ca\r
+\r
+%.gas : %.ca Makefile\r
+       $(CC1) -o $*.gas $*.ca\r
+\r
+%.nas : %.gas Makefile\r
+       $(GAS2NASK) $*.gas $*.nas\r
+\r
+%.obj : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj $*.lst\r
+\r
+\r
+\r
+# \83R\83}\83\93\83h\r
+\r
+clean :\r
+       -$(DEL) *.bin\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.gas\r
+       -$(DEL) *.obj\r
+       -$(DEL) $(APP).bim\r
+       -$(DEL) $(APP).map\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DEL) $(APP).chn\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/Makefile
new file mode 100644 (file)
index 0000000..e50b16d
--- /dev/null
@@ -0,0 +1,134 @@
+\r
+#OBJS_BOOTPACK = naskfunc.obj hankaku.obj gdtidt.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj init.obj intrpt.obj io.obj memory.obj paging.obj sheet.obj fifo.obj mtask.obj timer.obj keyboard.obj mouse.obj window.obj console.obj file.obj uuid.obj api.obj bootpack.obj\r
+#OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj nasfunc2.obj hankaku.obj callbios.obj cfunc.obj display.obj draw08.obj drawing.obj dsctbl.obj emu86.obj emu86asm.obj error.obj fifo.obj intrpt.obj keyboard.obj memory.obj mtask.obj serial.obj system.obj timer.obj vgatmode.obj xception.obj bootpack.obj\r
+#HEADS_BOOTPACK = core.h coredef0.h coredef1.h coredef2.h coredef3.h keyid.h\r
+\r
+include makeset.txt\r
+\r
+TOOLPATH = ../../z_tools/\r
+INCPATH  = ../../z_tools/CHNOSProject/\r
+\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+NASK     = $(TOOLPATH)nask.exe\r
+CC1      = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet\r
+BIN2OBJ  = $(TOOLPATH)bin2obj.exe\r
+GAS2NASK = $(TOOLPATH)gas2nask.exe -a\r
+OBJ2BIM  = $(TOOLPATH)obj2bim.exe\r
+BIM2CHN  = $(TOOLPATH)bim2chn.exe\r
+RULEFILE = $(INCPATH)chn010.rul\r
+EDIMG    = $(TOOLPATH)edimg.exe bias:9\r
+IMGTOL   = $(TOOLPATH)RWFD.EXE\r
+MAKEFONT = $(TOOLPATH)makefont.exe\r
+COPY     = copy\r
+DEL      = del\r
+SJISCONV = $(TOOLPATH)sjisconv.exe -s\r
+\r
+# \83f\83t\83H\83\8b\83g\93®\8dì\r
+\r
+default :\r
+       $(MAKE) img\r
+\r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥\r
+\r
+chnipl.bin : chnipl.nas Makefile\r
+       $(NASK) chnipl.nas chnipl.bin chnipl.lst\r
+\r
+hankaku.bin : hankaku.txt Makefile\r
+       $(MAKEFONT) hankaku.txt hankaku.bin\r
+\r
+hankaku.obj : hankaku.bin Makefile\r
+       $(BIN2OBJ) hankaku.bin hankaku.obj _hankaku\r
+\r
+asmhead.bin : asmhead.nas Makefile\r
+       $(NASK) asmhead.nas asmhead.bin asmhead.lst\r
+\r
+bootpack.gas : bootpack.ca $(HEADS_BOOTPACK) Makefile\r
+       $(CC1) -o bootpack.gas bootpack.ca\r
+\r
+bootpack.nas : bootpack.gas Makefile\r
+       $(GAS2NASK) bootpack.gas bootpack.nas\r
+\r
+bootpack.obj : bootpack.nas Makefile\r
+       $(NASK) bootpack.nas bootpack.obj bootpack.lst\r
+\r
+nasfunc0.obj : nasfunc0.nas Makefile\r
+       $(NASK) nasfunc0.nas nasfunc0.obj nasfunc0.lst\r
+\r
+bootpack.bim : $(OBJS_BOOTPACK) Makefile\r
+       $(OBJ2BIM) @$(RULEFILE) out:bootpack.bim stack:3136k map:bootpack.map \\r
+               $(OBJS_BOOTPACK)\r
+# 3MB+64KB=3136KB\r
+\r
+bootpack.chn : bootpack.bim Makefile\r
+       $(BIM2CHN) bootpack.bim bootpack.chn 0\r
+\r
+chnos.sys : asmhead.bin bootpack.chn Makefile\r
+       copy /B asmhead.bin+bootpack.chn chnos.sys\r
+\r
+chnos.img : chnipl.bin chnos.sys Makefile\r
+       $(EDIMG)   imgin:../../z_tools/fdimg0at.tek \\r
+               wbinimg src:chnipl.bin len:512 from:0 to:0 \\r
+               copy from:chnos.sys to:@: \\r
+               copy from:chnipl.nas to:@: \\r
+               copy from:chnlogo.bmp to:@: \\r
+               imgout:chnos.img\r
+\r
+#\88ê\94Ê\8bK\91¥\r
+\r
+%.ca : %.c Makefile\r
+       $(SJISCONV) $*.c $*.ca\r
+\r
+%.gas : %.ca $(HEADS_BOOTPACK) Makefile\r
+       $(CC1) -o $*.gas $*.ca\r
+\r
+%.nas : %.gas Makefile\r
+       $(GAS2NASK) $*.gas $*.nas\r
+\r
+%.obj : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj $*.lst\r
+\r
+\r
+\r
+# \83R\83}\83\93\83h\r
+\r
+img :\r
+       $(MAKE) chnos.img\r
+\r
+run :\r
+       $(MAKE) img\r
+       $(COPY) chnos.img ..\..\z_tools\qemu\fdimage0.bin\r
+       $(MAKE) -C ../../z_tools/qemu\r
+run_b :\r
+       $(MAKE) img\r
+       $(COPY) chnos.img ..\..\z_tools\bochs\fdimage0.bin\r
+       $(MAKE) -C ../../z_tools/bochs\r
+\r
+\r
+run_cd :\r
+       $(MAKE) iso\r
+       $(MAKE) -C ../../z_tools/qemu_iso\r
+\r
+install :\r
+       $(MAKE) img\r
+       $(IMGTOL) chnos.img a:\r
+\r
+clean :\r
+       -$(DEL) *.bin\r
+       -$(DEL) *.lst\r
+       -$(DEL) *.gas\r
+       -$(DEL) *.obj\r
+       -$(DEL) *.ca\r
+       -$(DEL) bootpack.nas\r
+       -$(DEL) bootpack.map\r
+       -$(DEL) bootpack.bim\r
+       -$(DEL) bootpack.chn\r
+       -$(DEL) chnos.sys\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DEL) chnos.img\r
+\r
+iso :\r
+       $(MAKE)\r
+       ..\..\z_tools\mkisofs.exe -v -iso-level 1 -b chnos.img -o ..\..\z_tools\qemu_iso\chnos.iso .\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/asmhead.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/asmhead.nas
new file mode 100644 (file)
index 0000000..edb5417
--- /dev/null
@@ -0,0 +1,489 @@
+\r
+[INSTRSET "i486p"]\r
+BOTPAK  equ             0x00280000\r
+DSKCAC  equ             0x00100000\r
+DSKCAC0 equ             0x00008000\r
+\r
+; BOOT_INFO_ADDR\r
+CYLS    equ             0x0ff0 ; uchar\r
+LEDS    equ             0x0ff1 ; uchar\r
+VMODE   equ             0x0ff2 ; uchar\r
+                               ; uchar Padding\r
+SCRNX   equ             0x0ff4 ; ushort\r
+SCRNY   equ             0x0ff6 ; ushort\r
+VRAM    equ             0x0ff8 ; uchar*\r
+VESAVER        equ             0x0ffc  ; ushort\r
+APMVER equ             0x0ffe  ; ushort\r
+ACPI_MEMMAPS   equ     0x1000  ; uint\r
+ACPI_MEMMAP    equ     0x1004  ; 0x18(24)*16=0x180(384)bytes\r
+APM_FLAGS      equ     0x1184  ; ushort\r
+\r
+; INFO_ADDR\r
+ADR_VESA_BIOS_INFO     equ     0x0d00  ;0x0d00-0x0dff\r
+ADR_VESA_MODE_INFO     equ     0x0e00  ;0x0e00-0x0eff\r
+\r
+XRESOLUTION    equ     0x12\r
+YRESOLUTION    equ     0x14\r
+BITSPERPIXEL   equ     0x19\r
+PHYSBASEPTR    equ     0x28\r
+\r
+[BITS 16]\r
+\r
+        org     0xc200\r
+asmhead:\r
+       mov     ax, 0\r
+       mov     ss, ax\r
+       mov     sp, 0xc200\r
+       mov     ds, ax\r
+       mov     es, ax\r
+\r
+       mov     ah, 0x00\r
+       mov     al, 0x03\r
+       int     0x10\r
+\r
+       lea     di, [msg000]\r
+       call    text_putstr\r
+\r
+       call    a20_try_loop\r
+\r
+       call    chk_acpi_memmap\r
+\r
+       call    chk_apm\r
+\r
+       call    chk_keyled\r
+\r
+        call    pmode\r
+\r
+halt_loop:\r
+       hlt\r
+       jmp     halt_loop\r
+\r
+; \83T\83u\83\8b\81[\83`\83\93\r
+\r
+chk_acpi_memmap:\r
+       pushad\r
+       mov     edi, ACPI_MEMMAP\r
+       mov     ebx, 0\r
+chk_acpi_memmap_loop:\r
+       mov     eax, 0xe820\r
+       mov     ecx, 24\r
+       mov     edx, 0x534d4150 ; edx="SMAP"\r
+       int     0x15\r
+       jc      chk_acpi_memmap_err\r
+       add     edi, 24\r
+       or      ebx, ebx\r
+       jnz     chk_acpi_memmap_loop\r
+       sub     edi, ACPI_MEMMAP\r
+       mov     eax, edi\r
+       xor     edx, edx\r
+       mov     ecx, 24\r
+       div     ecx\r
+       mov     [ACPI_MEMMAPS], eax\r
+       lea     di, [msg017]\r
+       call    text_putstr\r
+       call    text_newline\r
+       jmp     chk_acpi_memmap_end\r
+\r
+chk_acpi_memmap_err:\r
+       lea     di, [msg016]\r
+       call    text_putstr\r
+       call    text_newline\r
+       mov     dword [ACPI_MEMMAPS], 0\r
+\r
+chk_acpi_memmap_end:\r
+       popad\r
+       ret\r
+\r
+chk_keyled:\r
+       mov     ah, 0x02\r
+       int     0x16\r
+       mov     [LEDS], al\r
+       ret\r
+\r
+A20_TEST_LOOPS         equ     32\r
+A20_ENABLE_LOOPS       equ     255\r
+A20_TEST_ADDR          equ     4*0x80\r
+\r
+\r
+a20_try_loop:\r
+a20_none:\r
+       call    a20_test\r
+       jnz     a20_done\r
+a20_bios:\r
+       mov     ax, 0x2401\r
+       pushfd\r
+       int     0x15\r
+       popfd\r
+       call    a20_test\r
+       jnz     a20_done\r
+a20_kbc:\r
+       call    empty_8042\r
+       call    a20_test\r
+       jnz     a20_done\r
+       mov     al, 0xD1\r
+       out     0x64, al\r
+       call    empty_8042\r
+       mov     al, 0xDF\r
+       out     0x60, al\r
+       call    empty_8042\r
+a20_kbc_wait:\r
+       xor     cx, cx\r
+a20_kbc_wait_loop:\r
+       call    a20_test\r
+       jnz     a20_done\r
+       loop    a20_kbc_wait_loop\r
+a20_fast:\r
+       in      al, 0x92\r
+       or      al, 0x02\r
+\r
+       and     al, 0xFE\r
+       out     0x92, al\r
+a20_fast_wait:\r
+       xor     cx, cx\r
+a20_fast_wait_loop:\r
+       call    a20_test\r
+       jnz     a20_done\r
+       loop    a20_fast_wait_loop\r
+       dec     byte [a20_tries]\r
+       jnz     a20_try_loop\r
+a20_die:\r
+       lea     di, [msg014]\r
+       call    text_putstr\r
+       jmp     halt_loop\r
+\r
+a20_tries:\r
+       db      A20_ENABLE_LOOPS\r
+\r
+a20_done:\r
+       lea     di, [msg015]\r
+       call    text_putstr\r
+       ret\r
+\r
+a20_test:\r
+       push    cx\r
+       push    ax\r
+       xor     cx, cx\r
+       mov     fs, cx\r
+       dec     cx\r
+       mov     gs, cx\r
+       mov     cx, A20_TEST_LOOPS\r
+       mov     ax, word [fs:A20_TEST_ADDR]\r
+       push    ax\r
+a20_test_wait:\r
+       inc     ax\r
+       mov     word [fs:A20_TEST_ADDR], ax\r
+       call    delay\r
+       cmp     ax, word [gs:A20_TEST_ADDR + 0x10]\r
+       loop    a20_test_wait\r
+\r
+       pop     word [fs:A20_TEST_ADDR]\r
+       pop     ax\r
+       pop     cx\r
+       ret\r
+\r
+empty_8042:\r
+       push    ecx\r
+       mov     ecx, 100000\r
+\r
+empty_8042_loop:\r
+       dec     ecx\r
+       jz      empty_8042_end_loop\r
+\r
+       call    delay\r
+\r
+       in      al, 0x64\r
+       test    al, 1                   \r
+       jz      no_output\r
+\r
+       call    delay\r
+;      in      al, 0x60\r
+\r
+       jmp     empty_8042_loop\r
+\r
+no_output:\r
+       test    al, 2\r
+       jnz     empty_8042_loop\r
+\r
+empty_8042_end_loop:\r
+       pop     ecx\r
+       ret\r
+\r
+delay:\r
+       out     0x80, al\r
+       ret\r
+\r
+chk_apm:\r
+       pusha\r
+       lea     di, [msg006]\r
+       call    text_putstr\r
+       lea     di, [msg002]\r
+       call    text_putstr\r
+       mov     ax, 0x5300\r
+       mov     bx, 0x0000\r
+       pusha\r
+       int     0x15\r
+       jc      chk_apm_err_nosup\r
+       mov     [APMVER], ax\r
+       mov     [APM_FLAGS], cx\r
+       popa\r
+\r
+       lea     di, [msg004]\r
+       call    text_putstr\r
+       mov     ax, [APMVER]\r
+       shr     ax, 8\r
+       call    text_puthex_char\r
+       mov     al, '.'\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       mov     ax, [APMVER]\r
+       shr     ax, 4\r
+       call    text_puthex_char\r
+       mov     ax, [APMVER]\r
+       call    text_puthex_char\r
+       jmp     chk_apm_end\r
+\r
+chk_apm_err_nosup:\r
+       mov     word [APMVER], 0x0000\r
+       mov     word [APM_FLAGS], 0x0000\r
+       popa\r
+       lea     di, [msg006]\r
+       call    text_putstr\r
+       lea     di, [msg003]\r
+       call    text_putstr\r
+chk_apm_end:\r
+       popa\r
+       ret\r
+\r
+hex2bcd_16:    ;ax\82ðBCD\82É\95Ï\8a·\81B\8dÅ\91å9999\82Ü\82Å\81Bcx\82É\90Vax\82ð\95Û\91\r
+       push    cx\r
+       push    bx\r
+       push    dx\r
+       and     eax, 0x0000ffff\r
+       mov     cx, 0x000000\r
+\r
+       mov     dx, 0x0000\r
+       mov     bx, 1000\r
+       div     bx\r
+       shl     ax, 12\r
+       or      cx, ax\r
+\r
+       mov     ax, dx\r
+       mov     dx, 0x0000\r
+       mov     bx, 100\r
+       div     bx\r
+       shl     ax, 8\r
+       or      cx, ax\r
+\r
+       mov     ax, dx\r
+       mov     dx, 0x0000\r
+       mov     bx, 10\r
+       div     bx\r
+       shl     ax, 4\r
+       or      cx, ax\r
+\r
+       or      cx, dx\r
+\r
+       mov     ax, cx\r
+\r
+       pop     dx\r
+       pop     bx\r
+       pop     cx\r
+       ret\r
+\r
+text_puthex_str_16:    ; ax\82ð\8fo\97Í\81B0x\82Ì\95t\89Á\82 \82è\81B\r
+       push    ax\r
+       push    cx\r
+       mov     cx, ax\r
+       mov     ah, 0x0e\r
+       mov     al, '0'\r
+       int     0x10\r
+       mov     al, 'x'\r
+       int     0x10\r
+       mov     ax, cx\r
+       shr     ax, 12\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       shr     ax, 8\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       shr     ax, 4\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       call    text_puthex_char\r
+       pop     cx\r
+       pop     ax\r
+       ret\r
+\r
+text_puthex_str_16_no_0x:      ; ax\82ð\8fo\97Í\81B0x\82Ì\95t\89Á\82È\82µ\81BBCD\95\\8e¦\97p\r
+       push    ax\r
+       push    cx\r
+       mov     cx, ax\r
+       shr     ax, 12\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       shr     ax, 8\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       shr     ax, 4\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       call    text_puthex_char\r
+       pop     cx\r
+       pop     ax\r
+       ret\r
+\r
+text_puthex_str_08_no_0x:      ; al\82ð\8fo\97Í\81B0x\82Ì\95t\89Á\82È\82µ\81BBCD\95\\8e¦\97p\r
+       push    ax\r
+       push    cx\r
+       mov     cx, ax\r
+       shr     al, 4\r
+       call    text_puthex_char\r
+       mov     ax, cx\r
+       call    text_puthex_char\r
+       pop     cx\r
+       pop     ax\r
+       ret\r
+\r
+text_puthex_char:      ; al\82Ì\89º\88Ê4bit\95ª\8fo\97Í\81B0x\82Ì\95t\89Á\82Í\82È\82µ\81B\r
+       pusha\r
+       and     al, 0x0f\r
+       cmp     al, 9\r
+       ja      text_puthex_char_alphabet\r
+       add     al, 0x30\r
+       jmp     text_puthex_char_end\r
+text_puthex_char_alphabet:\r
+       add     al, 0x37\r
+text_puthex_char_end:\r
+       mov     ah, 0x0e\r
+       int     0x10\r
+       popa\r
+       ret\r
+\r
+text_putstr:   ; di=char*\r
+       pusha\r
+       mov     cx, 0\r
+       mov     ah, 0x0e\r
+text_putstr_loop:\r
+       mov     al, [es:di]\r
+       cmp     al, 0\r
+       je      text_putstr_end\r
+       inc     di\r
+       int     0x10\r
+       jmp     text_putstr_loop\r
+text_putstr_end:\r
+       popa\r
+       ret\r
+\r
+text_newline:\r
+       pusha\r
+       mov     ah, 0x0e\r
+       mov     al, 0x0d\r
+       int     0x10\r
+       mov     al, 0x0a\r
+       int     0x10\r
+       popa\r
+       ret\r
+\r
+; \88È\89º\81A\83v\83\8d\83e\83N\83g\83\82\81[\83h\88Ú\8ds\81Abootpack\8eÀ\8ds\8aÖ\90\94\8cQ\r
+\r
+pmode:\r
+       mov     al, 0xff\r
+       out     0x21, al        ; pic0-imr = 11111111\r
+       nop\r
+       out     0xa1, al        ; pic1-imr = 11111111\r
+       cli\r
+\r
+       lgdt    [GDTR0]\r
+\r
+       mov     eax, cr0\r
+       and     eax, 0x7fffffff ; PG = 0\r
+       or      eax, 0x00000001 ; PE = 1\r
+       mov     cr0, eax\r
+\r
+       jmp     pipelineflush\r
+pipelineflush:\r
+\r
+       mov     ax, 1 * 8\r
+       mov     ds, ax\r
+       mov     es, ax\r
+       mov     fs, ax\r
+       mov     gs, ax\r
+       mov     ss, ax\r
+\r
+       mov     esi, bootpack\r
+       mov     edi, BOTPAK\r
+       mov     ecx, 512 * 1024 / 4\r
+       call    memcpy\r
+\r
+       mov     esi, 0x7c00\r
+       mov     edi, DSKCAC\r
+       mov     ecx, 512 / 4\r
+       call    memcpy\r
+\r
+       mov     esi, DSKCAC0 + 512\r
+       mov     edi, DSKCAC + 512\r
+       mov     ecx, 0\r
+       mov     cl, byte[CYLS]\r
+       imul    ecx, 512 * 18 * 2 / 4\r
+       sub     ecx, 512 / 4\r
+       call    memcpy\r
+\r
+       mov     ebx, BOTPAK\r
+       mov     ecx, [ebx + 16]\r
+       add     ecx, 3\r
+       shr     ecx, 2\r
+       jz      skip\r
+       mov     esi, [ebx + 20]\r
+       add     esi, ebx\r
+       mov     edi, [ebx + 12]\r
+       call    memcpy\r
+\r
+skip:\r
+       mov     esp, [ebx + 12]\r
+       jmp     dword 2 * 8:0x0000001b\r
+\r
+memcpy:\r
+        mov     eax,[esi]\r
+        add     esi,4\r
+        mov     [edi],eax\r
+        add     edi,4\r
+        sub     ecx,1\r
+        jnz     memcpy\r
+        ret\r
+\r
+; \83f\81[\83^\r
+\r
+msg000:        db      "Welcome to CHNOS Project.", 0x0d, 0x0a, 0x00\r
+msg001:        db      "VESA BIOS Extention ", 0x00\r
+msg002:        db      "Checking...", 0x0d, 0x0a, 0x00\r
+msg003:        db      "is not supported by this computer.", 0x0d, 0x0a, 0x00\r
+msg004:        db      "Version:", 0x00\r
+msg005:        db      "Video Mode Numbers...", 0x0d, 0x0a, 0x00\r
+msg006:        db      "Advanced Power Management BIOS ", 0x00\r
+msg007:        db      "Please select the Video Mode Number.", 0x0d, 0x0a, 0x00\r
+msg008:        db      "VGA mode is 0x0000.", 0x0d, 0x0a, 0x00\r
+msg009:        db      ">0x", 0x00\r
+msg010:        db      "ModeInfo:", 0x00\r
+msg011:        db      "Function Error...", 0x0d, 0x0a, 0x00\r
+msg012:        db      "bpp:", 0x00\r
+msg013:        db      "Do you want to start in this screen mode?[Y/N]", 0x0d, 0x0a, ">", 0x00\r
+msg014:        db      "A20GateLine Failed.", 0x0d, 0x0a, 0x00\r
+msg015:        db      "A20GateLine Passed.", 0x0d, 0x0a, 0x00\r
+msg016:        db      "ACPI 0xe820 Failed.", 0x0d, 0x0a, 0x00\r
+msg017:        db      "ACPI 0xe820 Passed.", 0x0d, 0x0a, 0x00\r
+\r
+GDTR0:\r
+       dw      8 * 3 - 1       ; GDT\83\8a\83~\83b\83g = 8 * \83Z\83\8c\83N\83^\90\94 - 1\r
+       dd      GDT0            ; GDT\8aJ\8en\83A\83h\83\8c\83X\r
+\r
+       alignb  16\r
+\r
+GDT0:  ; \89¼GDT\r
+       resb    8               ; \83k\83\8b\81E\83Z\83\8c\83N\83^\81[\r
+       dw      0xffff, 0x0000, 0x9200, 0x00cf  ; \93Ç\82Ý\8f\91\82«\89Â\94\32\83r\83b\83g\r
+       dw      0xffff, 0x0000, 0x9a28, 0x0047  ; \8eÀ\8ds\89Â\94\32\83r\83b\83g\r
+       dw      0\r
+\r
+       alignb  16\r
+\r
+bootpack:\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/bootpack.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/bootpack.c
new file mode 100644 (file)
index 0000000..abed8d8
--- /dev/null
@@ -0,0 +1,416 @@
+\r
+#include "core.h"\r
+\r
+void CHNMain(void)\r
+{\r
+       uchar s[128];\r
+       uint data;\r
+       UI_Task *mytask;\r
+       uint i;\r
+       IO_DisplayControl *disp_ctrl;\r
+       UI_Sheet *vramsheet, *testsheet, *sheet_desktop;\r
+       UI_Sheet *sheet08, *sheet16, *sheet32;\r
+       int x, y;\r
+       UI_Timer *timer1, *timer2, *timer3;\r
+       uint counter1, counter2, counter3;\r
+       UI_TextBox *textbox;\r
+       UI_Console *console;\r
+       IO_FloppyDisk *boot_fd;\r
+       IO_File *file;\r
+\r
+       i = 0;\r
+       data = 0;\r
+\r
+       Initialize_System();\r
+\r
+       mytask = System_MultiTask_GetNowTask();\r
+       disp_ctrl = System_Display_Get_Controller();\r
+       boot_fd = FloppyDisk_Initialize(ADR_DISKIMG);\r
+\r
+       vramsheet = disp_ctrl->vramsheet;\r
+\r
+       Sheet_Drawing_Fill_Rectangle(vramsheet, 0xffffff, 0, 0, vramsheet->size.x - 1, vramsheet->size.y - 1);\r
+       Sheet_Drawing_Put_String(vramsheet, 10, 10, 0x000000, "Welcome to CHNOSProject!");\r
+\r
+       if(disp_ctrl->display_mode == DISPLAYMODE_VBE_LINEAR){\r
+               i = 0;\r
+               Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 1, 0x000000, "Please Select the VideoMode Number.");\r
+               Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 2, 0x000000, "(Use cursor Up or Down, Select Enter.)");\r
+               Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 6, 0x000000, "Press Esc to boot in VGA(320x200 8bit).");\r
+               Sheet_Drawing_Fill_Rectangle(vramsheet, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);\r
+               snprintf(s, sizeof(s), "%d:0x%X %dx%d-%dbits", i, disp_ctrl->VBE.list_vmode[i].mode_number, disp_ctrl->VBE.list_vmode[i].xsize, disp_ctrl->VBE.list_vmode[i].ysize, disp_ctrl->VBE.list_vmode[i].bpp);\r
+               Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 3, 0x000000, s);\r
+\r
+               for(;;){\r
+                       if(FIFO32_MyTaskFIFO_Status() == 0){\r
+                               System_MultiTask_Task_Sleep(mytask);\r
+                       } else{\r
+                               data = FIFO32_MyTaskFIFO_Get();\r
+                               if(SIGNAL_KEY_OFFSET <= data && data <= (SIGNAL_KEY_OFFSET + 0xFFFF)){\r
+                                       data -= SIGNAL_KEY_OFFSET;\r
+                                       if(!(data & KEYID_MASK_BREAK) && (data & KEYID_MASK_EXTENDED)){\r
+                                               if((data & KEYID_MASK_ID) == KEYID_CURSOR_U){\r
+                                                       if(i == 0){\r
+                                                               i = disp_ctrl->VBE.list_vmode_tags - 1;\r
+                                                       } else{\r
+                                                               i--;\r
+                                                       }\r
+                                                       Sheet_Drawing_Fill_Rectangle(vramsheet, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);\r
+                                                       snprintf(s, sizeof(s), "%d:0x%X %dx%d-%dbits", i, disp_ctrl->VBE.list_vmode[i].mode_number, disp_ctrl->VBE.list_vmode[i].xsize, disp_ctrl->VBE.list_vmode[i].ysize, disp_ctrl->VBE.list_vmode[i].bpp);\r
+                                                       Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 3, 0x000000, s);\r
+                                               } else if((data & KEYID_MASK_ID) == KEYID_CURSOR_D){\r
+                                                       if(i == disp_ctrl->VBE.list_vmode_tags - 1){\r
+                                                               i = 0;\r
+                                                       } else{\r
+                                                               i ++;\r
+                                                       }\r
+                                                       Sheet_Drawing_Fill_Rectangle(vramsheet, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 5 - 1);\r
+                                                       snprintf(s, sizeof(s), "%d:0x%X %dx%d-%dbits", i, disp_ctrl->VBE.list_vmode[i].mode_number, disp_ctrl->VBE.list_vmode[i].xsize, disp_ctrl->VBE.list_vmode[i].ysize, disp_ctrl->VBE.list_vmode[i].bpp);\r
+                                                       Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 3, 0x000000, s);\r
+                                               } else if((data & KEYID_MASK_ID) == KEYID_ENTER){\r
+                                                       if(System_Display_VESA_Set_VideoMode(i) == 0){\r
+                                                               break;\r
+                                                       }\r
+                                                       Sheet_Drawing_Fill_Rectangle(vramsheet, 0x00ff00, 10, 10 + 16 * 3, VGA08_VRAM_XSIZE - 10 - 1, 10 + 16 * 4 - 1);\r
+                                                       Sheet_Drawing_Put_String(vramsheet, 10, 10 + 16 * 4, 0x000000, "Function Failed. Try again.");\r
+                                               } else if((data & KEYID_MASK_ID) == KEYID_ESC){\r
+                                                       System_TaskControlMessage_Send_AllTask(TCM_OFFSET + TCM_INFO_DISPLAY_UPDATE_RESOLUTION);\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       Sheet_SetBuffer(vramsheet, disp_ctrl->vram, disp_ctrl->xsize, disp_ctrl->ysize, disp_ctrl->bpp);\r
+\r
+       sheet_desktop = Sheet_Initialize();\r
+       Sheet_SetBuffer(sheet_desktop, Null, disp_ctrl->xsize, disp_ctrl->ysize, disp_ctrl->bpp);\r
+\r
+       Sheet_Drawing_Fill_Rectangle(sheet_desktop, 0xffffff, 0, 0, disp_ctrl->xsize - 1, disp_ctrl->ysize - 1);\r
+       Sheet_Drawing_Put_String(sheet_desktop, 10, 10, 0x000000, "Welcome to CHNOSProject!");\r
+       if(FloppyDisk_IsPathExist(boot_fd, "chnlogo.bmp")){\r
+               file = File_Initilaize();\r
+               if(FloppyDisk_LoadFile(boot_fd, file, "chnlogo.bmp") == 0){\r
+                       Format_BMP_DrawPicture(sheet_desktop->vram, sheet_desktop->size.x, disp_ctrl->xsize - 128 - 4, 4, 0, 0, file->img);\r
+               }\r
+               File_Free(file);\r
+       }\r
+\r
+       testsheet = Sheet_Initialize();\r
+\r
+       sheet08 = Sheet_Initialize();\r
+       sheet16 = Sheet_Initialize();\r
+       sheet32 = Sheet_Initialize();\r
+\r
+       Sheet_SetBuffer(testsheet, Null, 256, 128, 8);\r
+       Sheet_SetBuffer(sheet08, Null, 128, 128, 8);\r
+       Sheet_SetBuffer(sheet16, Null, 128, 128, 16);\r
+       Sheet_SetBuffer(sheet32, Null, 128, 128, 32);\r
+\r
+       for(y = 0; y < testsheet->size.y; y++){\r
+               for(x = 0; x < testsheet->size.x; x++){\r
+                       ((uchar *)testsheet->vram)[y * testsheet->size.x + x] = x * 2;\r
+               }\r
+       }\r
+\r
+       Drawing08_Fill_Rectangle(testsheet->vram, testsheet->size.x, 0xc6c6c6, 4, 24, testsheet->size.x - 4 - 1, testsheet->size.y - 4 - 1);\r
+\r
+       textbox = TextBox_Initialize();\r
+       TextBox_SetBuffer(textbox, 20, 6, 8, testsheet);\r
+       TextBox_Show(textbox, 0, 4, 24);\r
+       TextBox_Put_Character(textbox, '>');\r
+       TextBox_SetEnable_RecordInputText(textbox, True);\r
+\r
+\r
+       Drawing08_Put_String(testsheet->vram, testsheet->size.x, 4, 4, 0xffffff, "TestSheet");\r
+       snprintf(s, sizeof(s), "Memory:%d Bytes", System_Get_PhisycalMemorySize());\r
+       Drawing08_Put_String(testsheet->vram, testsheet->size.x, 8, 24 + 16 * 4, 0xffffff, s);\r
+\r
+       for(y = 0; y < sheet08->size.y; y++){\r
+               for(x = 0; x < sheet08->size.x; x++){\r
+                       ((uchar *)sheet08->vram)[y * sheet08->size.x + x] = RGB_32_To_08(((x * 2) << 16) | ((y * 2) << 8) | (x + y));\r
+               }\r
+       }\r
+\r
+       for(y = 0; y < sheet16->size.y; y++){\r
+               for(x = 0; x < sheet16->size.x; x++){\r
+                       ((ushort *)sheet16->vram)[y * sheet16->size.x + x] = RGB_32_To_16(((x * 2) << 16) | ((y * 2) << 8) | (x + y));\r
+               }\r
+       }\r
+\r
+       for(y = 0; y < sheet32->size.y; y++){\r
+               for(x = 0; x < sheet32->size.x; x++){\r
+                       ((uint *)sheet32->vram)[y * sheet32->size.x + x] = ((x * 2) << 16) | ((y * 2) << 8) | (x + y);\r
+               }\r
+       }\r
+\r
+       Sheet_SetParent(sheet_desktop, vramsheet);\r
+       Sheet_Show(sheet_desktop, 0, 0, 0);\r
+\r
+       Sheet_SetParent(sheet08, vramsheet);\r
+       Sheet_Show(sheet08, 1, 20, vramsheet->size.y >> 1);\r
+\r
+       Sheet_SetParent(sheet16, vramsheet);\r
+       Sheet_Show(sheet16, 1, 220, vramsheet->size.y >> 1);\r
+\r
+       Sheet_SetParent(sheet32, vramsheet);\r
+       Sheet_Show(sheet32, 1, 420, vramsheet->size.y >> 1);\r
+\r
+       Sheet_SetParent(testsheet, vramsheet);\r
+       Sheet_SetMovable(testsheet, True);\r
+       Sheet_SetInputFIFO(testsheet, mytask->fifo);\r
+       Sheet_Show(testsheet, 6, 10, 10);\r
+\r
+       timer1 = Timer_Initialize();\r
+       Timer_Config(timer1, 50, mytask->fifo, 11, True);\r
+       counter1 = 0;\r
+       //Timer_Run(timer1);\r
+\r
+       timer2 = Timer_Initialize();\r
+       Timer_Config(timer2, 50, mytask->fifo, 12, False);\r
+       counter2 = 0;\r
+       //Timer_Run(timer2);\r
+\r
+       timer3 = Timer_Initialize();\r
+       Timer_Config(timer3, 200, mytask->fifo, 13, True);\r
+       counter3 = 0;\r
+       //Timer_Run(timer3);\r
+\r
+       console = Console_Initialize();\r
+       x = vramsheet->size.x >> (3 + 1);\r
+       y = vramsheet->size.y >> (4 + 1);\r
+\r
+       if(x < (VGA08_VRAM_XSIZE >> 3)){\r
+               x = (VGA08_VRAM_XSIZE >> 3);\r
+       }\r
+       if(y < (VGA08_VRAM_YSIZE >> 4)){\r
+               y = (VGA08_VRAM_YSIZE >> 4);\r
+       }\r
+\r
+       Console_SetSize(console, x, y);\r
+       Console_Run(console);\r
+       System_InputFocus_Change(console->textbox->sheet->input_fifo);\r
+\r
+       for(;;){\r
+               if(FIFO32_MyTaskFIFO_Status() == 0){\r
+                       System_MultiTask_Task_Sleep(mytask);\r
+               } else{\r
+                       data = FIFO32_MyTaskFIFO_Get();\r
+                       if(SIGNAL_KEY_OFFSET <= data && data <= (SIGNAL_KEY_OFFSET + 0xFFFF)){\r
+                               data -= SIGNAL_KEY_OFFSET;\r
+                               TextBox_Put_Key(textbox, data);\r
+                               if(!(data & KEYID_MASK_BREAK) && (data & KEYID_MASK_EXTENDED)){\r
+                                       if((data & KEYID_MASK_ID) == KEYID_ENTER){\r
+                                               TextBox_SetEnable_RecordInputText(textbox, False);\r
+                                               TextBox_Put_String(textbox, textbox->text_buf);\r
+                                               TextBox_Put_Character(textbox, '>');\r
+                                               TextBox_SetEnable_RecordInputText(textbox, True);\r
+                                       }\r
+                               }\r
+                       } else if(data == 11){\r
+                               Drawing08_Fill_Rectangle(testsheet->vram, testsheet->size.x, 0xc6c6c6, 8, 24, 8 + (20 * 8) - 1, 24 + (16 * 2) - 1);\r
+                               snprintf(s, sizeof(s), "Tick :%d", Timer_GetTick());\r
+                               Drawing08_Put_String(testsheet->vram, testsheet->size.x, 8, 24, 0xffffff, s);\r
+                               snprintf(s, sizeof(s), "Tick1:%d", counter1);\r
+                               Drawing08_Put_String(testsheet->vram, testsheet->size.x, 8, 24 + 16, 0xffffff, s);\r
+                               Sheet_RefreshSheet(testsheet, 8, 24, 8 + (20 * 8) - 1, 24 + (16 * 2) - 1);\r
+                               counter1++;\r
+                       } else if(data == 12){\r
+                               Drawing08_Fill_Rectangle(testsheet->vram, testsheet->size.x, 0xc6c6c6, 8, 24 + 16 * 2, 8 + (20 * 8) - 1, 24 + (16 * 3) - 1);\r
+                               snprintf(s, sizeof(s), "Tick2:%d", counter2);\r
+                               Drawing08_Put_String(testsheet->vram, testsheet->size.x, 8, 24 + 16 * 2, 0xffffff, s);\r
+                               Sheet_RefreshSheet(testsheet, 8, 24 + 16 * 2, 8 + (20 * 8) - 1, 24 + (16 * 3) - 1);\r
+                               Timer_Run(timer2);\r
+                               counter2++;\r
+                       } else if(data == 13){\r
+                               Drawing08_Fill_Rectangle(testsheet->vram, testsheet->size.x, 0xc6c6c6, 8, 24 + 16 * 3, 8 + (20 * 8) - 1, 24 + (16 * 4) - 1);\r
+                               snprintf(s, sizeof(s), "Tick3:%d", counter3);\r
+                               Drawing08_Put_String(testsheet->vram, testsheet->size.x, 8, 24 + 16 * 3, 0xffffff, s);\r
+                               Sheet_RefreshSheet(testsheet, 8, 24 + 16 * 3, 8 + (20 * 8) - 1, 24 + (16 * 4) - 1);\r
+                               counter3++;\r
+\r
+                               Drawing08_Fill_Rectangle(testsheet->vram, testsheet->size.x, 0xc6c6c6, 8, 24 + 16 * 5, 8 + (20 * 8) - 1, 24 + (16 * 6) - 1);\r
+                               snprintf(s, sizeof(s), "Free  :%d Bytes", System_Memory_Get_FreeSize());\r
+                               Drawing08_Put_String(testsheet->vram, testsheet->size.x, 8, 24 + 16 * 5, 0xffffff, s);\r
+                               Sheet_RefreshSheet(testsheet, 8, 24 + 16 * 5, 8 + (20 * 8) - 1, 24 + (16 * 6) - 1);\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+void KeyboardControlTask(DATA_FIFO32 **InputFocus)\r
+{\r
+       UI_Task *mytask;\r
+       uint data;\r
+\r
+       data = 0;\r
+\r
+       mytask = System_MultiTask_GetNowTask();\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG\r
+               debug("KBCT:KeyboardControlTask Start Running.\nKBCT:UI_Task=0x%X\n", mytask);\r
+       #endif\r
+\r
+       Keyboard_Set_ReceiveFIFO(mytask->fifo, 0x100);\r
+\r
+       for(;;){\r
+               if(FIFO32_MyTaskFIFO_Status() == 0){\r
+                       System_MultiTask_Task_Sleep(mytask);\r
+               } else{\r
+                       data = FIFO32_MyTaskFIFO_Get();\r
+                       #ifdef CHNOSPROJECT_DEBUG_KBCT\r
+                               debug("KBCT:Receive data from FIFO(data:0x%X).\n", data);\r
+                       #endif\r
+                       if(0x100 <= data && data <= 0x1ff){\r
+                               data -= 0x100;\r
+                               data = Keyboard_Decode_KeyCode(data);\r
+                               if(InputFocus != 0 && data != 0){\r
+                                       FIFO32_Put(*InputFocus, data + SIGNAL_KEY_OFFSET);\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+void MouseControlTask(DATA_FIFO32 **InputFocus, UI_MouseCursor *mcursor)\r
+{\r
+       UI_Task *mytask;\r
+       uint data;\r
+       IO_MouseControl *mctrl;\r
+       #ifdef CHNOSPROJECT_DEBUG_MCT\r
+               UI_Sheet *mouseinfosheet;\r
+               uchar s[16];\r
+       #endif\r
+       int scroll;\r
+\r
+       DATA_Location2D moveorg_mfocus;\r
+       UI_Sheet *mfocus;\r
+       bool old_mouse_buttonL;\r
+\r
+       data = 0;\r
+       scroll = 0;\r
+       mfocus = Null;\r
+       old_mouse_buttonL = False;\r
+\r
+       mytask = System_MultiTask_GetNowTask();\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG\r
+               debug("MCT:MouseControlTask Start Running.\nMCT:UI_Task=0x%X\n", mytask);\r
+       #endif\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_MCT\r
+               mouseinfosheet = Sheet_Initialize();\r
+               Sheet_SetBuffer(mouseinfosheet, Null, (4 * 2) + (8 * 16), 4 + 16 + (4 * 2) + (16 * 4), 8);\r
+               System_Sheet_SetParentToVRAM(mouseinfosheet);\r
+               Sheet_Drawing_Fill_Rectangle(mouseinfosheet, 0x99cc33, 0, 0, mouseinfosheet->size.x - 1, mouseinfosheet->size.y - 1);\r
+               Sheet_Drawing_Fill_Rectangle(mouseinfosheet, 0xccffff, 4, 24, mouseinfosheet->size.x - 1 - 4, mouseinfosheet->size.y - 1 - 4);\r
+               Sheet_Drawing_Put_String(mouseinfosheet, 4, 4, 0xffffff, "MouseInfo");\r
+       #endif\r
+\r
+       mctrl = Initialize_Mouse();\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_MCT\r
+               debug("MCT:Mouse Initialized.\n");\r
+       #endif\r
+\r
+       Mouse_Set_ReceiveFIFO(mytask->fifo, 0x100);\r
+\r
+       Mouse_Decode(mctrl, 0x00);      //Decode start.\r
+\r
+       for(;;){\r
+               if(FIFO32_MyTaskFIFO_Status() == 0){\r
+                       if(mfocus != Null && ((mcursor->cursor_sheet->location.x - moveorg_mfocus.x) != 0 || (mcursor->cursor_sheet->location.y - moveorg_mfocus.y) != 0)){\r
+                               Sheet_Slide_Relative(mfocus, mcursor->cursor_sheet->location.x - moveorg_mfocus.x, mcursor->cursor_sheet->location.y - moveorg_mfocus.y);\r
+                               moveorg_mfocus.x = mcursor->cursor_sheet->location.x;\r
+                               moveorg_mfocus.y = mcursor->cursor_sheet->location.y;\r
+                       } else{\r
+                               System_MultiTask_Task_Sleep(mytask);\r
+                       }\r
+               } else{\r
+                       data = FIFO32_MyTaskFIFO_Get();\r
+                       #ifdef CHNOSPROJECT_DEBUG_MCT\r
+                               debug("MCT:Receive data from FIFO(data:0x%X).\n", data);\r
+                       #endif\r
+                       if(0x100 <= data && data <= 0x1ff){\r
+                               if(Mouse_Decode(mctrl, data - 0x100)){\r
+                                       MouseCursor_Move_Relative(mcursor, mctrl->move.x, mctrl->move.y);\r
+                                       #ifdef CHNOSPROJECT_DEBUG_MCT\r
+                                               Sheet_Drawing_Fill_Rectangle(mouseinfosheet, 0xccffff, 4, 24 + (16 * 0), mouseinfosheet->size.x - 1 - 4, 24 + (16 * 0) + 15);\r
+                                               snprintf(s, sizeof(s), "X:%d", mcursor->cursor_sheet->location.x);\r
+                                               Sheet_Drawing_Put_String(mouseinfosheet, 4, 24 + (16 * 0), 0x000000, s);\r
+                                               Sheet_Drawing_Fill_Rectangle(mouseinfosheet, 0xccffff, 4, 24 + (16 * 1), mouseinfosheet->size.x - 1 - 4, 24 + (16 * 1) + 15);\r
+                                               snprintf(s, sizeof(s), "Y:%d", mcursor->cursor_sheet->location.y);\r
+                                               Sheet_Drawing_Put_String(mouseinfosheet, 4, 24 + (16 * 1), 0x000000, s);\r
+                                               Sheet_Drawing_Fill_Rectangle(mouseinfosheet, 0xccffff, 4, 24 + (16 * 2), mouseinfosheet->size.x - 1 - 4, 24 + (16 * 2) + 15);\r
+                                               snprintf(s, sizeof(s), "Button:lrc");\r
+                                       #endif\r
+\r
+                                       if(old_mouse_buttonL != mctrl->button.bit.L){\r
+                                               if(old_mouse_buttonL){  //up\r
+                                                       if(mfocus != Null){\r
+                                                               Sheet_Slide_Relative(mfocus, mcursor->cursor_sheet->location.x - moveorg_mfocus.x, mcursor->cursor_sheet->location.y - moveorg_mfocus.y);\r
+                                                       }\r
+                                                       mfocus = Null;\r
+                                               } else{ //down\r
+                                                       moveorg_mfocus.x = mcursor->cursor_sheet->location.x;\r
+                                                       moveorg_mfocus.y = mcursor->cursor_sheet->location.y;\r
+                                                       mfocus = Sheet_GetSheetFromLocation(mcursor->cursor_sheet->parent, mcursor->cursor_sheet->location.x, mcursor->cursor_sheet->location.y);\r
+                                                       System_InputFocus_Change(mfocus->input_fifo);\r
+                                                       if(mfocus != Null){\r
+                                                               if(mfocus->flags.bit.movable){\r
+                                                                       Sheet_ChangeHeight(mfocus, SHEET_MAX_CHILDREN);\r
+                                                               } else{\r
+                                                                       mfocus = Null;\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                               old_mouse_buttonL = mctrl->button.bit.L;\r
+                                       }\r
+                                       #ifdef CHNOSPROJECT_DEBUG_MCT\r
+                                               if(mctrl->button.bit.L){\r
+                                                       #ifdef CHNOSPROJECT_DEBUG_MCT\r
+                                                               s[7] -= 0x20;\r
+                                                       #endif\r
+                                               }\r
+                                               if(mctrl->button.bit.R){\r
+                                                       #ifdef CHNOSPROJECT_DEBUG_MCT\r
+                                                               s[8] -= 0x20;\r
+                                                       #endif\r
+                                               }\r
+                                               if(mctrl->button.bit.C){\r
+                                                       #ifdef CHNOSPROJECT_DEBUG_MCT\r
+                                                               s[9] -= 0x20;\r
+                                                       #endif\r
+                                               }\r
+                                       #endif\r
+                                       #ifdef CHNOSPROJECT_DEBUG_MCT\r
+                                               Sheet_Drawing_Put_String(mouseinfosheet, 4, 24 + (16 * 2), 0x000000, s);\r
+                                       #endif\r
+                                       if(mctrl->flags.scroll){\r
+                                               scroll += mctrl->scroll;\r
+                                               #ifdef CHNOSPROJECT_DEBUG_MCT\r
+                                                       Sheet_Drawing_Fill_Rectangle(mouseinfosheet, 0xccffff, 4, 24 + (16 * 3), mouseinfosheet->size.x - 1 - 4, 24 + (16 * 3) + 15);\r
+                                                       snprintf(s, sizeof(s), "Scroll:%d", scroll);\r
+                                                       Sheet_Drawing_Put_String(mouseinfosheet, 4, 24 + (16 * 3), 0x000000, s);\r
+                                                       Sheet_RefreshSheet(mouseinfosheet, 4, 24 + (16 * 0), mouseinfosheet->size.x - 1 - 4, 24 + (16 * 3) + 15);\r
+                                               #endif\r
+                                       } else{\r
+                                               #ifdef CHNOSPROJECT_DEBUG_MCT\r
+                                                       Sheet_RefreshSheet(mouseinfosheet, 4, 24 + (16 * 0), mouseinfosheet->size.x - 1 - 4, 24 + (16 * 2) + 15);\r
+                                               #endif\r
+                                       }\r
+                               }\r
+                       } else if(data == TCM_OFFSET + TCM_INFO_DISPLAY_UPDATE_RESOLUTION){\r
+                               MouseCursor_Move_Absolute(mcursor, mcursor->cursor_sheet->parent->size.x >> 1, mcursor->cursor_sheet->parent->size.y >> 1);\r
+                               MouseCursor_Show(mcursor);\r
+                               #ifdef CHNOSPROJECT_DEBUG_MCT\r
+                                       Sheet_Show(mouseinfosheet, 2, 200, 200);\r
+                               #endif\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/callbios.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/callbios.c
new file mode 100644 (file)
index 0000000..af2b771
--- /dev/null
@@ -0,0 +1,230 @@
+\r
+#include "core.h"\r
+\r
+IO_CallBIOSControl *Initialize_CallBIOS(void)\r
+{\r
+       IO_CallBIOSControl *ctrl;\r
+       uint i;\r
+       const uchar *p;\r
+       uchar *q;\r
+       CPU_ControlRegister4 cr4;\r
+\r
+       ctrl = System_Memory_Allocate(sizeof(IO_CallBIOSControl));\r
+\r
+       //ud2\96½\97ß=16bit\83R\81[\83h\82Ì\96\96\92[\82ð\92T\82·\r
+       p = (uchar *)(&asm_16bit_CallBIOSTask + ADR_BOOTPACK);\r
+       for(i = 0; ; i++){\r
+               if(p[i] == 0x0f){\r
+                       if(p[i + 1] == 0x0b){\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+\r
+       ctrl->codesize = i + 2;\r
+\r
+       //asmhead\82Ì\82 \82Á\82½\82Æ\82±\82ë\82É\83R\83s\81[\r
+       q = (uchar *)0xc200;\r
+       for(i = 0; i < ctrl->codesize; i++){\r
+               q[i] = p[i];\r
+       }\r
+\r
+       cr4.cr4 = Load_CR4();\r
+       cr4.bit.VME = True;\r
+       Store_CR4(cr4.cr4);\r
+\r
+       ctrl->CallBIOS_Task = System_MultiTask_Task_Initialize((256 >> 3) + (65536 >> 3) + 1);\r
+//CallBIOS 16Bit \83G\83~\83\85\83\8c\81[\83V\83\87\83\93\83^\83X\83N\82ÍFIFO\82ð\8eg\97p\82µ\82È\82¢\82Ì\82Å\83^\83X\83N\82ÌFIFO\82ð\89ð\95ú\r
+       FIFO32_Free(ctrl->CallBIOS_Task->fifo);\r
+       ctrl->CallBIOS_Task->fifo = Null;\r
+\r
+       q = (uchar *)(ctrl->CallBIOS_Task->tss + sizeof(CPU_TaskStateSegment));\r
+       for(i = 0; i < (256 >> 3); i++){\r
+               //q[i] = 0xff;  /*\91S\83\\83t\83g\83E\83G\83A\8a\84\82è\8d\9e\82Ý\82Å\95Û\8cì\83\82\81[\83h\88ê\94Ê\95Û\8cì\97á\8aO\82ð\8bN\82±\82·*/\r
+               q[i] = 0x00;    /*\91S\83\\83t\83g\83E\83G\83A\8a\84\82è\8d\9e\82Ý\82ð\89¼\91z86\83\82\81[\83h\82Å\8f\88\97\9d\82·\82é*/\r
+       }\r
+       //q[1] = ~(1 << 3);     /*(8 * 1) + 3 - 1 = INT:0x10\82ð\89¼\91z86\83\82\81[\83h\82Å\8f\88\97\9d\82·\82é*/\r
+\r
+       ctrl->CallBIOS_Task->tss->iomap_base = sizeof(CPU_TaskStateSegment) + (256 >> 3);\r
+\r
+       q = (uchar *)(ctrl->CallBIOS_Task->tss + sizeof(CPU_TaskStateSegment) + (256 >> 3));\r
+       for(i = 0; i < (65536 >> 3); i++){\r
+               q[i] = 0x00;    /*\91SIO\83|\81[\83g\82ð\81AIOPL\88È\89º\82ÌCPL\82Å\82à\83A\83N\83Z\83X\89Â\94\\82Æ\82·\82é*/\r
+       }\r
+       q[i] = 0xff;\r
+\r
+       ctrl->esp0 = (uint)System_Memory_Allocate(1024 * 32) + (1024 * 32);\r
+       ctrl->CallBIOS_Task->tss->esp0 = ctrl->esp0;\r
+       ctrl->CallBIOS_Task->tss->ss0 = SYSTEM_DS << 3;\r
+\r
+       return ctrl;\r
+}\r
+\r
+//fifo\82É\82Í\81A\8fI\97¹\8fó\8bµ\82ð\8eó\82¯\8eæ\82éfifo\82ð\8ew\92è\82·\82é\81Bendsignal\82Í\90³\8fí\8fI\97¹\81Aendsignal+1\82Í\88Ù\8fí\8fI\97¹\82ð\8e¦\82·\81B\r
+void CallBIOS_Execute(IO_CallBIOSControl *ctrl, uchar intn, DATA_FIFO32 *fifo, uint endsignal)\r
+{\r
+       uchar *q;\r
+\r
+       ctrl->CallBIOS_Task->tss->eip = 0xc200;\r
+       ctrl->CallBIOS_Task->tss->eflags.bit.VM = True;\r
+       ctrl->CallBIOS_Task->tss->cs = 0;\r
+       ctrl->CallBIOS_Task->tss->ss = 0;\r
+       ctrl->CallBIOS_Task->tss->ds = 0;\r
+       ctrl->CallBIOS_Task->tss->esp = 0xc200;\r
+\r
+       ctrl->CallBIOS_Task->tss->esp0 = ctrl->esp0;\r
+\r
+       ctrl->fifo = fifo;\r
+       ctrl->endsignal = endsignal;\r
+\r
+       q = (uchar *)0xc201;\r
+       *q = intn;\r
+\r
+       System_MultiTask_Task_Run(ctrl->CallBIOS_Task);\r
+\r
+       return;\r
+}\r
+\r
+void CallBIOS_Send_End_Of_Operation(IO_CallBIOSControl *ctrl, uint abort)\r
+{\r
+       if(ctrl->fifo != 0){\r
+               if(!abort){\r
+                       FIFO32_Put(ctrl->fifo, ctrl->endsignal);\r
+               } else{\r
+                       FIFO32_Put(ctrl->fifo, ctrl->endsignal + 1);\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void CallBIOS_Check_Privileged_Operation(uint *esp)\r
+{\r
+//\83G\83\89\81[\83R\81[\83h\82Ì\82 \82é\97á\8aO\94­\90\8e\9e\82É\8cÄ\82Î\82ê\82é\82±\82Æ\82ð\91z\92è\r
+//\83G\83\89\81[\83R\81[\83h\82Ì\82È\82¢\97á\8aO\82©\82ç\82¾\82Æ\81A\83X\83^\83b\83N\82ª\82¸\82ê\82é\82Ì\82Å\92\8d\88Ó\r
+       uchar *eip;\r
+       ushort *userstack;\r
+       Emulator_x86_FarPointer *vector;\r
+       CPU_EFlags eflags;\r
+\r
+       eip = (uchar *)((esp[EXCEPTION_INFO_CS] << 4) + (esp[EXCEPTION_INFO_EIP] & 0x0000ffff));\r
+       userstack = (ushort *)((esp[EXCEPTION_INFO_USER_SS] << 4) + (esp[EXCEPTION_INFO_USER_ESP] & 0x0000ffff));\r
+\r
+       if(eip[0] == 0xCD){     /*INT n*/\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("CallBIOS:Privileged Operation Found in v8086mode.\n");\r
+                       debug("UserStack:[0x%X:0x%X] = 0x%X\n", esp[EXCEPTION_INFO_USER_SS], esp[EXCEPTION_INFO_USER_ESP] & 0x0000ffff, userstack);\r
+                       debug("Opcode[0x%X]:INT 0x%X\n", eip, eip[1]);\r
+               #endif\r
+               vector = (Emulator_x86_FarPointer *)(eip[1] << 2);\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("New EIP = [0x%X:0x%X] = [0x%X]\n", vector->selector, vector->offset, (vector->selector << 4) + vector->offset);\r
+               #endif\r
+\r
+               eflags.eflags = esp[EXCEPTION_INFO_EFLAGS];\r
+               //eflags.bit.IF = False;\r
+               eflags.bit.IF = True;   /*\8a\84\82è\8d\9e\82Ý\8bÖ\8e~\82É\82µ\82È\82¢*/\r
+               eflags.bit.TF = False;\r
+               eflags.bit.AC = False;\r
+               CallBIOS_Push_Data_To_Stack(esp, eflags.eflags);\r
+               CallBIOS_Push_Data_To_Stack(esp, esp[EXCEPTION_INFO_CS]);\r
+               CallBIOS_Push_Data_To_Stack(esp, esp[EXCEPTION_INFO_EIP] + 2);\r
+               esp[EXCEPTION_INFO_CS] = vector->selector;\r
+               esp[EXCEPTION_INFO_EIP] = vector->offset;\r
+\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("Return to [0x%X:0x%X] = [0x%X]. Emulation End.\n", esp[EXCEPTION_INFO_CS], esp[EXCEPTION_INFO_EIP], (esp[EXCEPTION_INFO_CS] << 4) + esp[EXCEPTION_INFO_EIP]);\r
+               #endif\r
+\r
+               return;\r
+       } else if(eip[0] == 0xFB){      /*STI*/\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("CallBIOS:Privileged Operation Found in v8086mode.\n");\r
+                       debug("Opcode[0x%X]:STI\n", eip);\r
+               #endif\r
+               /*\89½\82à\82µ\82È\82¢*/\r
+               //eflags.eflags = esp[EXCEPTION_INFO_EFLAGS];\r
+               //eflags.bit.IF = True;\r
+               esp[EXCEPTION_INFO_EIP]++;\r
+\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("Return to [0x%X:0x%X] = [0x%X]. Emulation End.\n", esp[EXCEPTION_INFO_CS], esp[EXCEPTION_INFO_EIP], (esp[EXCEPTION_INFO_CS] << 4) + esp[EXCEPTION_INFO_EIP]);\r
+               #endif\r
+\r
+               return;\r
+       } else if(eip[0] == 0xCF){      /*IRET*/\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("CallBIOS:Privileged Operation Found in v8086mode.\n");\r
+                       debug("UserStack:[0x%X:0x%X] = 0x%X\n", esp[EXCEPTION_INFO_USER_SS], esp[EXCEPTION_INFO_USER_ESP] & 0x0000ffff, userstack);\r
+                       debug("Opcode[0x%X]:IRET\n", eip);\r
+               #endif\r
+               esp[EXCEPTION_INFO_EIP] = CallBIOS_Pop_Data_From_Stack(esp);\r
+               esp[EXCEPTION_INFO_CS] = CallBIOS_Pop_Data_From_Stack(esp);\r
+               eflags.eflags = esp[EXCEPTION_INFO_EFLAGS];\r
+               eflags.eflags = (eflags.eflags & 0xffff0000) | CallBIOS_Pop_Data_From_Stack(esp);\r
+\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("Return to [0x%X:0x%X] = [0x%X]. Emulation End.\n", esp[EXCEPTION_INFO_CS], esp[EXCEPTION_INFO_EIP], (esp[EXCEPTION_INFO_CS] << 4) + esp[EXCEPTION_INFO_EIP]);\r
+               #endif\r
+\r
+               return;\r
+       } else{\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("CallBIOS:Privileged Operation Found in v8086mode.\n");\r
+                       debug("Opcode[0x%X]:0x%X\n", eip, eip[0]);\r
+                       debug("Task Terminate...\n");\r
+               #endif\r
+       }\r
+\r
+       System_CallBIOS_Send_End_Of_Operation(True);\r
+\r
+       for(;;){\r
+               System_MultiTask_Task_Kill(System_MultiTask_GetNowTask());\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+uint CallBIOS_Push_Data_To_Stack(uint *esp, ushort data)\r
+{\r
+       ushort *userstack;\r
+\r
+       if(esp[EXCEPTION_INFO_USER_ESP] < 2){   /*\83X\83^\83b\83N\82ª\91«\82è\82È\82¢*/\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("PushToStack:No More Stack.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       esp[EXCEPTION_INFO_USER_ESP] -= 2;\r
+       userstack = (ushort *)((esp[EXCEPTION_INFO_USER_SS] << 4) + (esp[EXCEPTION_INFO_USER_ESP] & 0x0000ffff));\r
+       userstack[0] = data;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+               debug("PUSH 0x%X To [0x%X:0x%X] = [0x%X]\n", data, esp[EXCEPTION_INFO_USER_SS], esp[EXCEPTION_INFO_USER_ESP] & 0x0000ffff, userstack);\r
+       #endif\r
+\r
+       return 0;\r
+}\r
+\r
+uint CallBIOS_Pop_Data_From_Stack(uint *esp)\r
+{\r
+       ushort *userstack;\r
+\r
+       if(esp[EXCEPTION_INFO_USER_ESP] > 0x0000fffd){  /*\83X\83^\83b\83N\82ª\91«\82è\82È\82¢*/\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("PopFromStack:No More Stack.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+\r
+       userstack = (ushort *)((esp[EXCEPTION_INFO_USER_SS] << 4) + (esp[EXCEPTION_INFO_USER_ESP] & 0x0000ffff));\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+               debug("Pop 0x%X From [0x%X:0x%X] = [0x%X]\n", userstack[0], esp[EXCEPTION_INFO_USER_SS], esp[EXCEPTION_INFO_USER_ESP] & 0x0000ffff, userstack);\r
+       #endif\r
+\r
+       esp[EXCEPTION_INFO_USER_ESP] += 2;\r
+\r
+       return userstack[0];\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/cfunc.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/cfunc.c
new file mode 100644 (file)
index 0000000..9ca3c4d
--- /dev/null
@@ -0,0 +1,710 @@
+\r
+#include "core.h"\r
+\r
+uint system_seed;\r
+\r
+#define RAND_A ((10 << 3) + 5)\r
+#define RAND_B ((15 << 1) + 1)\r
+#define RAND_C (1 << 24)\r
+\r
+void srand(uint seed)\r
+{\r
+       system_seed = seed;\r
+       return;\r
+}\r
+\r
+uint rand(void)\r
+{\r
+       uint seed2;\r
+\r
+       system_seed = ((system_seed * RAND_A) + RAND_B) % RAND_C;\r
+       seed2 = ((system_seed * RAND_A) + RAND_B) % RAND_C;\r
+       system_seed = (system_seed & 0xff5688) | ((seed2 >> 8) & 0xa977) | ((system_seed & 0x000ff000) << 12);\r
+       return system_seed;\r
+}\r
+\r
+uint isqrt(uint n)\r
+{\r
+       uint x;\r
+\r
+//Overflow Check\r
+       if(n >= (uint)0xffff * (uint)0xffff){\r
+               return 0xffff;\r
+       }\r
+\r
+       x = (1 << 15);\r
+\r
+       if(n > x * x){\r
+               x += (1 << 14);\r
+       } else{\r
+               x -= (1 << 14);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 13);\r
+       } else{\r
+               x -= (1 << 13);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 12);\r
+       } else{\r
+               x -= (1 << 12);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 11);\r
+       } else{\r
+               x -= (1 << 11);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 10);\r
+       } else{\r
+               x -= (1 << 10);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 9);\r
+       } else{\r
+               x -= (1 << 9);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 8);\r
+       } else{\r
+               x -= (1 << 8);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 7);\r
+       } else{\r
+               x -= (1 << 7);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 6);\r
+       } else{\r
+               x -= (1 << 6);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 5);\r
+       } else{\r
+               x -= (1 << 5);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 4);\r
+       } else{\r
+               x -= (1 << 4);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 3);\r
+       } else{\r
+               x -= (1 << 3);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 2);\r
+       } else{\r
+               x -= (1 << 2);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 1);\r
+       } else{\r
+               x -= (1 << 1);\r
+       }\r
+       if(n > x * x){\r
+               x += (1 << 0);\r
+       } else{\r
+               x -= (1 << 0);\r
+       }\r
+\r
+       if(n > x * x){\r
+               x++;\r
+       }\r
+       if(n < x * x){\r
+               x--;\r
+       }\r
+\r
+       return x;\r
+}\r
+\r
+//\95\8e\9a\97ñ\82©\82ç\90\94\92l\82ð\90\90¬\82µ\82Ü\82·\81B\r
+//base=0:C\8c¾\8cê\82Ì\92è\90\94\95\\8bL\83\8b\81[\83\8b\82É\8f]\82¤\81B("0x..."=16, "0..."=8, else=10)\r
+//base=2-36(\90\94\8e\9a10+\83A\83\8b\83t\83@\83x\83b\83g26):\8ae\90\94\8e\9a\82ð\8aî\90\94\82Æ\82µ\82Ä\95\8e\9a\97ñ\82ð\97\9d\89ð\82µ\82æ\82¤\82Æ\82·\82é\81B\r
+//\83A\83\8b\83t\83@\83x\83b\83g\82Ì\91å\95\8e\9a\81E\8f¬\95\8e\9a\82Í\96â\82í\82È\82¢\81B\r
+//endptr=NULL\82à\89Â\81B\97L\8cø\82È\90\94\8e\9a\82ª\88ê\82Â\82à\82È\82¯\82ê\82Î\81A*endptr=s, retv=0\82Æ\82È\82é\81B\r
+//\8fo\97Í\82Ì\83I\81[\83o\81[\83t\83\8d\81[\82É\82Â\82¢\82Ä\82Í\8dl\97\82µ\82È\82¢\82Ì\82Å\92\8d\88Ó\81B\r
+//\8c»\8fó\82Å\82Í\95\89\90\94\82Í\88µ\82¦\82È\82¢(\83}\83C\83i\83X\8bL\8d\86\82Í\95Ï\8a·\95s\94\\82Æ\82³\82ê\82é)\r
+//s\82Ì\97á:"0xFEC375"(16), "0423"(8), "12345"(10)\r
+//\95\8e\9a\97ñ\91S\91Ì\82Ì\91O\82É\82Í\8bó\94\92\82ª\82 \82Á\82Ä\82à\96³\8e\8b\82³\82ê\82é\81B\90\94\8e\9a\95\94\95ª\8aJ\8en\8cã\82Í\8bó\94\92\82Í\95Ï\8a·\95s\94\\82Æ\82³\82ê\82é\81B\r
+//*endptr[0]==0x00\82Ì\82Æ\82«\81A\95\8e\9a\97ñs\82Ì\82·\82×\82Ä\82ª\95Ï\8a·\82³\82ê\82½\82±\82Æ\82ð\8e¦\82·\81B\r
+uint strtol(const uchar s[], uchar *endptr[], uint base)\r
+{\r
+       uint i, v;\r
+\r
+       v = 0;\r
+\r
+       if(s == Null || base > 36 || base == 1){\r
+               if(endptr != Null){\r
+                       *endptr = Null;\r
+               }\r
+               return 0;\r
+       }\r
+\r
+//\8bó\94\92\82ð\93Ç\82Ý\94ò\82Î\82·\r
+       for(i = 0; s[i] != 0x00; i++){\r
+               if(s[i] != ' '){\r
+                       break;\r
+               }\r
+       }\r
+//base=0\82Ì\8e\9e\82Ì\8aî\90\94\8c\88\92è\r
+       if(base == 0){\r
+               if(s[i] == '0'){\r
+                       i++;\r
+                       if(s[i] == 'x'){\r
+                               base = 16;\r
+                               i++;\r
+                       } else{\r
+                               base = 8;\r
+                       }\r
+               } else{\r
+                       base = 10;\r
+               }\r
+       }\r
+//\90\94\92l\95Ï\8a·\r
+       for(; s[i] != 0x00; i++){\r
+               if('0' <= s[i] <= '9' && s[i] - '0' < base){\r
+                       v *= base;\r
+                       v += s[i] - '0';\r
+               } else if('A' <= s[i] <= 'Z' && s[i] - 'A' + 10 < base){\r
+                       v *= base;\r
+                       v += s[i] - 'A' + 10;\r
+               } else if('a' <= s[i] <= 'z' && s[i] - 'a' + 10 < base){\r
+                       v *= base;\r
+                       v += s[i] - 'a' + 10;\r
+               } else{\r
+                       break;\r
+               }\r
+       }\r
+       if(endptr != Null){\r
+               *endptr = (uchar *)&s[i];\r
+       }\r
+       return v;\r
+}\r
+\r
+bool CFunction_CompareStrings(const uchar s1[], const uchar s2[])\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; s1[i] == s2[i]; i++){\r
+               if(s1[i] == 0x00){\r
+                       return True;\r
+               }\r
+       }\r
+       return False;\r
+}\r
+\r
+bool CFunction_CompareStrings_n(const uchar s1[], const uchar s2[], unsigned int n)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; i < n; i++){\r
+               if(s1[i] != s2[i]){\r
+                       return False;\r
+               }\r
+               if(s1[i] == 0x00){\r
+                       return True;\r
+               }\r
+       }\r
+       return True;\r
+}\r
+\r
+uint CFunction_ExtractBits(uint source, uint start, uint end)\r
+{\r
+       return (source >> start) & ~(0xffffffff << (end - start + 1));\r
+}\r
+\r
+//\95\8e\9a\97ñ\93à\82Ìn\94Ô\96Ú\82Ì\92P\8cê(\83X\83y\81[\83X\8bæ\90Ø\82è\82É\82æ\82é)\82Ì\90æ\93ª\83A\83h\83\8c\83X\82ð\8eæ\93¾\82·\82é\81B\r
+//\96ß\82è\92l\82Í\81An\94Ô\96Ú\82Ì\92P\8cê\82ª\91\8dÝ\82·\82é\82©\82Ç\82¤\82©\82ð\95Ô\82·\81B\r
+//\91\8dÝ\82µ\82È\82©\82Á\82½\8fê\8d\87\82Ì*wordptr\82Ís\82Ì\96\96\92[\82ð\95Ô\82·\81B\r
+//wordptr\82ÍNull\8b\96\97e\81B\r
+bool CFunction_String_GetWord(const uchar s[], uchar *wordptr[], uint n)\r
+{\r
+       uint i, count;\r
+\r
+       if(s == Null){\r
+               if(wordptr != Null){\r
+                       *wordptr = Null;\r
+               }\r
+               return False;\r
+       }\r
+\r
+       if(n == 0){\r
+               if(wordptr != Null){\r
+                       *wordptr = (uchar *)s;\r
+               }\r
+               return True;\r
+       }\r
+\r
+       count = 0;\r
+       for(i = 0; s[i] != 0x00; i++){\r
+               if(s[i] == ' '){\r
+                       count++;\r
+                       for(; s[i] != 0x00; i++){\r
+                               if(s[i] != ' '){\r
+                                       break;\r
+                               }\r
+                       }\r
+                       if(s[i] != 0x00 && count == n){\r
+                               if(wordptr != Null){\r
+                                       *wordptr = (uchar *)&s[i];\r
+                               }\r
+                               return True;\r
+                       }\r
+               }\r
+       }\r
+\r
+       if(wordptr != Null){\r
+               *wordptr = (uchar *)&s[i];\r
+       }\r
+       return False;\r
+}\r
+\r
+//source\94Ô\92n\82©\82ç\82Ì\81Adestination_size\82ð\92´\82¦\82È\82¢source_size\83o\83C\83g\82ð\81Adestination\94Ô\92n\82Ö\88Ú\93®\82³\82¹\82é\81B\r
+//\83\81\83\82\83\8a\94Í\88Í\82ª\8fd\82È\82Á\82Ä\82¢\82Ä\82à\83f\81[\83^\82Í\94j\89ó\82³\82ê\82È\82¢(\94Í\88Í\82ª\8fd\82È\82Á\82Ä\82¢\82é\8fê\8d\87\81Asource\82Ì\93à\97e\82ª\95Ï\8dX\82³\82ê\82é\89Â\94\\90«\82Í\82 \82é\82ª\81A\88Ú\93®\82³\82ê\82é\83f\81[\83^\8e©\91Ì\82Í\95Û\8e\9d\82³\82ê\82é)\81B\r
+//\93¯\88ê\94Ô\92n\82Ö\83R\83s\81[\82·\82é\8fê\8d\87\82Í\89½\82à\82µ\82È\82¢\81B\r
+//\96ß\82è\92l\82Í\81A\83R\83s\81[\82µ\82½\83o\83C\83g\90\94\81B\r
+uint CFunction_MemoryMove(void *destination, uint destination_size, const void *source, uint source_size)\r
+{\r
+       uint move_size, i;\r
+       void *temp;\r
+\r
+       if(destination == source){\r
+               return 0;\r
+       }\r
+\r
+       if(destination_size <= source_size){\r
+               move_size = destination_size;\r
+       } else{\r
+               move_size = source_size;\r
+       }\r
+\r
+       if((uint)source < (uint)destination && (uint)source + source_size > (uint)destination){\r
+               //source\82ð\8fã\8f\91\82«\82µ\82Ä\82µ\82Ü\82¤\8fê\8d\87\81A\88ê\93x\83o\83b\83t\83@\82É\91Þ\94ð\82³\82¹\82½\8cã\83R\83s\81[\82·\82é\81B\r
+               temp = System_Memory_Allocate(move_size);\r
+               i = 0;\r
+               if(move_size >= 4){\r
+                       for(; i < move_size - (4 - 1); i += 4){\r
+                               ((uint *)temp)[i >> 2] = ((uint *)source)[i >> 2];\r
+                       }\r
+               }\r
+               if(i != move_size){\r
+                       for(; i < move_size; i++){\r
+                               ((uchar *)temp)[i] = ((uchar *)source)[i];\r
+                       }\r
+               }\r
+       } else{\r
+               temp = (uchar *)source;\r
+       }\r
+\r
+       i = 0;\r
+       if(move_size >= 4){\r
+               for(; i < move_size - (4 - 1); i += 4){\r
+                       ((uint *)destination)[i >> 2] = ((uint *)temp)[i >> 2];\r
+               }\r
+       }\r
+       if(i != move_size){\r
+               for(; i < move_size; i++){\r
+                       ((uchar *)destination)[i] = ((uchar *)temp)[i];\r
+               }\r
+       }\r
+\r
+       if(temp != source){\r
+               System_Memory_Free(temp, move_size);\r
+       }\r
+\r
+       return move_size;\r
+}\r
+\r
+//\88ø\90\94(uchar s[], uint n, const uchar format[], ...)\r
+//     s       :\8c\8b\89Ê\82ð\8f\91\82«\8d\9e\82Þ\95\8e\9a\97ñ\82Ì\90æ\93ª\83A\83h\83\8c\83X\82ð\8ew\92è\82µ\82Ü\82·\81B\r
+//     n       :s[]\82Ì\91å\82«\82³\82ð\8ew\92è\82µ\82Ü\82·\81B(n - 1)\94Ô\96Ú\88È\8d~\82Ì\95\8e\9a\82Í\8f\91\82«\8d\9e\82Ü\82ê\82Ü\82¹\82ñ\81B\r
+//             :\82½\82¾\82µ\81A\83[\83\8d\82ð\8ew\92è\82µ\82½\8fê\8d\87\82Í\81A\89½\82à\8fo\97Í\82µ\82Ü\82¹\82ñ\81B\82±\82Ì\8fê\8d\87\81As[]\82Í0(null)\82ð\8ew\92è\82·\82é\82±\82Æ\82à\82Å\82«\82Ü\82·\81B\r
+//     format  :\8f\91\8e®\8ew\92è\95\8e\9a\97ñ\82Ì\90æ\93ª\83A\83h\83\8c\83X\82ð\8ew\92è\82µ\82Ü\82·\81B\8fI\92[\82Í0x00\82Å\82 \82é\95K\97v\82ª\82 \82è\82Ü\82·\81B\r
+//     ...     :\89Â\95Ï\92·\88ø\90\94\82Å\82·\81B\r
+//\r
+//\8cë\82Á\82½\83t\83H\81[\83}\83b\83g\82ª\8ew\92è\82³\82ê\82½\8fê\8d\87\81A\82»\82Ì\95\94\95ª\82Ì\83t\83H\81[\83}\83b\83g\89ð\8eß\82ð\8fI\97¹\82µ\81A\r
+//\89ð\8eß\82Å\82«\82È\82©\82Á\82½\95\94\95ª\82©\82ç\92Ê\8fí\95\8e\9a\82Æ\82µ\82Ä\8fo\97Í\82µ\82Ü\82·\r
+//\r
+//%[\83t\83\89\83O][\8dÅ\8f¬\83t\83B\81[\83\8b\83h\95\9d][\90¸\93x][\95Ï\8a·\8fC\8fü\8eq]\83t\83H\81[\83}\83b\83g\8ew\92è\8eq"\r
+//     text    :\95½\95\82Í%\82ð\8f\9c\82«\81A\82»\82Ì\82Ü\82Ü\8fo\97Í\82³\82ê\82Ü\82·\81B\r
+//     \8eg\97p\89Â\94\\82È\83t\83H\81[\83}\83b\83g\8ew\92è\8eq:\r
+//     %%      :%\95\8e\9a\82ð\8fo\97Í\82µ\82Ü\82·\81B\r
+//     o       :\83f\81[\83^\82ð8\90i\90\94\82Å\8fo\97Í\82µ\82Ü\82·\81B\r
+//     d, i    :\83f\81[\83^\82ð10\90i\90\94\82Å\8fo\97Í\82µ\82Ü\82·\81B\r
+//     x, X    :\83f\81[\83^\82ð16\90i\90\94\82Å\8fo\97Í\82µ\82Ü\82·\81Bx:\83A\83\8b\83t\83@\83x\83b\83g\8f¬\95\8e\9a\81BX:\83A\83\8b\83t\83@\83x\83b\83g\91å\95\8e\9a\81B\r
+//     u       :\83f\81[\83^\82ð\95\84\8d\86\82È\82µ10\90i\90\94\82Å\8fo\97Í\82µ\82Ü\82·\81B\r
+//     c       :\83f\81[\83^\82ðASCII\83R\81[\83h\82Æ\89ð\8eß\82µ\82Ä\88ê\95\8e\9a\82ð\8fo\97Í\82µ\82Ü\82·\81B\r
+//     s       :\83f\81[\83^\82ð\95\8e\9a\97ñ\82Ö\82Ì\83|\83C\83\93\83^\82Æ\89ð\8eß\82µ\82Ä\95\8e\9a\97ñ\82ð\8fo\97Í\82µ\82Ü\82·\81B\95\8e\9a\97ñ\82Ì\8fI\92[\82Í0(null)\82Å\82 \82é\95K\97v\82ª\82 \82è\82Ü\82·\81B\r
+//     f       :\83f\81[\83^\82ð\95\82\93®\8f¬\90\94\93_\90\94\82Æ\82µ\82Ä\8fo\97Í\82µ\82Ü\82·\81Bfloat/double\82Ì\8bæ\95Ê\82Í\82µ\82Ü\82¹\82ñ\81B\95W\8f\80\82Ì\90¸\93x\82Í6\8c\85\82Å\82·\81B\r
+//     e, E    :\83f\81[\83^\82ð\8ew\90\94\8c`\8e®\82Å\8fo\97Í\82µ\82Ü\82·\81Be:\83A\83\8b\83t\83@\83x\83b\83g\8f¬\95\8e\9a\81BE:\83A\83\8b\83t\83@\83x\83b\83g\91å\95\8e\9a\81B\95W\8f\80\82Ì\90¸\93x\82Í6\8c\85\82Å\82·\81B\r
+//     g, G    :\92Ê\8fí\82Íf\83t\83H\81[\83}\83b\83g\8ew\92è\8eq\82Æ\93¯\82\93®\8dì\82ð\82µ\82Ü\82·\82ª\81A\r
+//             :\8ew\90\94\95\94\82ª-5\88È\89º\82©\81A\97L\8cø\90¸\93x\88È\8fã\82Ì\82Æ\82«\82Íe,E\83t\83H\81[\83}\83b\83g\8ew\92è\8eq\82Æ\93¯\82\93®\8dì\82ð\82µ\82Ü\82·\81B\r
+//             :\82±\82Ì\8f\91\8e®\82Ì\96Ú\93I\82Í\81A\82È\82é\82×\82­\92Z\82¢\95\\8c»\82Å\8fo\97Í\82·\82é\82±\82Æ\82Å\82·\81B\r
+//     p       :\83f\81[\83^\82ð\89½\82ç\82©\82Ì\83|\83C\83\93\83^\82Æ\89ð\8eß\82µ\82Ä\81A\82»\82Ì\8ew\82µ\8e¦\82·\83A\83h\83\8c\83X\82ð\8fo\97Í\82µ\82Ü\82·\81B\r
+//     n       :\82±\82Ì\83t\83H\81[\83}\83b\83g\8ew\92è\8eq\82ð\8aÜ\82Þ\83t\83H\81[\83}\83b\83g\8ew\92è\82É\92B\82·\82é\82Ü\82Å\81A\8d¡\89ñ\8fo\97Í\82µ\82½\95\8e\9a\90\94\82ð\81A\r
+//             :\83f\81[\83^\82ðuint *\82Æ\82µ\82Ä\89ð\8eß\82µ\81A\83|\83C\83\93\83^\82ª\8ew\82µ\8e¦\82·\90æ\82Ìuint\8c^\95Ï\90\94\82É\91ã\93ü\82µ\82Ü\82·\81B\r
+\r
+int snprintf(uchar s[], uint n, const uchar format[], ...)\r
+{\r
+       return CFunction_vsnprintf(s, n, format, (uint *)(&format + 1));\r
+}\r
+\r
+int vsnprintf(uchar s[], uint n, const uchar format[], uint vargs[])\r
+{\r
+       return CFunction_vsnprintf(s, n, format, vargs);\r
+}\r
+\r
+int CFunction_vsnprintf(uchar s[], uint n, const uchar format[], uint vargs[])\r
+{\r
+       uchar c;\r
+       uint i, j;\r
+       const uchar *d;\r
+       uint flag_fill_zero;\r
+       uint fill_length;\r
+\r
+       CFunction_vsnprintf_WorkArea work;\r
+\r
+       CFunction_vsnprintf_Initialize_WorkArea(&work, s, format, n, vargs);    \r
+\r
+       flag_fill_zero = False;\r
+       fill_length = 0xffffffff;\r
+\r
+       for(;;){\r
+               if(CFunction_vsnprintf_Check_FormatBuffer(&work) == -1){\r
+                       break;\r
+               }\r
+               c = CFunction_vsnprintf_Read_FormatBuffer(&work);\r
+               if(work.format_phase > 0){      /*\8f\91\8e®\8ew\92è\92\86*/\r
+                       if(c == '%'){           /*%\95\8e\9a\82ð\8fo\97Í\82µ\82Ü\82·\81B*/\r
+                               CFunction_vsnprintf_Write_DestinationBuffer(&work, '%');\r
+                               work.format_phase = 0;\r
+                       } else if(c == 'o'){    /*\83f\81[\83^\82ð8\90i\90\94\82Å\8fo\97Í\82µ\82Ü\82·\81B*/\r
+                       } else if(c == 'd'){    /*\83f\81[\83^\82ð10\90i\90\94\82Å\8fo\97Í\82µ\82Ü\82·\81B*/\r
+                               /*\95W\8f\80\90¸\93x\82Í\88ê\8c\85\88È\8fã\81A\83[\83\8d\83t\83B\83\8b\82Å\82·\81B*/\r
+                               if(fill_length == 0xffffffff){\r
+                                       fill_length = 1;\r
+                                       flag_fill_zero = True;\r
+                               }\r
+                               i = CFunction_vsnprintf_Get_NextArgument(&work);\r
+                               if((i & 0x80000000) != 0){\r
+                                       i--;\r
+                                       i = ~i;\r
+                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, '-');\r
+                               }\r
+                               CFunction_vsnprintf_To_String_From_Decimal_Unsigned(&work, i);\r
+\r
+                               for(i = 0; i < 10; i++){\r
+                                       if(work.temporary_data[i] != ' '){\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if(i == 10){\r
+                                       i--;\r
+                                       work.temporary_data[10 - 1] = '0';\r
+                               }\r
+\r
+                               if((10 - i) < fill_length && fill_length != 0xffffffff){\r
+                                       if(flag_fill_zero){\r
+                                               for(j = 0; j < (fill_length - (10 - i)); j++){\r
+                                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, '0');\r
+                                               }\r
+                                       } else{\r
+                                               for(j = 0; j < (fill_length - (10 - i)); j++){\r
+                                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, ' ');\r
+                                               }\r
+                                       }\r
+                               }\r
+                               for(; i < 10; i++){\r
+                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, work.temporary_data[i]);\r
+                               }\r
+                               work.format_phase = 0;\r
+                       } else if(c == 'i'){    /*\83f\81[\83^\82ð10\90i\90\94\82Å\8fo\97Í\82µ\82Ü\82·\81B*/\r
+                               i = CFunction_vsnprintf_Get_NextArgument(&work);\r
+                               if((i & 0x80000000) != 0){\r
+                                       i--;\r
+                                       i = ~i;\r
+                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, '-');\r
+                               }\r
+                               CFunction_vsnprintf_To_String_From_Decimal_Unsigned(&work, i);\r
+                               for(i = 0; i < 10; i++){\r
+                                       if(work.temporary_data[i] != ' '){\r
+                                               break;\r
+                                       }\r
+                                       if(i >= 10 - 1){\r
+                                               CFunction_vsnprintf_Write_DestinationBuffer(&work, '0');\r
+                                       }\r
+                               }\r
+                               for(; i < 10; i++){\r
+                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, work.temporary_data[i]);\r
+                               }\r
+                               work.format_phase = 0;\r
+                       } else if(c == 'x'){    /*\83f\81[\83^\82ð16\90i\90\94\82Å\8fo\97Í\82µ\82Ü\82·\81Bx:\83A\83\8b\83t\83@\83x\83b\83g\8f¬\95\8e\9a\81B*/\r
+                               CFunction_vsnprintf_To_String_From_Hex_Lower(&work, CFunction_vsnprintf_Get_NextArgument(&work));\r
+                               for(i = 0; i < 8; i++){\r
+                                       if(work.temporary_data[i] != ' '){\r
+                                               break;\r
+                                       }\r
+                                       if(i >= 8 - 1){\r
+                                               CFunction_vsnprintf_Write_DestinationBuffer(&work, '0');\r
+                                       }\r
+                               }\r
+                               for(; i < 8; i++){\r
+                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, work.temporary_data[i]);\r
+                               }\r
+                       } else if(c == 'X'){    /*\83f\81[\83^\82ð16\90i\90\94\82Å\8fo\97Í\82µ\82Ü\82·\81BX:\83A\83\8b\83t\83@\83x\83b\83g\91å\95\8e\9a\81B*/\r
+                               /*\95W\8f\80\90¸\93x\82Í\88ê\8c\85\88È\8fã\81A\83[\83\8d\83t\83B\83\8b\82Å\82·\81B*/\r
+                               if(fill_length == 0xffffffff){\r
+                                       fill_length = 1;\r
+                                       flag_fill_zero = True;\r
+                               }\r
+                               CFunction_vsnprintf_To_String_From_Hex_Upper(&work, CFunction_vsnprintf_Get_NextArgument(&work));\r
+                               for(i = 0; i < 8; i++){\r
+                                       if(work.temporary_data[i] != ' '){\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               if((8 - i) < fill_length && fill_length != 0xffffffff){\r
+                                       if(flag_fill_zero){\r
+                                               for(j = 0; j < (fill_length - (8 - i)); j++){\r
+                                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, '0');\r
+                                               }\r
+                                       } else{\r
+                                               for(j = 0; j < (fill_length - (8 - i)); j++){\r
+                                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, ' ');\r
+                                               }\r
+                                       }\r
+                               }\r
+                               for(; i < 8; i++){\r
+                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, work.temporary_data[i]);\r
+                               }\r
+                               work.format_phase = 0;\r
+                       } else if(c == 'u'){    /*\83f\81[\83^\82ð\95\84\8d\86\82È\82µ10\90i\90\94\82Å\8fo\97Í\82µ\82Ü\82·\81B*/\r
+                               CFunction_vsnprintf_To_String_From_Decimal_Unsigned(&work, CFunction_vsnprintf_Get_NextArgument(&work));\r
+                               for(i = 0; i < 10; i++){\r
+                                       if(work.temporary_data[i] != ' '){\r
+                                               break;\r
+                                       }\r
+                                       if(i >= 10 - 1){\r
+                                               CFunction_vsnprintf_Write_DestinationBuffer(&work, '0');\r
+                                       }\r
+                               }\r
+                               for(; i < 10; i++){\r
+                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, work.temporary_data[i]);\r
+                               }\r
+                               work.format_phase = 0;\r
+                       } else if(c == 'c'){    /*\83f\81[\83^\82ðASCII\83R\81[\83h\82Æ\89ð\8eß\82µ\82Ä\88ê\95\8e\9a\82ð\8fo\97Í\82µ\82Ü\82·\81B*/\r
+                               CFunction_vsnprintf_Write_DestinationBuffer(&work, CFunction_vsnprintf_Get_NextArgument(&work));\r
+                               work.format_phase = 0;\r
+                       } else if(c == 's'){    /*\83f\81[\83^\82ð\95\8e\9a\97ñ\82Ö\82Ì\83|\83C\83\93\83^\82Æ\89ð\8eß\82µ\82Ä\95\8e\9a\97ñ\82ð\8fo\97Í\82µ\82Ü\82·\81B\95\8e\9a\97ñ\82Ì\8fI\92[\82Í0(null)\82Å\82 \82é\95K\97v\82ª\82 \82è\82Ü\82·\81B*/\r
+                               d = (const uchar *)CFunction_vsnprintf_Get_NextArgument(&work);\r
+                               for (; *d != 0x00; d++){\r
+                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, *d);\r
+                               }\r
+                               work.format_phase = 0;\r
+                       } else if(c == 'f'){    /*\83f\81[\83^\82ð\95\82\93®\8f¬\90\94\93_\90\94\82Æ\82µ\82Ä\8fo\97Í\82µ\82Ü\82·\81Bfloat/double\82Ì\8bæ\95Ê\82Í\82µ\82Ü\82¹\82ñ\81B\95W\8f\80\82Ì\90¸\93x\82Í6\8c\85\82Å\82·\81B\89Â\95Ï\92·\88ø\90\94\82Ì\8fê\8d\87\81A\95\82\93®\8f¬\90\94\93_\90\94\82Í\8fí\82Édouble\82É\8ag\92£\82³\82ê\82é\82©\82ç\82Å\82·\81B*/\r
+                               ((uint *)work.temporary_data_double)[0] = CFunction_vsnprintf_Get_NextArgument(&work);\r
+                               ((uint *)work.temporary_data_double)[1] = CFunction_vsnprintf_Get_NextArgument(&work);\r
+\r
+                               CFunction_vsnprintf_To_String_From_Hex_Upper(&work, ((uint *)work.temporary_data_double)[1]);\r
+                               for(i = 0; i < 8; i++){\r
+                                       if(work.temporary_data[i] != ' '){\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               for(; i < 8; i++){\r
+                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, work.temporary_data[i]);\r
+                               }\r
+\r
+                               CFunction_vsnprintf_To_String_From_Hex_Upper(&work, ((uint *)work.temporary_data_double)[0]);\r
+                               for(i = 0; i < 8; i++){\r
+                                       if(work.temporary_data[i] != ' '){\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               for(; i < 8; i++){\r
+                                       CFunction_vsnprintf_Write_DestinationBuffer(&work, work.temporary_data[i]);\r
+                               }\r
+                               work.format_phase = 0;\r
+                       } else if(c == 'e'){    /*\83f\81[\83^\82ð\8ew\90\94\8c`\8e®\82Å\8fo\97Í\82µ\82Ü\82·\81Be:\83A\83\8b\83t\83@\83x\83b\83g\8f¬\95\8e\9a\81B\95W\8f\80\82Ì\90¸\93x\82Í6\8c\85\82Å\82·\81B*/\r
+                               \r
+                       } else if(c == 'E'){    /*\83f\81[\83^\82ð\8ew\90\94\8c`\8e®\82Å\8fo\97Í\82µ\82Ü\82·\81BE:\83A\83\8b\83t\83@\83x\83b\83g\91å\95\8e\9a\81B\95W\8f\80\82Ì\90¸\93x\82Í6\8c\85\82Å\82·\81B*/\r
+                       } else if(c == 'g'){    /*\92Ê\8fí\82Íf\83t\83H\81[\83}\83b\83g\8ew\92è\8eq\82Æ\93¯\82\93®\8dì\82ð\82µ\82Ü\82·\82ª\81A\8ew\90\94\95\94\82ª-5\88È\89º\82©\81A\97L\8cø\90¸\93x\88È\8fã\82Ì\82Æ\82«\82Í*/\r
+                       } else if(c == 'G'){    /*e,E\83t\83H\81[\83}\83b\83g\8ew\92è\8eq\82Æ\93¯\82\93®\8dì\82ð\82µ\82Ü\82·\81B\82±\82Ì\8f\91\8e®\82Ì\96Ú\93I\82Í\81A\82È\82é\82×\82­\92Z\82¢\95\\8c»\82Å\8fo\97Í\82·\82é\82±\82Æ\82Å\82·\81B*/\r
+                       } else if(c == 'p'){    /*\83f\81[\83^\82ð\89½\82ç\82©\82Ì\83|\83C\83\93\83^\82Æ\89ð\8eß\82µ\82Ä\81A\82»\82Ì\8ew\82µ\8e¦\82·\83A\83h\83\8c\83X\82ð\8fo\97Í\82µ\82Ü\82·\81B*/\r
+                       } else if(c == 'n'){    /*\82±\82Ì\83t\83H\81[\83}\83b\83g\8ew\92è\8eq\82ð\8aÜ\82Þ\83t\83H\81[\83}\83b\83g\8ew\92è\82É\92B\82·\82é\82Ü\82Å\81A\8d¡\89ñ\8fo\97Í\82µ\82½\95\8e\9a\90\94\82ð\81A\83f\81[\83^\82ðuint *\82Æ\82µ\82Ä\89ð\8eß\82µ\81A\83|\83C\83\93\83^\82ª\8ew\82µ\8e¦\82·\90æ\82Ìuint\8c^\95Ï\90\94\82É\91ã\93ü\82µ\82Ü\82·\81B*/\r
+                       } else if(0x30 <= c && c <= 0x39){      /*\90\94\8e\9a*/\r
+                               c -= 0x30;\r
+                               if(fill_length == 0xffffffff && c == 0){        /*\8dÅ\8f\89\82Ì\83[\83\8d:\83[\83\8d\8f[\93U\82ð\97v\8b\81*/\r
+                                       flag_fill_zero = True;\r
+                                       fill_length = 0;\r
+                               } else{\r
+                                       if(fill_length == 0xffffffff){\r
+                                               fill_length = c;\r
+                                       } else{\r
+                                               fill_length = (fill_length * 10) + c;\r
+                                       }\r
+                               }\r
+                       } else{\r
+                               CFunction_vsnprintf_Write_DestinationBuffer(&work, c);\r
+                               work.format_phase = 0;\r
+                       }\r
+               } else{ /*\88ê\94Ê\95\8e\9a\82©\82à*/\r
+                       if(c == '%'){   /*\8e\9f\82©\82ç\82Í\8f\91\8e®\8ew\92è*/\r
+                               flag_fill_zero = False;\r
+                               fill_length = 0xffffffff;\r
+                               work.format_phase = 1;\r
+                       } else{ /*\88ê\94Ê\95\8e\9a\8fo\97Í\92\86*/\r
+                               CFunction_vsnprintf_Write_DestinationBuffer(&work, c);\r
+                       }\r
+               }\r
+       }\r
+\r
+       CFunction_vsnprintf_End(&work);\r
+\r
+       return work.index_destination_buf;\r
+}\r
+\r
+void CFunction_vsnprintf_Initialize_WorkArea(CFunction_vsnprintf_WorkArea *work, uchar s[], const uchar format[], uint n, uint vargs[])\r
+{\r
+       work->destination_buf = s;\r
+       work->length_destination_buf = n;\r
+       work->index_destination_buf = 0;\r
+\r
+       work->format_buf = format;\r
+       work->index_format_buf = 0;\r
+\r
+       work->temporary_data[15] = 0x00;\r
+\r
+       work->vargs = vargs;\r
+       work->index_vargs = 0;\r
+\r
+       work->format_phase = 0;\r
+\r
+       return;\r
+}\r
+\r
+int CFunction_vsnprintf_Check_FormatBuffer(CFunction_vsnprintf_WorkArea *work)\r
+{\r
+       if(work->format_buf[work->index_format_buf] == 0x00){\r
+               return -1;\r
+       }\r
+       return 0;\r
+}\r
+\r
+int CFunction_vsnprintf_Check_DestinationBuffer(CFunction_vsnprintf_WorkArea *work)\r
+{\r
+       if(work->index_destination_buf >= work->length_destination_buf){\r
+               return -1;\r
+       }\r
+       return 0;\r
+}\r
+\r
+uchar CFunction_vsnprintf_Read_FormatBuffer(CFunction_vsnprintf_WorkArea *work)\r
+{\r
+       if(CFunction_vsnprintf_Check_FormatBuffer(work) == -1){\r
+               return 0;\r
+       }\r
+       work->index_format_buf++;\r
+       return work->format_buf[work->index_format_buf - 1];\r
+}\r
+\r
+void CFunction_vsnprintf_Write_DestinationBuffer(CFunction_vsnprintf_WorkArea *work, uchar c)\r
+{\r
+       if(CFunction_vsnprintf_Check_DestinationBuffer(work) != -1){\r
+               if(work->destination_buf != 0){\r
+                       work->destination_buf[work->index_destination_buf] = c;\r
+               }\r
+       }\r
+       work->index_destination_buf++;\r
+       return;\r
+}\r
+\r
+void CFunction_vsnprintf_End(CFunction_vsnprintf_WorkArea *work)\r
+{\r
+       if(work->destination_buf != 0){\r
+               work->destination_buf[work->index_destination_buf] = 0x00;\r
+       }\r
+       return;\r
+}\r
+\r
+uint CFunction_vsnprintf_Get_NextArgument(CFunction_vsnprintf_WorkArea *work)\r
+{\r
+       work->index_vargs++;\r
+       return work->vargs[work->index_vargs - 1];\r
+}\r
+\r
+void CFunction_vsnprintf_To_String_From_Hex_Upper(CFunction_vsnprintf_WorkArea *work, uint hex)\r
+{\r
+/*\83e\83\93\83|\83\89\83\8a\83f\81[\83^\82É\81A\89E\8bl\82ß\81A8\8c\85\8cÅ\92è\81A\8bó\94\92\8f[\93U\81A\8fI\92[null\81A\91å\95\8e\9a*/\r
+       uint i;\r
+\r
+       for(i = 0; i < 8; i++){ /*\92l\82Ì\95ª\94z*/\r
+               work->temporary_data[7 - i] = (hex >> (i << 2)) & 0x0000000f;\r
+       }\r
+       work->temporary_data[8] = 0x00; /*\8fI\92[null*/\r
+       for(i = 0; i < 8; i++){ /*\8bó\94\92\8f[\93U*/\r
+               if(work->temporary_data[i] != 0x00){\r
+                       break;\r
+               }\r
+               work->temporary_data[i] = ' ';\r
+       }\r
+       for(; i < 8; i++){      /*ASCII\83R\81[\83h\82Ö\95Ï\8a·\81i\91å\95\8e\9a\81j*/\r
+               if(work->temporary_data[i] > 9){        /*\83A\83\8b\83t\83@\83x\83b\83g\91å\95\8e\9a\82Ö\95Ï\8a·*/\r
+                       work->temporary_data[i] += 55;\r
+               } else{ /*\90\94\8e\9a\82Ö\95Ï\8a·*/\r
+                       work->temporary_data[i] += 48;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void CFunction_vsnprintf_To_String_From_Hex_Lower(CFunction_vsnprintf_WorkArea *work, uint hex)\r
+{\r
+/*\83e\83\93\83|\83\89\83\8a\83f\81[\83^\82É\81A\89E\8bl\82ß\81A8\8c\85\8cÅ\92è\81A\8bó\94\92\8f[\93U\81A\8fI\92[null\81A\8f¬\95\8e\9a*/\r
+       uint i;\r
+\r
+       for(i = 0; i < 8; i++){ /*\92l\82Ì\95ª\94z*/\r
+               work->temporary_data[7 - i] = (hex >> (i << 2)) & 0x0000000f;\r
+       }\r
+       work->temporary_data[8] = 0x00; /*\8fI\92[null*/\r
+       for(i = 0; i < 8; i++){ /*\8bó\94\92\8f[\93U*/\r
+               if(work->temporary_data[i] != 0x00){\r
+                       break;\r
+               }\r
+               work->temporary_data[i] = ' ';\r
+       }\r
+       for(; i < 8; i++){      /*ASCII\83R\81[\83h\82Ö\95Ï\8a·\81i\8f¬\95\8e\9a\81j*/\r
+               if(work->temporary_data[i] > 9){        /*\83A\83\8b\83t\83@\83x\83b\83g\8f¬\95\8e\9a\82Ö\95Ï\8a·*/\r
+                       work->temporary_data[i] += 87;\r
+               } else{ /*\90\94\8e\9a\82Ö\95Ï\8a·*/\r
+                       work->temporary_data[i] += 48;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void CFunction_vsnprintf_To_String_From_Decimal_Unsigned(CFunction_vsnprintf_WorkArea *work, uint d)\r
+{\r
+/*\83e\83\93\83|\83\89\83\8a\83f\81[\83^\82É\81A\89E\8bl\82ß\81A10\8c\85\8cÅ\92è\81A\8bó\94\92\8f[\93U\81A\8fI\92[null*/\r
+       uint i;\r
+\r
+       for(i = 0; i < 10; i++){        /*\92l\82Ì\95ª\94z*/\r
+               work->temporary_data[9 - i] = d % 10;\r
+               d = d / 10;\r
+       }\r
+       work->temporary_data[10] = 0x00;        /*\8fI\92[null*/\r
+       for(i = 0; i < 10; i++){        /*\8bó\94\92\8f[\93U*/\r
+               if(work->temporary_data[i] != 0x00){\r
+                       break;\r
+               }\r
+               work->temporary_data[i] = ' ';\r
+       }\r
+       for(; i < 10; i++){     /*ASCII\83R\81[\83h\82Ö\95Ï\8a·*/\r
+               work->temporary_data[i] += 48;\r
+       }\r
+       return;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/chnipl.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/chnipl.nas
new file mode 100644 (file)
index 0000000..3496759
--- /dev/null
@@ -0,0 +1,185 @@
+\r
+[INSTRSET "i486p"]\r
+\r
+; BOOT_INFO_ADDR\r
+CYLS    equ             0x0ff0\r
+\r
+       org             0x7c00                  ; \82±\82Ì\83v\83\8d\83O\83\89\83\80\82ª\82Ç\82±\82É\93Ç\82Ý\8d\9e\82Ü\82ê\82é\82Ì\82©\r
+\r
+; \88È\89º\82Í\95W\8f\80\93I\82Èfat12\83t\83H\81[\83}\83b\83g\83t\83\8d\83b\83s\81[\83f\83B\83X\83N\82Ì\82½\82ß\82Ì\8bL\8fq\r
+\r
+       jmp             entry\r
+       db              0x90\r
+       db              "chnos   "              ; \83u\81[\83g\83Z\83N\83^\82Ì\96¼\91O\82ð\8e©\97R\82É\8f\91\82¢\82Ä\82æ\82¢\81i8\83o\83C\83g\81j\r
+       dw              512                     ; 1\83Z\83N\83^\82Ì\91å\82«\82³\81i512\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       db              1                       ; \83N\83\89\83X\83^\82Ì\91å\82«\82³\81i1\83Z\83N\83^\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dw              1                       ; fat\82ª\82Ç\82±\82©\82ç\8en\82Ü\82é\82©\81i\95\81\92Ê\82Í1\83Z\83N\83^\96Ú\82©\82ç\82É\82·\82é\81j\r
+       db              2                       ; fat\82Ì\8cÂ\90\94\81i2\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dw              224                     ; \83\8b\81[\83g\83f\83B\83\8c\83N\83g\83\8a\97Ì\88æ\82Ì\91å\82«\82³\81i\95\81\92Ê\82Í224\83G\83\93\83g\83\8a\82É\82·\82é\81j\r
+       dw              2880                    ; \82±\82Ì\83h\83\89\83C\83u\82Ì\91å\82«\82³\81i2880\83Z\83N\83^\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       db              0xf0                    ; \83\81\83f\83B\83A\82Ì\83^\83C\83v\81i0xf0\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dw              9                       ; fat\97Ì\88æ\82Ì\92·\82³\81i9\83Z\83N\83^\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dw              18                      ; 1\83g\83\89\83b\83N\82É\82¢\82­\82Â\82Ì\83Z\83N\83^\82ª\82 \82é\82©\81i18\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dw              2                       ; \83w\83b\83h\82Ì\90\94\81i2\82É\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81j\r
+       dd              0                       ; \83p\81[\83e\83B\83V\83\87\83\93\82ð\8eg\82Á\82Ä\82È\82¢\82Ì\82Å\82±\82±\82Í\95K\82¸0\r
+       dd              2880                    ; \82±\82Ì\83h\83\89\83C\83u\91å\82«\82³\82ð\82à\82¤\88ê\93x\8f\91\82­\r
+       db              0, 0, 0x29              ; \82æ\82­\82í\82©\82ç\82È\82¢\82¯\82Ç\82±\82Ì\92l\82É\82µ\82Ä\82¨\82­\82Æ\82¢\82¢\82ç\82µ\82¢\r
+       dd              0xffffffff              ; \82½\82Ô\82ñ\83{\83\8a\83\85\81[\83\80\83V\83\8a\83A\83\8b\94Ô\8d\86\r
+       db              "chnosboot  "           ; \83f\83B\83X\83N\82Ì\96¼\91O\81i11\83o\83C\83g\81j\r
+       db              "fat12   "              ; \83t\83H\81[\83}\83b\83g\82Ì\96¼\91O\81i8\83o\83C\83g\81j\r
+       resb    18                              ; \82Æ\82è\82 \82¦\82¸18\83o\83C\83g\82 \82¯\82Ä\82¨\82­\r
+\r
+; \83v\83\8d\83O\83\89\83\80\96{\91Ì\r
+\r
+entry:\r
+       mov     ax, 0                   ; \83\8c\83W\83X\83^\8f\89\8aú\89»\r
+       mov     ss, ax\r
+       mov     sp, 0x7c00\r
+       mov     ds, ax\r
+\r
+; \83f\83B\83X\83N\82ð\93Ç\82Þ\r
+\r
+        mov     ax, 0x0820\r
+        mov     es, ax\r
+        mov     ch, 0            ; \83V\83\8a\83\93\83_0\r
+        mov     dh, 0            ; \83w\83b\83h0\r
+        mov     cl, 2            ; \83Z\83N\83^2\r
+        mov     bx, 18*2-1       ; \93Ç\82Ý\8d\9e\82Ý\82½\82¢\8d\87\8cv\83Z\83N\83^\90\94 (2006.12.23 \83o\83O\8fC\90³)\r
+        call    readfast        ; \8d\82\91¬\93Ç\82Ý\8d\9e\82Ý\r
+\r
+        mov     bx, 4312+0x8200+2\r
+fatloop:\r
+        add     bx, -2\r
+        cmp     word [bx], 0\r
+        jz      fatloop\r
+        mov     ax, bx\r
+        add     ax, -0x8200-5+54+53\r
+        mov     bl, 54\r
+        div     bl              ; al = ax / bl\r
+\r
+        cmp     al, 0\r
+        jnz     fatskip1\r
+        mov     al, 1\r
+fatskip1:\r
+        cmp     al, 33\r
+        jbe     fatskip2\r
+        mov     al, 33\r
+fatskip2:\r
+        mov     [CYLS], al     ; ipl\82ª\82Ç\82±\82Ü\82Å\93Ç\82ñ\82¾\82Ì\82©\82ð\83\81\83\82\r
+        add     al, -1\r
+        jz      fatskip3\r
+        mov     ah, 0\r
+        imul    bx, ax, 18*2\r
+\r
+        mov     ax, 0x0c80\r
+        mov     es, ax\r
+        mov     ch, 1            ; \83V\83\8a\83\93\83_1\r
+        mov     dh, 0            ; \83w\83b\83h0\r
+        mov     cl, 1            ; \83Z\83N\83^1\r
+        call    readfast        ; \8d\82\91¬\93Ç\82Ý\8d\9e\82Ý\r
+fatskip3:\r
+\r
+; \93Ç\82Ý\8fI\82í\82Á\82½\82Ì\82Åharibote.sys\82ð\8eÀ\8ds\82¾\81I\r
+\r
+        jmp     0xc200\r
+\r
+\r
+error:\r
+       mov             ax, 0\r
+       mov             es, ax\r
+       mov             si, msg\r
+putloop:\r
+       mov             al, [si]\r
+       add             si, 1                   ; si\82É1\82ð\91«\82·\r
+       cmp             al, 0\r
+       je              fin\r
+       mov             ah, 0x0e                        ; \88ê\95\8e\9a\95\\8e¦\83t\83@\83\93\83N\83V\83\87\83\93\r
+       mov             bx, 15                  ; \83J\83\89\81[\83R\81[\83h\r
+       int             0x10                    ; \83r\83f\83Ibios\8cÄ\82Ñ\8fo\82µ\r
+       jmp             putloop\r
+fin:\r
+       hlt                                     ; \89½\82©\82 \82é\82Ü\82Åcpu\82ð\92â\8e~\82³\82¹\82é\r
+       jmp             fin                     ; \96³\8cÀ\83\8b\81[\83v\r
+\r
+msg:   db              0x0a, 0x0a              ; \89ü\8ds\82ð2\82Â\r
+       db              "chnipl load error"\r
+       db              0x0a                    ; \89ü\8ds\r
+       db              0\r
+\r
+readfast:      ; al\82ð\8eg\82Á\82Ä\82Å\82«\82é\82¾\82¯\82Ü\82Æ\82ß\82Ä\93Ç\82Ý\8fo\82·\r
+               ; es:\93Ç\82Ý\8d\9e\82Ý\94Ô\92n, ch:\83V\83\8a\83\93\83_, dh:\83w\83b\83h, cl:\83Z\83N\83^, bx:\93Ç\82Ý\8d\9e\82Ý\83Z\83N\83^\90\94\r
+\r
+       mov             ax, es                  ; < es\82©\82çal\82Ì\8dÅ\91å\92l\82ð\8cv\8eZ >\r
+       shl             ax, 3                   ; ax\82ð32\82Å\8a\84\82Á\82Ä\81A\82»\82Ì\8c\8b\89Ê\82ðah\82É\93ü\82ê\82½\82±\82Æ\82É\82È\82é \81ishl\82Í\8d\83V\83t\83g\96½\97ß\81j\r
+       and             ah, 0x7f                        ; ah\82Íah\82ð128\82Å\8a\84\82Á\82½\97]\82è\81i512*128=64k\81j\r
+       mov             al, 128                 ; al = 128 - ah; \88ê\94Ô\8bß\82¢64kb\8b«\8aE\82Ü\82Å\8dÅ\91å\89½\83Z\83N\83^\93ü\82é\82©\r
+       sub             al, ah\r
+\r
+       mov             ah, bl                  ; < bx\82©\82çal\82Ì\8dÅ\91å\92l\82ðah\82É\8cv\8eZ >\r
+       cmp             bh, 0                   ; if (bh != 0) { ah = 18; }\r
+       je              .skip1\r
+       mov             ah, 18\r
+.skip1:\r
+       cmp             al, ah                  ; if (al > ah) { al = ah; }\r
+       jbe             .skip2\r
+       mov             al, ah\r
+.skip2:\r
+\r
+       mov             ah, 19                  ; < cl\82©\82çal\82Ì\8dÅ\91å\92l\82ðah\82É\8cv\8eZ >\r
+       sub             ah, cl                  ; ah = 19 - cl;\r
+       cmp             al, ah                  ; if (al > ah) { al = ah; }\r
+       jbe             .skip3\r
+       mov             al, ah\r
+.skip3:\r
+\r
+       push    bx\r
+       mov             si, 0                   ; \8e¸\94s\89ñ\90\94\82ð\90\94\82¦\82é\83\8c\83W\83X\83^\r
+retry:\r
+       mov             ah, 0x02                        ; ah=0x02 : \83f\83B\83X\83N\93Ç\82Ý\8d\9e\82Ý\r
+       mov             bx, 0\r
+       mov             dl, 0x00                        ; a\83h\83\89\83C\83u\r
+       push    es\r
+       push    dx\r
+       push    cx\r
+       push    ax\r
+       int             0x13                    ; \83f\83B\83X\83Nbios\8cÄ\82Ñ\8fo\82µ\r
+       jnc             next                    ; \83G\83\89\81[\82ª\82¨\82«\82È\82¯\82ê\82Înext\82Ö\r
+       add             si, 1                   ; si\82É1\82ð\91«\82·\r
+       cmp             si, 5                   ; si\82Æ5\82ð\94ä\8ar\r
+       jae             error                   ; si >= 5 \82¾\82Á\82½\82çerror\82Ö\r
+       mov             ah, 0x00\r
+       mov             dl, 0x00                        ; a\83h\83\89\83C\83u\r
+       int             0x13                    ; \83h\83\89\83C\83u\82Ì\83\8a\83Z\83b\83g\r
+       pop             ax\r
+       pop             cx\r
+       pop             dx\r
+       pop             es\r
+       jmp             retry\r
+next:\r
+       pop             ax\r
+       pop             cx\r
+       pop             dx\r
+       pop             bx                      ; es\82Ì\93à\97e\82ðbx\82Å\8eó\82¯\8eæ\82é\r
+       shr             bx, 5                   ; bx\82ð16\83o\83C\83g\92P\88Ê\82©\82ç512\83o\83C\83g\92P\88Ê\82Ö\r
+       mov             ah, 0\r
+       add             bx, ax                  ; bx += al;\r
+       shl             bx, 5                   ; bx\82ð512\83o\83C\83g\92P\88Ê\82©\82ç16\83o\83C\83g\92P\88Ê\82Ö\r
+       mov             es, bx                  ; \82±\82ê\82Å es += al * 0x20; \82É\82È\82é\r
+       pop             bx\r
+       sub             bx, ax\r
+       jz              .ret\r
+       add             cl, al                  ; cl\82Éal\82ð\91«\82·\r
+       cmp             cl, 18                  ; cl\82Æ18\82ð\94ä\8ar\r
+       jbe             readfast                ; cl <= 18 \82¾\82Á\82½\82çreadfast\82Ö\r
+       mov             cl, 1\r
+       add             dh, 1\r
+       cmp             dh, 2\r
+       jb              readfast                ; dh < 2 \82¾\82Á\82½\82çreadfast\82Ö\r
+       mov             dh, 0\r
+       add             ch, 1\r
+       jmp             readfast\r
+.ret:\r
+       ret\r
+\r
+       resb    0x7dfe-$                ; 0x7dfe\82Ü\82Å\82ð0x00\82Å\96\84\82ß\82é\96½\97ß\r
+       db              0x55, 0xaa\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/chnlogo.bmp b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/chnlogo.bmp
new file mode 100644 (file)
index 0000000..bad60c1
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/chnlogo.bmp differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/color.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/color.c
new file mode 100644 (file)
index 0000000..c8faa44
--- /dev/null
@@ -0,0 +1,159 @@
+\r
+#include "core.h"\r
+\r
+uint RGB_Table_08[16] = {\r
+       0x00000000,     //黒\r
+       0x00ff0000,     //赤\r
+       0x0000ff00,     //緑\r
+       0x00ffff00,     //黄\r
+       0x000000ff,     //青\r
+       0x0000ffff,     //水\r
+       0x00ffffff,     //白\r
+       0x00c6c6c6,     //明るい灰色\r
+       0x00840000,     //暗い赤\r
+       0x00008400,     //暗い緑\r
+       0x00848400,     //暗い黄\r
+       0x00000084,     //暗い青\r
+       0x00840084,     //紫\r
+       0x00008484,     //暗い水\r
+       0x00848484      //暗い灰色\r
+};\r
+\r
+ushort RGB_08_To_16(uchar c8)\r
+{\r
+       RGB32 c32;\r
+\r
+       if(c8 < 16){\r
+               c32.c32 = RGB_Table_08[c8];\r
+               return ((c32.bit.r / 7) << 11) | ((c32.bit.g / 7) << (5 + 1) | (c32.bit.b / 7));\r
+       }\r
+\r
+       if(c8 >= 16 + 216){\r
+               return 0x0000;\r
+       }\r
+\r
+       c8 -= 16;\r
+\r
+       c32.bit.b = c8 / 36;\r
+       c8 -= c32.bit.b * 36;\r
+       c32.bit.g = c8 / 6;\r
+       c8 -= c32.bit.g * 6;\r
+       c32.bit.r = c8;\r
+       c32.bit.a = 0x00;\r
+\r
+       return ((c32.bit.r * 6) << 11) | ((c32.bit.g * 6) << (5 + 1) | (c32.bit.b * 6));\r
+}\r
+\r
+uint RGB_08_To_32(uchar c8)\r
+{\r
+       RGB32 c32;\r
+\r
+       if(c8 < 16){\r
+               return RGB_Table_08[c8];\r
+       }\r
+\r
+       if(c8 >= 16 + 216){\r
+               return 0x00000000;\r
+       }\r
+\r
+       c8 -= 16;\r
+\r
+       c32.bit.b = c8 / 36;\r
+       c8 -= c32.bit.b * 36;\r
+       c32.bit.g = c8 / 6;\r
+       c8 -= c32.bit.g * 6;\r
+       c32.bit.r = c8;\r
+       c32.bit.a = 0x00;\r
+\r
+       c32.bit.r *= 51;\r
+       c32.bit.g *= 51;\r
+       c32.bit.b *= 51;\r
+\r
+       return c32.c32;\r
+}\r
+\r
+uchar RGB_16_To_08(ushort c16)\r
+{\r
+       uchar c[3];\r
+\r
+       c[0] = c16 >> (5 + 6);\r
+       c[1] = (c16 & 0x7e0) >> 5;\r
+       c[2] = c16 & 0x1f;\r
+\r
+       c[0] /= 6;\r
+       c[1] /= 12;\r
+       c[2] /= 6;\r
+\r
+       return 16 + c[0] + c[1] * 6 + c[2] * 36;\r
+}\r
+\r
+uint RGB_16_To_32(ushort c16)\r
+{\r
+       uchar c[3];\r
+\r
+       c[0] = c16 >> (5 + 6);\r
+       c[1] = (c16 & 0x7e0) >> 5;\r
+       c[2] = c16 & 0x1f;\r
+\r
+       return (c[0] << (16 + 3)) | (c[1] << (8 + 2)) | (c[2] << 3);\r
+}\r
+\r
+uchar RGB_32_To_08(uint c32)\r
+{\r
+       uchar c8;\r
+       uchar c[4];\r
+\r
+       c[3] = (c32 << 24) >> 24;\r
+       c[2] = (c32 << 16) >> 24;\r
+       c[1] = (c32 <<  8) >> 24;\r
+\r
+       c[1] = c[1] / 51;\r
+       c[2] = c[2] / 51;\r
+       c[3] = c[3] / 51;\r
+\r
+       c8 = (c[1] + c[2] * 6 + c[3] * 36) + 16;\r
+\r
+       return c8;\r
+}\r
+\r
+uchar RGB_32_To_08_xy(uint c32, int x, int y)\r
+{\r
+       static int table[4] = { 3, 1, 0, 2 };\r
+       uchar c8;\r
+       uchar c[4];\r
+       int i;\r
+\r
+       c[3] = (c32 << 24) >> 24;\r
+       c[2] = (c32 << 16) >> 24;\r
+       c[1] = (c32 <<  8) >> 24;\r
+\r
+       x &= 1; /* 偶数か奇数か */\r
+       y &= 1;\r
+\r
+       i = table[x + y * 2];   /* 中間色を作るための定数 */\r
+       c[1] = (c[1] * 21) / 256;       /* これで 0~20 になる */\r
+       c[2] = (c[2] * 21) / 256;\r
+       c[3] = (c[3] * 21) / 256;\r
+       c[1] = (c[1] + i) / 4;  /* これで 0~5 になる */\r
+       c[2] = (c[2] + i) / 4;\r
+       c[3] = (c[3] + i) / 4;\r
+\r
+       c8 = 16 + c[1] + c[2] * 6 + c[3] * 36;\r
+\r
+       return c8;\r
+}\r
+\r
+ushort RGB_32_To_16(uint c32)\r
+{\r
+       ushort c16;\r
+       uchar c[4];\r
+\r
+       c[3] = (c32 << 24) >> 24;\r
+       c[2] = (c32 << 16) >> 24;\r
+       c[1] = (c32 <<  8) >> 24;\r
+\r
+       c16 = ((c[1] >> 3) << 11 | (c[2] >> 2) << 5 | (c[3] >> 3));\r
+       \r
+       return c16;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/console.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/console.c
new file mode 100644 (file)
index 0000000..ab8488a
--- /dev/null
@@ -0,0 +1,351 @@
+\r
+#include "core.h"\r
+\r
+UI_Console *Console_Initialize(void)\r
+{\r
+       UI_Console *console;\r
+\r
+       console = (UI_Console *)System_CommonStruct_Allocate(SYSTEM_STRUCTID_CONSOLE);\r
+\r
+       console->task = System_MultiTask_Task_Initialize(0);\r
+       console->task->tss->eip = (uint)&Console_MainTask;\r
+       console->task->tss->cs = SYSTEM_CS << 3;\r
+       console->task->tss->ss = SYSTEM_DS << 3;\r
+       console->task->tss->ds = SYSTEM_DS << 3;\r
+       console->task->tss->esp = (uint)System_Memory_Allocate(1024 * 32) + (1024 * 32);\r
+       MultiTask_Push_Arguments(console->task, 1, console);\r
+\r
+       console->textbox = TextBox_Initialize();\r
+\r
+       console->flags.bit.initialized = True;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_CONSOLE\r
+               debug("Console_Initialize:initialized[0x%X]\n", console);\r
+       #endif\r
+\r
+       return console;\r
+}\r
+\r
+uint Console_SetSize(UI_Console *console, uint xchars, uint ychars)\r
+{\r
+       if(console == Null){\r
+               return 1;\r
+       }\r
+\r
+       if(!console->flags.bit.initialized){\r
+               return 2;\r
+       }\r
+\r
+       if(console->flags.bit.configured_size){\r
+               return 3;\r
+       }\r
+\r
+       TextBox_SetBuffer(console->textbox, xchars, ychars, 8, Null);\r
+       System_Sheet_SetParentToVRAM(console->textbox->sheet);\r
+       Sheet_SetMovable(console->textbox->sheet, True);\r
+       Sheet_SetInputFIFO(console->textbox->sheet, console->task->fifo);\r
+\r
+       console->flags.bit.configured_size = True;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_CONSOLE\r
+               debug("Console_SetSize:configured[0x%X]\n", console);\r
+       #endif\r
+\r
+       return 0;\r
+}\r
+\r
+uint Console_Run(UI_Console *console)\r
+{\r
+       if(console == Null){\r
+               return 1;\r
+       }\r
+\r
+       if(!console->flags.bit.initialized){\r
+               return 2;\r
+       }\r
+\r
+       if(!console->flags.bit.configured_size){\r
+               return 3;\r
+       }\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_CONSOLE\r
+               debug("Console_Run:start running[0x%X]\n", console);\r
+       #endif\r
+\r
+       System_MultiTask_Task_Run(console->task);\r
+       return 0;\r
+}\r
+\r
+void Console_MainTask(UI_Console *console)\r
+{\r
+       UI_Task *mytask;\r
+       uint data;\r
+       UI_Timer *ctimer;\r
+       bool key_ignore;\r
+\r
+       data = 0;\r
+\r
+       mytask = System_MultiTask_GetNowTask();\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG\r
+               debug("CMT:ConsoleMainTask[UI_Task=0x%X] Start Running.\n", mytask);\r
+       #endif\r
+\r
+       console->printf_buffer = (uchar *)System_Memory_Allocate(CONSOLE_PRINTF_BUFFER_SIZE);\r
+\r
+       TextBox_Show(console->textbox, SHEET_MAX_CHILDREN, (int)(console->textbox->sheet->parent->size.x >> 1) - (int)(console->textbox->sheet->size.x >> 1), (int)(console->textbox->sheet->parent->size.y >> 1) - (int)(console->textbox->sheet->size.y >> 1));\r
+       if(console->textbox->sheet->location.x < 0){\r
+               Sheet_Slide_Absolute(console->textbox->sheet, 0, SHEET_LOCATION_NOCHANGE);\r
+       }\r
+       if(console->textbox->sheet->location.y < 0){\r
+               Sheet_Slide_Absolute(console->textbox->sheet, SHEET_LOCATION_NOCHANGE, 0);\r
+       }\r
+       TextBox_Put_Character(console->textbox, '>');\r
+       TextBox_SetEnable_RecordInputText(console->textbox, True);\r
+       console->flags.bit.isprompt = True;\r
+\r
+       ctimer = Timer_Initialize();\r
+       Timer_Config(ctimer, 500, mytask->fifo, 1, True);\r
+       Timer_Run(ctimer);\r
+\r
+       console->boot_fd = FloppyDisk_Initialize(ADR_DISKIMG);\r
+\r
+       for(;;){\r
+               if(FIFO32_MyTaskFIFO_Status() == 0){\r
+                       System_MultiTask_Task_Sleep(mytask);\r
+               } else{\r
+                       data = FIFO32_MyTaskFIFO_Get();\r
+                       #ifdef CHNOSPROJECT_DEBUG_CMT\r
+                               debug("CMT:Receive data from FIFO(data:0x%X).\n", data);\r
+                       #endif\r
+                       if(data < INPUTSIGNAL_OFFSET){\r
+                               //\94Ä\97p\97\98\97p\89Â\94\\97Ì\88æ0\r
+                               if(data == 1){\r
+                                       TextBox_Cursor_Blink(console->textbox);\r
+                               }\r
+                       } else if(data < SIGNAL_KEY_OFFSET){\r
+                               data -= INPUTSIGNAL_OFFSET;\r
+                               if(data == INPUTSIGNAL_FOCUS_GOT){\r
+                                       TextBox_SetEnable_CursorBlink(console->textbox, True);\r
+                               } else if(data == INPUTSIGNAL_FOCUS_LOST){\r
+                                       TextBox_SetEnable_CursorBlink(console->textbox, False);\r
+                               }\r
+                               //\93ü\97Í\92Ê\92m\97Ì\88æ\r
+                       } else if(data < SIGNAL_KEY_OFFSET + 0xffff){\r
+                               key_ignore = False;\r
+                               //keyid\92Ê\92m\r
+                               data -= SIGNAL_KEY_OFFSET;\r
+                               if(!(data & KEYID_MASK_BREAK) && (data & KEYID_MASK_EXTENDED)){\r
+                                       if((data & KEYID_MASK_ID) == KEYID_ENTER){\r
+                                               key_ignore = True;\r
+                                               TextBox_SetEnable_RecordInputText(console->textbox, False);\r
+                                               TextBox_Put_Character(console->textbox, '\n');\r
+                                               if(Console_CompareCommandline_n(console, "test", 4)){\r
+                                                       TextBox_Put_String(console->textbox, "Hello, World.\n");\r
+                                                       if(console->textbox->text_buf[4] == ' '){\r
+                                                               Console_printf(console, "value16:0x%X\n", strtol(&console->textbox->text_buf[5], Null, 0));\r
+                                                               Console_printf(console, "value10:%u\n", strtol(&console->textbox->text_buf[5], Null, 0));\r
+                                                       }\r
+                                               } else if(Console_CompareCommandline_s(console, "mem")){\r
+                                                       Console_printf(console, "Total:%10uBytes %5uKB\n", System_Get_PhisycalMemorySize(), System_Get_PhisycalMemorySize() >> 10);\r
+                                                       Console_printf(console, "Free :%10uBytes %5uKB\n", System_Memory_Get_FreeSize(), System_Memory_Get_FreeSize() >> 10);\r
+                                               } else if(Console_CompareCommandline_s(console, "dir")){\r
+                                                       Console_Command_dir(console);\r
+                                               } else if(Console_CompareCommandline_n(console, "pci", 3)){\r
+                                                       Console_Command_pci(console);\r
+                                               } else if(Console_CompareCommandline_n(console, "type", 4)){\r
+                                                       Console_Command_type(console);\r
+                                               } else if(Console_CompareCommandline_n(console, "task", 4)){\r
+                                                       Console_Command_task(console);\r
+                                               } else{\r
+                                                       TextBox_Put_String(console->textbox, "Console:There is no such file or command:");\r
+                                                       TextBox_Put_String(console->textbox, console->textbox->text_buf);\r
+                                               }\r
+                                               TextBox_Put_Character(console->textbox, '\n');\r
+                                               TextBox_Put_Character(console->textbox, '>');\r
+                                               TextBox_SetEnable_RecordInputText(console->textbox, True);\r
+                                       }\r
+                               }\r
+                               if(!key_ignore){\r
+                                       TextBox_Put_Key(console->textbox, data);\r
+                               }\r
+                       } else if(data < TCM_OFFSET){\r
+                               //\94Ä\97p\97\98\97p\89Â\94\\97Ì\88æ1\r
+                       } else{\r
+                               //TCM\97Ì\88æ\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+bool Console_CompareCommandline_s(UI_Console *console, const uchar s[])\r
+{\r
+       return CFunction_CompareStrings(console->textbox->text_buf, s);\r
+}\r
+\r
+bool Console_CompareCommandline_n(UI_Console *console, const uchar s[], unsigned int n)\r
+{\r
+       return CFunction_CompareStrings_n(console->textbox->text_buf, s, n);\r
+}\r
+\r
+uint Console_printf(UI_Console *console, const uchar format[], ...)\r
+{\r
+       CFunction_vsnprintf(console->printf_buffer, CONSOLE_PRINTF_BUFFER_SIZE, format, (uint *)(&format + 1));\r
+       TextBox_Put_String(console->textbox, console->printf_buffer);\r
+       return 0;\r
+}\r
+\r
+uint Console_Command_dir(UI_Console *console)\r
+{\r
+       uint i, j;\r
+       IO_FloppyDisk_DirectoryEntry_UpdateTime rdetime;\r
+       IO_FloppyDisk_DirectoryEntry_UpdateDate rdedate;\r
+       IO_FloppyDisk_DirectoryEntry_Attribute rdeattr;\r
+\r
+       for(i = 0; i < FLOPPYDISK_RDE_ENTRIES; i++){\r
+               if(console->boot_fd->files[i].name[0] == 0x00){\r
+                       break;\r
+               }\r
+               rdeattr.attribute = console->boot_fd->files[i].attribute;\r
+               if(console->boot_fd->files[i].name[0] != 0xe5 && console->boot_fd->files[i].name[0] != 0x05 && !rdeattr.bit.volumelabel && !rdeattr.bit.directory){\r
+                       for(j = 0; j < 8; j++){\r
+                               TextBox_Put_Character(console->textbox, console->boot_fd->files[i].name[j]);\r
+                       }\r
+                       TextBox_Put_Character(console->textbox, '.');\r
+                       for(j = 0; j < 3; j++){\r
+                               TextBox_Put_Character(console->textbox, console->boot_fd->files[i].ext[j]);\r
+                       }\r
+                       Console_printf(console, " %6d", console->boot_fd->files[i].size);\r
+                       rdedate.updatedate = console->boot_fd->files[i].updatedate;\r
+                       Console_printf(console, " %04d/%02d/%02d", rdedate.bit.year + 1980, rdedate.bit.month, rdedate.bit.day);\r
+                       rdetime.updatetime = console->boot_fd->files[i].updatetime;\r
+                       Console_printf(console, " %02d:%02d:%02d\n", rdetime.bit.hour, rdetime.bit.minute, rdetime.bit.second << 1);\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint Console_Command_pci(UI_Console *console)\r
+{\r
+       uchar *p;\r
+       uint bus, device, function;\r
+       uint data;\r
+\r
+       TextBox_Put_String(console->textbox, "-<pci information>-\n");\r
+       if(CFunction_String_GetWord(console->textbox->text_buf, &p, 1)){\r
+               if(CFunction_String_GetWord(console->textbox->text_buf, &p, 3)){\r
+                       function = strtol(p, Null, 0);\r
+                       CFunction_String_GetWord(console->textbox->text_buf, &p, 2);\r
+                       device = strtol(p, Null, 0);\r
+                       CFunction_String_GetWord(console->textbox->text_buf, &p, 1);\r
+                       bus = strtol(p, Null, 0);\r
+                       Console_printf(console, "Bus%3d.Device%2d.Function%2d:\n", bus, device, function);\r
+                       if(bus < 256 && device < 32 && function < 8){\r
+                               PCI_ConfigurationRegister_SelectDevice(bus, device, function);\r
+                               data = PCI_ConfigurationRegister_Read32(0x00);\r
+                               if(data == 0xffffffff){\r
+                                       TextBox_Put_String(console->textbox, "Device not exist.\n");\r
+                               } else{\r
+                                       Console_printf(console, "DeviceVendor:%s(0x%04X)\n", PCI_GetDeviceVendor(data & 0xffff), data & 0xffff);\r
+                                       Console_printf(console, "DeviceID    :0x%04X\n", data >> 16);\r
+\r
+                                       data = PCI_ConfigurationRegister_Read32(0x08);\r
+                                       data = CFunction_ExtractBits(data, 8, 31);\r
+                                       Console_printf(console, "ClassCode   :%s(0x%06X)\n", PCI_GetDeviceClass(data), data);\r
+\r
+                                       data = PCI_ConfigurationRegister_Read32(0x0c);\r
+                                       data = CFunction_ExtractBits(data, 16, 22);\r
+                                       Console_printf(console, "DeviceType  :%s(%d)\n", PCI_GetDeviceType(data), data);\r
+                               }\r
+                       } else{\r
+                               TextBox_Put_String(console->textbox, "Invalid Device.\n");\r
+                       }\r
+               }\r
+       } else{\r
+               TextBox_Put_String(console->textbox, "Usage:");\r
+               TextBox_Put_String(console->textbox, "pci <bus> <device> <function>\n\nDevices which exist:\n");\r
+               for(bus = 0; bus < 256; bus++){\r
+                       for(device = 0; device < 32; device++){\r
+                               for(function = 0; function < 8; function++){\r
+                                       PCI_ConfigurationRegister_SelectDevice(bus, device, function);\r
+                                       data = PCI_ConfigurationRegister_Read32(0x00);\r
+                                       if(data != 0xffffffff){\r
+                                               Console_printf(console, "%3d.%2d.%2d, ", bus, device, function);\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+       return 0;\r
+}\r
+\r
+uint Console_Command_type(UI_Console *console)\r
+{\r
+       uchar *p;\r
+       IO_File *file;\r
+       uint i;\r
+\r
+       TextBox_Put_String(console->textbox, "-<type>-");\r
+       if(CFunction_String_GetWord(console->textbox->text_buf, &p, 1)){\r
+                       if(FloppyDisk_IsPathExist(console->boot_fd, p)){\r
+                               TextBox_Put_String(console->textbox, ":");\r
+                               TextBox_Put_String(console->textbox, p);\r
+                               TextBox_Put_String(console->textbox, "\n");\r
+                               file = File_Initilaize();\r
+                               if(FloppyDisk_LoadFile(console->boot_fd, file, p) == 0){\r
+                                       for(i = 0; i < file->size; i++){\r
+                                               TextBox_Put_Character(console->textbox, ((uchar *)file->img)[i]);\r
+                                       }\r
+                               } else{\r
+                                       TextBox_Put_String(console->textbox, "type:File load Error.\n");\r
+                               }\r
+                               File_Free(file);\r
+                       } else{\r
+                               TextBox_Put_String(console->textbox, "\ntype:The path is not exist.\n");\r
+                       }\r
+       } else{\r
+               TextBox_Put_String(console->textbox, "\nUsage:");\r
+               TextBox_Put_String(console->textbox, "type filepath\n");\r
+       }\r
+       return 0;\r
+}\r
+\r
+uint Console_Command_task(UI_Console *console)\r
+{\r
+       uint i;\r
+       uchar *p;\r
+       UI_TaskControl *taskctrl;\r
+       UI_Task *search;\r
+\r
+       taskctrl = System_MultiTask_GetController();\r
+\r
+       TextBox_Put_String(console->textbox, "-<task>-\n");\r
+       if(CFunction_String_GetWord(console->textbox->text_buf, &p, 1)){\r
+/*\r
+                       if(FloppyDisk_IsPathExist(console->boot_fd, p)){\r
+                               TextBox_Put_String(console->textbox, ":");\r
+                               TextBox_Put_String(console->textbox, p);\r
+                               TextBox_Put_String(console->textbox, "\n");\r
+                               file = File_Initilaize();\r
+                               if(FloppyDisk_LoadFile(console->boot_fd, file, p) == 0){\r
+                                       for(i = 0; i < file->size; i++){\r
+                                               TextBox_Put_Character(console->textbox, ((uchar *)file->img)[i]);\r
+                                       }\r
+                               } else{\r
+                                       TextBox_Put_String(console->textbox, "type:File load Error.\n");\r
+                               }\r
+                               File_Free(file);\r
+                       } else{\r
+                               TextBox_Put_String(console->textbox, "\ntype:The path is not exist.\n");\r
+                       }\r
+*/\r
+       } else{\r
+               TextBox_Put_String(console->textbox, "Task list:\n");\r
+               for(search = taskctrl->start; search != Null; search = search->next){\r
+                       Console_printf(console, "sel:%02X count:%d\n", search->selector, search->count);\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/core.h b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/core.h
new file mode 100644 (file)
index 0000000..9acef5b
--- /dev/null
@@ -0,0 +1,571 @@
+\r
+/*includes*/\r
+#include "coredef0.h"  /*\83V\83X\83e\83\80\92è\90\94\90é\8c¾*/\r
+#include "coredef1.h"  /*\83V\83X\83e\83\80\83f\81[\83^\8c^\90é\8c¾*/\r
+#include "coredef2.h"  /*\83V\83X\83e\83\80\8aO\95\94\83\8a\83\\81[\83X\90é\8c¾*/\r
+#include "coredef3.h"  /*TaskControlMessage\90é\8c¾*/\r
+#include "keyid.h"             /*KeyIdentifier \83L\81[ID\90é\8c¾*/\r
+#include "structid.h"  /*SystemCommonStructID\90é\8c¾*/\r
+\r
+/*functions*/\r
+/*bootpack.c \8aî\8a²\95\94\95ª*/\r
+void KeyboardControlTask(DATA_FIFO32 **InputFocus);\r
+void MouseControlTask(DATA_FIFO32 **InputFocus, UI_MouseCursor *mcursor);\r
+\r
+/*callbios.c 32bit\82©\82çBIOS\82ð\83R\81[\83\8b\82·\82é\82½\82ß\82Ì\8aÖ\90\94\8cQ*/\r
+\r
+IO_CallBIOSControl *Initialize_CallBIOS(void);\r
+void CallBIOS_Execute(IO_CallBIOSControl *ctrl, uchar intn, DATA_FIFO32 *fifo, uint endsignal);\r
+void CallBIOS_Send_End_Of_Operation(IO_CallBIOSControl *ctrl, uint abort);\r
+void CallBIOS_Check_Privileged_Operation(uint *esp);\r
+uint CallBIOS_Push_Data_To_Stack(uint *esp, ushort data);\r
+uint CallBIOS_Pop_Data_From_Stack(uint *esp);\r
+\r
+/*cfunc.c vsnprintf\82Ì\93Æ\8e©\8eÀ\91\95\93\99*/\r
+void srand(uint seed);\r
+uint rand(void);\r
+uint isqrt(uint n);\r
+uint strtol(const uchar s[], uchar *endptr[], uint base);\r
+bool CFunction_CompareStrings(const uchar s1[], const uchar s2[]);\r
+bool CFunction_CompareStrings_n(const uchar s1[], const uchar s2[], unsigned int n);\r
+uint CFunction_ExtractBits(uint source, uint start, uint end);\r
+bool CFunction_String_GetWord(const uchar s[], uchar *wordptr[], uint n);\r
+uint CFunction_MemoryMove(void *destination, uint destination_size, const void *source, uint source_size);\r
+int snprintf(uchar s[], uint n, const uchar format[], ...);\r
+int vsnprintf(uchar s[], uint n, const uchar format[], uint vargs[]);\r
+//\r
+int CFunction_vsnprintf(uchar s[], uint n, const uchar format[], uint vargs[]);\r
+void CFunction_vsnprintf_Initialize_WorkArea(CFunction_vsnprintf_WorkArea *work, uchar s[], const uchar format[], uint n, uint vargs[]);\r
+int CFunction_vsnprintf_Check_FormatBuffer(CFunction_vsnprintf_WorkArea *work);\r
+int CFunction_vsnprintf_Check_DestinationBuffer(CFunction_vsnprintf_WorkArea *work);\r
+uchar CFunction_vsnprintf_Read_FormatBuffer(CFunction_vsnprintf_WorkArea *work);\r
+void CFunction_vsnprintf_Write_DestinationBuffer(CFunction_vsnprintf_WorkArea *work, uchar c);\r
+void CFunction_vsnprintf_End(CFunction_vsnprintf_WorkArea *work);\r
+uint CFunction_vsnprintf_Get_NextArgument(CFunction_vsnprintf_WorkArea *work);\r
+void CFunction_vsnprintf_To_String_From_Hex_Upper(CFunction_vsnprintf_WorkArea *work, uint hex);\r
+void CFunction_vsnprintf_To_String_From_Hex_Lower(CFunction_vsnprintf_WorkArea *work, uint hex);\r
+void CFunction_vsnprintf_To_String_From_Decimal_Unsigned(CFunction_vsnprintf_WorkArea *work, uint d);\r
+\r
+/*color.c \90F\8aÖ\98A*/\r
+extern uint RGB_Table_08[16];\r
+ushort RGB_08_To_16(uchar c8);\r
+uint RGB_08_To_32(uchar c8);\r
+uchar RGB_16_To_08(ushort c16);\r
+uint RGB_16_To_32(ushort c16);\r
+uchar RGB_32_To_08(uint c32);\r
+uchar RGB_32_To_08_xy(uint c32, int x, int y);\r
+ushort RGB_32_To_16(uint c32);\r
+\r
+/*console.c \83R\83\93\83\\81[\83\8b\8aÖ\98A*/\r
+UI_Console *Console_Initialize(void);\r
+uint Console_SetSize(UI_Console *console, uint xchars, uint ychars);\r
+uint Console_Run(UI_Console *console);\r
+void Console_MainTask(UI_Console *console);\r
+bool Console_CompareCommandline_s(UI_Console *console, const uchar s[]);\r
+bool Console_CompareCommandline_n(UI_Console *console, const uchar s[], unsigned int n);\r
+uint Console_printf(UI_Console *console, const uchar format[], ...);\r
+uint Console_Command_dir(UI_Console *console);\r
+uint Console_Command_pci(UI_Console *console);\r
+uint Console_Command_type(UI_Console *console);\r
+uint Console_Command_task(UI_Console *console);\r
+\r
+/*debug.c \83f\83o\83b\83O\8ex\89\87*/\r
+#ifdef CHNOSPROJECT_DEBUG\r
+void debug(const uchar format[], ...);\r
+void Debug_PhysicalMemoryDump(void *addr, uint bytes);\r
+void Debug_Set_Breakpoint(uint reg, void *addr, uint rw, uint len);\r
+void Debug_ExceptionHandler(uint *esp);\r
+#endif\r
+\r
+/*display.c \83f\83B\83X\83v\83\8c\83C\90§\8cä\8aÖ\98A*/\r
+IO_DisplayControl *Initialize_Display(void);\r
+uint Display_VESA_Set_VideoMode(IO_DisplayControl *ctrl, uint index);\r
+\r
+/*draw08.c 8bit\95`\89æ\8aÖ\98A*/\r
+void Drawing08_Initialize_Palette(void);\r
+void Drawing08_Set_Palette(uint start, uint end, uchar *rgb);\r
+void Drawing08_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void Drawing08_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);\r
+void Drawing08_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);\r
+void Drawing08_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);\r
+\r
+/*draw16.c 16bit\95`\89æ\8aÖ\98A*/\r
+void Drawing16_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void Drawing16_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);\r
+void Drawing16_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);\r
+void Drawing16_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);\r
+\r
+/*draw32.c 32bit\95`\89æ\8aÖ\98A*/\r
+void Drawing32_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void Drawing32_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font);\r
+void Drawing32_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[]);\r
+void Drawing32_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);\r
+\r
+/*drawing.c \95`\89æ\8aÖ\98A*/\r
+extern void (*Drawing_Fill_Rectangle)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+extern void (*Drawing_Put_String)(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);\r
+extern void (*Drawing_Draw_Point)(void *vram, uint xsize, uint x, uint y, uint c);\r
+void Drawing_Invalid_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);\r
+void Drawing_Invalid_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void Drawing_Invalid_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c);\r
+void Drawing_Invalid_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void Initialize_Drawing(void);\r
+void Drawing_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void Drawing_Draw_Circle(void *vram, uint xsize, uint x, uint y, uint c, uint r);\r
+void Drawing_Fill_Circle(void *vram, uint xsize, uint x, uint y, uint c, uint r);\r
+\r
+/*dsctbl.c \83Z\83O\83\81\83\93\83g\81E\83Q\81[\83g\83f\83B\83X\83N\83\8a\83v\83^\8aÖ\98A*/\r
+void Initialize_GlobalDescriptorTable(void);\r
+void Initialize_InterruptDescriptorTable(void);\r
+void SegmentDescriptor_Set(IO_SegmentDescriptor *seg_desc, uint limit, uint base, uint ar);\r
+uint SegmentDescriptor_Get_Base(IO_SegmentDescriptor *seg_desc);\r
+uint SegmentDescriptor_Get_Limit(IO_SegmentDescriptor *seg_desc);\r
+uint SegmentDescriptor_Get_AccessRight(IO_SegmentDescriptor *seg_desc);\r
+void GateDescriptor_Set(IO_GateDescriptor *gate_desc, uint offset, uint selector, uint ar);\r
+\r
+/*emu86.c x86\83G\83~\83\85\83\8c\81[\83^\81[\8aÖ\98A*/\r
+void Emulator_x86_Initialize(Emulator_x86_Environment *env);\r
+uint Emulator_x86_Execute(Emulator_x86_Environment *env);\r
+uint Emulator_x86_Execute_Auto(Emulator_x86_Environment *env);\r
+int Emulator_x86_Put_EmulationInformation(Emulator_x86_Environment *env, const uchar format[], ...);\r
+uint Emulator_x86_FetchCode(Emulator_x86_Environment *env, uint bytes);\r
+void Emulator_x86_InstructionPointer_Increment(Emulator_x86_Environment *env);\r
+uint Emulator_x86_Get_EffectivePhysicalAddress(Emulator_x86_Environment *env, uint sreg, uint offset);\r
+uint Emulator_x86_Get_EffectivePhysicalAddress_FromModRM(Emulator_x86_Environment *env, uint modrm);\r
+void Emulator_x86_MoveToGReg(Emulator_x86_Environment *env, uint reg, uint data, uint fullsize);\r
+uint Emulator_x86_MoveFromGReg(Emulator_x86_Environment *env, uint reg, uint fullsize);\r
+void Emulator_x86_MoveToSReg(Emulator_x86_Environment *env, uint sreg, ushort selector);\r
+void Emulator_x86_Push_Data_To_Stack(Emulator_x86_Environment *env, uint data, uint size_dword);\r
+uint Emulator_x86_Pop_Data_From_Stack(Emulator_x86_Environment *env, uint size_dword);\r
+void Emulator_x86_Push_eIP_To_Stack(Emulator_x86_Environment *env);\r
+void Emulator_x86_Pop_eIP_From_Stack(Emulator_x86_Environment *env);\r
+void Emulator_x86_Push_eFLAGS_To_Stack(Emulator_x86_Environment *env);\r
+void Emulator_x86_Pop_eFLAGS_From_Stack(Emulator_x86_Environment *env);\r
+void Emulator_x86_Push_SReg_To_Stack(Emulator_x86_Environment *env, uint sreg);\r
+void Emulator_x86_Pop_SReg_From_Stack(Emulator_x86_Environment *env, uint sreg);\r
+//\r
+void Emulator_x86_Operation_MOV_To_Reg_FullSize(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_MOV_To_SegReg(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_MOV_To_ByteReg(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_INTn(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_LEA(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_CALL_Near_Relative(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_PUSHA(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_POPA(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_MOV_To_ByteReg_Gb_Eb(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_CMP_AL(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_Jcc_JE_rel8(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_INC_RegOnly(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_JMP_rel8(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_RET_Near(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_PUSH_RegOnly(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_XOR_Eb_Gb(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_DEC_RegOnly(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_MOV_eAX_Ov(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_MOV_Ov_eAX(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_OUT_AL(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_CMP_Gv_Ev(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_LOOP_Jv(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_POP_Ev(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_POP_RegOnly(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_Jcc_JNE_rel8(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_STI(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_SBB_Gv_Ev(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_MOV_Ev_Gv(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_PUSH_Ib(Emulator_x86_Environment *env);\r
+void Emulator_x86_Operation_CLD(Emulator_x86_Environment *env);\r
+\r
+/*emu86asm.nas x86\83G\83~\83\85\83\8c\81[\83^\81[\8aÖ\98A\83A\83Z\83\93\83u\83\89\8aÖ\90\94*/\r
+uint asm_Emulator_x86_Get_EFlags_Compare(uint first_op, uint second_op);       //eflags\82ð\95Ô\82·\r
+uint asm_Emulator_x86_Get_EFlags_Increment(uint first_op);\r
+uint asm_Emulator_x86_Get_EFlags_XOR(uint first_op, uint second_op);\r
+uint asm_Emulator_x86_Get_EFlags_Decrement(uint first_op);\r
+uint asm_Emulator_x86_Get_EFlags_Subtract_with_Borrow(uint *first_op, uint second_op, uint borrow);\r
+\r
+/*error.c \83G\83\89\81[\8aÖ\98A*/\r
+uint Error_Report(uint error_no, ...);\r
+void Error_Abort(void);\r
+void Error_Set_Enable_SerialPort(bool serial);\r
+void Error_Set_Enable_Display_TextMode(bool tdisp);\r
+void Error_Set_Enable_Display_GraphicMode(bool gdisp, void *vram, uint xsize, uint lines);\r
+int Error_Put_String(const uchar format[], ...);\r
+void Error_CPU_Exception_Put_Registers_With_ErrorCode(uint *esp);\r
+void Error_CPU_Exception_Put_Registers_Without_ErrorCode(uint *esp);\r
+\r
+/*fifo.c FIFO\83o\83b\83t\83@\8aÖ\98A*/\r
+DATA_FIFO32 *FIFO32_Initialize(IO_MemoryControl memctrl, uint size);\r
+int FIFO32_Put(DATA_FIFO32 *fifo, uint data);\r
+int FIFO32_Put_Arguments(DATA_FIFO32 *fifo, uint args, ...);\r
+void FIFO32_Set_Task(DATA_FIFO32 *fifo, UI_Task *task);\r
+uint FIFO32_Get(DATA_FIFO32 *fifo);\r
+uint FIFO32_Status(DATA_FIFO32 *fifo);\r
+void FIFO32_Free(DATA_FIFO32 *fifo);\r
+uint FIFO32_MyTaskFIFO_Status(void);\r
+uint FIFO32_MyTaskFIFO_Get(void);\r
+\r
+/*file.c \83t\83@\83C\83\8b\8aÖ\98A*/\r
+IO_File *File_Initilaize(void);\r
+uint File_Free(IO_File *file);\r
+\r
+/*floppy.c \83t\83\8d\83b\83s\81[\83f\83B\83X\83N\8aÖ\98A*/\r
+IO_FloppyDisk *FloppyDisk_Initialize(void *img);\r
+uint FloppyDisk_Decode_FAT16(IO_FloppyDisk *fd, bool backup);\r
+bool FloppyDisk_IsPathExist(IO_FloppyDisk *fd, const uchar path[]);\r
+uint FloppyDisk_LoadFile(IO_FloppyDisk *fd, IO_File *file, const uchar path[]);\r
+IO_FloppyDisk_DirectoryEntry *FloppyDisk_Internal_GetDirectoryEntryFromPath(IO_FloppyDisk *fd, const uchar path[]);\r
+\r
+/*fmt_bmp.c \83r\83b\83g\83}\83b\83v\95`\89æ\8aÖ\98A*/\r
+uint Format_BMP_DrawPicture(void *vram, uint xsize, uint x, uint y, uint pxsize, uint pysize, void *bmp);\r
+\r
+/*intrpt.c \8a\84\82è\8d\9e\82Ý\8aÖ\98A*/\r
+void Initialize_ProgrammableInterruptController(void);\r
+void ProgrammableInterruptController_InterruptMask_Clear(uint irq);\r
+void ProgrammableInterruptController_InterruptRequest_Complete(uint irq);\r
+void InterruptHandler27(uint *esp);\r
+\r
+/*keyboard.c \83L\81[\83{\81[\83h\8aÖ\98A*/\r
+void Initialize_Keyboard(void);\r
+void InterruptHandler21(uint *esp);\r
+void Keyboard_Set_ReceiveFIFO(DATA_FIFO32 *fifo, uint data0);\r
+ushort Keyboard_Decode_KeyCode(uchar keycode);\r
+void KeyboardController_SetLED(uchar leds);\r
+void KeyboardController_Wait_SendReady(void);\r
+void KeyboardController_SendData(uchar data);\r
+void KeyboardController_SendCommand(uchar cmd);\r
+\r
+/*memory.c \83\81\83\82\83\8a\8aÖ\98A*/\r
+uint Memory_Test(uint start, uint end);\r
+IO_MemoryControl Memory_Initialize_Control(void *start, uint size, uint tags);\r
+void Memory_Free(IO_MemoryControl ctrl, void *addr, uint size);\r
+void Memory_Free_Sub(IO_MemoryControl ctrl, uint tagno);\r
+void *Memory_Allocate(IO_MemoryControl ctrl, uint size);\r
+void *Memory_Allocate_Aligned(IO_MemoryControl ctrl, uint size, uint align);\r
+uint Memory_Get_FreeSize(IO_MemoryControl ctrl);\r
+\r
+/*mouse.c \83}\83E\83X\8aÖ\98A*/\r
+IO_MouseControl *Initialize_Mouse(void);\r
+void InterruptHandler2c(uint *esp);\r
+void Mouse_Set_ReceiveFIFO(DATA_FIFO32 *fifo, uint data0);\r
+void Mouse_SendCommand(uint cmd);\r
+UI_MouseCursor *MouseCursor_Initialize(UI_Sheet *parent);\r
+uint MouseCursor_Show(UI_MouseCursor *mcursor);\r
+uint MouseCursor_Move_Relative(UI_MouseCursor *mcursor, int rpx, int rpy);\r
+uint MouseCursor_Move_Absolute(UI_MouseCursor *mcursor, int apx, int apy);\r
+bool Mouse_Decode(IO_MouseControl *mctrl, uint data);\r
+\r
+/*mtask.c \83}\83\8b\83`\83^\83X\83N\8aÖ\98A*/\r
+UI_TaskControl *Initialize_MultiTask_Control(IO_MemoryControl sysmemctrl);\r
+UI_Task *MultiTask_Task_Initialize(UI_TaskControl *ctrl, uint tss_additional_size);\r
+uint MultiTask_Internal_Task_SetLink(UI_TaskControl *ctrl, UI_Task *task);\r
+uint MultiTask_Internal_Task_CleartLink(UI_TaskControl *ctrl, UI_Task *task);\r
+void MultiTask_Task_Run(UI_TaskControl *ctrl, UI_Task *task);\r
+void MultiTask_TaskSwitch(UI_TaskControl *ctrl);\r
+void MultiTask_Task_Sleep(UI_TaskControl *ctrl, UI_Task *task);\r
+void MultiTask_Task_Kill(UI_TaskControl *ctrl, UI_Task *task);\r
+UI_Task *MultiTask_GetNowTask(UI_TaskControl *ctrl);\r
+uint MultiTask_Push_Arguments(UI_Task *task, uint args, ...);\r
+\r
+/*pci.c PCI\8aÖ\98A*/\r
+void Initialize_PCI(void);\r
+void PCI_ConfigurationRegister_SelectDevice(uint bus, uint device, uint function);\r
+uint PCI_ConfigurationRegister_Read32(uint addr);\r
+uchar *PCI_GetDeviceVendor(uint id);\r
+uchar *PCI_GetDeviceClass(uint id);\r
+uchar *PCI_GetDeviceType(uint id);\r
+\r
+/*serial.c \83V\83\8a\83A\83\8b\92Ê\90M\8aÖ\98A*/\r
+void Initialize_SerialPort(void);\r
+void SerialPort_Send(const uchar s[]);\r
+\r
+/*sheet.c \83V\81[\83g\8aÖ\98A*/\r
+UI_Sheet *Sheet_Initialize(void);\r
+uint Sheet_Free(UI_Sheet *sheet);\r
+uint Sheet_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp);\r
+uint Sheet_SetParent(UI_Sheet *sheet, UI_Sheet *parent);\r
+uint Sheet_Show(UI_Sheet *sheet, uint height, int px, int py);\r
+uint Sheet_ChangeHeight(UI_Sheet *sheet, uint height);\r
+uint Sheet_RefreshSheet_All(UI_Sheet *sheet);\r
+uint Sheet_Slide_Absolute(UI_Sheet *sheet, int apx, int apy);\r
+uint Sheet_Slide_Relative(UI_Sheet *sheet, int rpx, int rpy);\r
+uint Sheet_RefreshAllInRange(UI_Sheet *parent, int px0, int py0, int px1, int py1);\r
+uint Sheet_RefreshSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+uint Sheet_RefreshMap(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+uint Sheet_RefreshMap_All(UI_Sheet *sheet);\r
+uint Sheet_Enable_InvisibleColor(UI_Sheet *sheet, uint invcol);\r
+uint Sheet_Disable_InvisibleColor(UI_Sheet *sheet);\r
+uint Sheet_SetTopmost(UI_Sheet *sheet, bool topmost);\r
+UI_Sheet *Sheet_GetSheetFromLocation(UI_Sheet *parent, int px, int py);\r
+uint Sheet_SetMovable(UI_Sheet *sheet, bool movable);\r
+uint Sheet_SetInputFIFO(UI_Sheet *sheet, DATA_FIFO32 *fifo);\r
+\r
+/*sht08.c 8bit\83J\83\89\81\83V\81[\83g\8aÖ\98A*/\r
+uint Sheet08_Internal_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp);\r
+uint Sheet08_Config_Functions(UI_Sheet *sheet);\r
+uint Sheet08_Internal_RefreshSheet_To_08(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+uint Sheet08_Internal_RefreshSheet_To_16(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+uint Sheet08_Internal_RefreshSheet_To_32(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+bool Sheet08_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py);\r
+\r
+/*sht16.c 16bit\83J\83\89\81\83V\81[\83g\8aÖ\98A*/\r
+uint Sheet16_Internal_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp);\r
+uint Sheet16_Config_Functions(UI_Sheet *sheet);\r
+uint Sheet16_Internal_RefreshSheet_To_16(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+uint Sheet16_Internal_RefreshSheet_To_08(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+uint Sheet16_Internal_RefreshSheet_To_32(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+bool Sheet16_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py);\r
+\r
+/*sht32.c 32bit\83J\83\89\81\83V\81[\83g\8aÖ\98A*/\r
+uint Sheet32_Internal_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp);\r
+uint Sheet32_Config_Functions(UI_Sheet *sheet);\r
+uint Sheet32_Internal_RefreshSheet_To_32(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+uint Sheet32_Internal_RefreshSheet_To_16(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+uint Sheet32_Internal_RefreshSheet_To_08_xy(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+bool Sheet32_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py);\r
+\r
+/*shtdraw \83V\81[\83g\95`\89æ\8aÖ\90\94*/\r
+uint Sheet_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1);\r
+uint Sheet_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]);\r
+uint Sheet_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c);\r
+uint Sheet_Drawing_Scroll_Vertical(UI_Sheet *sheet, int vpx);\r
+//\r
+uint Sheet_Drawing_Fill_Rectangle_Invalid(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1);\r
+uint Sheet_Drawing_Put_String_Invalid(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]);\r
+uint Sheet_Drawing_Draw_Point_Invalid(UI_Sheet *sheet, int x, int y, uint c);\r
+//\r
+uint Sheet08_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1);\r
+uint Sheet08_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]);\r
+uint Sheet08_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c);\r
+//\r
+uint Sheet16_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1);\r
+uint Sheet16_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]);\r
+uint Sheet16_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c);\r
+//\r
+uint Sheet32_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1);\r
+uint Sheet32_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[]);\r
+uint Sheet32_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c);\r
+\r
+/*shtfunc.c \83V\81[\83g\93à\95\94\8aÖ\90\94*/\r
+uint Sheet_Internal_GetLocationP(UI_Sheet *sheet, DATA_Location2D *dest);\r
+uint Sheet_Internal_GetLocationQ(UI_Sheet *sheet, DATA_Location2D *dest);\r
+uint Sheet_Internal_GetLocationR(UI_Sheet *sheet, DATA_Location2D *dest);\r
+uint Sheet_Internal_GetLocationS(UI_Sheet *sheet, DATA_Location2D *dest);\r
+uint Sheet_Internal_MapInitialize(UI_Sheet *parent);\r
+uint Sheet_Internal_MapWriteFromSheet(UI_Sheet *sheet, bool force, int px0, int py0, int px1, int py1);\r
+bool Sheet_Internal_IsLocationInRangeOfSheet(UI_Sheet *sheet, int px, int py);\r
+bool Sheet_Internal_IsRangeOverlappedWithSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+UI_Sheet *Sheet_Internal_GetSheetFromLocation(UI_Sheet *parent, int px, int py);\r
+uint Sheet_Internal_MapRebuild(UI_Sheet *parent, int px0, int py0, int px1, int py1);\r
+uint Sheet_Internal_MapRefresh(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+uint Sheet_Internal_RefreshSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+uint Sheet_Internal_SlideSub(UI_Sheet *sheet, int rpx, int rpy);\r
+uint Sheet_Internal_ChangeHeight(UI_Sheet *sheet, uint height);\r
+bool Sheet_Internal_IsVisiblePixel_Invalid(UI_Sheet *sheet, int px, int py);\r
+uint Sheet_Internal_RefreshSheet_Invalid(struct UI_SHEET *sheet, int px0, int py0, int px1, int py1);\r
+\r
+/*struct.c \83V\83X\83e\83\80\8d\\91¢\91Ì\8b¤\92Ê\8aÇ\97\9d\83\8b\81[\83`\83\93*/\r
+System_CommonStruct *System_CommonStruct_Allocate(uint structid);\r
+uint System_CommonStruct_Free(System_CommonStruct *str);\r
+\r
+\r
+/*system.c \83V\83X\83e\83\80\83f\81[\83^\81E\8f\89\8aú\89»\8aÖ\98A*/\r
+void Initialize_System(void);\r
+void System_Set_RunningPhase(uint phase);\r
+uint System_Get_RunningPhase(void);\r
+uint System_Get_PhisycalMemorySize(void);\r
+void System_SegmentDescriptor_Set_Absolute(uint selector, uint limit, uint base, uint ar);\r
+uint System_SegmentDescriptor_Get_Base(uint selector);\r
+uint System_SegmentDescriptor_Get_Limit(uint selector);\r
+uint System_SegmentDescriptor_Get_AccessRight(uint selector);\r
+uint System_SegmentDescriptor_Set(uint limit, uint base, uint ar);\r
+void System_GateDescriptor_Set(uint irq, uint offset, uint selector, uint ar);\r
+void System_TaskSwitch(void);\r
+UI_Task *System_MultiTask_Task_Initialize(uint tss_additional_size);\r
+void System_MultiTask_Task_Run(UI_Task *task);\r
+void *System_Memory_Allocate(uint size);\r
+UI_Task *System_MultiTask_GetNowTask(void);\r
+IO_CallBIOSControl *System_CallBIOS_Get_Controller(void);\r
+void System_CallBIOS_Execute(uchar intn, DATA_FIFO32 *fifo, uint endsignal);\r
+void System_Memory_Free(void *addr, uint size);\r
+void System_CallBIOS_Send_End_Of_Operation(uint abort);\r
+void System_MultiTask_Task_Sleep(UI_Task *task);\r
+void System_MultiTask_Task_Kill(UI_Task *task);\r
+DATA_FIFO32 *System_FIFO32_Initialize(uint size);\r
+uint System_Display_VESA_Set_VideoMode(uint index);\r
+IO_DisplayControl *System_Display_Get_Controller(void);\r
+uint System_Memory_Get_FreeSize(void);\r
+uint System_TaskControlMessage_Send_AllTask(uint message);\r
+uint System_Sheet_SetParentToVRAM(UI_Sheet *sheet);\r
+uint System_InputFocus_Change(DATA_FIFO32 *fifo);\r
+UI_TaskControl *System_MultiTask_GetController(void);\r
+\r
+/*textbox.c \83e\83L\83X\83g\93ü\97ÍUI\8aÖ\98A*/\r
+UI_TextBox *TextBox_Initialize(void);\r
+uint TextBox_SetBuffer(UI_TextBox *textbox, uint xchars, uint ychars, uint bpp, UI_Sheet *parent);\r
+uint TextBox_Show(UI_TextBox *textbox, uint height, int px, int py);\r
+uint TextBox_Put_Key(UI_TextBox *textbox, ushort keyid);\r
+uint TextBox_Put_String(UI_TextBox *textbox, const uchar s[]);\r
+uint TextBox_Put_Character(UI_TextBox *textbox, uchar c);\r
+bool TextBox_SetEnable_RecordInputText(UI_TextBox *textbox, bool enable);\r
+uint TextBox_SetEnable_CursorBlink(UI_TextBox *textbox, bool enable);\r
+uint TextBox_Cursor_Blink(UI_TextBox *textbox);\r
+uint TextBox_Internal_Put_Character(UI_TextBox *textbox, uchar c);\r
+bool TextBox_Internal_Put_Character_TextBuffer(UI_TextBox *textbox, uchar c);\r
+uint TextBox_Internal_DrawCursor(UI_TextBox *textbox, bool cursor);\r
+\r
+/*timer.c \83^\83C\83}\81[\8aÖ\98A*/\r
+UI_TimerControl *Initialize_ProgrammableIntervalTimer(void);\r
+void InterruptHandler20(uint *esp);\r
+void Timer_Set_TaskSwitch(void (*TaskSwitchFunction)(void));\r
+void Timer_TaskSwitch_Invalid(void);\r
+UI_Timer *Timer_Initialize(void);\r
+uint Timer_Config(UI_Timer *timer, uint tick_ms, DATA_FIFO32 *fifo, uint fifo_putdata, bool interval);\r
+uint Timer_Run(UI_Timer *timer);\r
+uint Timer_TimeOut(void);\r
+uint Timer_GetTick(void);\r
+\r
+/*vgatmode.c VGA\83e\83L\83X\83g\83\82\81[\83h\8aÖ\98A*/\r
+uchar VGA_CRTController_ReadRegister(uchar regno);\r
+void VGA_CRTController_WriteRegister(uchar regno, uchar data);\r
+void TextMode_Write_TextRAM(ushort index, uchar data);\r
+void TextMode_Put_Character_Absolute(uchar c, col_text col, ushort location);\r
+void TextMode_Put_String_Absolute(const uchar s[], col_text col, uint x, uint y);\r
+void TextMode_Clear_Screen(void);\r
+ushort TextMode_Get_CursorLocation(void);\r
+void TextMode_Set_CursorLocation(ushort location);\r
+void TextMode_Put_Character(uchar c, col_text col);\r
+void TextMode_Newline(void);\r
+void TextMode_Put_String(const uchar s[], col_text col);\r
+\r
+/*xception.c \97á\8aO\8aÖ\98A*/\r
+void CPU_ExceptionHandler00(uint *esp);\r
+void CPU_ExceptionHandler01(uint *esp);\r
+void CPU_ExceptionHandler02(uint *esp);\r
+void CPU_ExceptionHandler03(uint *esp);\r
+void CPU_ExceptionHandler04(uint *esp);\r
+void CPU_ExceptionHandler05(uint *esp);\r
+void CPU_ExceptionHandler06(uint *esp);\r
+void CPU_ExceptionHandler07(uint *esp);\r
+void CPU_ExceptionHandler08(uint *esp);\r
+void CPU_ExceptionHandler09(uint *esp);\r
+void CPU_ExceptionHandler0a(uint *esp);\r
+void CPU_ExceptionHandler0b(uint *esp);\r
+void CPU_ExceptionHandler0c(uint *esp);\r
+void CPU_ExceptionHandler0d(uint *esp);\r
+void CPU_ExceptionHandler0e(uint *esp);\r
+void CPU_ExceptionHandler0f(uint *esp);\r
+void CPU_ExceptionHandler10(uint *esp);\r
+void CPU_ExceptionHandler11(uint *esp);\r
+void CPU_ExceptionHandler12(uint *esp);\r
+void CPU_ExceptionHandler13(uint *esp);\r
+void CPU_ExceptionHandler14(uint *esp);\r
+void CPU_ExceptionHandler15(uint *esp);\r
+void CPU_ExceptionHandler16(uint *esp);\r
+void CPU_ExceptionHandler17(uint *esp);\r
+void CPU_ExceptionHandler18(uint *esp);\r
+void CPU_ExceptionHandler19(uint *esp);\r
+void CPU_ExceptionHandler1a(uint *esp);\r
+void CPU_ExceptionHandler1b(uint *esp);\r
+void CPU_ExceptionHandler1c(uint *esp);\r
+void CPU_ExceptionHandler1d(uint *esp);\r
+void CPU_ExceptionHandler1e(uint *esp);\r
+void CPU_ExceptionHandler1f(uint *esp);\r
+\r
+/*nasfunc0.nas \91¼\82Ì\8aÖ\90\94\82É\91S\82­\88Ë\91\82µ\82È\82¢\83A\83Z\83\93\83u\83\89\8aÖ\90\94\8cQ*/\r
+void IO_HLT(void);                     //CPU\82ð\92â\8e~\82³\82¹\82é\81B\8a\84\82è\8d\9e\82Ý\82ª\82 \82é\82Æ\8dÄ\8aJ\82·\82é\81B\93Á\8c \96½\97ß\81B\r
+void IO_CLI(void);                     //CPU\82Ö\82Ì\8aO\95\94\8a\84\82è\8d\9e\82Ý\82ð\92â\8e~\82³\82¹\82é\81B\93Á\8c \96½\97ß\81BNMI\82Æ\97á\8aO\82É\82Í\8cø\82©\82È\82¢\81B\r
+void IO_STI(void);                     //CPU\82Ö\82Ì\8aO\95\94\8a\84\82è\8d\9e\82Ý\82ð\8dÄ\8aJ\82³\82¹\82é\81B\93Á\8c \96½\97ß\81B\r
+void IO_STIHLT(void);                  //CPU\82Ö\82Ì\8aO\95\94\8a\84\82è\8d\9e\82Ý\82ð\8dÄ\8aJ\82³\82¹\82½\8cã\81ACPU\82ð\92â\8e~\82³\82¹\82é\81Bsti\82Æhlt\82Ì\8aÔ\82É\94­\90\82·\82é\8a\84\82è\8d\9e\82Ý\82Ö\82Ì\91Î\8dô\81B\81B\r
+uint IO_In8(uint port);                        //port\94Ô\82ÌI/O\83|\81[\83g\82©\82ç\83f\81[\83^\82ð\83o\83C\83g\92P\88Ê\82Å\8eó\82¯\8eæ\82é\81B\96ß\82è\92l\82Í\8eó\82¯\8eæ\82Á\82½\83f\81[\83^\81BI/O\93Á\8c \96½\97ß\81B\r
+void IO_Out8(uint port, uint data);    //port\94Ô\82ÌI/O\83|\81[\83g\82Édata\82ð\83o\83C\83g\92P\88Ê\82Å\8fo\97Í\82·\82é\81BI/O\93Á\8c \96½\97ß\81B\r
+uint IO_In16(uint port);               //port\94Ô\82ÌI/O\83|\81[\83g\82©\82ç\83f\81[\83^\82ð\83\8f\81[\83h\92P\88Ê\82Å\8eó\82¯\8eæ\82é\81B\96ß\82è\92l\82Í\8eó\82¯\8eæ\82Á\82½\83f\81[\83^\81BI/O\93Á\8c \96½\97ß\81B\r
+void IO_Out16(uint port, uint data);   //port\94Ô\82ÌI/O\83|\81[\83g\82Édata\82ð\83\8f\81[\83h\92P\88Ê\82Å\8fo\97Í\82·\82é\81BI/O\93Á\8c \96½\97ß\81B\r
+uint IO_In32(uint port);               //port\94Ô\82ÌI/O\83|\81[\83g\82©\82ç\83f\81[\83^\82ð\83_\83u\83\8b\83\8f\81[\83h\92P\88Ê\82Å\8eó\82¯\8eæ\82é\81B\96ß\82è\92l\82Í\8eó\82¯\8eæ\82Á\82½\83f\81[\83^\81BI/O\93Á\8c \96½\97ß\81B\r
+void IO_Out32(uint port, uint data);   //port\94Ô\82ÌI/O\83|\81[\83g\82Édata\82ð\83_\83u\83\8b\83\8f\81[\83h\92P\88Ê\82Å\8fo\97Í\82·\82é\81BI/O\93Á\8c \96½\97ß\81B\r
+uint IO_Load_EFlags(void);             //EFLAGS\83\8c\83W\83X\83^\82ð\93Ç\82Ý\8d\9e\82Þ\81B\r
+void IO_Store_EFlags(uint eflags);     //EFLAGS\83\8c\83W\83X\83^\82ðeflags\82É\95Ï\8dX\82·\82é\81B\r
+uint Load_CR0(void);                   //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^0\82ð\93Ç\82Ý\8d\9e\82Þ\81B\93Á\8c \96½\97ß\81B\r
+void Store_CR0(uint cr0);              //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^0\82ðcr0\82É\95Ï\8dX\82·\82é\81B\93Á\8c \96½\97ß\81B\r
+uint Load_CR2(void);                   //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^2\82ð\93Ç\82Ý\8d\9e\82Þ\81B\93Á\8c \96½\97ß\81B\r
+void Store_CR2(uint cr2);              //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^2\82ðcr2\82É\95Ï\8dX\82·\82é\81B\93Á\8c \96½\97ß\81B\r
+uint Load_CR3(void);                   //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^3\82ð\93Ç\82Ý\8d\9e\82Þ\81B\93Á\8c \96½\97ß\81B\r
+void Store_CR3(uint cr3);              //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^3\82ðcr3\82É\95Ï\8dX\82·\82é\81B\93Á\8c \96½\97ß\81B\r
+uint Load_CR4(void);                   //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^4\82ð\93Ç\82Ý\8d\9e\82Þ\81B\93Á\8c \96½\97ß\81B\r
+void Store_CR4(uint cr4);              //\83R\83\93\83g\83\8d\81[\83\8b\83\8c\83W\83X\83^4\82ðcr4\82É\95Ï\8dX\82·\82é\81B\93Á\8c \96½\97ß\81B\r
+uint Load_DR0(void);\r
+void Store_DR0(uint dr0);\r
+uint Load_DR1(void);\r
+void Store_DR1(uint dr1);\r
+uint Load_DR2(void);\r
+void Store_DR2(uint dr2);\r
+uint Load_DR3(void);\r
+void Store_DR3(uint dr3);\r
+uint Load_DR6(void);\r
+void Store_DR6(uint dr6);\r
+uint Load_DR7(void);\r
+void Store_DR7(uint dr7);\r
+void Load_GDTR(uint limit, uint addr); //\83O\83\8d\81[\83o\83\8b\81E\83f\83B\83X\83N\83\8a\83v\83^\81E\83e\81[\83u\83\8b\81E\83\8c\83W\83X\83^(GDTR)\82É\81Aaddr\82©\82çlimit\82Ì\94Í\88Í\82ðGDT\82Æ\82µ\82Ä\83\8d\81[\83h\82³\82¹\82é\81B\93Á\8c \96½\97ß\81B\r
+void Load_IDTR(uint limit, uint addr); //\83C\83\93\83^\83\89\83v\83g\81E\83f\83B\83X\83N\83\8a\83v\83^\81E\83e\81[\83u\83\8b\81E\83\8c\83W\83X\83^(IDTR)\82É\81Aaddr\82©\82çlimit\82Ì\94Í\88Í\82ðIDT\82Æ\82µ\82Ä\83\8d\81[\83h\82³\82¹\82é\81B\93Á\8c \96½\97ß\81B\r
+void Load_TR(uint tr);                 //\83Z\83O\83\81\83\93\83g\81E\83Z\83\8c\83N\83^tr\82ð\81A\83^\83X\83N\83\8c\83W\83X\83^\82É\8c»\8dÝ\82Ì\83^\83X\83N\82Æ\82µ\82Ä\83\8d\81[\83h\82³\82¹\82é\81B\93Á\8c \96½\97ß\81B\r
+void FarJMP(uint eip, uint cs);                //\8c»\8dÝ\82Ì\83Z\83O\83\81\83\93\83g\82Æ\82Í\88Ù\82È\82é\83Z\83O\83\81\83\93\83gcs\82Ì\83I\83t\83Z\83b\83geip\82É\83v\83\8d\83O\83\89\83\80\82Ì\90§\8cä\82ð\88Ú\82·\81B\r
+void FarCall(uint eip, uint cs);       //\8c»\8dÝ\82Ì\83Z\83O\83\81\83\93\83g\82Æ\82Í\88Ù\82È\82é\83Z\83O\83\81\83\93\83gcs\82Ì\83I\83t\83Z\83b\83geip\82É\83v\83\8d\83O\83\89\83\80\82Ì\90§\8cä\82ð\95ª\8aò\82³\82¹\82é\81B\r
+void CLTS(void);                       //\83R\83\93\83g\83\8d\81[\83\8b\81E\83\8c\83W\83X\83^0\93à\82É\82 \82é\81ATask-Switched\83t\83\89\83O\82ð\83N\83\8a\83A\82·\82é\81BFPU\82Ì\90§\8cä\82É\97\98\97p\81B\93Á\8c \96½\97ß\81B\r
+void FNSave(uint *addr);               //FPU\93®\8dì\8aÂ\8b«\82ðaddr\82©\82ç\8en\82Ü\82é108\83o\83C\83g\82É\8ai\94[\82µ\81AFPU\82ð\8f\89\8aú\89»\82·\82é\81B\8fÚ\8d×\82È\83`\83F\83b\83N\82Í\8ds\82í\82È\82¢\81B\r
+void FRStore(uint *addr);              //FPU\93®\8dì\8aÂ\8b«\82ðaddr\82©\82ç\8en\82Ü\82é108\83o\83C\83g\82©\82ç\95\9c\8c³\82·\82é\81B\r
+void PIT_Beep_On(void);                        //\83r\81[\83v\89¹\82ð\8aJ\8en\82·\82é\81B\r
+void PIT_Beep_Off(void);               //\83r\81[\83v\89¹\82ð\92â\8e~\82·\82é\81B\r
+void PIT_Beep_Set(uint fq);            //\83r\81[\83v\89¹\82Ì\8eü\94g\90\94\82ð\81AfqHz\82É\95Ï\8dX\82·\82é\81B\r
+                                       //fq\82Ì\92l\r
+                                       //C:262 C#:277 D:294 D#:311 E:330 F:349 F#:370 G:392 G#:415 A:440 A#:466 B:494 C:523\r
+void CPUID(void *addr, uint id);       //addr\94Ô\92n\82Ìuint[4]\82É\81ACPU\82Ì\8e¯\95Ê\8fî\95ñid\94Ô\82ðEAX\81EEBX\81EEDX\81EECX\82Ì\8f\87\94Ô\82Å\8ai\94[\82·\82é\81B\r
+void CPUID2(void *addr, uint id);      //addr\94Ô\92n\82Ìuint[4]\82É\81ACPU\82Ì\8e¯\95Ê\8fî\95ñid\94Ô\82ðEAX\81EEBX\81EECX\81EEDX\82Ì\8f\87\94Ô\82Å\8ai\94[\82·\82é\81B\r
+                                       //\8fã\8bL\93ñ\82Â\82Ì\8aÖ\90\94\82Í\81AEFLAGS\93à\82ÌID\83t\83\89\83O(\83r\83b\83g21)\82ª\95Ï\8dX\89Â\94\\82È\8fê\8d\87\82Ì\82Ý\8eÀ\8ds\82Å\82«\82é\81B\r
+void TSC_Read(uint *addr);             //addr\94Ô\92n\82Ìuint[2]\82É\81A\83}\83V\83\93\8cÅ\97L\83\8c\83W\83X\83^(MSR)\93à\82É\82 \82é\81A\83^\83C\83\80\81E\83X\83^\83\93\83v\81E\83J\83E\83\93\83^\82Ì\8fã\88Ê\81E\89º\88Ê\82»\82ê\82¼\82ê32\83r\83b\83g\82ð\93Ç\82Ý\8d\9e\82Þ\81B\r
+                                       //\82±\82Ì\8aÖ\90\94\82Í\81Acpuid\82ÌTSC\83r\83b\83g\82ª\97L\8cø\82Å\82È\82¯\82ê\82Î\8eg\97p\82Å\82«\82È\82¢\81B\r
+uint Memory_Test_Sub(uint start, uint end);\r
+void INT_3(void);                      //\83u\83\8c\81[\83N\83|\83C\83\93\83g\97á\8aO\82ð\94­\90\82³\82¹\82é\81B\r
+uint DIV_64_32(uint dividend_low, uint dividend_high, uint divisor);\r
+                                       //=((dividend_high << 32) | dividend_low) / divisor\r
+uint MOD_64_32(uint dividend_low, uint dividend_high, uint divisor);\r
+                                       //=((dividend_high << 32) | dividend_low) % divisor\r
+void MOVSD_ZeroFill(void *addr, uint bytes);   //4Byte\92P\88Ê\82Å\83[\83\8d\83t\83B\83\8b\82·\82é\81B\r
+/*nasfunc1.nas \91¼\82Ì\8aÖ\90\94\82É\88Ë\91\82·\82é\83A\83Z\83\93\83u\83\89\8aÖ\90\94\8cQ*/\r
+void asm_CPU_ExceptionHandler00(void);\r
+void asm_CPU_ExceptionHandler01(void);\r
+void asm_CPU_ExceptionHandler02(void);\r
+void asm_CPU_ExceptionHandler03(void);\r
+void asm_CPU_ExceptionHandler04(void);\r
+void asm_CPU_ExceptionHandler05(void);\r
+void asm_CPU_ExceptionHandler06(void);\r
+void asm_CPU_ExceptionHandler07(void);\r
+void asm_CPU_ExceptionHandler08(void);\r
+void asm_CPU_ExceptionHandler09(void);\r
+void asm_CPU_ExceptionHandler0a(void);\r
+void asm_CPU_ExceptionHandler0b(void);\r
+void asm_CPU_ExceptionHandler0c(void);\r
+void asm_CPU_ExceptionHandler0d(void);\r
+void asm_CPU_ExceptionHandler0e(void);\r
+void asm_CPU_ExceptionHandler0f(void);\r
+void asm_CPU_ExceptionHandler10(void);\r
+void asm_CPU_ExceptionHandler11(void);\r
+void asm_CPU_ExceptionHandler12(void);\r
+void asm_CPU_ExceptionHandler13(void);\r
+void asm_CPU_ExceptionHandler14(void);\r
+void asm_CPU_ExceptionHandler15(void);\r
+void asm_CPU_ExceptionHandler16(void);\r
+void asm_CPU_ExceptionHandler17(void);\r
+void asm_CPU_ExceptionHandler18(void);\r
+void asm_CPU_ExceptionHandler19(void);\r
+void asm_CPU_ExceptionHandler1a(void);\r
+void asm_CPU_ExceptionHandler1b(void);\r
+void asm_CPU_ExceptionHandler1c(void);\r
+void asm_CPU_ExceptionHandler1d(void);\r
+void asm_CPU_ExceptionHandler1e(void);\r
+void asm_CPU_ExceptionHandler1f(void);\r
+//\r
+void asm_InterruptHandler20(void);\r
+void asm_InterruptHandler21(void);\r
+void asm_InterruptHandler27(void);\r
+void asm_InterruptHandler2c(void);\r
+\r
+/*nasfunc2.nas 16bit\83R\81[\83h*/\r
+void asm_16bit_CallBIOSTask(void);\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef0.h b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef0.h
new file mode 100644 (file)
index 0000000..124ee46
--- /dev/null
@@ -0,0 +1,373 @@
+\r
+/*\83V\83X\83e\83\80\92è\90\94\90é\8c¾*/\r
+\r
+/*debug option*/\r
+#define CHNOSPROJECT_DEBUG             /*\92è\8b`\82·\82é\82Æ\83f\83o\83b\83O\83\82\81[\83h\82Å\8eÀ\8ds\81B\82»\82ê\82¼\82ê\82Ì\83f\83o\83b\83O\83I\83v\83V\83\87\83\93\82à\97L\8cø\82É\82·\82é\95K\97v\82ª\82 \82é*/\r
+\r
+#ifdef CHNOSPROJECT_DEBUG\r
+       //#define CHNOSPROJECT_DEBUG_CALLLINK\r
+       //#define CHNOSPROJECT_DEBUG_MEMORY\r
+       //#define CHNOSPROJECT_DEBUG_MEMORY_ALLOCATE_AND_FREE\r
+       //#define CHNOSPROJECT_DEBUG_EMULATOR_X86\r
+       //#define CHNOSPROJECT_DEBUG_CALLBIOS\r
+       //#define CHNOSPROJECT_DEBUG_FIFO\r
+       //#define CHNOSPROJECT_DEBUG_KBCT\r
+       //#define CHNOSPROJECT_DEBUG_MCT\r
+       //#define CHNOSPROJECT_DEBUG_MOUSE\r
+       //#define CHNOSPROJECT_DEBUG_DISPLAY\r
+       //#define CHNOSPROJECT_DEBUG_DRAWING\r
+       //#define CHNOSPROJECT_DEBUG_SHEET\r
+       //#define CHNOSPROJECT_DEBUG_TIMER\r
+       //#define CHNOSPROJECT_DEBUG_MULTITASK\r
+       //#define CHNOSPROJECT_DEBUG_PCI\r
+       //#define CHNOSPROJECT_DEBUG_COMMON_STRUCT\r
+       //#define CHNOSPROJECT_DEBUG_TEXTBOX\r
+       #define CHNOSPROJECT_DEBUG_CONSOLE\r
+#endif\r
+\r
+/*defines*/\r
+/*boolean*/\r
+#define True   1\r
+#define False  0\r
+\r
+/*null*/\r
+#define Null   0\r
+\r
+/*descriptors*/\r
+#define AR_DATA32_RW   0x4092  //AR_32+AR_PRESENT+AR_CODE_OR_DATA+AR_TYPE_DATA_RW\r
+#define AR_CODE32_ER   0x409a  //AR_32+AR_PRESENT+AR_CODE_OR_DATA+AR_TYPE_CODE_ER\r
+#define AR_LDT         0x0082  //AR_PRESENT+AR_SYSTEM_DESCRIPTOR+AR_TYPE_LDT\r
+#define AR_TSS32       0x0089  //AR_PRESENT+AR_SYSTEM_DESCRIPTOR+AR_TYPE_TSS32_READY\r
+#define AR_INTGATE32   0x008e  //AR_PRESENT+AR_SYSTEM_DESCRIPTOR+AR_TYPE_INTGATE32\r
+\r
+#define AR_GRANULARITY_BYTE    0x0000  //G=0   \8aÖ\90\94\82Å\8e©\93®\90Ý\92è\82·\82é\82Ì\82Å\82±\82Ì\83r\83b\83g\82Í\8fí\82É0\r
+#define AR_GRANULARITY_4KB     0x8000  //G=1\r
+#define AR_16                  0x0000  //D/B=0\r
+#define AR_32                  0x4000  //D/B=1\r
+#define AR_NOTPRESENT          0x0000  //P=0\r
+#define AR_PRESENT             0x0080  //P=1\r
+#define AR_SYSTEM              0x0000  //DPL=0\r
+#define AR_USER                        0x0060  //DPL=3\r
+#define        AR_SYSTEM_DESCRIPTOR    0x0000  //S=0\r
+#define AR_CODE_OR_DATA                0x0010  //S=1\r
+\r
+#define AR_TYPE_TSS16_READY    0x0001\r
+#define AR_TYPE_LDT            0x0002\r
+#define AR_TYPE_TSS16_BUSY     0x0003\r
+#define AR_TYPE_CALLGATE16     0x0004\r
+#define AR_TYPE_TASKGATE       0x0005\r
+#define AR_TYPE_INTGATE16      0x0006\r
+#define AR_TYPE_TRAPGATE16     0x0007\r
+#define AR_TYPE_TSS32_READY    0x0009\r
+#define AR_TYPE_TSS32_BUSY     0x000b\r
+#define AR_TYPE_CALLGATE32     0x000c\r
+#define AR_TYPE_INTGATE32      0x000e\r
+#define AR_TYPE_TRAPGATE32     0x000f\r
+\r
+#define AR_TYPE_ACCESSED       0x0001  //\8aÖ\90\94\90Ý\92è\8e\9e\82É\82Í\83N\83\8a\83A\81A\93Ç\82Ý\8fo\82µ\8e\9e\82Í\83A\83N\83Z\83X\8dÏ\82Ý\82È\82ç\83Z\83b\83g\r
+\r
+#define AR_TYPE_DATA_R                 0x0000\r
+#define AR_TYPE_DATA_RW                        0x0002\r
+#define AR_TYPE_DATA_R_EXPAND_DOWN     0x0004\r
+#define AR_TYPE_DATA_RW_EXPAND_DOWN    0x0006\r
+\r
+#define AR_TYPE_CODE_E                 0x0008\r
+#define AR_TYPE_CODE_ER                        0x000a\r
+#define AR_TYPE_CODE_E_CONFORMING      0x000c\r
+#define AR_TYPE_CODE_ER_CONFORMING     0x000e\r
+\r
+/*DebugRegister Settings*/\r
+#define DR7_RW_EXECUTE_INSTRUCTION     0\r
+#define DR7_RW_WRITE_DATA                      1\r
+#define DR7_RW_IO_RW                           2\r
+#define DR7_RW_DATA_RW                         3\r
+\r
+#define DR7_LEN_BYTE   0\r
+#define DR7_LEN_WORD   1\r
+#define DR7_LEN_DWORD  3\r
+\r
+/*CPU Opcodes*/\r
+#define OPCODE_REG_EAX                 0\r
+#define OPCODE_REG_ECX                 1\r
+#define OPCODE_REG_EDX                 2\r
+#define OPCODE_REG_EBX                 3\r
+#define OPCODE_REG_ESP                 4\r
+#define OPCODE_REG_EBP                 5\r
+#define OPCODE_REG_ESI                 6\r
+#define OPCODE_REG_EDI                 7\r
+\r
+#define OPCODE_W_BYTE                  0\r
+#define OPCODE_W_16BIT_OR_32BIT                1\r
+\r
+#define OPCODE_REG_BYTE_AL             0\r
+#define OPCODE_REG_BYTE_CL             1\r
+#define OPCODE_REG_BYTE_DL             2\r
+#define OPCODE_REG_BYTE_BL             3\r
+#define OPCODE_REG_BYTE_AH             4\r
+#define OPCODE_REG_BYTE_CH             5\r
+#define OPCODE_REG_BYTE_DH             6\r
+#define OPCODE_REG_BYTE_BH             7\r
+\r
+#define OPCODE_SREG2_ES                        0\r
+#define OPCODE_SREG2_CS                        1\r
+#define OPCODE_SREG2_SS                        2\r
+#define OPCODE_SREG2_DS                        3\r
+\r
+#define OPCODE_SREG3_ES                        0\r
+#define OPCODE_SREG3_CS                        1\r
+#define OPCODE_SREG3_SS                        2\r
+#define OPCODE_SREG3_DS                        3\r
+#define OPCODE_SREG3_FS                        4\r
+#define OPCODE_SREG3_GS                        5\r
+\r
+#define OPCODE_EEE_CR0                 0\r
+#define OPCODE_EEE_CR2                 2\r
+#define OPCODE_EEE_CR3                 3\r
+#define OPCODE_EEE_CR4                 4\r
+\r
+#define OPCODE_EEE_DR0                 0\r
+#define OPCODE_EEE_DR1                 1\r
+#define OPCODE_EEE_DR2                 2\r
+#define OPCODE_EEE_DR3                 3\r
+#define OPCODE_EEE_DR6                 6\r
+#define OPCODE_EEE_DR7                 7\r
+\r
+#define OPCODE_TTTN_OVERFLOW           0\r
+#define OPCODE_TTTN_NO_OVERFLOW                1\r
+#define OPCODE_TTTN_BELOW              2\r
+#define OPCODE_TTTN_NOT_BELOW          3\r
+#define OPCODE_TTTN_EQUAL_OR_ZERO      4\r
+#define OPCODE_TTTN_NOT_EQUAL_OR_ZERO  5\r
+#define OPCODE_TTTN_NOT_ABOVE          6\r
+#define OPCODE_TTTN_ABOVE              7\r
+#define OPCODE_TTTN_SIGN               8\r
+#define OPCODE_TTTN_NOT_SIGN           9\r
+#define OPCODE_TTTN_PARITY             10\r
+#define OPCODE_TTTN_NOT_PARITY         10\r
+#define OPCODE_TTTN_LESS_THAN          10\r
+#define OPCODE_TTTN_NOT_LESS_THAN      10\r
+#define OPCODE_TTTN_NOT_GREATER_THAN   10\r
+#define OPCODE_TTTN_GREATER_THAN       10\r
+\r
+#define OPCODE_D_REG_SOURCE            0\r
+#define OPCODE_D_REG_DESTINATION       1\r
+\r
+#define OPCODE_MOD_INDEXONLY           0\r
+#define OPCODE_MOD_INDEX_AND_DISP_BYTE 1\r
+#define OPCODE_MOD_INDEX_AND_DISP_FULL 2\r
+#define OPCODE_MOD_REGISTER            3\r
+\r
+#define OPCODE_RM32_ADDR_EAX           0\r
+#define OPCODE_RM32_ADDR_ECX           1\r
+#define OPCODE_RM32_ADDR_EDX           2\r
+#define OPCODE_RM32_ADDR_EBX           3\r
+#define OPCODE_RM32_ADDR_SIB           4\r
+#define OPCODE_RM32_ADDR_EBP           5\r
+#define OPCODE_RM32_MOD00_ADDR_DISP32  5\r
+#define OPCODE_RM32_ADDR_ESI           6\r
+#define OPCODE_RM32_ADDR_EDI           7\r
+\r
+#define OPCODE_RM16_ADDR_BX_SI         0\r
+#define OPCODE_RM16_ADDR_BX_DI         1\r
+#define OPCODE_RM16_ADDR_BP_SI         2\r
+#define OPCODE_RM16_ADDR_BP_DI         3\r
+#define OPCODE_RM16_ADDR_SI            4\r
+#define OPCODE_RM16_ADDR_DI            5\r
+#define OPCODE_RM16_ADDR_BP            6\r
+#define OPCODE_RM16_MOD00_ADDR_DISP16  6\r
+#define OPCODE_RM16_ADDR_BX            7\r
+\r
+#define OPCODE_PREFIX_NONE             0\r
+\r
+#define OPCODE_PREFIX_LOCK             0xf0\r
+#define OPCODE_PREFIX_REPNE_REPNZ      0xf2\r
+#define OPCODE_PREFIX_REP_REPE_REPZ    0xf3\r
+\r
+//#define OPCODE_PREFIX_CS             0x2e\r
+//#define OPCODE_PREFIX_SS             0x36\r
+//#define OPCODE_PREFIX_DS             0x3e\r
+//#define OPCODE_PREFIX_ES             0x26\r
+//#define OPCODE_PREFIX_FS             0x64\r
+//#define OPCODE_PREFIX_GS             0x65\r
+#define OPCODE_PREFIX_BRANCH_NOT_TAKEN 0x2e\r
+#define OPCODE_PREFIX_BRANCH_TAKEN     0x3e\r
+\r
+#define OPCODE_PREFIX_OPERAND_SIZE     0x66\r
+\r
+#define OPCODE_PREFIX_ADDRESS_SIZE     0x67\r
+\r
+/*PIC io port*/\r
+#define PIC0_ICW1      0x0020\r
+#define PIC0_OCW2      0x0020\r
+#define PIC0_IMR       0x0021\r
+#define PIC0_ICW2      0x0021\r
+#define PIC0_ICW3      0x0021\r
+#define PIC0_ICW4      0x0021\r
+#define PIC1_ICW1      0x00a0\r
+#define PIC1_OCW2      0x00a0\r
+#define PIC1_IMR       0x00a1\r
+#define PIC1_ICW2      0x00a1\r
+#define PIC1_ICW3      0x00a1\r
+#define PIC1_ICW4      0x00a1\r
+\r
+/*KBD io port*/\r
+#define PORT_KEYDATA           0x0060\r
+#define PORT_KEYSTA            0x0064\r
+#define PORT_KEYCMD            0x0064\r
+#define KBC_MODE               0x47    //Keyboard and Mouse Interrupt Enable.\r
+#define KEYSTA_SEND_NOTREADY   0x02\r
+#define KEYDATA_ACK    0xfa\r
+#define KEYDATA_RESEND 0xfe\r
+#define KEYDATA_TEST_SUCCEEDED 0xaa\r
+#define KEYDATA_TEST_FAILED    0xfc\r
+#define KEYCMD_WRITE_8042_MODE_REG     0x60\r
+#define KEYCMD_SENDTO_MOUSE    0xd4\r
+#define KEYCMD_LED             0xed\r
+\r
+/*Mouse*/\r
+#define MOUSECMD_RESET 0xff\r
+//#define MOUSECMD_SET_DEFAULTS        0xf6\r
+//#define MOUSECMD_DISABLE_DATA_REPORTING      0xf5\r
+#define MOUSECMD_ENABLE_DATA_REPORTING 0xf4\r
+#define MOUSECMD_SET_SAMPLE_RATE       0xf3\r
+#define MOUSECMD_GET_DEVICE_ID 0xf2\r
+#define MOUSE_TYPE_3BUTTON     0x00\r
+#define MOUSE_TYPE_3BUTTON_SCROLL      0x03\r
+\r
+/*COM1 io port*/\r
+#define COM1_RX                0x03f8\r
+#define COM1_TX                0x03f8\r
+#define COM1_BAUD_LSB  0x03f8\r
+#define COM1_BAUD_MSB  0x03f9\r
+#define COM1_INTR_ENBL 0x03f9\r
+#define COM1_INTR_ID   0x03fa\r
+#define COM1_CTRL_FIFO 0x03fa\r
+#define COM1_CTRL_LINE 0x03fb\r
+#define COM1_CTRL_MODEM        0x03fc\r
+#define COM1_STA_LINE  0x03fd\r
+#define COM1_STA_MODEM 0x03fe\r
+\r
+/*PIT io port*/\r
+#define PIT_CTRL       0x0043\r
+#define PIT_CNT0       0x0040\r
+\r
+/*VGA*/\r
+#define VGA_CRTC_R_NUMBER              0x03d4\r
+#define VGA_CRTC_R_DATA                        0x03d5\r
+#define VGA_CRTC_R_CURSOR_LOCATION_HIGH        0x0e\r
+#define VGA_CRTC_R_CURSOR_LOCATION_LOW 0x0f\r
+#define VGA_TEXTMODE_ADR               0xb8000\r
+#define VGA_VDAC_DATA                  0x03c9\r
+#define VGA_VDAC_WRITE_ADR             0x03c8\r
+#define VGA_VRAM_ADR                   (void *)0x000a0000\r
+#define VGA08_VRAM_XSIZE               320\r
+#define VGA08_VRAM_YSIZE               200\r
+\r
+#define VESA_LINEAR_ACCESS             0x4000\r
+#define VESA_OMIT_CLEARING_VRAM                0x8000\r
+\r
+#define VBE_REALMODE_RETVALUE_ADDRESS  (void *)0x00000e00;\r
+#define DISPLAYMODE_BIOS               0x0000\r
+#define DISPLAYMODE_VBE_WINDOW         0x0001\r
+#define DISPLAYMODE_VBE_LINEAR         0x0002\r
+\r
+/*settings*/\r
+/*IPL defines*/\r
+#define ADR_DISKIMG    (void *)0x00100000\r
+\r
+/*system segments*/\r
+#define SYSTEM_DS      0x01\r
+#define SYSTEM_CS      0x02\r
+\r
+/*descriptor tables*/\r
+#define ADR_IDT                0x0026f800\r
+#define LIMIT_IDT      0x000007ff\r
+#define ADR_GDT                0x00270000\r
+#define LIMIT_GDT      0x0000ffff\r
+#define ADR_BOOTPACK   0x00280000\r
+#define LIMIT_BOOTPACK 0x0007ffff\r
+\r
+/*error id*/\r
+#define ERROR_CPU_EXCEPTION_00                 0x00000000      //int *esp\r
+#define ERROR_CPU_EXCEPTION_01                 0x00000001      //int *esp\r
+#define ERROR_CPU_EXCEPTION_02                 0x00000002      //int *esp\r
+#define ERROR_CPU_EXCEPTION_03                 0x00000003      //int *esp\r
+#define ERROR_CPU_EXCEPTION_04                 0x00000004      //int *esp\r
+#define ERROR_CPU_EXCEPTION_05                 0x00000005      //int *esp\r
+#define ERROR_CPU_EXCEPTION_06                 0x00000006      //int *esp\r
+#define ERROR_CPU_EXCEPTION_07                 0x00000007      //int *esp\r
+#define ERROR_CPU_EXCEPTION_08                 0x00000008      //int *esp\r
+#define ERROR_CPU_EXCEPTION_09                 0x00000009      //int *esp\r
+#define ERROR_CPU_EXCEPTION_0A                 0x0000000a      //int *esp\r
+#define ERROR_CPU_EXCEPTION_0B                 0x0000000b      //int *esp\r
+#define ERROR_CPU_EXCEPTION_0C                 0x0000000c      //int *esp\r
+#define ERROR_CPU_EXCEPTION_0D                 0x0000000d      //int *esp\r
+#define ERROR_CPU_EXCEPTION_0E                 0x0000000e      //int *esp\r
+#define ERROR_CPU_EXCEPTION_0F                 0x0000000f      //int *esp\r
+#define ERROR_CPU_EXCEPTION_10                 0x00000010      //int *esp\r
+#define ERROR_CPU_EXCEPTION_11                 0x00000011      //int *esp\r
+#define ERROR_CPU_EXCEPTION_12                 0x00000012      //int *esp\r
+#define ERROR_CPU_EXCEPTION_13                 0x00000013      //int *esp\r
+#define ERROR_CPU_EXCEPTION_14                 0x00000014      //int *esp\r
+#define ERROR_CPU_EXCEPTION_15                 0x00000015      //int *esp\r
+#define ERROR_CPU_EXCEPTION_16                 0x00000016      //int *esp\r
+#define ERROR_CPU_EXCEPTION_17                 0x00000017      //int *esp\r
+#define ERROR_CPU_EXCEPTION_18                 0x00000018      //int *esp\r
+#define ERROR_CPU_EXCEPTION_19                 0x00000019      //int *esp\r
+#define ERROR_CPU_EXCEPTION_1A                 0x0000001a      //int *esp\r
+#define ERROR_CPU_EXCEPTION_1B                 0x0000001b      //int *esp\r
+#define ERROR_CPU_EXCEPTION_1C                 0x0000001c      //int *esp\r
+#define ERROR_CPU_EXCEPTION_1D                 0x0000001d      //int *esp\r
+#define ERROR_CPU_EXCEPTION_1E                 0x0000001e      //int *esp\r
+#define ERROR_CPU_EXCEPTION_1F                 0x0000001f      //int *esp\r
+#define ERROR_CPU_EXCEPTIONS                   0x0000001f\r
+\r
+#define ERROR_NO_MORE_SEGMENT                          0x00000020      //uint *retaddr\r
+#define ERROR_NOT_ENOUGH_FREE_MEMORY           0x00000021      //IO_MemoryControl ctrl, uint size\r
+#define ERROR_MEMORY_FREE_RANGE_OVERLAPPED     0x00000022      //IO_MemoryControl ctrl, uint tagno\r
+#define ERROR_NO_MORE_FREE_TAG                         0x00000023      //IO_MemoryControl ctrl\r
+#define ERROR_INVALID_FREE_MEMORY_INDEX                0x00000024      //IO_MemoryControl ctrl, uint tagno\r
+#define ERROR_FIFO_BUFFER_OVERFLOW                     0x00000025      //DATA_FIFO32 *fifo\r
+\r
+/*FIFO buffer*/\r
+#define SIGNAL_ARGUMENTS_END   0xfefe1234\r
+/*task*/\r
+#define TASK_FIFOSIZE  (4 * 64)\r
+\r
+/*exceptions esp[] data with errorcode*/\r
+#define EXCEPTION_INFO_EDI             0x00\r
+#define EXCEPTION_INFO_ESI             0x01\r
+#define EXCEPTION_INFO_EBP             0x02\r
+#define EXCEPTION_INFO_ESP             0x03\r
+#define EXCEPTION_INFO_EBX             0x04\r
+#define EXCEPTION_INFO_EDX             0x05\r
+#define EXCEPTION_INFO_ECX             0x06\r
+#define EXCEPTION_INFO_EAX             0x07\r
+#define EXCEPTION_INFO_DS              0x08\r
+#define EXCEPTION_INFO_ES              0x09\r
+#define EXCEPTION_INFO_ERRORCODE       0x0a\r
+#define EXCEPTION_INFO_EIP             0x0b\r
+#define EXCEPTION_INFO_CS              0x0c\r
+#define EXCEPTION_INFO_EFLAGS          0x0d\r
+#define EXCEPTION_INFO_USER_ESP                0x0e\r
+#define EXCEPTION_INFO_USER_SS         0x0f\r
+\r
+/*sheet*/\r
+#define SHEET_MAX_XSIZE        65535\r
+#define SHEET_MAX_YSIZE        65535\r
+#define SHEET_MAX_CHILDREN     255\r
+#define SHEET_LOCATION_NOCHANGE        0x7ffffffe\r
+\r
+/*console*/\r
+#define CONSOLE_PRINTF_BUFFER_SIZE     1024\r
+\r
+/*floppy*/\r
+#define FLOPPYDISK_FAT0_OFFSET 0x000200\r
+#define FLOPPYDISK_FAT1_OFFSET 0x001400 \r
+#define FLOPPYDISK_RDE_OFFSET  0x002600\r
+#define FLOPPYDISK_RDE_ENTRIES 224\r
+#define FLOPPYDISK_SECTORS             (1440 * 2)\r
+\r
+/*file*/\r
+#define FILE_PATH_LENGTH_MAX   (256 - 1)\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef1.h b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef1.h
new file mode 100644 (file)
index 0000000..4af4ad6
--- /dev/null
@@ -0,0 +1,680 @@
+\r
+/*\83V\83X\83e\83\80\83f\81[\83^\8c^\90é\8c¾*/\r
+\r
+/*new object types*/\r
+//typedef enum _bool { false, true} bool;\r
+typedef unsigned char bool;\r
+typedef unsigned char uchar;\r
+typedef unsigned short ushort;\r
+typedef unsigned int uint;\r
+typedef enum _col_text { black, blue, green, skyblue, red, purple, brown, white} col_text;\r
+typedef unsigned char sector[512];\r
+\r
+/*structs*/\r
+/*CPU structs*/\r
+typedef union CPU_CONTROL_REGISTER0 {\r
+       uint cr0;\r
+       struct CPU_CONTROL_REGISTER0_BIT {\r
+               unsigned PE : 1;\r
+               unsigned MP : 1;\r
+               unsigned EM : 1;\r
+               unsigned TS : 1;\r
+               unsigned ET : 1;\r
+               unsigned NE : 1;\r
+               unsigned bit6 : 1;\r
+               unsigned bit7 : 1;\r
+               unsigned bit8 : 1;\r
+               unsigned bit9 : 1;\r
+               unsigned bit10 : 1;\r
+               unsigned bit11 : 1;\r
+               unsigned bit12 : 1;\r
+               unsigned bit13 : 1;\r
+               unsigned bit14 : 1;\r
+               unsigned bit15 : 1;\r
+               unsigned WP : 1;\r
+               unsigned bit17 : 1;\r
+               unsigned AM : 1;\r
+               unsigned bit19 : 1;\r
+               unsigned bit20 : 1;\r
+               unsigned bit21 : 1;\r
+               unsigned bit22 : 1;\r
+               unsigned bit23 : 1;\r
+               unsigned bit24 : 1;\r
+               unsigned bit25 : 1;\r
+               unsigned bit26 : 1;\r
+               unsigned bit27 : 1;\r
+               unsigned bit28 : 1;\r
+               unsigned NW : 1;\r
+               unsigned CD : 1;\r
+               unsigned PG : 1;\r
+       } bit;\r
+} CPU_ControlRegister0;\r
+\r
+typedef union CPU_CONTROL_REGISTER3 {\r
+       uint cr3;\r
+       struct CPU_CONTROL_REGISTER3_BIT {\r
+               unsigned bit0 : 1;\r
+               unsigned bit1 : 1;\r
+               unsigned bit2 : 1;\r
+               unsigned PWT : 1;\r
+               unsigned PCD : 1;\r
+               unsigned bit5 : 1;\r
+               unsigned bit6 : 1;\r
+               unsigned bit7 : 1;\r
+               unsigned bit8 : 1;\r
+               unsigned bit9 : 1;\r
+               unsigned bit10 : 1;\r
+               unsigned bit11 : 1;\r
+               unsigned PDB : 20;\r
+       } bit;\r
+} CPU_ControlRegister3;\r
+\r
+typedef union CPU_CONTROL_REGISTER4 {\r
+       uint cr4;\r
+       struct CPU_CONTROL_REGISTER4_BIT {\r
+               unsigned VME : 1;\r
+               unsigned PVI : 1;\r
+               unsigned TSD : 1;\r
+               unsigned DE : 1;\r
+               unsigned PSE : 1;\r
+               unsigned PAE : 1;\r
+               unsigned MCE : 1;\r
+               unsigned PGE : 1;\r
+               unsigned PCE : 1;\r
+               unsigned OSFXSR : 1;\r
+               unsigned OSXMMEXCPT : 1;\r
+               unsigned bit11 : 1;\r
+               unsigned bit12 : 1;\r
+               unsigned VMXE : 1;\r
+               unsigned SMXE : 1;\r
+               unsigned bit15 : 1;\r
+               unsigned bit16 : 1;\r
+               unsigned PCIDE : 1;\r
+               unsigned OSXSAVE : 1;\r
+               unsigned bit19 : 1;\r
+               unsigned SMEP : 1;\r
+               unsigned bit21 : 1;\r
+               unsigned bit22 : 1;\r
+               unsigned bit23 : 1;\r
+               unsigned bit24 : 1;\r
+               unsigned bit25 : 1;\r
+               unsigned bit26 : 1;\r
+               unsigned bit27 : 1;\r
+               unsigned bit28 : 1;\r
+               unsigned bit29 : 1;\r
+               unsigned bit30 : 1;\r
+               unsigned bit31 : 1;\r
+       } bit;\r
+} CPU_ControlRegister4;\r
+\r
+typedef union CPU_DEBUG_REGISTER6 {\r
+       uint dr6;\r
+       struct CPU_DEBUG_REGISTER6_BIT {\r
+               unsigned B0 : 1;\r
+               unsigned B1 : 1;\r
+               unsigned B2 : 1;\r
+               unsigned B3 : 1;\r
+               unsigned bit4_11 : 8;   //1\r
+               unsigned bit12 : 1;     //0\r
+               unsigned BD : 1;\r
+               unsigned BS : 1;\r
+               unsigned BT : 1;\r
+               unsigned bit16_31 : 16;\r
+       } bit;\r
+} CPU_DebugRegister6;\r
+\r
+typedef union CPU_DEBUG_REGISTER7 {\r
+       uint dr7;\r
+       struct CPU_DEBUG_REGISTER7_BIT {\r
+               unsigned L0 : 1;\r
+               unsigned G0 : 1;\r
+               unsigned L1 : 1;\r
+               unsigned G1 : 1;\r
+               unsigned L2 : 1;\r
+               unsigned G2 : 1;\r
+               unsigned L3 : 1;\r
+               unsigned G3 : 1;\r
+               unsigned LE : 1;        //must be 1\r
+               unsigned GE : 1;        //must be 1\r
+               unsigned bit10 : 1;     //1\r
+               unsigned bit11 : 1;     //0\r
+               unsigned bit12 : 1;     //0\r
+               unsigned GD : 1;\r
+               unsigned bit14 : 1;     //0\r
+               unsigned bit15 : 1;     //0\r
+               unsigned RW0 : 2;\r
+               unsigned LEN0 : 2;\r
+               unsigned RW1 : 2;\r
+               unsigned LEN1 : 2;\r
+               unsigned RW2 : 2;\r
+               unsigned LEN2 : 2;\r
+               unsigned RW3 : 2;\r
+               unsigned LEN3 : 2;\r
+       } bit;\r
+} CPU_DebugRegister7;\r
+\r
+typedef union CPU_EFLAGS {\r
+       uint eflags;\r
+       struct CPU_EFLAGS_BIT {\r
+               unsigned CF : 1;\r
+               unsigned bit1 : 1;      //\8fí\82ÉTrue\81A\82±\82ê\88È\8aO\82Ì\97\\96ñ\8dÏ\82Ý\83r\83b\83g\82Í\8fí\82ÉFalse\r
+               unsigned PF : 1;\r
+               unsigned bit3 : 1;\r
+               unsigned AF : 1;\r
+               unsigned bit5 : 1;\r
+               unsigned ZF : 1;\r
+               unsigned SF : 1;\r
+               unsigned TF : 1;\r
+               unsigned IF : 1;\r
+               unsigned DF : 1;\r
+               unsigned OF : 1;\r
+               unsigned IOPL : 2;\r
+               unsigned NT : 1;\r
+               unsigned bit15 : 1;\r
+               unsigned RF : 1;\r
+               unsigned VM : 1;\r
+               unsigned AC : 1;\r
+               unsigned VIF : 1;\r
+               unsigned VIP : 1;\r
+               unsigned ID : 1;\r
+               unsigned bit22 : 1;\r
+               unsigned bit23 : 1;\r
+               unsigned bit24 : 1;\r
+               unsigned bit25 : 1;\r
+               unsigned bit26 : 1;\r
+               unsigned bit27 : 1;\r
+               unsigned bit28 : 1;\r
+               unsigned bit29 : 1;\r
+               unsigned bit30 : 1;\r
+               unsigned bit31 : 1;\r
+       } bit;\r
+} CPU_EFlags;\r
+\r
+typedef struct TASK_STATE_SEGMENT {\r
+       ushort backlink, reserve00;\r
+       uint esp0;\r
+       ushort ss0, reserve01;\r
+       uint esp1;\r
+       ushort ss1, reserve02;\r
+       uint esp2;\r
+       ushort ss2, reserve03;\r
+       uint cr3;\r
+       uint eip;\r
+       CPU_EFlags eflags;\r
+       uint eax;\r
+       uint ecx;\r
+       uint edx;\r
+       uint ebx;\r
+       uint esp;\r
+       uint ebp;\r
+       uint esi;\r
+       uint edi;\r
+       ushort es, reserve04;\r
+       ushort cs, reserve05;\r
+       ushort ss, reserve06;\r
+       ushort ds, reserve07;\r
+       ushort fs, reserve08;\r
+       ushort gs, reserve09;\r
+       ushort ldtr, reserve10;\r
+       unsigned flag_trap : 1;\r
+       unsigned reserve11 : 15;\r
+       ushort iomap_base;\r
+} CPU_TaskStateSegment;\r
+\r
+typedef struct SEGMENT_DESCRIPTOR { \r
+       ushort limit_low, base_low;\r
+       uchar base_mid, access_right;\r
+       uchar limit_high, base_high;\r
+} IO_SegmentDescriptor;\r
+\r
+typedef struct GATE_DESCRIPTOR { \r
+       ushort offset_low, selector;\r
+       uchar dw_count, access_right;\r
+       ushort offset_high;\r
+} IO_GateDescriptor;\r
+\r
+/*memory*/\r
+typedef struct IO_MEMORYCONTROLTAG {\r
+       void *addr;\r
+       uint size;\r
+} IO_MemoryControlTag;\r
+\r
+typedef IO_MemoryControlTag* IO_MemoryControl;\r
+\r
+/*common tag*/\r
+typedef struct SYSTEM_COMMON_STRUCT {\r
+       uint structid;\r
+       uint structsize;\r
+} System_CommonStruct;\r
+\r
+/*FIFO*/\r
+typedef struct FIFO32 {\r
+       System_CommonStruct common_tag;\r
+       uint *buf;\r
+       uint p, q, size, free;\r
+       struct FIFO32_FLAGS {\r
+               unsigned initialized : 1;\r
+               unsigned overflow : 1;\r
+       } flags;\r
+       struct UI_TASK *task;\r
+} DATA_FIFO32;\r
+\r
+/*task*/\r
+typedef struct UI_TASK {\r
+       uint selector;\r
+       struct UI_TASK *next;\r
+       uint count;\r
+       DATA_FIFO32 *fifo;\r
+       CPU_TaskStateSegment *tss;\r
+       struct UI_TASK_STATE_FLAGS {\r
+               unsigned initialized : 1;\r
+               unsigned linked : 1;\r
+               unsigned running : 1;\r
+               unsigned first_run : 1;\r
+       } flags;\r
+} UI_Task;\r
+\r
+typedef struct UI_TASK_CONTROL {\r
+       struct UI_TASK *start;\r
+       struct UI_TASK *now;\r
+       IO_MemoryControl sysmemctrl;\r
+} UI_TaskControl;\r
+\r
+/*callbios*/\r
+typedef struct CALL_BIOS_CONTROL {\r
+       UI_Task *CallBIOS_Task;\r
+       uint codesize;\r
+       DATA_FIFO32 *fifo;\r
+       uint endsignal;\r
+       CPU_TaskStateSegment retvalue;\r
+       uint esp0;\r
+} IO_CallBIOSControl;\r
+\r
+/*cfunction*/\r
+typedef struct CFUNCTION_VSNPRINTF_WORKAREA {\r
+       uchar *destination_buf;         /*\8f\91\82«\8d\9e\82Ý\90æ\95\8e\9a\97ñ\82Ì\8aJ\8en\83A\83h\83\8c\83X*/\r
+       uint length_destination_buf;    /*\8f\91\82«\8d\9e\82Ý\90æ\95\8e\9a\97ñ\82Ì\8dÅ\91å\83T\83C\83Y*/\r
+       uint index_destination_buf;     /*\8f\91\82«\8d\9e\82Ý\90æ\95\8e\9a\97ñ\82Ì\83C\83\93\83f\83b\83N\83X*/\r
+\r
+       const uchar *format_buf;        /*\8f\91\8e®\8ew\92è\95\8e\9a\97ñ\82Ì\8aJ\8en\83A\83h\83\8c\83X*/\r
+       uint index_format_buf;          /*\8f\91\8e®\8ew\92è\95\8e\9a\97ñ\82Ì\83C\83\93\83f\83b\83N\83X*/\r
+\r
+       uchar temporary_data[16];       /*\88ê\8e\9e\83f\81[\83^\82Ì\94z\97ñ*/\r
+       uchar temporary_data_double[8]; /*64\83r\83b\83g\95\82\93®\8f¬\90\94\93_\97p\83o\83b\83t\83@*/\r
+\r
+       uint *vargs;                    /*\89Â\95Ï\92·\88ø\90\94\82Ì\8aJ\8en\83A\83h\83\8c\83X*/\r
+       uint index_vargs;               /*\89Â\95Ï\92·\88ø\90\94\82Ì\8c»\8dÝ\82Ì\8fê\8f\8a*/\r
+\r
+       uint format_phase;              /*\83t\83H\81[\83}\83b\83g\82Ì\92i\8aK\82ð\8e¦\82·\81B*/\r
+                                               /*\90\94\92l  :\88Ó\96¡*/\r
+                                               /*0     :\83t\83H\81[\83}\83b\83g\8ew\92è\92\86\82Å\82Í\82È\82¢*/\r
+                                               /*1     :\83t\83\89\83O\88È\8d~\82Ì\8f\91\8e®\82ð\97v\8b\81*/\r
+                                               /*2     :\83t\83B\81[\83\8b\83h\95\9d\88È\8d~\82Ì\8f\91\8e®\82ð\97v\8b\81\81B*/\r
+                                               /*3     :\90¸\93x\88È\8d~\82Ì\8f\91\8e®\82ð\97v\8b\81\81B*/\r
+                                               /*4     :\95Ï\8a·\8fC\8fü\8eq\88È\8d~\82Ì\8f\91\8e®\82ð\97v\8b\81\81B*/\r
+                                               /*5     :\83t\83H\81[\83}\83b\83g\8ew\92è\8eq\82ð\97v\8b\81*/\r
+} CFunction_vsnprintf_WorkArea;\r
+\r
+/*emu86*/\r
+typedef struct EMULATOR_X86_ENVIRONMENT_SEGMENT_REGISTER {\r
+       ushort selector;\r
+       ushort type;\r
+       uint base;\r
+       uint limit;\r
+} Emulator_x86_Environment_SegmentRegister;\r
+\r
+typedef struct EMULATOR_X86_ENVIRONMENT_SYSTEM_TABLE_REGISTER {\r
+       uint base;\r
+       ushort limit;\r
+} Emulator_x86_Environment_SystemTableRegister;\r
+\r
+typedef struct EMULATOR_X86_ENVIRONMENT {\r
+       CPU_EFlags EFLAGS;\r
+       uint EIP;\r
+\r
+       uint GReg[8];\r
+\r
+       Emulator_x86_Environment_SystemTableRegister GDTR;\r
+       Emulator_x86_Environment_SystemTableRegister IDTR;\r
+\r
+       Emulator_x86_Environment_SegmentRegister SReg[8];\r
+\r
+       CPU_ControlRegister0 CR0;\r
+       uint CR2;\r
+       CPU_ControlRegister3 CR3;\r
+       CPU_ControlRegister4 CR4;\r
+\r
+       uchar now_opcode;\r
+       uchar operation_end;\r
+       uchar operation_32bit;\r
+       uchar operation_prefix_lock_repeat;\r
+       uchar operation_prefix_segment;\r
+       uchar operation_prefix_opsize;\r
+       uchar operation_prefix_addrsize;\r
+} Emulator_x86_Environment;\r
+\r
+typedef union EMULATOR_X86_OPCODE_MODRM {\r
+       uchar modrm;\r
+       struct EMULATOR_X86_OPCODE_MODRM_BIT {\r
+               unsigned RM : 3;\r
+               unsigned Reg : 3;\r
+               unsigned Mod : 2;\r
+       } bit;\r
+} Emulator_x86_OperationCode_ModRM;\r
+\r
+typedef struct EMULATOR_X86_FAR_POINTER {\r
+       ushort offset;\r
+       ushort selector;\r
+} Emulator_x86_FarPointer;\r
+\r
+/*drawing*/\r
+typedef struct DATA_LOCATION_2D {\r
+       int x;\r
+       int y;\r
+} DATA_Location2D;\r
+\r
+typedef struct DATA_LOCATION_2DU {\r
+       uint x;\r
+       uint y;\r
+} DATA_Location2DU;\r
+\r
+/*display*/\r
+typedef struct _INFO_VBE_BIOS {\r
+       uchar sign[4];\r
+       uchar ver_minor;\r
+       uchar ver_major;\r
+       ushort oem_string_offset;\r
+       ushort oem_string_segment;\r
+       ushort flags[2];        //\83p\83f\83B\83\93\83O\82Ì\8aÖ\8cW\82Å\81A\96{\93\96\82Íuint\82¾\82ªushort*2\82É\82µ\82Ä\82¢\82é\81B\r
+       ushort vmode_args_offset;\r
+       ushort vmode_args_segment;\r
+       ushort vram_supported_size_kb;\r
+} INFO_VBE_BIOS;\r
+\r
+typedef struct _INFO_VBE_VIDEO_MODE {\r
+       ushort  ModeAttributes;\r
+       uchar   WinAAttributes;\r
+       uchar   WinBAttributes;\r
+       ushort  WinGranularity;\r
+       ushort  WinSize;\r
+       ushort  WinASegment;\r
+       ushort  WinBSegment;\r
+       uint    WinFuncPtr;\r
+       ushort  BytesPerScanLine;\r
+       ushort  XResolution;\r
+       ushort  YResolution;\r
+       uchar   XCharSize;\r
+       uchar   YCharSize;\r
+       uchar   NumberOfPlanes;\r
+       uchar   BitsPerPixel;\r
+       uchar   NumberOfBanks;\r
+       uchar   MemoryModel;\r
+       uchar   BankSize;\r
+       uchar   NumberOfImagePages;\r
+       uchar   Reserved;\r
+       uchar   RedMaskSize;\r
+       uchar   RedFieldPosition;\r
+       uchar   GreenMaskSize;\r
+       uchar   GreenFieldPosition;\r
+       uchar   BlueMaskSize;\r
+       uchar   BlueFieldPosition;\r
+       uchar   RsvdMaskSize;\r
+       uchar   RsvdFieldPodition;\r
+       uchar   DirectColorModeInfo;\r
+       void*   PhysBasePtr;\r
+} INFO_VBE_VideoMode;\r
+\r
+typedef struct _INFO_VBE_VIDEOMODETAG {\r
+       ushort mode_number;\r
+       ushort xsize;\r
+       ushort ysize;\r
+       uchar bpp;\r
+       uchar memory_model;     //0x00:text 0x04:256palette 0x06:direct color\r
+       ushort attribute;       //bit3:1:color 0:monochrome\r
+                               //bit4:1:graphic 0:text\r
+                               //bit7:linear buffer support\r
+       ushort reserve;\r
+       void *vram;     //vram:0=not supported.\r
+} INFO_VBE_VideoModeTag;\r
+\r
+typedef struct IO_DISPLAY_CONTROL {\r
+       struct IO_DISPLAY_CONTROL_VBE {\r
+               uchar version_minor;\r
+               uchar version_major;\r
+               ushort vram_supported_size_kb;\r
+               uint flags;\r
+               uchar *oem_string;\r
+               ushort *vmode_args;\r
+               uint list_vmode_tags;\r
+               INFO_VBE_VideoModeTag *list_vmode;\r
+       } VBE;\r
+       ushort display_mode;    //0x0000:BIOS 0x0001:VBE Window Access(version < 2.0)(not implemented) 0x0002:VBE Linear Access\r
+       ushort vmode;   //0x0000:VGA 320x200 8bit\r
+       ushort vmode_index;\r
+       ushort bpp;\r
+       ushort xsize;\r
+       ushort ysize;\r
+       void *vram;\r
+       DATA_FIFO32 *bios_signal;\r
+       struct UI_SHEET *vramsheet;\r
+} IO_DisplayControl;\r
+\r
+/*sheet*/\r
+typedef struct UI_SHEET {\r
+       System_CommonStruct common_tag;\r
+       struct UI_SHEET *parent;        //one sheet has one parent(if vramseet then:0)\r
+       struct UI_SHEET *next;          //same level sheet link\r
+       struct UI_SHEET *child;         //lowest height sheet in children\r
+       DATA_Location2D location;\r
+       DATA_Location2DU size;\r
+       ushort bpp;\r
+       union UI_SHEET_FLAGS {\r
+               ushort flags;\r
+               struct UI_SHEET_FLAGS_BITS {\r
+                       unsigned initialized : 1;\r
+                       unsigned buffer_configured : 1;\r
+                       unsigned visible : 1;\r
+                       unsigned using_map : 1;\r
+                       unsigned vram_auto_allocated : 1;\r
+                       unsigned using_invcol : 1;\r
+                       unsigned topmost : 1;\r
+                       unsigned movable : 1;\r
+                       unsigned autorefresh_upperlevel : 1;\r
+               } bit;\r
+       } flags;\r
+       void *vram;\r
+       uint *map;\r
+       uint vramsize;\r
+       uint mapsize;\r
+       uint invcol;\r
+       uint (*Config_Functions)(struct UI_SHEET *sheet);\r
+       uint (*RefreshSheet)(struct UI_SHEET *sheet, int px0, int py0, int px1, int py1);\r
+       bool (*IsVisiblePixel)(struct UI_SHEET *sheet, int px, int py);\r
+       struct UI_SHEET_DRAWING {\r
+               uint (*Fill_Rectangle)(struct UI_SHEET *sheet, uint c, int px0, int py0, int px1, int py1);\r
+               uint (*Put_String)(struct UI_SHEET *sheet, int x, int y, uint fc, const uchar s[]);\r
+               uint (*Draw_Point)(struct UI_SHEET *sheet, int x, int y, uint c);\r
+       } Drawing;\r
+       DATA_FIFO32 *input_fifo;\r
+} UI_Sheet;\r
+\r
+/*timer*/\r
+typedef struct UI_TIMER {\r
+       uint tick;\r
+       uint timeout;\r
+       struct UI_TIMER *root_next;\r
+       struct UI_TIMER *tree_next;\r
+       DATA_FIFO32 *fifo;\r
+       uint fifo_putdata;\r
+       union UI_TIMER_FLAGS {\r
+               uint flags;\r
+               struct UI_TIMER_FLAGS_BITS {\r
+                       unsigned initialized : 1;\r
+                       unsigned configured : 1;\r
+                       unsigned running : 1;\r
+                       unsigned interval : 1;\r
+               } bit;\r
+       } flags;\r
+} UI_Timer;\r
+\r
+typedef struct UI_TIMER_CONTROL {\r
+       uint tick_10ms;\r
+       void (*TaskSwitch)(void);\r
+       UI_Timer *timer_root;\r
+} UI_TimerControl;\r
+\r
+/*color*/\r
+typedef union RGB_32BIT {\r
+       uint c32;\r
+       struct RGB_32BIT_RGBA {\r
+               uchar b;\r
+               uchar g;\r
+               uchar r;\r
+               uchar a;\r
+       } bit;\r
+} RGB32;\r
+\r
+/*mouse*/\r
+\r
+typedef struct IO_MOUSE_CONTROL {\r
+       uint decode_phase;\r
+       uchar decode_buf[4];\r
+       DATA_Location2D move;\r
+       int scroll;\r
+       struct IO_MOUSE_CONTROL_FLAGS {\r
+               unsigned scroll : 1;\r
+       } flags;\r
+       union IO_MOUSE_CONTROL_BUTTON {\r
+               uchar button;\r
+               struct IO_MOUSE_CONTROL_BUTTON_BIT {\r
+                       unsigned L : 1;\r
+                       unsigned R : 1;\r
+                       unsigned C : 1;\r
+               } bit;\r
+       } button;\r
+} IO_MouseControl;\r
+\r
+typedef struct UI_MOUSE_CURSOR {\r
+       UI_Sheet *cursor_sheet;\r
+       struct UI_MOUSE_CURSOR_FLAGS {\r
+               unsigned mode : 2;\r
+       } flags;\r
+       uchar *cursors[4];\r
+} UI_MouseCursor;\r
+\r
+/*textbox*/\r
+typedef struct UI_TEXT_BOX {\r
+       System_CommonStruct common_tag;\r
+       UI_Sheet *sheet;\r
+       uint forecol;\r
+       uint backcol;\r
+       DATA_Location2D location_cursor;\r
+       DATA_Location2D location_cursor_record_started;\r
+       DATA_Location2DU chars;\r
+       uchar *text_buf;\r
+       uint size_text_buf;\r
+       uint using_text_buf;\r
+       \r
+       union UI_TEXT_BOX_FLAGS {\r
+               uint flags;\r
+               struct UI_TEXT_BOX_FLAGS_BITS {\r
+                       unsigned initialized : 1;\r
+                       unsigned textbuffer_configured : 1;\r
+                       unsigned record_input_text : 1;\r
+                       unsigned cursor_blink : 1;\r
+                       unsigned cursor_state : 1;\r
+               } bit;\r
+       } flags;\r
+} UI_TextBox;\r
+\r
+typedef struct IO_FLOPPYDISK_DIRECTORY_ENTRY {\r
+       uchar name[8];  //0x00:empty(no more files)\r
+                                       //0x05:=0xe5\r
+                                       //0x2e:(only directory)\r
+                                       //.             0x2e:current directory\r
+                                       //..    0x2e, 0x2e:parent directory\r
+                                       //0xe5:deleted(usable)\r
+       uchar ext[3];\r
+       uchar attribute;        //0x0f=LongFileNameEntry\r
+       uchar reserved;\r
+       uchar VFAT_createTimeMs;\r
+       ushort VFAT_createTime;\r
+       ushort VFAT_createDate;\r
+       ushort VFAT_accessDate;\r
+       ushort VFAT_clusterHighWord;\r
+       ushort updatetime;\r
+       ushort updatedate;\r
+       ushort cluster;\r
+       uint size;      //attribute.bit.directory==true:0\r
+} IO_FloppyDisk_DirectoryEntry;\r
+\r
+typedef struct IO_FLOPPYDISK {\r
+       System_CommonStruct common_tag;\r
+       uchar *img;\r
+       IO_FloppyDisk_DirectoryEntry *files;\r
+       sector *userdataarea;\r
+       ushort *fat;\r
+} IO_FloppyDisk;\r
+\r
+typedef union IO_FLOPPYDISK_DIRECTORY_ENTRY_ATTRIBUTE {\r
+       uchar attribute;        //0x0f=LongFileNameEntry\r
+       struct IO_FLOPPYDISK_RDE_ATTRIBUTE_BITS {\r
+               unsigned readonly : 1;\r
+               unsigned hidden : 1;\r
+               unsigned system : 1;\r
+               unsigned volumelabel : 1;\r
+               unsigned directory : 1;\r
+               unsigned archive : 1;\r
+               unsigned bit6 : 1;\r
+               unsigned bit7 : 1;\r
+       } bit;\r
+} IO_FloppyDisk_DirectoryEntry_Attribute;\r
+\r
+typedef union IO_FLOPPYDISK_DIRECTORY_ENTRY_UPDATETIME {\r
+       ushort updatetime;\r
+       struct IO_FLOPPYDISK_RDE_UPDATETIME_BITS {\r
+               unsigned second : 5;    //second/2\r
+               unsigned minute : 6;\r
+               unsigned hour : 5;\r
+       } bit;\r
+} IO_FloppyDisk_DirectoryEntry_UpdateTime;\r
+\r
+typedef union IO_FLOPPYDISK_DIRECTORY_ENTRY_UPDATEDATE {\r
+       ushort updatedate;\r
+       struct IO_FLOPPYDISK_RDE_UPDATEDATE_BITS {\r
+               unsigned day : 5;               //day(1-31)\r
+               unsigned month : 4;     //month(1-12)\r
+               unsigned year : 7;              //year(from 1980)\r
+       } bit;\r
+} IO_FloppyDisk_DirectoryEntry_UpdateDate;\r
+\r
+typedef struct UI_CONSOLE {\r
+       UI_TextBox *textbox;\r
+       UI_Task *task;\r
+       uchar *printf_buffer;\r
+       union UI_CONSOLE_FLAGS {\r
+               uint flags;\r
+               struct UI_CONSOLE_FLAGS_BITS {\r
+                       unsigned initialized : 1;\r
+                       unsigned configured_size : 1;\r
+                       unsigned isprompt : 1;\r
+               } bit;\r
+       } flags;\r
+       IO_FloppyDisk *boot_fd;\r
+} UI_Console;\r
+\r
+typedef struct IO_FILE {\r
+       System_CommonStruct common_tag;\r
+       uchar *path;\r
+       uint size;\r
+       void *img;\r
+       union IO_FILE_FLAGS {\r
+               uint flags;\r
+               struct IO_FILE_FLAGS_BITS {\r
+                       unsigned initialized : 1;\r
+                       unsigned img_loaded : 1;\r
+               } bit;\r
+       } flags;\r
+} IO_File;\r
+\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef2.h b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef2.h
new file mode 100644 (file)
index 0000000..241db73
--- /dev/null
@@ -0,0 +1,4 @@
+\r
+/*\83V\83X\83e\83\80\8aO\95\94\83\8a\83\\81[\83X\90é\8c¾*/\r
+\r
+extern uchar hankaku[4096];    /*hankaku.txt*/\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef3.h b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/coredef3.h
new file mode 100644 (file)
index 0000000..633bf88
--- /dev/null
@@ -0,0 +1,24 @@
+\r
+/*TaskControlMessage\90é\8c¾*/\r
+\r
+//\83^\83X\83N\82É\95W\8f\80\95t\91®\82ÌFIFO\82É\91\97\90M\82³\82ê\82é\81A\83V\83X\83e\83\80\82©\82ç\82Ì\92Ê\92m\81B\r
+//0x80000000\82©\82ç\8en\82Ü\82é\81B=31\83r\83b\83g\96Ú\82ªTrue\82©\82Â\83^\83X\83N\82ÌFIFO\82Å\82 \82ê\82Î\81ATCM\82Å\82 \82é\81B\r
+//\83^\83X\83N\8eÀ\8ds\83\8a\83\93\83N\92\86\82É\82È\82¢\83^\83X\83N\82É\82Í\91\97\90M\82³\82ê\82È\82¢\82ª\81A\83X\83\8a\81[\83v\92\86\82Ì\83^\83X\83N\82É\82Í\91\97\90M\82³\82ê\82é\81B\r
+\r
+#define TCM_OFFSET                                                     0x80000000\r
+#define TCM_NULL                                                       0x80000000\r
+#define TCM_INFO_DISPLAY_UPDATE_RESOLUTION     0x00000001\r
+\r
+//\82»\82Ì\91¼\81A\93ü\97Í\82É\8eg\82í\82ê\82éinput\83o\83b\83t\83@\82Å\82Í\81A\r
+//INPUTSIGNAL_OFFSET\82©\82çSIGNAL_KEY_OFFSET-1\82Í\81A\8ae\8eí\8fî\95ñ\82Ì\93`\92B\82É\8eg\82¤\82½\82ß\82É\83V\83X\83e\83\80\82Å\97\\96ñ\82³\82ê\82Ä\82¢\82é\81B\r
+#define INPUTSIGNAL_OFFSET             0x08000\r
+\r
+#define INPUTSIGNAL_NULL               0x00000\r
+#define INPUTSIGNAL_FOCUS_GOT  0x00001\r
+#define INPUTSIGNAL_FOCUS_LOST 0x00002\r
+#define INPUTSIGNAL_MAX                        0x07fff\r
+\r
+//\82Ü\82½\81ASIGNAL_KEY_OFFSET\82©\82çSIGNAL_KEY_OFFSET+0xffff\82Í\81Akeyid\82Ì\92Ê\92m\82É\8eg\82í\82ê\82é\81B\r
+//\8fÚ\8d×\82Í\81Akeyid.h\82ð\8eQ\8fÆ\81B\r
+#define SIGNAL_KEY_OFFSET 0x10000\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/debug.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/debug.c
new file mode 100644 (file)
index 0000000..df144fa
--- /dev/null
@@ -0,0 +1,166 @@
+#include "core.h"\r
+\r
+//DR7:RWn Breakpoint Condition\r
+//     CR4.DE==1\r
+//             00:Execute Instruction\r
+//             01:Write Data\r
+//             10:I/O R/W\r
+//             11:Data R/W\r
+//     CR4.DE==0\r
+//             00:Execute Operation\r
+//             01:Write Data\r
+//             10:(Undefined)\r
+//             11:Data R/W\r
+\r
+//DR7:LENn Address Location Size\r
+//     00:Byte(or Instruction)\r
+//     01:Word\r
+//     10:(Undefined)\r
+//     11:Double Word\r
+\r
+#ifdef CHNOSPROJECT_DEBUG\r
+\r
+extern uchar *cpu_exception_infos[16]; //error.c\r
+extern uint Error_Output_Display_GraphicMode_UsedLines; //error.c\r
+\r
+uint debug_exception_last_addr;\r
+\r
+void debug(const uchar format[], ...)\r
+{\r
+       uchar s[256];\r
+\r
+       vsnprintf(s, sizeof(s), format, (uint *)(&format + 1));\r
+       SerialPort_Send(s);\r
+       return;\r
+}\r
+\r
+void Debug_PhysicalMemoryDump(void *addr, uint bytes)\r
+{\r
+       uchar *p;\r
+       uint i, j;\r
+       uint eflags;\r
+\r
+       bytes += (uint)addr - ((uint)addr & 0xfffffff0);\r
+       (uint)addr &= 0xfffffff0; \r
+\r
+       j = (bytes + 0x0f) >> 4;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       debug("\n***PhysicalMemoryDump Start***\n");\r
+       debug("Dump from[0x%08X] for 0x%X bytes.\n", addr, j << 4);\r
+       debug("Address+|00|01|02|03|04|05|06|07|08|09|0A|0B|0C|0D|0E|0F|\n");\r
+       for(i = 0; i < j; i++){\r
+               p = (uchar *)((uint)addr + (i << 4));\r
+               debug("%08X:%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X|\n", p, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);\r
+       }\r
+       debug("***PhysicalMemoryDump End***\n");\r
+\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return;\r
+}\r
+\r
+void Debug_Set_Breakpoint(uint reg, void *addr, uint rw, uint len)\r
+{\r
+       CPU_DebugRegister7 dr7;\r
+\r
+       dr7.dr7 = Load_DR7();\r
+\r
+       dr7.bit.LE = True;\r
+       dr7.bit.GE = True;\r
+\r
+       switch(reg){\r
+               case 0:\r
+                       Store_DR0((uint)addr);\r
+                       dr7.bit.L0 = True;\r
+                       dr7.bit.G0 = True;\r
+                       dr7.bit.RW0 = rw;\r
+                       dr7.bit.LEN0 = len;\r
+                       debug("Debug_Set_Breakpoint:Breakpoint%d Enabled(target:[0x%08X] rw:%d len:%d).\n", reg, addr, dr7.bit.RW0, dr7.bit.LEN0);\r
+                       break;\r
+       }\r
+\r
+       Store_DR7(dr7.dr7);\r
+\r
+       return;\r
+}\r
+\r
+void Debug_ExceptionHandler(uint *esp)\r
+{\r
+       uint i, j;\r
+       IO_SegmentDescriptor *gdt;\r
+\r
+       gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       if(esp[0x0a] == debug_exception_last_addr){\r
+               debug("Debug_ExceptionHandler:Ignore debug exception(same eip.)\n");\r
+               return;\r
+       }\r
+\r
+       Error_Put_String("Exception 0x01 Debug. CHNOSProject is running in debug mode.");\r
+\r
+       Error_Put_String("#PUSHAD by _asm_CPU_ExceptionHandler");\r
+       for(i = 0; i < 4; i++){\r
+               Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[i << 1], cpu_exception_infos[(i << 1) + 1], esp[(i << 1) + 1]);\r
+       }\r
+\r
+       Error_Put_String("#PUSH by _asm_CPU_ExceptionHandler");\r
+       for(; i < 5; i++){\r
+               Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[i << 1], cpu_exception_infos[(i << 1) + 1], esp[(i << 1) + 1]);\r
+       }\r
+\r
+       Error_Put_String("#PUSH by CPU");\r
+       Error_Put_String("%s:0x%08X", cpu_exception_infos[(i << 1) + 1], esp[i << 1]);\r
+       i++;\r
+       for(; i < 8; i++){\r
+               Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[(i << 1) - 1], cpu_exception_infos[(i << 1) + 1], esp[i << 1]);\r
+       }\r
+\r
+       Error_Put_String("#Control Registers");\r
+       Error_Put_String("CR0 = 0x%08X", Load_CR0());\r
+       Error_Put_String("CR2 = 0x%08X", Load_CR2());\r
+       Error_Put_String("CR3 = 0x%08X", Load_CR3());\r
+       Error_Put_String("#Debug Registers");\r
+       Error_Put_String("DR0 = 0x%08X", Load_DR0());\r
+       Error_Put_String("DR1 = 0x%08X", Load_DR1());\r
+       Error_Put_String("DR2 = 0x%08X", Load_DR2());\r
+       Error_Put_String("DR3 = 0x%08X", Load_DR3());\r
+       Error_Put_String("DR6 = 0x%08X", Load_DR6());\r
+       Error_Put_String("DR7 = 0x%08X", Load_DR7());\r
+\r
+\r
+       Error_Put_String("Opcode[0x%X:0x%X]:0x%X", SegmentDescriptor_Get_Base(&gdt[esp[0x0b] >> 3]), esp[0x0a], ((uchar *)(SegmentDescriptor_Get_Base(&gdt[esp[0x0b] >> 3])))[esp[0x0a]]);\r
+       Error_Put_String("Press any key to continue.");\r
+\r
+       debug_exception_last_addr = esp[0x0a];\r
+\r
+//Microsot VirtualPC2007 Only\r
+/*\r
+       if(((uchar *)(SegmentDescriptor_Get_Base(&gdt[esp[0x0b] >> 3])))[esp[0x0a]] == 0x89){\r
+               esp[0x0a] += 3;\r
+       }\r
+*/\r
+\r
+Debug_PhysicalMemoryDump((void *)(Load_DR0() - 16), 32);\r
+\r
+//Wait press any key.\r
+       for(;;){\r
+               if((IO_In8(PORT_KEYSTA) & 0x01) != 0){\r
+                       break;\r
+               }\r
+       }\r
+\r
+//Clear Display.\r
+       j = Error_Output_Display_GraphicMode_UsedLines;\r
+       Error_Output_Display_GraphicMode_UsedLines = 0;\r
+       for(i = 0; i < j; i++){\r
+               Error_Put_String("");\r
+       }\r
+       Error_Output_Display_GraphicMode_UsedLines = 0;\r
+\r
+       return;\r
+}\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/display.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/display.c
new file mode 100644 (file)
index 0000000..0af1837
--- /dev/null
@@ -0,0 +1,284 @@
+\r
+#include "core.h"\r
+\r
+//VBE\82ª\8eg\82¦\82é\82Ì\82Í\81Actrl->display_mode == DISPLAYMODE_VBE_LINEAR\82Ì\8e\9e\82¾\82¯\81B\r
+\r
+#define SIGNAL_BIOS_OPERATION_END      0xff\r
+\r
+IO_DisplayControl *Initialize_Display(void)\r
+{\r
+       //\8dÅ\8f\89\82É\8c»\8dÝ\82Ì\89æ\96Ê\83\82\81[\83h\82ðVGA320*200-8bit\82É\90Ý\92è\82·\82é\81B(BIOS)\r
+\r
+       IO_CallBIOSControl *callbiosctrl;\r
+       INFO_VBE_BIOS *info_vbe_bios;\r
+       uint data;\r
+       IO_DisplayControl *ctrl;\r
+       uint i;\r
+       INFO_VBE_VideoMode *info_vbe_vmode;\r
+\r
+       ctrl = (IO_DisplayControl *)System_Memory_Allocate(sizeof(IO_DisplayControl));\r
+\r
+       ctrl->bios_signal = System_FIFO32_Initialize(64);\r
+\r
+       callbiosctrl = System_CallBIOS_Get_Controller();\r
+       callbiosctrl->CallBIOS_Task->tss->eax = 0x0013;\r
+       System_CallBIOS_Execute(0x10, ctrl->bios_signal, SIGNAL_BIOS_OPERATION_END);\r
+\r
+       for(;;){\r
+               if(FIFO32_Status(ctrl->bios_signal) == 0){\r
+\r
+               } else{\r
+                       data = FIFO32_Get(ctrl->bios_signal);\r
+                       if(data == SIGNAL_BIOS_OPERATION_END || data == SIGNAL_BIOS_OPERATION_END + 1){\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+\r
+       ctrl->vmode = 0x0000;\r
+       ctrl->vmode_index = 0;\r
+       ctrl->bpp = 8;\r
+       ctrl->xsize = VGA08_VRAM_XSIZE;\r
+       ctrl->ysize = VGA08_VRAM_YSIZE;\r
+       ctrl->vram = VGA_VRAM_ADR;\r
+\r
+       Drawing08_Initialize_Palette();\r
+       Initialize_Drawing();\r
+       Error_Set_Enable_Display_TextMode(False);\r
+       Error_Set_Enable_Display_GraphicMode(True, ctrl->vram, ctrl->xsize, ctrl->ysize >> 4);\r
+       ctrl->vramsheet = Sheet_Initialize();\r
+       Sheet_SetBuffer(ctrl->vramsheet, ctrl->vram, ctrl->xsize, ctrl->ysize, ctrl->bpp);\r
+\r
+       //\8e\9f\82É\81AVBE\82ÌBIOS\8fî\95ñ\82ð\93¾\82é\81B\r
+\r
+       callbiosctrl->CallBIOS_Task->tss->eax = 0x4f00;\r
+       callbiosctrl->CallBIOS_Task->tss->es = 0x0000;\r
+       callbiosctrl->CallBIOS_Task->tss->edi = 0x0e00;\r
+       System_CallBIOS_Execute(0x10, ctrl->bios_signal, SIGNAL_BIOS_OPERATION_END);\r
+\r
+       for(;;){\r
+               if(FIFO32_Status(ctrl->bios_signal) == 0){\r
+\r
+               } else{\r
+                       data = FIFO32_Get(ctrl->bios_signal);\r
+                       if(data == SIGNAL_BIOS_OPERATION_END || data == SIGNAL_BIOS_OPERATION_END + 1){\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+\r
+       info_vbe_bios = VBE_REALMODE_RETVALUE_ADDRESS;\r
+\r
+       if(data == SIGNAL_BIOS_OPERATION_END && (callbiosctrl->retvalue.eax & 0x000000ff) == 0x4f && (callbiosctrl->retvalue.eax & 0x0000ff00) == 0x00){\r
+               ctrl->VBE.version_minor = info_vbe_bios->ver_minor;\r
+               ctrl->VBE.version_major = info_vbe_bios->ver_major;\r
+               ctrl->VBE.vram_supported_size_kb = info_vbe_bios->vram_supported_size_kb;\r
+               ctrl->VBE.flags = (info_vbe_bios->flags[1] << 8) | info_vbe_bios->flags[0];\r
+               ctrl->VBE.oem_string = (uchar *)(info_vbe_bios->oem_string_segment << 4 | info_vbe_bios->oem_string_offset);\r
+               ctrl->VBE.vmode_args = (ushort *)(info_vbe_bios->vmode_args_segment << 4 | info_vbe_bios->vmode_args_offset);\r
+               if(ctrl->VBE.version_major >= 0x02){\r
+                       ctrl->display_mode = DISPLAYMODE_VBE_LINEAR;\r
+               } else{\r
+                       ctrl->display_mode = DISPLAYMODE_VBE_WINDOW;\r
+               }\r
+               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                       debug("Display:VBE is Enbaled(Version %d.%d).\n", ctrl->VBE.version_major, ctrl->VBE.version_minor);\r
+                       debug("Display:OEM:[%s]\n", ctrl->VBE.oem_string);\r
+               #endif\r
+       } else{\r
+               ctrl->display_mode = DISPLAYMODE_BIOS;\r
+       }\r
+\r
+       if(ctrl->display_mode == DISPLAYMODE_VBE_LINEAR){\r
+               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                       debug("Display:Getting Video Modes...\n");\r
+               #endif\r
+               for(i = 0; ctrl->VBE.vmode_args[i] != 0xffff; i++){\r
+\r
+               }\r
+               ctrl->VBE.list_vmode_tags = i;\r
+               ctrl->VBE.list_vmode = (INFO_VBE_VideoModeTag *)System_Memory_Allocate(sizeof(INFO_VBE_VideoModeTag) * ctrl->VBE.list_vmode_tags);\r
+               info_vbe_vmode = VBE_REALMODE_RETVALUE_ADDRESS;\r
+               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                       debug("Display:VBE has %d Video Modes.\n", ctrl->VBE.list_vmode_tags);\r
+               #endif\r
+               for(i = 0; i < ctrl->VBE.list_vmode_tags; i++){\r
+                       callbiosctrl->CallBIOS_Task->tss->eax = 0x4f01;\r
+                       callbiosctrl->CallBIOS_Task->tss->es = 0x0000;\r
+                       callbiosctrl->CallBIOS_Task->tss->edi = 0x0e00;\r
+                       callbiosctrl->CallBIOS_Task->tss->ecx = ctrl->VBE.vmode_args[i];\r
+                       System_CallBIOS_Execute(0x10, ctrl->bios_signal, SIGNAL_BIOS_OPERATION_END);\r
+\r
+                       for(;;){\r
+                               if(FIFO32_Status(ctrl->bios_signal) == 0){\r
+\r
+                               } else{\r
+                                       data = FIFO32_Get(ctrl->bios_signal);\r
+                                       if(data == SIGNAL_BIOS_OPERATION_END || data == SIGNAL_BIOS_OPERATION_END + 1){\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       if(data == SIGNAL_BIOS_OPERATION_END && (callbiosctrl->retvalue.eax & 0x000000ff) == 0x4f && (callbiosctrl->retvalue.eax & 0x0000ff00) == 0x00){\r
+                               ctrl->VBE.list_vmode[i].mode_number = ctrl->VBE.vmode_args[i];\r
+                               ctrl->VBE.list_vmode[i].xsize = info_vbe_vmode->XResolution;\r
+                               ctrl->VBE.list_vmode[i].ysize = info_vbe_vmode->YResolution;\r
+                               ctrl->VBE.list_vmode[i].bpp = info_vbe_vmode->BitsPerPixel;\r
+                               ctrl->VBE.list_vmode[i].memory_model = info_vbe_vmode->MemoryModel;\r
+                               ctrl->VBE.list_vmode[i].attribute = info_vbe_vmode->ModeAttributes;\r
+                               ctrl->VBE.list_vmode[i].vram = info_vbe_vmode->PhysBasePtr;\r
+                               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                                       debug("Display:%d:0x%X (%dx%d-%dbit) [0x%X]\nDisplay:", i, ctrl->VBE.list_vmode[i].mode_number, ctrl->VBE.list_vmode[i].xsize, ctrl->VBE.list_vmode[i].ysize, ctrl->VBE.list_vmode[i].bpp, ctrl->VBE.list_vmode[i].vram);\r
+                                       if(ctrl->VBE.list_vmode[i].memory_model == 0x04){\r
+                                               debug(" 256-palette");\r
+                                       }\r
+                                       if(ctrl->VBE.list_vmode[i].memory_model == 0x06){\r
+                                               debug(" direct-color");\r
+                                       }\r
+                                       if((ctrl->VBE.list_vmode[i].attribute & (1 << 3)) != 0){\r
+                                               debug(" color");\r
+                                       } else{\r
+                                               debug(" monochrome");\r
+                                       }\r
+                                       if((ctrl->VBE.list_vmode[i].attribute & (1 << 4)) != 0){\r
+                                               debug(" graphic");\r
+                                       } else{\r
+                                               debug(" text");\r
+                                       }\r
+                                       if((ctrl->VBE.list_vmode[i].attribute & (1 << 7)) != 0){\r
+                                               debug(" linear-access-supported");\r
+                                       }\r
+                                       debug("\n");\r
+                                       debug("%d:0x%X %dx%d-%dbits\n", 0, ctrl->VBE.list_vmode[0].mode_number, ctrl->VBE.list_vmode[0].xsize, ctrl->VBE.list_vmode[0].ysize, ctrl->VBE.list_vmode[0].bpp);\r
+\r
+                               #endif\r
+                       } else{\r
+                               ctrl->VBE.list_vmode[i].mode_number = ctrl->VBE.vmode_args[i];\r
+                               ctrl->VBE.list_vmode[i].vram = (void *)0x00000000;\r
+                               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                                       debug("Display:%d:0x%X Function Failed.\n", i, ctrl->VBE.list_vmode[i].mode_number);\r
+                               #endif\r
+                       }\r
+               }\r
+\r
+\r
+       }\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+               debug("Display:Ctrl:[0x%X]\n", ctrl);\r
+               debug("Display:ctrl->VBE.list_vmode[0]:[0x%X]\n", &ctrl->VBE.list_vmode[0]);\r
+               debug("Display:ctrl->bios_signal->buf:[0x%X]\n", ctrl->bios_signal->buf);\r
+       #endif\r
+\r
+       return ctrl;\r
+}\r
+\r
+uint Display_VESA_Set_VideoMode(IO_DisplayControl *ctrl, uint index)\r
+{\r
+       //retvalue:0 = \90Ø\82è\91Ö\82¦\90¬\8c÷\r
+       //retvalue:1 = \90Ø\82è\91Ö\82¦\8e¸\94s(BIOS Call Error)\r
+       //retvalue:2 = \90Ø\82è\91Ö\82¦\8e¸\94s(VBE\96³\8cø version < 2.0)\r
+       //retvalue:3 = \90Ø\82è\91Ö\82¦\8e¸\94s(Invalid VideoMode Index)\r
+       //retvalue:4 = \90Ø\82è\91Ö\82¦\8e¸\94s(Linear Mode Not Supported)\r
+       //retvalue:5 = \90Ø\82è\91Ö\82¦\8e¸\94s(\83V\83X\83e\83\80(CHNOSProject)\8fã\82Å\96¢\91Î\89\9e\82Ì\83r\83b\83g\90\94\82Ì\82½\82ß)\r
+       //retvalue:6 = \90Ø\82è\91Ö\82¦\8e¸\94s(\83V\83X\83e\83\80(CHNOSProject)\8fã\82Å\96³\8cø\82Æ\83}\81[\83N\82³\82ê\82Ä\82¢\82é(vram == null)\82½\82ß)\r
+\r
+       IO_CallBIOSControl *callbiosctrl;\r
+       uint data;\r
+\r
+       callbiosctrl = System_CallBIOS_Get_Controller();\r
+\r
+       if(ctrl->display_mode != DISPLAYMODE_VBE_LINEAR){\r
+               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                       debug("SetVideo:Error:VBE version < 2.0.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       if(index >= ctrl->VBE.list_vmode_tags){\r
+               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                       debug("SetVideo:Error:Invalid VideoMode Index.\n");\r
+               #endif\r
+               return 3;\r
+       }\r
+\r
+       if((ctrl->VBE.list_vmode[index].attribute & (1 << 7)) == 0){\r
+               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                       debug("SetVideo:Error:This VideoMode is Not Supported Linear Mode.\n");\r
+               #endif\r
+               return 4;\r
+       }\r
+\r
+       if(!(ctrl->VBE.list_vmode[index].bpp == 8 || ctrl->VBE.list_vmode[index].bpp == 16 || ctrl->VBE.list_vmode[index].bpp == 32)){\r
+               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                       debug("SetVideo:Error:This VideoMode's BitsPerPixel is Not Supported in CHNOSProject.\n");\r
+               #endif\r
+               return 5;\r
+       }\r
+\r
+       if(ctrl->VBE.list_vmode[index].vram == 0x00000000){\r
+               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                       debug("SetVideo:Error:This VideoMode has been Marked Invalid(vram==null).\n");\r
+               #endif\r
+               return 6;\r
+       }\r
+\r
+       callbiosctrl->CallBIOS_Task->tss->eax = 0x4f02;\r
+       callbiosctrl->CallBIOS_Task->tss->ebx = ctrl->VBE.list_vmode[index].mode_number | VESA_LINEAR_ACCESS;\r
+       System_CallBIOS_Execute(0x10, ctrl->bios_signal, SIGNAL_BIOS_OPERATION_END);\r
+\r
+       for(;;){\r
+               if(FIFO32_Status(ctrl->bios_signal) == 0){\r
+\r
+               } else{\r
+                       data = FIFO32_Get(ctrl->bios_signal);\r
+                       if(data == SIGNAL_BIOS_OPERATION_END || data == SIGNAL_BIOS_OPERATION_END + 1){\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+\r
+       if(data == SIGNAL_BIOS_OPERATION_END && (callbiosctrl->retvalue.eax & 0x000000ff) == 0x4f && (callbiosctrl->retvalue.eax & 0x0000ff00) == 0x00){\r
+               ctrl->vmode = ctrl->VBE.list_vmode[index].mode_number;\r
+               ctrl->vmode_index = index;\r
+               ctrl->bpp = ctrl->VBE.list_vmode[index].bpp;\r
+               ctrl->xsize = ctrl->VBE.list_vmode[index].xsize;\r
+               ctrl->ysize = ctrl->VBE.list_vmode[index].ysize;\r
+               ctrl->vram = ctrl->VBE.list_vmode[index].vram;\r
+               #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+                       debug("Display:VBE VideoMode Changed.\nDisplay:%d:0x%X (%dx%d-%dbit) [0x%X]\nDisplay:", index, ctrl->VBE.list_vmode[index].mode_number, ctrl->VBE.list_vmode[index].xsize, ctrl->VBE.list_vmode[index].ysize, ctrl->VBE.list_vmode[index].bpp, ctrl->VBE.list_vmode[index].vram);\r
+                       if(ctrl->VBE.list_vmode[index].memory_model == 0x04){\r
+                               debug(" 256-palette");\r
+                       }\r
+                       if(ctrl->VBE.list_vmode[index].memory_model == 0x06){\r
+                               debug(" direct-color");\r
+                       }\r
+                       if((ctrl->VBE.list_vmode[index].attribute & (1 << 3)) != 0){\r
+                               debug(" color");\r
+                       } else{\r
+                               debug(" monochrome");\r
+                       }\r
+                       if((ctrl->VBE.list_vmode[index].attribute & (1 << 4)) != 0){\r
+                               debug(" graphic");\r
+                       } else{\r
+                               debug(" text");\r
+                       }\r
+                       if((ctrl->VBE.list_vmode[index].attribute & (1 << 7)) != 0){\r
+                               debug(" linear-access-supported");\r
+                       }\r
+                       debug("\n");\r
+               #endif\r
+               Initialize_Drawing();\r
+               Error_Set_Enable_Display_GraphicMode(True, ctrl->vram, ctrl->xsize, ctrl->ysize >> 4);\r
+               Sheet_SetBuffer(ctrl->vramsheet, ctrl->vram, ctrl->xsize, ctrl->ysize, ctrl->bpp);\r
+               System_TaskControlMessage_Send_AllTask(TCM_OFFSET + TCM_INFO_DISPLAY_UPDATE_RESOLUTION);\r
+               return 0;\r
+       }\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_DISPLAY\r
+               debug("Display:%d:0x%X Function Failed.\n", index, ctrl->VBE.list_vmode[index].mode_number);\r
+       #endif\r
+\r
+       return 1;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/draw08.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/draw08.c
new file mode 100644 (file)
index 0000000..f52a9e5
--- /dev/null
@@ -0,0 +1,134 @@
+\r
+#include "core.h"\r
+\r
+void Drawing08_Initialize_Palette(void)\r
+{\r
+       static uchar table_rgb[16 * 3] = {\r
+               0x00, 0x00, 0x00,\r
+               0xff, 0x00, 0x00,\r
+               0x00, 0xff, 0x00,\r
+               0xff, 0xff, 0x00,\r
+               0x00, 0x00, 0xff,\r
+               0xff, 0x00, 0xff,\r
+               0x00, 0xff, 0xff,\r
+               0xff, 0xff, 0xff,\r
+               0xc6, 0xc6, 0xc6,\r
+               0x84, 0x00, 0x00,\r
+               0x00, 0x84, 0x00,\r
+               0x84, 0x84, 0x00,\r
+               0x00, 0x00, 0x84,\r
+               0x84, 0x00, 0x84,\r
+               0x00, 0x84, 0x84,\r
+               0x84, 0x84, 0x84\r
+       };\r
+       uchar table2[216 * 3];\r
+       uint r, g, b;\r
+\r
+       Drawing08_Set_Palette(0, 15, table_rgb);\r
+       for (b = 0; b < 6; b++) {\r
+               for (g = 0; g < 6; g++) {\r
+                       for (r = 0; r < 6; r++) {\r
+                               table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;\r
+                               table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;\r
+                               table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;\r
+                       }\r
+               }\r
+       }\r
+       Drawing08_Set_Palette(16, 231, table2);\r
+\r
+       return;\r
+}\r
+\r
+void Drawing08_Set_Palette(uint start, uint end, uchar *rgb)\r
+{\r
+       uint i, eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI(); \r
+       IO_Out8(VGA_VDAC_WRITE_ADR, start);\r
+       for (i = start; i <= end; i++) {\r
+               IO_Out8(VGA_VDAC_DATA, rgb[0] >> 2);\r
+               IO_Out8(VGA_VDAC_DATA, rgb[1] >> 2);\r
+               IO_Out8(VGA_VDAC_DATA, rgb[2] >> 2);\r
+               rgb += 3;\r
+       }\r
+       IO_Store_EFlags(eflags);\r
+       return;\r
+}\r
+\r
+void Drawing08_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)\r
+{\r
+       uint x, y;\r
+\r
+//if negative location\r
+       if((x0 & 0x80000000) != 0 || (y0 & 0x80000000) != 0 || (x1 & 0x80000000) != 0 || (y1 & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       c = RGB_32_To_08(c);\r
+       for(y = y0; y <= y1; y++){\r
+               for(x = x0; x <= x1; x++){\r
+                       ((uchar *)vram)[y * xsize + x] = (uchar)c;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing08_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)\r
+{\r
+       int i;\r
+       uchar d;\r
+       uchar *p;\r
+\r
+//if negative location\r
+       if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       for (i = 0; i < 16; i++) {\r
+               p = (uchar *)(vram + (y + i) * xsize + x);\r
+               d = font[i];\r
+               if ((d & 0x80) != 0) { p[0] = (uchar)c; }\r
+               if ((d & 0x40) != 0) { p[1] = (uchar)c; }\r
+               if ((d & 0x20) != 0) { p[2] = (uchar)c; }\r
+               if ((d & 0x10) != 0) { p[3] = (uchar)c; }\r
+               if ((d & 0x08) != 0) { p[4] = (uchar)c; }\r
+               if ((d & 0x04) != 0) { p[5] = (uchar)c; }\r
+               if ((d & 0x02) != 0) { p[6] = (uchar)c; }\r
+               if ((d & 0x01) != 0) { p[7] = (uchar)c; }\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing08_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[])\r
+{\r
+//if negative location\r
+       if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       if(s == Null){\r
+               return;\r
+       }\r
+\r
+       c = RGB_32_To_08(c);\r
+       for(; *s != 0x00; s++){\r
+               if(x > xsize - 8){\r
+                       break;\r
+               }\r
+               Drawing08_Put_Font(vram, xsize, x, y, c, hankaku + *s * 16);\r
+               x += 8;\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing08_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)\r
+{\r
+//if negative location\r
+       if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       ((uchar *)vram)[y * xsize + x] = RGB_32_To_08_xy(c, x, y);\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/draw16.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/draw16.c
new file mode 100644 (file)
index 0000000..b0409ce
--- /dev/null
@@ -0,0 +1,79 @@
+\r
+#include "core.h"\r
+\r
+void Drawing16_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)\r
+{\r
+       uint x, y;\r
+\r
+//if negative location\r
+       if((x0 & 0x80000000) != 0 || (y0 & 0x80000000) != 0 || (x1 & 0x80000000) != 0 || (y1 & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       c = RGB_32_To_16(c);\r
+       for(y = y0; y <= y1; y++){\r
+               for(x = x0; x <= x1; x++){\r
+                       ((ushort *)vram)[y * xsize + x] = (ushort)c;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing16_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)\r
+{\r
+       int i;\r
+       uchar d;\r
+       ushort *p;\r
+\r
+//if negative location\r
+       if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       for (i = 0; i < 16; i++) {\r
+               p = (ushort *)vram + (y + i) * xsize + x;\r
+               d = font[i];\r
+               if ((d & 0x80) != 0) { p[0] = (ushort)c; }\r
+               if ((d & 0x40) != 0) { p[1] = (ushort)c; }\r
+               if ((d & 0x20) != 0) { p[2] = (ushort)c; }\r
+               if ((d & 0x10) != 0) { p[3] = (ushort)c; }\r
+               if ((d & 0x08) != 0) { p[4] = (ushort)c; }\r
+               if ((d & 0x04) != 0) { p[5] = (ushort)c; }\r
+               if ((d & 0x02) != 0) { p[6] = (ushort)c; }\r
+               if ((d & 0x01) != 0) { p[7] = (ushort)c; }\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing16_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[])\r
+{\r
+//if negative location\r
+       if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       if(s == Null){\r
+               return;\r
+       }\r
+\r
+       c = RGB_32_To_16(c);\r
+       for(; *s != 0x00; s++){\r
+               if(x > xsize - 8){\r
+                       break;\r
+               }\r
+               Drawing16_Put_Font(vram, xsize, x, y, c, hankaku + *s * 16);\r
+               x += 8;\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing16_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)\r
+{\r
+//if negative location\r
+       if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       ((ushort *)vram)[y * xsize + x] = RGB_32_To_16(c);\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/draw32.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/draw32.c
new file mode 100644 (file)
index 0000000..713be02
--- /dev/null
@@ -0,0 +1,77 @@
+\r
+#include "core.h"\r
+\r
+void Drawing32_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)\r
+{\r
+       uint x, y;\r
+\r
+//if negative location\r
+       if((x0 & 0x80000000) != 0 || (y0 & 0x80000000) != 0 || (x1 & 0x80000000) != 0 || (y1 & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       for(y = y0; y <= y1; y++){\r
+               for(x = x0; x <= x1; x++){\r
+                       ((uint *)vram)[y * xsize + x] = c;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing32_Put_Font(void *vram, uint xsize, uint x, uint y, uint c, const uchar *font)\r
+{\r
+       int i;\r
+       uchar d;\r
+       uint *p;\r
+\r
+//if negative location\r
+       if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       for (i = 0; i < 16; i++) {\r
+               p = (uint *)vram + (y + i) * xsize + x;\r
+               d = font[i];\r
+               if ((d & 0x80) != 0) { p[0] = (uint)c; }\r
+               if ((d & 0x40) != 0) { p[1] = (uint)c; }\r
+               if ((d & 0x20) != 0) { p[2] = (uint)c; }\r
+               if ((d & 0x10) != 0) { p[3] = (uint)c; }\r
+               if ((d & 0x08) != 0) { p[4] = (uint)c; }\r
+               if ((d & 0x04) != 0) { p[5] = (uint)c; }\r
+               if ((d & 0x02) != 0) { p[6] = (uint)c; }\r
+               if ((d & 0x01) != 0) { p[7] = (uint)c; }\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing32_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar s[])\r
+{\r
+//if negative location\r
+       if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       if(s == Null){\r
+               return;\r
+       }\r
+\r
+       for(; *s != 0x00; s++){\r
+               if(x > xsize - 8){\r
+                       break;\r
+               }\r
+               Drawing32_Put_Font(vram, xsize, x, y, c, hankaku + *s * 16);\r
+               x += 8;\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing32_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)\r
+{\r
+//if negative location\r
+       if((x & 0x80000000) != 0 || (y & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       ((uint *)vram)[y * xsize + x] = c;\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/drawing.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/drawing.c
new file mode 100644 (file)
index 0000000..b86c111
--- /dev/null
@@ -0,0 +1,161 @@
+\r
+#include "core.h"\r
+\r
+void (*Drawing_Fill_Rectangle)(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1);\r
+void (*Drawing_Put_String)(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s);\r
+void (*Drawing_Draw_Point)(void *vram, uint xsize, uint x, uint y, uint c);\r
+//Drawing\82É\8aÜ\82Ü\82ê\82é\92á\83\8c\83x\83\8b\95`\89æ\8aÖ\90\94\82Í\91S\82Ä\81A\8dÀ\95W\82Í\95\84\8d\86\82È\82µ\90®\90\94\82Å\82 \82è\81Avram\82Ì\8d\8fã\82Ì\8dÀ\95W\82ð\8c´\93_(0, 0)\82Æ\82µ\82Ä\81Ax\82Í\89E\95û\8cü\81Ay\82Í\89º\95û\8cü\82É\91\9d\89Á\82·\82é\81B\r
+//\82Ü\82½\81A\93ñ\93_\82Ì\8dÀ\95W\82ð\82Æ\82é\8aÖ\90\94\82Í\81A\81i\8aî\96{\93I\82É\81j\91S\82Ä\88ø\90\94\8d\91¤\82ªx\90¬\95ª\82Ì\8f¬\82³\82¢\91¤\81i\8c´\93_\82É\8bß\82¢\81j\82Å\82È\82¯\82ê\82Î\82È\82ç\82È\82¢\81B\r
+//\8d\82\83\8c\83x\83\8b\95`\89æ\8aÖ\90\94\82Å\82Í\81A\82»\82ê\82ç\82ð\8fã\8eè\82­\83\89\83b\83v\82·\82×\82«\82Å\82 \82é\81B\r
+\r
+void Initialize_Drawing(void)\r
+{\r
+       IO_DisplayControl *dispctrl;\r
+\r
+       dispctrl = System_Display_Get_Controller();\r
+\r
+       if(dispctrl->bpp == 8){\r
+               Drawing_Fill_Rectangle  = Drawing08_Fill_Rectangle;\r
+               Drawing_Put_String      = Drawing08_Put_String;\r
+               Drawing_Draw_Point      = Drawing08_Draw_Point;\r
+               Drawing08_Initialize_Palette();\r
+       } else if(dispctrl->bpp == 16){\r
+               Drawing_Fill_Rectangle  = Drawing16_Fill_Rectangle;\r
+               Drawing_Put_String      = Drawing16_Put_String;\r
+               Drawing_Draw_Point      = Drawing16_Draw_Point;\r
+       } else if(dispctrl->bpp == 32){\r
+               Drawing_Fill_Rectangle  = Drawing32_Fill_Rectangle;\r
+               Drawing_Put_String      = Drawing32_Put_String;\r
+               Drawing_Draw_Point      = Drawing32_Draw_Point;\r
+       } else{\r
+               Drawing_Fill_Rectangle  = Drawing_Invalid_Fill_Rectangle;\r
+               Drawing_Put_String      = Drawing_Invalid_Put_String;\r
+               Drawing_Draw_Point      = Drawing_Invalid_Draw_Point;\r
+               #ifdef CHNOSPROJECT_DEBUG_DRAWING\r
+                       debug("Initalise_Drawing:Not implemented %d bpp.\n", dispctrl->bpp);\r
+               #endif\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing_Invalid_Fill_Rectangle(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)\r
+{\r
+       #ifdef CHNOSPROJECT_DEBUG_DRAWING\r
+               debug("Drawing_Invalid_Fill_Rectangle:[0x%X] xsize:%d color:0x%X\nDrawing_Invalid_Fill_Rectangle: (%d, %d) -> (%d, %d)\n", vram, xsize, c, x0, y0, x1, y1);\r
+       #endif\r
+       return;\r
+}\r
+\r
+void Drawing_Invalid_Put_String(void *vram, uint xsize, uint x, uint y, uint c, const uchar *s)\r
+{\r
+       #ifdef CHNOSPROJECT_DEBUG_DRAWING\r
+               debug("Drawing_Invalid_Put_String:[0x%X] xsize:%d (%d, %d) color:0x%X\nDrawing_Invalid_Put_String:>%s\n", vram, xsize, x, y, c, s);\r
+       #endif\r
+       return;\r
+}\r
+\r
+void Drawing_Invalid_Draw_Point(void *vram, uint xsize, uint x, uint y, uint c)\r
+{\r
+       #ifdef CHNOSPROJECT_DEBUG_DRAWING\r
+               debug("Drawing_Invalid_Draw_Point:[0x%X] xsize:%d (%d, %d) color:0x%X\n", vram, xsize, x, y, c);\r
+       #endif\r
+       return;\r
+}\r
+\r
+void Drawing_Draw_Line_PQ(void *vram, uint xsize, uint c, uint x0, uint y0, uint x1, uint y1)\r
+{\r
+       uint lx;\r
+       uint i;\r
+       uint a;\r
+\r
+//if negative position\r
+       if((x0 & 0x80000000) != 0 || (y0 & 0x80000000) != 0 || (x1 & 0x80000000) != 0 || (y1 & 0x80000000) != 0){\r
+               return;\r
+       }\r
+\r
+       if(x1 < x0){\r
+               lx = x0;\r
+               x0 = x1;\r
+               x1 = lx;\r
+\r
+               lx = y0;\r
+               y0 = y1;\r
+               y1 = lx;\r
+       } else if(x1 == x0){\r
+               if(y0 <= y1){\r
+                       for(i = 0; i < y1 - y0 + 1; i++){\r
+                               Drawing_Draw_Point(vram, xsize, x0, y0 + i, c);\r
+                       }\r
+               } else{\r
+                       for(i = 0; i < y0 - y1 + 1; i++){\r
+                               Drawing_Draw_Point(vram, xsize, x0, y1 + i, c);\r
+                       }\r
+               }\r
+               return;\r
+       }\r
+\r
+       lx = x1 - x0;\r
+       if(lx == 0){\r
+               lx = 1;\r
+       }\r
+\r
+       if(y0 <= y1){   //+a\r
+               a = ((y1 - y0) << 10) / lx;\r
+               for(i = 0; i < lx; i++){\r
+                       Drawing_Draw_Line_PQ(vram, xsize, c, x0 + i, y0 + ((i * a) >> 10), x0 + i,  y0 + (((i + 1) * a) >> 10));\r
+               }\r
+       } else{ //-a\r
+               a = ((y0 - y1) << 10) / lx;\r
+               for(i = 0; i < lx; i++){\r
+                       Drawing_Draw_Line_PQ(vram, xsize, c, x0 + i, y0 - ((i * a) >> 10), x0 + i,  y0 - (((i + 1) * a) >> 10));\r
+               }\r
+       }\r
+\r
+       Drawing_Draw_Point(vram, xsize, x1, y1, c);\r
+\r
+       return;\r
+}\r
+\r
+void Drawing_Draw_Circle(void *vram, uint xsize, uint x, uint y, uint c, uint r)\r
+{\r
+       uint i, r2;\r
+       uint py0, py1;\r
+\r
+       if(r > 0xfff){\r
+               return;\r
+       }\r
+\r
+       r2 = r * r;\r
+\r
+       for(i = 0; i < r; i++){\r
+               py0 = (isqrt((r2 - (i * i)) << 8) + (1 << 2)) >> 4;\r
+               py1 = (isqrt((r2 - ((i + 1) * (i + 1))) << 8) + (1 << 2)) >> 4;\r
+               Drawing_Draw_Line_PQ(vram, xsize, c, x + i, y + py0, x + i + 1, y + py1);\r
+               Drawing_Draw_Line_PQ(vram, xsize, c, x - i, y + py0, x - i - 1, y + py1);\r
+               Drawing_Draw_Line_PQ(vram, xsize, c, x - i, y - py0, x - i - 1, y - py1);\r
+               Drawing_Draw_Line_PQ(vram, xsize, c, x + i, y - py0, x + i + 1, y - py1);\r
+       }\r
+       return;\r
+}\r
+\r
+void Drawing_Fill_Circle(void *vram, uint xsize, uint x, uint y, uint c, uint r)\r
+{\r
+       uint i, r2;\r
+       uint py0, py1;\r
+\r
+       if(r > 0xfff){\r
+               return;\r
+       }\r
+\r
+       r2 = r * r;\r
+\r
+       for(i = 0; i < r; i ++){\r
+               py0 = (isqrt((r2 - (i * i)) << 8) + (1 << 2)) >> 4;\r
+               py1 = (isqrt((r2 - ((i + 1) * (i + 1))) << 8) + (1 << 2)) >> 4;\r
+               Drawing_Draw_Line_PQ(vram, xsize, c, x + i + 1, y - py1, x + i + 1, y + py1);\r
+               Drawing_Draw_Line_PQ(vram, xsize, c, x - i - 1, y - py1, x - i - 1, y + py1);\r
+       }\r
+       Drawing_Draw_Line_PQ(vram, xsize, c, x, y - r, x, y + r);\r
+       return;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/dsctbl.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/dsctbl.c
new file mode 100644 (file)
index 0000000..e25d026
--- /dev/null
@@ -0,0 +1,111 @@
+\r
+#include "core.h"\r
+\r
+void Initialize_GlobalDescriptorTable(void)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; i < 8192; i++){\r
+               System_SegmentDescriptor_Set_Absolute(i, 0, 0, 0);\r
+       }\r
+\r
+       System_SegmentDescriptor_Set_Absolute(SYSTEM_DS, 0xffffffff, 0x00000000, AR_DATA32_RW);\r
+       System_SegmentDescriptor_Set_Absolute(SYSTEM_CS, LIMIT_BOOTPACK, ADR_BOOTPACK, AR_CODE32_ER);\r
+\r
+       Load_GDTR(LIMIT_GDT, ADR_GDT);\r
+\r
+       return;\r
+}\r
+\r
+void Initialize_InterruptDescriptorTable(void)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; i < 256; i++) {\r
+               System_GateDescriptor_Set(i, 0, 0, 0);\r
+       }\r
+\r
+       Load_IDTR(LIMIT_IDT, ADR_IDT);\r
+\r
+       System_GateDescriptor_Set(0x00, (uint)asm_CPU_ExceptionHandler00, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x01, (uint)asm_CPU_ExceptionHandler01, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x02, (uint)asm_CPU_ExceptionHandler02, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x03, (uint)asm_CPU_ExceptionHandler03, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x04, (uint)asm_CPU_ExceptionHandler04, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x05, (uint)asm_CPU_ExceptionHandler05, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x06, (uint)asm_CPU_ExceptionHandler06, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x07, (uint)asm_CPU_ExceptionHandler07, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x08, (uint)asm_CPU_ExceptionHandler08, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x09, (uint)asm_CPU_ExceptionHandler09, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0a, (uint)asm_CPU_ExceptionHandler0a, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0b, (uint)asm_CPU_ExceptionHandler0b, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0c, (uint)asm_CPU_ExceptionHandler0c, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0d, (uint)asm_CPU_ExceptionHandler0d, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0e, (uint)asm_CPU_ExceptionHandler0e, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x0f, (uint)asm_CPU_ExceptionHandler0f, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x10, (uint)asm_CPU_ExceptionHandler10, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x11, (uint)asm_CPU_ExceptionHandler11, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x12, (uint)asm_CPU_ExceptionHandler12, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x13, (uint)asm_CPU_ExceptionHandler13, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x14, (uint)asm_CPU_ExceptionHandler14, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x15, (uint)asm_CPU_ExceptionHandler15, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x16, (uint)asm_CPU_ExceptionHandler16, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x17, (uint)asm_CPU_ExceptionHandler17, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x18, (uint)asm_CPU_ExceptionHandler18, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x19, (uint)asm_CPU_ExceptionHandler19, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1a, (uint)asm_CPU_ExceptionHandler1a, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1b, (uint)asm_CPU_ExceptionHandler1b, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1c, (uint)asm_CPU_ExceptionHandler1c, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1d, (uint)asm_CPU_ExceptionHandler1d, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1e, (uint)asm_CPU_ExceptionHandler1e, SYSTEM_CS, AR_INTGATE32);\r
+       System_GateDescriptor_Set(0x1f, (uint)asm_CPU_ExceptionHandler1f, SYSTEM_CS, AR_INTGATE32);\r
+\r
+       return;\r
+}\r
+\r
+void SegmentDescriptor_Set(IO_SegmentDescriptor *seg_desc, uint limit, uint base, uint ar)\r
+{\r
+       if(limit > 0xfffff){\r
+               ar |= 0x8000;\r
+               limit = limit >> 12;\r
+       }\r
+       seg_desc->limit_low     = limit & 0xffff;\r
+       seg_desc->base_low      = base & 0xffff;\r
+       seg_desc->base_mid      = (base >> 16) & 0xff;\r
+       seg_desc->access_right  = ar & 0xff;\r
+       seg_desc->limit_high    = ((limit >> 16) & 0x0f) | ((ar >> 8) & 0xf0);\r
+       seg_desc->base_high     = (base >> 24) & 0xff;\r
+\r
+       return;\r
+}\r
+\r
+uint SegmentDescriptor_Get_Base(IO_SegmentDescriptor *seg_desc)\r
+{\r
+       return (seg_desc->base_low | (seg_desc->base_mid << 16) | (seg_desc->base_high << 24));\r
+}\r
+\r
+uint SegmentDescriptor_Get_Limit(IO_SegmentDescriptor *seg_desc)\r
+{\r
+       if((seg_desc->limit_high & 0x80) != 0){\r
+               return ((((seg_desc->limit_low | ((seg_desc->limit_high & 0x0f) << 16))) << 12) | 0xFFF);\r
+       }\r
+\r
+       return (seg_desc->limit_low | ((seg_desc->limit_high & 0x0f) << 16));\r
+}\r
+\r
+uint SegmentDescriptor_Get_AccessRight(IO_SegmentDescriptor *seg_desc)\r
+{\r
+       return (seg_desc->access_right | ((seg_desc->limit_high & 0xf0) << 8)) & 0x7FFF;\r
+}\r
+\r
+void GateDescriptor_Set(IO_GateDescriptor *gate_desc, uint offset, uint selector, uint ar)\r
+{\r
+       gate_desc->offset_low           = offset & 0xffff;\r
+       gate_desc->selector             = selector << 3;\r
+       gate_desc->dw_count             = (ar >> 8) & 0xff;\r
+       gate_desc->access_right = ar & 0xff;\r
+       gate_desc->offset_high          = (offset >> 16) & 0xffff;\r
+\r
+       return;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/emu86.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/emu86.c
new file mode 100644 (file)
index 0000000..3135734
--- /dev/null
@@ -0,0 +1,1336 @@
+\r
+#include "core.h"\r
+\r
+//x86\83G\83~\83\85\83\8c\81[\83^\r
+//\89¼\91z86\83\82\81[\83h\82ð\97\98\97p\82·\82é\82Ì\82ª\93ï\82µ\82»\82¤\82È\82Ì\82Å\81A16bit\83R\81[\83h\82Ì\82Ý\91Î\89\9e\82Å\97Ç\82¢\82©\82ç\81A\r
+//CPU\82Æ\93¯\93\99\82Ì\93®\8dì\82ð\82·\82é\83G\83~\83\85\83\8c\81[\83^\81[\82ð\8dì\82é\81B\r
+//\83\81\83\82\83\8a\82Ö\82Ì\91S\8c \83A\83N\83Z\83X\82ª\89Â\94\\82Å\82 \82é\82±\82Æ\82ª\91O\92ñ\81B\r
+\r
+uchar *Emulator_x86_RegNames[] = {\r
+       "AX",\r
+       "CX",\r
+       "DX",\r
+       "BX",\r
+       "SP",\r
+       "BP",\r
+       "SI",\r
+       "DI"\r
+};\r
+\r
+uchar *Emulator_x86_SRegNames[] = {\r
+       "ES",\r
+       "CS",\r
+       "SS",\r
+       "DS",\r
+       "FS",\r
+       "GS",\r
+       "xx",\r
+       "xx"\r
+};\r
+\r
+uchar *Emulator_x86_ByteRegNames[] = {\r
+       "AL",\r
+       "CL",\r
+       "DL",\r
+       "BL",\r
+       "AH",\r
+       "CH",\r
+       "DH",\r
+       "BH"\r
+};\r
+\r
+void Emulator_x86_Initialize(Emulator_x86_Environment *env)\r
+{\r
+       env->EFLAGS.eflags                      = 0x00000002;\r
+       env->EIP                                = 0x0000fff0;\r
+\r
+       env->CR0.cr0                            = 0x60000010;\r
+       env->CR2                                = 0x00000000;\r
+       env->CR3.cr3                            = 0x00000000;\r
+       env->CR4.cr4                            = 0x00000000;\r
+\r
+       env->SReg[OPCODE_SREG3_ES].selector     = 0x0000;\r
+       env->SReg[OPCODE_SREG3_ES].base         = 0x00000000;\r
+       env->SReg[OPCODE_SREG3_ES].limit        = 0xffff;\r
+       env->SReg[OPCODE_SREG3_ES].type         = AR_PRESENT + AR_TYPE_DATA_RW + AR_TYPE_ACCESSED;\r
+       env->SReg[OPCODE_SREG3_CS]              = env->SReg[OPCODE_SREG3_ES];\r
+       env->SReg[OPCODE_SREG3_SS]              = env->SReg[OPCODE_SREG3_ES];\r
+       env->SReg[OPCODE_SREG3_DS]              = env->SReg[OPCODE_SREG3_ES];\r
+       env->SReg[OPCODE_SREG3_FS]              = env->SReg[OPCODE_SREG3_ES];\r
+       env->SReg[OPCODE_SREG3_GS]              = env->SReg[OPCODE_SREG3_ES];\r
+\r
+       env->GReg[OPCODE_REG_EAX]               = 0x00000000;\r
+       env->GReg[OPCODE_REG_ECX]               = 0x00000000;\r
+       env->GReg[OPCODE_REG_EDX]               = 0x00000000;\r
+       env->GReg[OPCODE_REG_EBX]               = 0x00000000;\r
+       env->GReg[OPCODE_REG_ESP]               = 0x00000000;\r
+       env->GReg[OPCODE_REG_EBP]               = 0x00000000;\r
+       env->GReg[OPCODE_REG_ESI]               = 0x00000000;\r
+       env->GReg[OPCODE_REG_EDI]               = 0x00000000;\r
+\r
+       env->GDTR.base                          = 0x00000000;\r
+       env->GDTR.limit                         = 0xffff;\r
+\r
+       env->IDTR.base                          = 0x00000000;\r
+       env->IDTR.limit                         = 0xffff;\r
+\r
+       env->now_opcode                         = 0x00;\r
+       env->operation_end                      = False;\r
+       env->operation_32bit                    = False;\r
+\r
+       return;\r
+}\r
+\r
+uint Emulator_x86_Execute(Emulator_x86_Environment *env)\r
+{\r
+       Emulator_x86_Put_EmulationInformation(env, "Emulator-x86:EIP=0x%08X ", env->EIP);\r
+\r
+       env->operation_prefix_lock_repeat = OPCODE_PREFIX_NONE;\r
+       env->operation_prefix_segment = OPCODE_SREG3_DS;\r
+       env->operation_prefix_opsize = OPCODE_PREFIX_NONE;\r
+       env->operation_prefix_addrsize = OPCODE_PREFIX_NONE;\r
+\r
+       for(; !env->operation_end; ){\r
+               env->now_opcode = Emulator_x86_FetchCode(env, 1);\r
+               Emulator_x86_Put_EmulationInformation(env, "opcode=0x%02X ", env->now_opcode);\r
+\r
+               if(0x40 <= env->now_opcode && env->now_opcode <= 0x47){ /*INC FullReg*/\r
+                       Emulator_x86_Operation_INC_RegOnly(env);\r
+\r
+               } else if(0x48 <= env->now_opcode && env->now_opcode <= 0x4F){  /*DEC FullReg*/\r
+                       Emulator_x86_Operation_DEC_RegOnly(env);\r
+\r
+               } else if(0x50 <= env->now_opcode && env->now_opcode <= 0x57){  /*PUSH FullReg*/\r
+                       Emulator_x86_Operation_PUSH_RegOnly(env);\r
+\r
+               } else if(0x58 <= env->now_opcode && env->now_opcode <= 0x5F){  /*POP FullReg*/\r
+                       Emulator_x86_Operation_POP_RegOnly(env);\r
+\r
+               } else if(0xB0 <= env->now_opcode && env->now_opcode <= 0xB7){  /*MOV ByteReg*/\r
+                       Emulator_x86_Operation_MOV_To_ByteReg(env);\r
+\r
+               } else if(0xB8 <= env->now_opcode && env->now_opcode <= 0xBF){  /*MOV FullSize*/\r
+                       Emulator_x86_Operation_MOV_To_Reg_FullSize(env);\r
+\r
+               } else if(env->now_opcode == 0x1B){     /*SBB Gv, Ev*/\r
+                       Emulator_x86_Operation_SBB_Gv_Ev(env);\r
+\r
+               } else if(env->now_opcode == 0x1E){     /*PUSH DS*/\r
+                       Emulator_x86_Push_SReg_To_Stack(env, OPCODE_SREG3_DS);\r
+                       env->operation_end = True;\r
+\r
+               } else if(env->now_opcode == 0x1F){     /*POP DS*/\r
+                       Emulator_x86_Pop_SReg_From_Stack(env, OPCODE_SREG3_DS);\r
+                       env->operation_end = True;\r
+\r
+               } else if(env->now_opcode == 0x26){     /*ES Prefix*/\r
+                       env->operation_prefix_segment = OPCODE_SREG3_ES;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:ES)");\r
+\r
+               } else if(env->now_opcode == 0x2E){     /*CS/BranchNotTaken Prefix*/\r
+                       env->operation_prefix_segment = OPCODE_SREG3_CS;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:CS)");\r
+\r
+               } else if(env->now_opcode == 0x31){     /*XOR Eb, Gb*/\r
+                       Emulator_x86_Operation_XOR_Eb_Gb(env);\r
+\r
+               } else if(env->now_opcode == 0x36){     /*SS Prefix*/\r
+                       env->operation_prefix_segment = OPCODE_SREG3_SS;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:SS)");\r
+\r
+               } else if(env->now_opcode == 0x3B){     /*CMP Gv, Ev*/\r
+                       Emulator_x86_Operation_CMP_Gv_Ev(env);\r
+\r
+               } else if(env->now_opcode == 0x3C){     /*CMP AL*/\r
+                       Emulator_x86_Operation_CMP_AL(env);\r
+\r
+               } else if(env->now_opcode == 0x3E){     /*DS/BranchTaken Prefix*/\r
+                       env->operation_prefix_segment = OPCODE_SREG3_DS;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:DS)");\r
+\r
+               } else if(env->now_opcode == 0x60){     /*PUSHA/PUSHAD*/\r
+                       Emulator_x86_Operation_PUSHA(env);\r
+\r
+               } else if(env->now_opcode == 0x61){     /*POPA/POPAD*/\r
+                       Emulator_x86_Operation_POPA(env);\r
+\r
+               } else if(env->now_opcode == 0x64){     /*FS Prefix*/\r
+                       env->operation_prefix_segment = OPCODE_SREG3_FS;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:FS)");\r
+\r
+               } else if(env->now_opcode == 0x65){     /*GS Prefix*/\r
+                       env->operation_prefix_segment = OPCODE_SREG3_GS;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:GS)");\r
+\r
+               } else if(env->now_opcode == 0x66){     /*OperandSize Prefix*/\r
+                       env->operation_prefix_opsize = OPCODE_PREFIX_OPERAND_SIZE;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:OperandSize)");\r
+\r
+               } else if(env->now_opcode == 0x67){     /*AddressSize Prefix*/\r
+                       env->operation_prefix_addrsize = OPCODE_PREFIX_ADDRESS_SIZE;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:AddressSize)");\r
+\r
+               } else if(env->now_opcode == 0x6A){     /*AddressSize Prefix*/\r
+                       Emulator_x86_Operation_PUSH_Ib(env);\r
+\r
+               } else if(env->now_opcode == 0x74){     /*JE rel8*/\r
+                       Emulator_x86_Operation_Jcc_JE_rel8(env);\r
+\r
+               } else if(env->now_opcode == 0x75){     /*JE rel8*/\r
+                       Emulator_x86_Operation_Jcc_JNE_rel8(env);\r
+\r
+               } else if(env->now_opcode == 0x89){     /*MOV Ev, Gv*/\r
+                       Emulator_x86_Operation_MOV_Ev_Gv(env);\r
+\r
+               } else if(env->now_opcode == 0x8A){     /*MOV Byte*/\r
+                       Emulator_x86_Operation_MOV_To_ByteReg_Gb_Eb(env);\r
+\r
+               } else if(env->now_opcode == 0x8D){     /*LEA*/\r
+                       Emulator_x86_Operation_LEA(env);\r
+\r
+               } else if(env->now_opcode == 0x8E){     /*MOV SegReg*/\r
+                       Emulator_x86_Operation_MOV_To_SegReg(env);\r
+\r
+               } else if(env->now_opcode == 0x8F){     /*POP Ev*/\r
+                       Emulator_x86_Operation_POP_Ev(env);\r
+\r
+               } else if(env->now_opcode == 0xA1){     /*MOV eAX, Ov*/\r
+                       Emulator_x86_Operation_MOV_eAX_Ov(env);\r
+\r
+               } else if(env->now_opcode == 0xA3){     /*MOV Ov, eAX*/\r
+                       Emulator_x86_Operation_MOV_Ov_eAX(env);\r
+\r
+               } else if(env->now_opcode == 0xC3){     /*near RET*/\r
+                       Emulator_x86_Operation_RET_Near(env);\r
+\r
+               } else if(env->now_opcode == 0xCD){     /*INT n*/\r
+                       Emulator_x86_Operation_INTn(env);\r
+\r
+               } else if(env->now_opcode == 0xE2){     /*LOOP Jv*/\r
+                       Emulator_x86_Operation_LOOP_Jv(env);\r
+\r
+               } else if(env->now_opcode == 0xE6){     /*OUT AL*/\r
+                       Emulator_x86_Operation_OUT_AL(env);\r
+\r
+               } else if(env->now_opcode == 0xE8){     /*CALL near*/\r
+                       Emulator_x86_Operation_CALL_Near_Relative(env);\r
+\r
+               } else if(env->now_opcode == 0xEB){     /*JMP short*/\r
+                       Emulator_x86_Operation_JMP_rel8(env);\r
+\r
+               } else if(env->now_opcode == 0xF0){     /*LOCK Prefix*/\r
+                       env->operation_prefix_lock_repeat = OPCODE_PREFIX_LOCK;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:LOCK)");\r
+\r
+               } else if(env->now_opcode == 0xF2){     /*REPNE/REPNZ Prefix*/\r
+                       env->operation_prefix_lock_repeat = OPCODE_PREFIX_REPNE_REPNZ;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:REPNE/REPNZ)");\r
+\r
+               } else if(env->now_opcode == 0xF3){     /*REP/REPE/REPZ Prefix*/\r
+                       env->operation_prefix_lock_repeat = OPCODE_PREFIX_REP_REPE_REPZ;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Prefix:REP/REPE/REPZ)");\r
+\r
+               } else if(env->now_opcode == 0xFB){     /*STI*/\r
+                       Emulator_x86_Operation_STI(env);\r
+\r
+               } else if(env->now_opcode == 0xFC){     /*CLD*/\r
+                       Emulator_x86_Operation_CLD(env);\r
+\r
+               } else{\r
+                       Emulator_x86_Put_EmulationInformation(env, "Unknown OperationCode.\n");\r
+                       return 0xFFFFFFFF;\r
+               }\r
+       }\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "\n");\r
+\r
+       env->operation_end = False;\r
+\r
+       return 0;\r
+}\r
+\r
+uint Emulator_x86_Execute_Auto(Emulator_x86_Environment *env)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; ; i++){\r
+               if(Emulator_x86_Execute(env) == 0xffffffff){\r
+                       break;\r
+               }\r
+       }\r
+       return i + 1;\r
+}\r
+\r
+int Emulator_x86_Put_EmulationInformation(Emulator_x86_Environment *env, const uchar format[], ...)\r
+{\r
+       int i;\r
+       uchar s[256];\r
+\r
+       i = vsnprintf(s, sizeof(s), format, (uint *)(&format + 1));\r
+       SerialPort_Send(s);\r
+\r
+       return i;\r
+}\r
+\r
+uint Emulator_x86_FetchCode(Emulator_x86_Environment *env, uint bytes)\r
+{\r
+       uint data;\r
+       uint i;\r
+\r
+       data = 0;\r
+       for(i = 0; i < bytes; i++){\r
+               data |= (*((uchar *)Emulator_x86_Get_EffectivePhysicalAddress(env, OPCODE_SREG3_CS, env->EIP)) << (i << 3));\r
+               Emulator_x86_InstructionPointer_Increment(env);\r
+       }\r
+\r
+       return data;\r
+}\r
+\r
+void Emulator_x86_InstructionPointer_Increment(Emulator_x86_Environment *env)\r
+{\r
+       env->EIP++;\r
+       if(!env->operation_32bit){\r
+               env->EIP &= 0x0000ffff;\r
+       }\r
+       return;\r
+}\r
+\r
+uint Emulator_x86_Get_EffectivePhysicalAddress(Emulator_x86_Environment *env, uint sreg, uint offset)\r
+{\r
+       uint addr;\r
+\r
+       addr = 0;\r
+\r
+       if(sreg > 5){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(Invalid SReg).");\r
+               return 0;\r
+       }\r
+\r
+       if(env->operation_32bit){       /*32-bit addressing*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit mode is not implemented.");\r
+       } else{ /*16-bit addressing*/\r
+               addr = (env->SReg[sreg].selector << 4) + offset;\r
+       }\r
+       return addr;\r
+}\r
+\r
+uint Emulator_x86_Get_EffectivePhysicalAddress_FromModRM(Emulator_x86_Environment *env, uint mrm)\r
+{\r
+       Emulator_x86_OperationCode_ModRM modrm;\r
+       uint offset;\r
+       uint address;\r
+\r
+       modrm.modrm = mrm;\r
+       offset = 0;\r
+       address = 0;\r
+\r
+       if(!env->operation_32bit){      /*16-bit Addressing*/\r
+               if(modrm.bit.Mod == OPCODE_MOD_REGISTER){       /*Reg only*/\r
+                       Emulator_x86_Put_EmulationInformation(env, "Not Address, From Register.");\r
+                       return 0;\r
+               } else{ /*From MemoryAddress*/\r
+                       if(modrm.bit.RM == OPCODE_RM16_ADDR_BX_SI){\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_EBX, True);\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_ESI, True);\r
+                       } else if(modrm.bit.RM == OPCODE_RM16_ADDR_BX_SI){\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_EBX, True);\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_EDI, True);\r
+                       } else if(modrm.bit.RM == OPCODE_RM16_ADDR_BX_DI){\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_EBP, True);\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_ESI, True);\r
+                       } else if(modrm.bit.RM == OPCODE_RM16_ADDR_BP_SI){\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_EBP, True);\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_EDI, True);\r
+                       } else if(modrm.bit.RM == OPCODE_RM16_ADDR_SI){\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_ESI, True);\r
+                       } else if(modrm.bit.RM == OPCODE_RM16_ADDR_DI){\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_EDI, True);\r
+                       } else if(modrm.bit.RM == OPCODE_RM16_MOD00_ADDR_DISP16){\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_EBP, True);\r
+                       } else if(modrm.bit.RM == OPCODE_RM16_ADDR_BX){\r
+                               offset += Emulator_x86_MoveFromGReg(env, OPCODE_REG_EBX, True);\r
+                       }\r
+                       if(modrm.bit.Mod == OPCODE_MOD_INDEXONLY){\r
+                               if(modrm.bit.RM == OPCODE_RM16_MOD00_ADDR_DISP16){\r
+                                       offset = Emulator_x86_FetchCode(env, 2);\r
+                               }\r
+                       } else if(modrm.bit.Mod == OPCODE_MOD_INDEX_AND_DISP_BYTE){\r
+                               offset += Emulator_x86_FetchCode(env, 1);\r
+                       } else if(modrm.bit.Mod == OPCODE_MOD_INDEX_AND_DISP_FULL){\r
+                               offset += Emulator_x86_FetchCode(env, 2);\r
+                       }\r
+                       offset &= 0x0000ffff;\r
+                       address = Emulator_x86_Get_EffectivePhysicalAddress(env, env->operation_prefix_segment, offset);\r
+                       Emulator_x86_Put_EmulationInformation(env, "(Address Generated %s:0x%X = [0x%X])", Emulator_x86_SRegNames[env->operation_prefix_segment], offset, address);\r
+               }\r
+       } else{ /*32-bit Addressing*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit mode is not implemented.");\r
+       }\r
+\r
+       return address;\r
+}\r
+\r
+void Emulator_x86_MoveToGReg(Emulator_x86_Environment *env, uint reg, uint data, uint fullsize)\r
+{\r
+       if(reg > 7){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(Invalid GReg).");\r
+               return;\r
+       }\r
+\r
+       if(fullsize){\r
+               if(env->operation_32bit){       /*DoubleWord*/\r
+                       env->GReg[reg] = data;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(MoveToE%s:0x%X)", Emulator_x86_RegNames[reg], data);\r
+               } else{ /*Word*/\r
+                       env->GReg[reg] &= 0xffff0000;\r
+                       env->GReg[reg] |= 0x0000ffff & data;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(MoveTo%s:0x%X)", Emulator_x86_RegNames[reg], data);\r
+               }\r
+       } else{ /*Byte*/\r
+               if(reg < 4){    /*Low*/\r
+                       env->GReg[reg] &= 0xffffff00;\r
+                       env->GReg[reg] |= 0x000000ff & data;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(MoveTo%s:0x%X)", Emulator_x86_ByteRegNames[reg], data);\r
+               } else{ /*High*/\r
+                       reg -= 4;\r
+                       env->GReg[reg] &= 0xffff00ff;\r
+                       env->GReg[reg] |= 0x0000ff00 & (data << 8);\r
+                       Emulator_x86_Put_EmulationInformation(env, "(MoveTo%s:0x%X)", Emulator_x86_ByteRegNames[reg + 4], data);\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+uint Emulator_x86_MoveFromGReg(Emulator_x86_Environment *env, uint reg, uint fullsize)\r
+{\r
+       uint data;\r
+\r
+       if(reg > 7){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(Invalid GReg).");\r
+               return 0;\r
+       }\r
+\r
+       if(fullsize){\r
+               if(env->operation_32bit){       /*DoubleWord*/\r
+                       data = env->GReg[reg];\r
+                       Emulator_x86_Put_EmulationInformation(env, "(MoveFromE%s:0x%X)", Emulator_x86_RegNames[reg], data);\r
+               } else{ /*Word*/\r
+                       data = env->GReg[reg];\r
+                       data &= 0x0000ffff;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(MoveFrom%s:0x%X)", Emulator_x86_RegNames[reg], data);\r
+               }\r
+       } else{ /*Byte*/\r
+               if(reg < 4){    /*Low*/\r
+                       data = env->GReg[reg];\r
+                       data &= 0x000000ff;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(MoveFrom%s:0x%X)", Emulator_x86_ByteRegNames[reg], data);\r
+               } else{ /*High*/\r
+                       reg -= 4;\r
+                       data = env->GReg[reg];\r
+                       data &= 0x0000ff00;\r
+                       data = data >> 8;\r
+                       Emulator_x86_Put_EmulationInformation(env, "(MoveFrom%s:0x%X)", Emulator_x86_ByteRegNames[reg + 4], data);\r
+               }\r
+       }\r
+       return data;\r
+}\r
+\r
+void Emulator_x86_MoveToSReg(Emulator_x86_Environment *env, uint sreg, ushort selector)\r
+{\r
+       if(sreg > 7){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(Invalid SReg).");\r
+               return;\r
+       }\r
+\r
+       if(env->operation_32bit){       /*32-bit Segmentation*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit mode is not implemented.");\r
+       } else{ /*16-bit Segmentation*/\r
+               env->SReg[sreg].selector = selector;\r
+               Emulator_x86_Put_EmulationInformation(env, "(MoveTo%s:0x%X)", Emulator_x86_SRegNames[sreg], selector);\r
+       }\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Push_Data_To_Stack(Emulator_x86_Environment *env, uint data, uint size_dword)\r
+{\r
+       void *addr;\r
+\r
+       if(env->GReg[OPCODE_REG_ESP] < 4){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(No More Stack).");\r
+               return;\r
+       }\r
+       if(size_dword){ /*DoubleWord*/\r
+               Emulator_x86_MoveToGReg(env, OPCODE_REG_ESP, env->GReg[OPCODE_REG_ESP] - 4, True);\r
+               addr = (void *)Emulator_x86_Get_EffectivePhysicalAddress(env, OPCODE_SREG3_SS, env->GReg[OPCODE_REG_ESP]);\r
+               *((uint *)addr) = data;\r
+       } else{ /*Word*/\r
+               Emulator_x86_MoveToGReg(env, OPCODE_REG_ESP, env->GReg[OPCODE_REG_ESP] - 2, True);\r
+               addr = (void *)Emulator_x86_Get_EffectivePhysicalAddress(env, OPCODE_SREG3_SS, env->GReg[OPCODE_REG_ESP]);\r
+               *((ushort *)addr) = data;\r
+       }\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "(PushTo[0x%08X]:0x%X)", Emulator_x86_Get_EffectivePhysicalAddress(env, OPCODE_SREG3_SS, env->GReg[OPCODE_REG_ESP]), data);\r
+\r
+       return;\r
+}\r
+\r
+uint Emulator_x86_Pop_Data_From_Stack(Emulator_x86_Environment *env, uint size_dword)\r
+{\r
+       uint data;\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "(PopFrom[0x%08X]:", Emulator_x86_Get_EffectivePhysicalAddress(env, OPCODE_SREG3_SS, env->GReg[OPCODE_REG_ESP]));\r
+\r
+       if(size_dword){ /*DoubleWord*/\r
+               data = *((uint *)Emulator_x86_Get_EffectivePhysicalAddress(env, OPCODE_SREG3_SS, env->GReg[OPCODE_REG_ESP]));\r
+               Emulator_x86_MoveToGReg(env, OPCODE_REG_ESP, env->GReg[OPCODE_REG_ESP] + 4, True);\r
+       } else{ /*Word*/\r
+               data = *((ushort *)Emulator_x86_Get_EffectivePhysicalAddress(env, OPCODE_SREG3_SS, env->GReg[OPCODE_REG_ESP]));\r
+               Emulator_x86_MoveToGReg(env, OPCODE_REG_ESP, env->GReg[OPCODE_REG_ESP] + 2, True);\r
+       }\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "0x%X)", data);\r
+\r
+       return data;\r
+}\r
+\r
+void Emulator_x86_Push_eIP_To_Stack(Emulator_x86_Environment *env)\r
+{\r
+       if(!env->operation_32bit){      /*16-bit*/\r
+               env->EIP &= 0x0000ffff;\r
+               Emulator_x86_Push_Data_To_Stack(env, env->EIP, False);\r
+               Emulator_x86_Put_EmulationInformation(env, "(Push IP[0x%X])", env->EIP);\r
+       } else{ /*32-bit*/\r
+               Emulator_x86_Push_Data_To_Stack(env, env->EIP, True);\r
+               Emulator_x86_Put_EmulationInformation(env, "(Push EIP[0x%X])", env->EIP);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Pop_eIP_From_Stack(Emulator_x86_Environment *env)\r
+{\r
+       if(!env->operation_32bit){      /*16-bit*/\r
+               env->EIP = Emulator_x86_Pop_Data_From_Stack(env, False);\r
+               Emulator_x86_Put_EmulationInformation(env, "(Pop IP[0x%X])", env->EIP);\r
+       } else{ /*32-bit*/\r
+               env->EIP = Emulator_x86_Pop_Data_From_Stack(env, True);\r
+               Emulator_x86_Put_EmulationInformation(env, "(Pop EIP[0x%X])", env->EIP);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Push_eFLAGS_To_Stack(Emulator_x86_Environment *env)\r
+{\r
+       if(!env->operation_32bit){      /*16-bit*/\r
+               env->EFLAGS.eflags &= 0x0000ffff;\r
+               Emulator_x86_Push_Data_To_Stack(env, env->EFLAGS.eflags, False);\r
+               Emulator_x86_Put_EmulationInformation(env, "(Push FLAGS(0x%X))", env->EFLAGS.eflags);\r
+       } else{ /*32-bit*/\r
+               Emulator_x86_Push_Data_To_Stack(env, env->EIP, True);\r
+               Emulator_x86_Put_EmulationInformation(env, "(Push EFLAGS(0x%X))", env->EFLAGS.eflags);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Pop_eFLAGS_From_Stack(Emulator_x86_Environment *env)\r
+{\r
+       if(!env->operation_32bit){      /*16-bit*/\r
+               env->EFLAGS.eflags = Emulator_x86_Pop_Data_From_Stack(env, False);\r
+               Emulator_x86_Put_EmulationInformation(env, "(Pop FLAGS(0x%X))", env->EFLAGS.eflags);\r
+       } else{ /*32-bit*/\r
+               env->EFLAGS.eflags = Emulator_x86_Pop_Data_From_Stack(env, True);\r
+               Emulator_x86_Put_EmulationInformation(env, "(Pop EFLAGS(0x%X))", env->EFLAGS.eflags);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Push_SReg_To_Stack(Emulator_x86_Environment *env, uint sreg)\r
+{\r
+       //16bit/32bit\r
+\r
+       if(sreg > 7){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(Invalid SReg).");\r
+               return;\r
+       }\r
+\r
+       if(!env->operation_32bit){      /*16-bit*/\r
+               Emulator_x86_Push_Data_To_Stack(env, env->SReg[sreg].selector, False);\r
+       } else{ /*32-bit*/\r
+               Emulator_x86_Push_Data_To_Stack(env, env->SReg[sreg].selector, True);\r
+       }\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "(Push %s(0x%X))", Emulator_x86_SRegNames[sreg], env->SReg[sreg].selector);\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Pop_SReg_From_Stack(Emulator_x86_Environment *env, uint sreg)\r
+{\r
+       //16bit/32bit\r
+\r
+       if(sreg > 7){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(Invalid SReg).");\r
+               return;\r
+       }\r
+\r
+       if(!env->operation_32bit){      /*16-bit*/\r
+               Emulator_x86_MoveToSReg(env, sreg, Emulator_x86_Pop_Data_From_Stack(env, False));\r
+       } else{ /*32-bit*/\r
+               Emulator_x86_MoveToSReg(env, sreg, Emulator_x86_Pop_Data_From_Stack(env, True));\r
+       }\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "(Pop %s(0x%X))", Emulator_x86_SRegNames[sreg], env->SReg[sreg].selector);\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_MOV_To_Reg_FullSize(Emulator_x86_Environment *env)\r
+{\r
+       uint imm;\r
+\r
+       imm = Emulator_x86_FetchCode(env, 2);\r
+\r
+       Emulator_x86_MoveToGReg(env, env->now_opcode - 0xB8, imm, True);\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "MOV %s, 0x%X", Emulator_x86_RegNames[env->now_opcode - 0xB8], imm);\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_MOV_To_SegReg(Emulator_x86_Environment *env)\r
+{\r
+       Emulator_x86_OperationCode_ModRM modrm;\r
+       uint addr;\r
+\r
+       modrm.modrm = Emulator_x86_FetchCode(env, 1);\r
+\r
+       if(modrm.bit.Mod == OPCODE_MOD_REGISTER){\r
+               Emulator_x86_MoveToSReg(env, modrm.bit.Reg, Emulator_x86_MoveFromGReg(env, modrm.bit.RM, True));\r
+               Emulator_x86_Put_EmulationInformation(env, "MOV %s, %s", Emulator_x86_SRegNames[modrm.bit.Reg], Emulator_x86_RegNames[modrm.bit.RM]);\r
+       } else{\r
+               addr = Emulator_x86_Get_EffectivePhysicalAddress_FromModRM(env, modrm.modrm);\r
+               Emulator_x86_MoveToSReg(env, modrm.bit.Reg, *((ushort *)addr));\r
+               Emulator_x86_Put_EmulationInformation(env, "MOV %s, [0x%X]", Emulator_x86_SRegNames[modrm.bit.Reg], addr);\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_MOV_To_ByteReg(Emulator_x86_Environment *env)\r
+{\r
+       uchar imm8;\r
+\r
+       imm8 = Emulator_x86_FetchCode(env, 1);\r
+\r
+       Emulator_x86_MoveToGReg(env, env->now_opcode - 0xB0, imm8, False);\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "MOV %s, 0x%X", Emulator_x86_ByteRegNames[env->now_opcode - 0xB0], imm8);\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_INTn(Emulator_x86_Environment *env)\r
+{\r
+       //16-bit only\r
+\r
+       uchar intn;\r
+       Emulator_x86_FarPointer *vector;\r
+\r
+       intn = Emulator_x86_FetchCode(env, 1);\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "INT 0x%X", intn);\r
+\r
+       vector = (Emulator_x86_FarPointer *)(intn << 2);\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "[0x%X:0x%X] = [0x%X]", vector->selector, vector->offset, (vector->selector << 4) + vector->offset);\r
+\r
+       Emulator_x86_Push_eFLAGS_To_Stack(env);\r
+       env->EFLAGS.bit.IF = False;\r
+       env->EFLAGS.bit.TF = False;\r
+       env->EFLAGS.bit.AC = False;\r
+       Emulator_x86_Push_SReg_To_Stack(env, OPCODE_SREG3_CS);\r
+       Emulator_x86_Push_eIP_To_Stack(env);\r
+\r
+       Emulator_x86_MoveToSReg(env, OPCODE_SREG3_CS, vector->selector);\r
+       env->EIP = vector->offset;\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_LEA(Emulator_x86_Environment *env)\r
+{\r
+       Emulator_x86_OperationCode_ModRM modrm;\r
+       uint disp;\r
+\r
+       modrm.modrm = Emulator_x86_FetchCode(env, 1);\r
+\r
+       if(!env->operation_32bit){\r
+               if(modrm.bit.Mod == OPCODE_MOD_REGISTER){\r
+                       Emulator_x86_Put_EmulationInformation(env, "LEA Invalid.");\r
+               } else{\r
+                       disp = Emulator_x86_Get_EffectivePhysicalAddress_FromModRM(env, modrm.modrm);\r
+                       disp -= (env->SReg[env->operation_prefix_segment].selector << 4);\r
+                       Emulator_x86_MoveToGReg(env, modrm.bit.Reg, disp, True);\r
+                       Emulator_x86_Put_EmulationInformation(env, "LEA %s, 0x%X", Emulator_x86_RegNames[modrm.bit.Reg], disp);\r
+               }\r
+       } else{\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit mode is not implemented.");\r
+       }\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_CALL_Near_Relative(Emulator_x86_Environment *env)\r
+{\r
+       short relative_addr;\r
+       uchar sign;\r
+\r
+       sign = False;\r
+\r
+       relative_addr = Emulator_x86_FetchCode(env, 2);\r
+\r
+       if(relative_addr < 0){\r
+               sign = True;\r
+               relative_addr = -relative_addr;\r
+       }\r
+\r
+       Emulator_x86_Push_eIP_To_Stack(env);\r
+\r
+       if(sign){\r
+               env->EIP -= (uint)relative_addr;\r
+       } else{\r
+               env->EIP += (uint)relative_addr;\r
+       }\r
+\r
+       if(!env->operation_32bit){\r
+               env->EIP &= 0x0000ffff;\r
+       }\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "near CALL 0x%X", env->EIP);\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_PUSHA(Emulator_x86_Environment *env)\r
+{\r
+       uint Temp;\r
+       uint i;\r
+\r
+       Temp = env->GReg[OPCODE_REG_ESP];\r
+\r
+       if(env->operation_32bit){       /*PUSHAD*/\r
+               Emulator_x86_Put_EmulationInformation(env, "PUSHAD");\r
+               for(i = 0; i < 4; i++){\r
+                       Emulator_x86_Push_Data_To_Stack(env, Emulator_x86_MoveFromGReg(env, i, True), True);\r
+               }\r
+               Emulator_x86_Push_Data_To_Stack(env, Temp, False);\r
+               for(i = 5; i < 8; i++){\r
+                       Emulator_x86_Push_Data_To_Stack(env, Emulator_x86_MoveFromGReg(env, i, True), True);\r
+               }\r
+       } else{ /*PUSHA*/\r
+               Emulator_x86_Put_EmulationInformation(env, "PUSHA");\r
+               for(i = 0; i < 4; i++){\r
+                       Emulator_x86_Push_Data_To_Stack(env, Emulator_x86_MoveFromGReg(env, i, True), False);\r
+               }\r
+               Emulator_x86_Push_Data_To_Stack(env, Temp, False);\r
+               for(i = 5; i < 8; i++){\r
+                       Emulator_x86_Push_Data_To_Stack(env, Emulator_x86_MoveFromGReg(env, i, True), False);\r
+               }\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_POPA(Emulator_x86_Environment *env)\r
+{\r
+       int i;\r
+\r
+       if(env->operation_32bit){       /*POPAD*/\r
+               Emulator_x86_Put_EmulationInformation(env, "POPAD");\r
+               for(i = 7; i > 4; i--){\r
+                       Emulator_x86_MoveToGReg(env, i, Emulator_x86_Pop_Data_From_Stack(env, True), True);\r
+               }\r
+               Emulator_x86_Pop_Data_From_Stack(env, True);\r
+               for(i = 3; i > -1; i--){\r
+                       Emulator_x86_MoveToGReg(env, i, Emulator_x86_Pop_Data_From_Stack(env, True), True);\r
+               }\r
+       } else{ /*POPA*/\r
+               Emulator_x86_Put_EmulationInformation(env, "POPA");\r
+               for(i = 7; i > 4; i--){\r
+                       Emulator_x86_MoveToGReg(env, i, Emulator_x86_Pop_Data_From_Stack(env, False), True);\r
+               }\r
+               Emulator_x86_Pop_Data_From_Stack(env, False);\r
+               for(i = 3; i > -1; i--){\r
+                       Emulator_x86_MoveToGReg(env, i, Emulator_x86_Pop_Data_From_Stack(env, False), True);\r
+               }\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_MOV_To_ByteReg_Gb_Eb(Emulator_x86_Environment *env)\r
+{\r
+       Emulator_x86_OperationCode_ModRM modrm;\r
+       uint addr;\r
+\r
+       modrm.modrm = Emulator_x86_FetchCode(env, 1);\r
+       addr = 0;\r
+\r
+       if(!env->operation_32bit){      /*16-bit Addressing*/\r
+               if(modrm.bit.Mod == OPCODE_MOD_REGISTER){       /*Reg only*/\r
+                       Emulator_x86_MoveToGReg(env, modrm.bit.Reg, Emulator_x86_MoveFromGReg(env, modrm.bit.RM, False), False);\r
+                       Emulator_x86_Put_EmulationInformation(env, "MOV %s, %s", Emulator_x86_ByteRegNames[modrm.bit.Reg], Emulator_x86_ByteRegNames[modrm.bit.RM]);\r
+               } else{ /*From MemoryAddress*/\r
+                       addr = Emulator_x86_Get_EffectivePhysicalAddress_FromModRM(env, modrm.modrm);\r
+                       Emulator_x86_MoveToGReg(env, modrm.bit.Reg, *((uchar *)addr), False);\r
+                       Emulator_x86_Put_EmulationInformation(env, "MOV %s, [0x%X]", Emulator_x86_ByteRegNames[modrm.bit.Reg], addr);\r
+               }\r
+       } else{ /*32-bit Addressing*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit mode is not implemented.");\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_CMP_AL(Emulator_x86_Environment *env)\r
+{\r
+       CPU_EFlags eflags;\r
+       uint imm;\r
+\r
+       imm = Emulator_x86_FetchCode(env, 1);\r
+\r
+       eflags.eflags = asm_Emulator_x86_Get_EFlags_Compare(Emulator_x86_MoveFromGReg(env, OPCODE_REG_BYTE_AL, False), imm);\r
+       env->EFLAGS.bit.CF = eflags.bit.CF;\r
+       env->EFLAGS.bit.PF = eflags.bit.PF;\r
+       env->EFLAGS.bit.AF = eflags.bit.AF;\r
+       env->EFLAGS.bit.ZF = eflags.bit.ZF;\r
+       env->EFLAGS.bit.SF = eflags.bit.SF;\r
+       env->EFLAGS.bit.OF = eflags.bit.OF;\r
+       Emulator_x86_Put_EmulationInformation(env, "CMP AL, 0x%X (CF:%d PF:%d AF:%d ZF:%d SF:%d OF:%d)", imm, env->EFLAGS.bit.CF, env->EFLAGS.bit.PF, env->EFLAGS.bit.AF, env->EFLAGS.bit.ZF, env->EFLAGS.bit.SF, env->EFLAGS.bit.OF);\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_Jcc_JE_rel8(Emulator_x86_Environment *env)\r
+{\r
+       char relative_addr;\r
+       uchar sign;\r
+       uint new_eip;\r
+\r
+       sign = False;\r
+       relative_addr = Emulator_x86_FetchCode(env, 1);\r
+       new_eip = env->EIP;\r
+\r
+       if(relative_addr < 0){\r
+               sign = True;\r
+               relative_addr = -relative_addr;\r
+       }\r
+       if(sign){\r
+               new_eip -= (uint)relative_addr;\r
+       } else{\r
+               new_eip += (uint)relative_addr;\r
+       }\r
+\r
+       if(!env->operation_32bit){\r
+               new_eip &= 0x0000ffff;\r
+       }\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "JE 0x%X ", new_eip);\r
+\r
+       if(env->EFLAGS.bit.ZF){\r
+               Emulator_x86_Put_EmulationInformation(env, "Taken.");\r
+               env->EIP = new_eip;\r
+       } else{\r
+               Emulator_x86_Put_EmulationInformation(env, "NotTaken.");\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_INC_RegOnly(Emulator_x86_Environment *env)\r
+{\r
+       uint operand;\r
+       CPU_EFlags eflags;\r
+\r
+       if((env->now_opcode - 0x40) > 7){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(Invalid GReg From OpCode).");\r
+       }\r
+\r
+       operand = Emulator_x86_MoveFromGReg(env, env->now_opcode - 0x40, True);\r
+       Emulator_x86_MoveToGReg(env, env->now_opcode - 0x40, operand + 1, True);\r
+\r
+       eflags.eflags = asm_Emulator_x86_Get_EFlags_Increment(operand);\r
+       env->EFLAGS.bit.PF = eflags.bit.PF;\r
+       env->EFLAGS.bit.AF = eflags.bit.AF;\r
+       env->EFLAGS.bit.ZF = eflags.bit.ZF;\r
+       env->EFLAGS.bit.SF = eflags.bit.SF;\r
+       env->EFLAGS.bit.OF = eflags.bit.OF;\r
+       Emulator_x86_Put_EmulationInformation(env, "INC %s (PF:%d AF:%d ZF:%d SF:%d OF:%d)", Emulator_x86_RegNames[env->now_opcode - 0x40], env->EFLAGS.bit.PF, env->EFLAGS.bit.AF, env->EFLAGS.bit.ZF, env->EFLAGS.bit.SF, env->EFLAGS.bit.OF);\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_JMP_rel8(Emulator_x86_Environment *env)\r
+{\r
+       char relative_addr;\r
+       uchar sign;\r
+       uint new_eip;\r
+\r
+       sign = False;\r
+       relative_addr = Emulator_x86_FetchCode(env, 1);\r
+       new_eip = env->EIP;\r
+\r
+       if(relative_addr < 0){\r
+               sign = True;\r
+               relative_addr = -relative_addr;\r
+       }\r
+       if(sign){\r
+               new_eip -= (uint)relative_addr;\r
+       } else{\r
+               new_eip += (uint)relative_addr;\r
+       }\r
+\r
+       if(!env->operation_32bit){\r
+               new_eip &= 0x0000ffff;\r
+       }\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "JMP 0x%X", new_eip);\r
+\r
+       env->EIP = new_eip;\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_RET_Near(Emulator_x86_Environment *env)\r
+{\r
+       Emulator_x86_Pop_eIP_From_Stack(env);\r
+       Emulator_x86_Put_EmulationInformation(env, "near RET to 0x%X", env->EIP);\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_PUSH_RegOnly(Emulator_x86_Environment *env)\r
+{\r
+       if((env->now_opcode - 0x50) > 7){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(Invalid GReg From OpCode).");\r
+       }\r
+       if(!env->operation_32bit){      /*16-bit*/\r
+               Emulator_x86_Put_EmulationInformation(env, "PUSH %s", Emulator_x86_RegNames[env->now_opcode - 0x50]);\r
+               Emulator_x86_Push_Data_To_Stack(env, Emulator_x86_MoveFromGReg(env, env->now_opcode - 0x50, True), False);\r
+       } else{ /*32-bit*/\r
+               Emulator_x86_Put_EmulationInformation(env, "PUSH E%s", Emulator_x86_RegNames[env->now_opcode - 0x50]);\r
+               Emulator_x86_Push_Data_To_Stack(env, Emulator_x86_MoveFromGReg(env, env->now_opcode - 0x50, True), True);\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_XOR_Eb_Gb(Emulator_x86_Environment *env)\r
+{\r
+       Emulator_x86_OperationCode_ModRM modrm;\r
+       uint addr;\r
+       CPU_EFlags eflags;\r
+       uint dest_op, source_op;\r
+\r
+       modrm.modrm = Emulator_x86_FetchCode(env, 1);\r
+       addr = 0;\r
+       dest_op = 0;\r
+       source_op = 0;\r
+\r
+       if(!env->operation_32bit){      /*16-bit Addressing*/\r
+               source_op = Emulator_x86_MoveFromGReg(env, modrm.bit.Reg, True);\r
+               if(modrm.bit.Mod == OPCODE_MOD_REGISTER){       /*Reg*/\r
+                       dest_op = Emulator_x86_MoveFromGReg(env, modrm.bit.RM, True);\r
+                       Emulator_x86_MoveToGReg(env, modrm.bit.Reg, dest_op ^ source_op, True);\r
+                       Emulator_x86_Put_EmulationInformation(env, "XOR %s, %s", Emulator_x86_RegNames[modrm.bit.RM], Emulator_x86_RegNames[modrm.bit.Reg]);\r
+               } else{ /*MemoryAddress*/\r
+                       addr = Emulator_x86_Get_EffectivePhysicalAddress_FromModRM(env, modrm.modrm);\r
+                       dest_op = *((ushort *)addr);\r
+                       Emulator_x86_Put_EmulationInformation(env, "XOR [0x%X], %s", addr, Emulator_x86_RegNames[modrm.bit.Reg]);\r
+                       *((ushort *)addr) = dest_op ^ source_op;\r
+               }\r
+               eflags.eflags = asm_Emulator_x86_Get_EFlags_XOR(dest_op, source_op);\r
+               env->EFLAGS.bit.CF = False;\r
+               env->EFLAGS.bit.PF = eflags.bit.PF;\r
+               env->EFLAGS.bit.AF = eflags.bit.AF;\r
+               env->EFLAGS.bit.ZF = eflags.bit.ZF;\r
+               env->EFLAGS.bit.SF = eflags.bit.SF;\r
+               env->EFLAGS.bit.OF = False;\r
+               Emulator_x86_Put_EmulationInformation(env, " (CF:%d PF:%d AF:%d ZF:%d SF:%d OF:%d)", env->EFLAGS.bit.CF, env->EFLAGS.bit.PF, env->EFLAGS.bit.AF, env->EFLAGS.bit.ZF, env->EFLAGS.bit.SF, env->EFLAGS.bit.OF);\r
+       } else{ /*32-bit Addressing*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit addressing is not implemented.");\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_DEC_RegOnly(Emulator_x86_Environment *env)\r
+{\r
+       uint operand;\r
+       CPU_EFlags eflags;\r
+\r
+       if((env->now_opcode - 0x48) > 7){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(Invalid GReg From OpCode).");\r
+       }\r
+\r
+       operand = Emulator_x86_MoveFromGReg(env, env->now_opcode - 0x48, True);\r
+       Emulator_x86_MoveToGReg(env, env->now_opcode - 0x48, operand - 1, True);\r
+\r
+       eflags.eflags = asm_Emulator_x86_Get_EFlags_Decrement(operand);\r
+       env->EFLAGS.bit.PF = eflags.bit.PF;\r
+       env->EFLAGS.bit.AF = eflags.bit.AF;\r
+       env->EFLAGS.bit.ZF = eflags.bit.ZF;\r
+       env->EFLAGS.bit.SF = eflags.bit.SF;\r
+       env->EFLAGS.bit.OF = eflags.bit.OF;\r
+       Emulator_x86_Put_EmulationInformation(env, "DEC %s (PF:%d AF:%d ZF:%d SF:%d OF:%d)", Emulator_x86_RegNames[env->now_opcode - 0x48], env->EFLAGS.bit.PF, env->EFLAGS.bit.AF, env->EFLAGS.bit.ZF, env->EFLAGS.bit.SF, env->EFLAGS.bit.OF);\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_MOV_eAX_Ov(Emulator_x86_Environment *env)\r
+{\r
+       uint offset;\r
+       uint addr;\r
+\r
+       if(!env->operation_32bit){      /*16-bit Addressing*/\r
+               offset = Emulator_x86_FetchCode(env, 2);\r
+               addr = Emulator_x86_Get_EffectivePhysicalAddress(env, env->operation_prefix_segment, offset);\r
+               Emulator_x86_MoveToGReg(env, OPCODE_REG_EAX, *((ushort *)addr), True);\r
+               Emulator_x86_Put_EmulationInformation(env, "MOV AX, [0x%X]", addr);\r
+       } else{ /*32-bit Addressing*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit addressing is not implemented.");\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_MOV_Ov_eAX(Emulator_x86_Environment *env)\r
+{\r
+       uint offset;\r
+       uint addr;\r
+\r
+       if(!env->operation_32bit){      /*16-bit Addressing*/\r
+               offset = Emulator_x86_FetchCode(env, 2);\r
+               addr = Emulator_x86_Get_EffectivePhysicalAddress(env, env->operation_prefix_segment, offset);\r
+               *((ushort *)addr) = Emulator_x86_MoveFromGReg(env, OPCODE_REG_EAX, True);\r
+               Emulator_x86_Put_EmulationInformation(env, "MOV [0x%X], AX", addr);\r
+       } else{ /*32-bit Addressing*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit addressing is not implemented.");\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_OUT_AL(Emulator_x86_Environment *env)\r
+{\r
+       uint port;\r
+\r
+       port = Emulator_x86_FetchCode(env, 1);\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "OUT 0x%X, AL(Not implemented)", port);\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_CMP_Gv_Ev(Emulator_x86_Environment *env)\r
+{\r
+       Emulator_x86_OperationCode_ModRM modrm;\r
+       uint addr;\r
+       uint op0, op1;\r
+       CPU_EFlags eflags;\r
+\r
+       modrm.modrm = Emulator_x86_FetchCode(env, 1);\r
+       addr = 0;\r
+\r
+       if(!env->operation_32bit){      /*16-bit Addressing*/\r
+               op0 = Emulator_x86_MoveFromGReg(env, modrm.bit.Reg, True);\r
+               if(modrm.bit.Mod == OPCODE_MOD_REGISTER){       /*Reg*/\r
+                       op1 = Emulator_x86_MoveFromGReg(env, modrm.bit.RM, True);\r
+                       Emulator_x86_Put_EmulationInformation(env, "CMP %s, %s", Emulator_x86_RegNames[modrm.bit.Reg], Emulator_x86_RegNames[modrm.bit.RM]);\r
+               } else{ /*MemoryAddress*/\r
+                       addr = Emulator_x86_Get_EffectivePhysicalAddress_FromModRM(env, modrm.modrm);\r
+                       op1 = *((ushort *)addr);\r
+                       Emulator_x86_Put_EmulationInformation(env, "CMP %s, [0x%X]", Emulator_x86_RegNames[modrm.bit.Reg], addr);\r
+               }\r
+               eflags.eflags = asm_Emulator_x86_Get_EFlags_Compare(op0, op1);\r
+               env->EFLAGS.bit.CF = eflags.bit.CF;\r
+               env->EFLAGS.bit.PF = eflags.bit.PF;\r
+               env->EFLAGS.bit.AF = eflags.bit.AF;\r
+               env->EFLAGS.bit.ZF = eflags.bit.ZF;\r
+               env->EFLAGS.bit.SF = eflags.bit.SF;\r
+               env->EFLAGS.bit.OF = eflags.bit.OF;\r
+               Emulator_x86_Put_EmulationInformation(env, " (CF:%d PF:%d AF:%d ZF:%d SF:%d OF:%d)", env->EFLAGS.bit.CF, env->EFLAGS.bit.PF, env->EFLAGS.bit.AF, env->EFLAGS.bit.ZF, env->EFLAGS.bit.SF, env->EFLAGS.bit.OF);\r
+       } else{ /*32-bit Addressing*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit addressing is not implemented.");\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_LOOP_Jv(Emulator_x86_Environment *env)\r
+{\r
+       char relative_addr;\r
+       uchar sign;\r
+       uint new_eip;\r
+       uint operand;\r
+\r
+       sign = False;\r
+       relative_addr = Emulator_x86_FetchCode(env, 1);\r
+       new_eip = env->EIP;\r
+\r
+       operand = Emulator_x86_MoveFromGReg(env, OPCODE_REG_ECX, True);\r
+       Emulator_x86_MoveToGReg(env, OPCODE_REG_ECX, operand - 1, True);\r
+\r
+       if(relative_addr < 0){\r
+               sign = True;\r
+               relative_addr = -relative_addr;\r
+       }\r
+       if(sign){\r
+               new_eip -= (uint)relative_addr;\r
+       } else{\r
+               new_eip += (uint)relative_addr;\r
+       }\r
+\r
+       if(!env->operation_32bit){\r
+               new_eip &= 0x0000ffff;\r
+       }\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "LOOP 0x%X", new_eip);\r
+\r
+       if(0 == operand - 1){\r
+               Emulator_x86_Put_EmulationInformation(env, "(NotTaken)");\r
+       } else{\r
+               Emulator_x86_Put_EmulationInformation(env, "(Taken)");\r
+               env->EIP = new_eip;\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_POP_Ev(Emulator_x86_Environment *env)\r
+{\r
+       Emulator_x86_OperationCode_ModRM modrm;\r
+       uint addr;\r
+\r
+       modrm.modrm = Emulator_x86_FetchCode(env, 1);\r
+       addr = 0;\r
+\r
+       if(!env->operation_32bit){      /*16-bit Addressing*/\r
+               if(modrm.bit.Mod == OPCODE_MOD_REGISTER){       /*Reg only*/\r
+                       Emulator_x86_MoveToGReg(env, modrm.bit.RM, Emulator_x86_Pop_Data_From_Stack(env, False), True);\r
+                       Emulator_x86_Put_EmulationInformation(env, "POP %s", Emulator_x86_RegNames[modrm.bit.RM]);\r
+               } else{ /*From MemoryAddress*/\r
+                       addr = Emulator_x86_Get_EffectivePhysicalAddress_FromModRM(env, modrm.modrm);\r
+                       *((ushort *)addr) = Emulator_x86_Pop_Data_From_Stack(env, False);\r
+                       Emulator_x86_Put_EmulationInformation(env, "POP [0x%X]", addr);\r
+               }\r
+       } else{ /*32-bit Addressing*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit addressing is not implemented.");\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return; \r
+}\r
+\r
+void Emulator_x86_Operation_POP_RegOnly(Emulator_x86_Environment *env)\r
+{\r
+       if((env->now_opcode - 0x58) > 7){\r
+               Emulator_x86_Put_EmulationInformation(env, "\nEmulator-x86:Internal Error(Invalid GReg From OpCode).");\r
+       }\r
+       if(!env->operation_32bit){      /*16-bit*/\r
+               Emulator_x86_Put_EmulationInformation(env, "POP %s", Emulator_x86_RegNames[env->now_opcode - 0x58]);\r
+               Emulator_x86_MoveToGReg(env, env->now_opcode - 0x58, Emulator_x86_Pop_Data_From_Stack(env, False), True);\r
+       } else{ /*32-bit*/\r
+               Emulator_x86_Put_EmulationInformation(env, "POP E%s", Emulator_x86_RegNames[env->now_opcode - 0x58]);\r
+               Emulator_x86_MoveToGReg(env, env->now_opcode - 0x58, Emulator_x86_Pop_Data_From_Stack(env, True), True);\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_Jcc_JNE_rel8(Emulator_x86_Environment *env)\r
+{\r
+       char relative_addr;\r
+       uchar sign;\r
+       uint new_eip;\r
+\r
+       sign = False;\r
+       relative_addr = Emulator_x86_FetchCode(env, 1);\r
+       new_eip = env->EIP;\r
+\r
+       if(relative_addr < 0){\r
+               sign = True;\r
+               relative_addr = -relative_addr;\r
+       }\r
+       if(sign){\r
+               new_eip -= (uint)relative_addr;\r
+       } else{\r
+               new_eip += (uint)relative_addr;\r
+       }\r
+\r
+       if(!env->operation_32bit){\r
+               new_eip &= 0x0000ffff;\r
+       }\r
+\r
+       Emulator_x86_Put_EmulationInformation(env, "JNE 0x%X ", new_eip);\r
+\r
+       if(!env->EFLAGS.bit.ZF){\r
+               Emulator_x86_Put_EmulationInformation(env, "Taken.");\r
+               env->EIP = new_eip;\r
+       } else{\r
+               Emulator_x86_Put_EmulationInformation(env, "NotTaken.");\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_STI(Emulator_x86_Environment *env)\r
+{\r
+       env->EFLAGS.bit.IF = True;\r
+       Emulator_x86_Put_EmulationInformation(env, "STI");\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_SBB_Gv_Ev(Emulator_x86_Environment *env)\r
+{\r
+       Emulator_x86_OperationCode_ModRM modrm;\r
+       uint addr;\r
+       uint op0, op1;\r
+       CPU_EFlags eflags;\r
+\r
+       modrm.modrm = Emulator_x86_FetchCode(env, 1);\r
+       addr = 0;\r
+\r
+       if(!env->operation_32bit){      /*16-bit Addressing*/\r
+               op0 = Emulator_x86_MoveFromGReg(env, modrm.bit.Reg, True);\r
+               if(modrm.bit.Mod == OPCODE_MOD_REGISTER){       /*Reg*/\r
+                       op1 = Emulator_x86_MoveFromGReg(env, modrm.bit.RM, True);\r
+                       Emulator_x86_Put_EmulationInformation(env, "SBB %s, %s(CF:%d)", Emulator_x86_RegNames[modrm.bit.Reg], Emulator_x86_RegNames[modrm.bit.RM], env->EFLAGS.bit.CF);\r
+               } else{ /*MemoryAddress*/\r
+                       addr = Emulator_x86_Get_EffectivePhysicalAddress_FromModRM(env, modrm.modrm);\r
+                       op1 = *((ushort *)addr);\r
+                       Emulator_x86_Put_EmulationInformation(env, "SBB %s, [0x%X](CF:%d)", Emulator_x86_RegNames[modrm.bit.Reg], addr, env->EFLAGS.bit.CF);\r
+               }\r
+               eflags.eflags = asm_Emulator_x86_Get_EFlags_Subtract_with_Borrow(&op0, op1, env->EFLAGS.bit.CF);\r
+               Emulator_x86_MoveToGReg(env, modrm.bit.RM, op0, True);\r
+               env->EFLAGS.bit.CF = eflags.bit.CF;\r
+               env->EFLAGS.bit.PF = eflags.bit.PF;\r
+               env->EFLAGS.bit.AF = eflags.bit.AF;\r
+               env->EFLAGS.bit.ZF = eflags.bit.ZF;\r
+               env->EFLAGS.bit.SF = eflags.bit.SF;\r
+               env->EFLAGS.bit.OF = eflags.bit.OF;\r
+               Emulator_x86_Put_EmulationInformation(env, " (CF:%d PF:%d AF:%d ZF:%d SF:%d OF:%d)", env->EFLAGS.bit.CF, env->EFLAGS.bit.PF, env->EFLAGS.bit.AF, env->EFLAGS.bit.ZF, env->EFLAGS.bit.SF, env->EFLAGS.bit.OF);\r
+       } else{ /*32-bit Addressing*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit addressing is not implemented.");\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_MOV_Ev_Gv(Emulator_x86_Environment *env)\r
+{\r
+       Emulator_x86_OperationCode_ModRM modrm;\r
+       uint addr;\r
+       uint op1;\r
+\r
+       modrm.modrm = Emulator_x86_FetchCode(env, 1);\r
+       addr = 0;\r
+\r
+       if(!env->operation_32bit){      /*16-bit Addressing*/\r
+               op1 = Emulator_x86_MoveFromGReg(env, modrm.bit.Reg, True);\r
+               if(modrm.bit.Mod == OPCODE_MOD_REGISTER){       /*Reg*/\r
+                       Emulator_x86_MoveToGReg(env, modrm.bit.RM, op1, True);\r
+                       Emulator_x86_Put_EmulationInformation(env, "MOV %s, %s", Emulator_x86_RegNames[modrm.bit.RM], Emulator_x86_RegNames[modrm.bit.Reg]);\r
+               } else{ /*MemoryAddress*/\r
+                       addr = Emulator_x86_Get_EffectivePhysicalAddress_FromModRM(env, modrm.modrm);\r
+                       *((ushort *)addr) = op1;\r
+                       Emulator_x86_Put_EmulationInformation(env, "MOV [0x%X], %s(0x%X)", addr, Emulator_x86_RegNames[modrm.bit.Reg], op1);\r
+               }\r
+       } else{ /*32-bit Addressing*/\r
+               Emulator_x86_Put_EmulationInformation(env, "32-bit addressing is not implemented.");\r
+       }\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_PUSH_Ib(Emulator_x86_Environment *env)\r
+{\r
+       //16bit/32bit?\r
+       uint imm8;\r
+\r
+       imm8 = Emulator_x86_FetchCode(env, 1);\r
+       Emulator_x86_Push_Data_To_Stack(env, imm8, env->operation_32bit);\r
+       Emulator_x86_Put_EmulationInformation(env, "PUSH 0x%X", imm8);\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
+\r
+void Emulator_x86_Operation_CLD(Emulator_x86_Environment *env)\r
+{\r
+       env->EFLAGS.bit.DF = False;\r
+       Emulator_x86_Put_EmulationInformation(env, "CLD");\r
+\r
+       env->operation_end = True;\r
+\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/emu86asm.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/emu86asm.nas
new file mode 100644 (file)
index 0000000..e70cb54
--- /dev/null
@@ -0,0 +1,60 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+[FILE "nasfunc0.nas"]\r
+\r
+       GLOBAL  _asm_Emulator_x86_Get_EFlags_Compare\r
+       GLOBAL  _asm_Emulator_x86_Get_EFlags_Increment\r
+       GLOBAL  _asm_Emulator_x86_Get_EFlags_XOR\r
+       GLOBAL  _asm_Emulator_x86_Get_EFlags_Decrement\r
+       GLOBAL  _asm_Emulator_x86_Get_EFlags_Subtract_with_Borrow\r
+\r
+[SECTION .text]\r
+\r
+_asm_Emulator_x86_Get_EFlags_Compare:\r
+       mov     eax, [esp + 4]\r
+       cmp     eax, [esp + 8]\r
+       pushfd\r
+       pop     eax\r
+       ret\r
+\r
+_asm_Emulator_x86_Get_EFlags_Increment:\r
+       mov     eax, [esp + 4]\r
+       inc     eax\r
+       pushfd\r
+       pop     eax\r
+       ret\r
+\r
+_asm_Emulator_x86_Get_EFlags_XOR:\r
+       mov     eax, [esp + 8]\r
+       xor     [esp + 4], eax\r
+       pushfd\r
+       pop     eax\r
+       ret\r
+\r
+_asm_Emulator_x86_Get_EFlags_Decrement:\r
+       mov     eax, [esp + 4]\r
+       dec     eax\r
+       pushfd\r
+       pop     eax\r
+       ret\r
+\r
+_asm_Emulator_x86_Get_EFlags_Subtract_with_Borrow:\r
+       mov     edx, [esp + 4]\r
+       xor     eax, eax\r
+       mov     ax, [edx]\r
+       cmp     dword[esp + 12], 1\r
+       jne     asm_Emulator_x86_Get_EFlags_Subtract_with_Borrow_CF0\r
+asm_Emulator_x86_Get_EFlags_Subtract_with_Borrow_CF1:\r
+       stc\r
+       jmp     asm_Emulator_x86_Get_EFlags_Subtract_with_Borrow_DO\r
+asm_Emulator_x86_Get_EFlags_Subtract_with_Borrow_CF0:\r
+       clc\r
+asm_Emulator_x86_Get_EFlags_Subtract_with_Borrow_DO:\r
+       sbb     ax, [esp + 8]\r
+       mov     [edx], eax\r
+       pushfd\r
+       pop     eax\r
+       ret\r
+\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/error.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/error.c
new file mode 100644 (file)
index 0000000..b13beb2
--- /dev/null
@@ -0,0 +1,293 @@
+\r
+#include "core.h"\r
+\r
+bool Error_Output_Enable_SerialPort = False;\r
+bool Error_Output_Enable_Display_TextMode = False;\r
+uint Error_Output_Enable_Display_GraphicMode = False;\r
+\r
+void *Error_Output_Display_GraphicMode_VRAM = 0;\r
+uint Error_Output_Display_GraphicMode_Lines = 0;\r
+uint Error_Output_Display_GraphicMode_ResolutionX = 0;\r
+uint Error_Output_Display_GraphicMode_UsedLines = 0;\r
+\r
+uchar *cpu_exceptions[0x20] = {\r
+       "Divided by zero.",\r
+       "Debug.",\r
+       "Nonmaskable interrupt.",\r
+       "Breakpoint.",\r
+       "Overflow.",\r
+       "Outside BOUND.",\r
+       "Invalid opcode.",\r
+       "Disable Device.",\r
+       "Double fault.",\r
+       "Coprocessor Segment Overrun.",\r
+       "Invalid task status segment.",\r
+       "Segment not present.",\r
+       "Stack Segment Fault.",\r
+       "General Protection Exception.",\r
+       "Page fault.",\r
+       "Reserved.",\r
+       "Floating point error.",\r
+       "Alignment Check.",\r
+       "Machine Check.",\r
+       "SIMD floating-point exception.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved.",\r
+       "Reserved."\r
+};\r
+\r
+uchar *cpu_exception_infos[16] = {\r
+       "EDI      ",\r
+       "ESI      ",\r
+       "EBP      ",\r
+       "ESP      ",\r
+       "EBX      ",\r
+       "EDX      ",\r
+       "ECX      ",\r
+       "EAX      ",\r
+       "DS       ",\r
+       "ES       ",\r
+       "ERRORCODE",\r
+       "EIP      ",\r
+       "CS       ",\r
+       "EFLAGS   ",\r
+       "User ESP ",\r
+       "User SS  "\r
+};\r
+\r
+uint Error_Report(uint error_no, ...)\r
+{\r
+       uint *retaddr, *va_args;\r
+\r
+       retaddr = &error_no - 1;\r
+       va_args = &error_no + 1;\r
+\r
+       if(error_no <= ERROR_CPU_EXCEPTIONS){\r
+               #ifdef CHNOSPROJECT_DEBUG\r
+                       if(error_no == ERROR_CPU_EXCEPTION_01){\r
+                               Debug_ExceptionHandler((uint *)*va_args);\r
+                               return 0;\r
+                       }\r
+               #endif\r
+               Error_Put_String("Exception 0x%02X:%s", error_no, cpu_exceptions[error_no]);\r
+               if(error_no == ERROR_CPU_EXCEPTION_00){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_01){\r
+                               Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_02){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_03){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_04){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_05){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_06){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_07){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_08){\r
+                       Error_CPU_Exception_Put_Registers_With_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_09){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_0A){\r
+                       Error_CPU_Exception_Put_Registers_With_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_0B){\r
+                       Error_CPU_Exception_Put_Registers_With_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_0C){\r
+                       Error_CPU_Exception_Put_Registers_With_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_0D){\r
+                       Error_CPU_Exception_Put_Registers_With_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_0E){\r
+                       Error_CPU_Exception_Put_Registers_With_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_0F){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_10){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_11){\r
+                       Error_CPU_Exception_Put_Registers_With_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_12){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_13){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_14){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_15){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_16){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_17){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_18){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_19){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_1A){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_1B){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_1C){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_1D){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_1E){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               } else if(error_no == ERROR_CPU_EXCEPTION_1F){\r
+                       Error_CPU_Exception_Put_Registers_Without_ErrorCode((uint *)*va_args);\r
+               }\r
+               Error_Abort();\r
+       } else{\r
+               Error_Put_String("[0x%08X]Error:0x%08X ", *retaddr, error_no);\r
+               if(error_no == ERROR_NO_MORE_SEGMENT){\r
+                       Error_Put_String("No More Segment Descriptor(requested at 0x%08X).", *va_args);\r
+                       Error_Abort();\r
+               } else if(error_no == ERROR_NOT_ENOUGH_FREE_MEMORY){\r
+                       Error_Put_String("No More Free Memory(Control:0x%08X Request Size:0x%08X).", *va_args, *(va_args + 1));\r
+               } else if(error_no == ERROR_MEMORY_FREE_RANGE_OVERLAPPED){\r
+                       Error_Put_String("Memory Free Range Overlapped(Control:0x%08X TagIndex:%u).", *va_args, *(va_args + 1));\r
+               } else if(error_no == ERROR_NO_MORE_FREE_TAG){\r
+                       Error_Put_String("No More Free Tag(Control:0x%08X).", *va_args);\r
+               } else if(error_no == ERROR_INVALID_FREE_MEMORY_INDEX){\r
+                       Error_Put_String("Invalid Free Memory Index(Control:0x%08X TagIndex:%u).", *va_args, *(va_args + 1));\r
+               } else if(error_no == ERROR_FIFO_BUFFER_OVERFLOW){\r
+                       Error_Put_String("FIFO Buffer Overflow(FIFO:0x%08X).", *va_args);\r
+               } else{\r
+                       Error_Put_String("Unknown Error Number.");\r
+                       Error_Abort();\r
+               }\r
+       }\r
+       Error_Put_String("Continue.");\r
+       Error_Output_Display_GraphicMode_UsedLines = 0;\r
+       return 0;\r
+}\r
+\r
+void Error_Abort(void)\r
+{\r
+       Error_Put_String("Abort.");\r
+       IO_CLI();\r
+       for(;;){\r
+               IO_HLT();\r
+       }\r
+}\r
+\r
+void Error_Set_Enable_SerialPort(bool serial)\r
+{\r
+       Error_Output_Enable_SerialPort = serial;\r
+       return;\r
+}\r
+\r
+void Error_Set_Enable_Display_TextMode(bool tdisp)\r
+{\r
+       Error_Output_Enable_Display_TextMode = tdisp;\r
+       return;\r
+}\r
+\r
+void Error_Set_Enable_Display_GraphicMode(bool gdisp, void *vram, uint xsize, uint lines)\r
+{\r
+       Error_Output_Enable_Display_GraphicMode = gdisp;\r
+       Error_Output_Display_GraphicMode_VRAM = vram;\r
+       Error_Output_Display_GraphicMode_ResolutionX = xsize;\r
+       Error_Output_Display_GraphicMode_Lines = lines;\r
+       Error_Output_Display_GraphicMode_UsedLines = 0;\r
+       return;\r
+}\r
+\r
+int Error_Put_String(const uchar format[], ...)\r
+{\r
+       int i;\r
+       uchar s[256];\r
+\r
+       i = vsnprintf(s, sizeof(s), format, (uint *)(&format + 1));\r
+       if(Error_Output_Enable_Display_GraphicMode){\r
+               if(Error_Output_Display_GraphicMode_Lines > Error_Output_Display_GraphicMode_UsedLines){\r
+                       Drawing_Fill_Rectangle(Error_Output_Display_GraphicMode_VRAM, Error_Output_Display_GraphicMode_ResolutionX, 0xc6c6c6, 0, Error_Output_Display_GraphicMode_UsedLines << 4, Error_Output_Display_GraphicMode_ResolutionX - 1, (Error_Output_Display_GraphicMode_UsedLines << 4) + 16 - 1);\r
+                       Drawing_Put_String(Error_Output_Display_GraphicMode_VRAM, Error_Output_Display_GraphicMode_ResolutionX, 0, Error_Output_Display_GraphicMode_UsedLines << 4, 0xffffff, s);\r
+                       Error_Output_Display_GraphicMode_UsedLines++;\r
+               }\r
+       }\r
+       if(Error_Output_Enable_SerialPort){\r
+               SerialPort_Send(s);\r
+               SerialPort_Send("\n");\r
+       }\r
+       if(Error_Output_Enable_Display_TextMode){\r
+               TextMode_Put_String(s, white);\r
+               TextMode_Put_String("\n", white);\r
+       }\r
+       return i;\r
+}\r
+\r
+void Error_CPU_Exception_Put_Registers_With_ErrorCode(uint *esp)\r
+{\r
+       uint i;\r
+\r
+       IO_SegmentDescriptor *gdt;\r
+\r
+       gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       Error_Put_String("#PUSHAD by _asm_CPU_ExceptionHandler");\r
+       for(i = 0; i < 4; i++){\r
+               Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[i << 1], cpu_exception_infos[(i << 1) + 1], esp[(i << 1) + 1]);\r
+       }\r
+\r
+       Error_Put_String("#PUSH by _asm_CPU_ExceptionHandler");\r
+       for(; i < 5; i++){\r
+               Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[i << 1], cpu_exception_infos[(i << 1) + 1], esp[(i << 1) + 1]);\r
+       }\r
+\r
+       Error_Put_String("#PUSH by CPU");\r
+       for(; i < 8; i++){\r
+               Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[i << 1], cpu_exception_infos[(i << 1) + 1], esp[(i << 1) + 1]);\r
+       }\r
+\r
+       Error_Put_String("#Control Registers");\r
+       Error_Put_String("CR0 = 0x%08X", Load_CR0());\r
+       Error_Put_String("CR2 = 0x%08X", Load_CR2());\r
+       Error_Put_String("CR3 = 0x%08X", Load_CR3());\r
+       Error_Put_String("CR4 = 0x%08X", Load_CR4());\r
+\r
+       Error_Put_String("Opcode[0x%X:0x%X]:0x%X", SegmentDescriptor_Get_Base(&gdt[esp[0x0c] >> 3]), esp[0x0b], ((uchar *)(SegmentDescriptor_Get_Base(&gdt[esp[0x0c] >> 3])))[esp[0x0b]]);\r
+       return;\r
+}\r
+\r
+void Error_CPU_Exception_Put_Registers_Without_ErrorCode(uint *esp)\r
+{\r
+       uint i;\r
+\r
+       IO_SegmentDescriptor *gdt;\r
+\r
+       gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       Error_Put_String("#PUSHAD by _asm_CPU_ExceptionHandler");\r
+       for(i = 0; i < 4; i++){\r
+               Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[i << 1], cpu_exception_infos[(i << 1) + 1], esp[(i << 1) + 1]);\r
+       }\r
+\r
+       Error_Put_String("#PUSH by _asm_CPU_ExceptionHandler");\r
+       for(; i < 5; i++){\r
+               Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[i << 1], cpu_exception_infos[(i << 1) + 1], esp[(i << 1) + 1]);\r
+       }\r
+\r
+       Error_Put_String("#PUSH by CPU");\r
+       Error_Put_String("%s:0x%08X", cpu_exception_infos[(i << 1) + 1], esp[i << 1]);\r
+       i++;\r
+       for(; i < 8; i++){\r
+               Error_Put_String("%s:0x%08X %s:0x%08X", cpu_exception_infos[i << 1], esp[(i << 1) - 1], cpu_exception_infos[(i << 1) + 1], esp[i << 1]);\r
+       }\r
+\r
+       Error_Put_String("#Control Registers");\r
+       Error_Put_String("CR0 = 0x%08X", Load_CR0());\r
+       Error_Put_String("CR2 = 0x%08X", Load_CR2());\r
+       Error_Put_String("CR3 = 0x%08X", Load_CR3());\r
+\r
+       Error_Put_String("Opcode[0x%X:0x%X]:0x%X", SegmentDescriptor_Get_Base(&gdt[esp[0x0b] >> 3]), esp[0x0a], ((uchar *)(SegmentDescriptor_Get_Base(&gdt[esp[0x0b] >> 3])))[esp[0x0a]]);\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/fifo.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/fifo.c
new file mode 100644 (file)
index 0000000..4800888
--- /dev/null
@@ -0,0 +1,193 @@
+\r
+#include "core.h"\r
+\r
+//\8ew\92è\83T\83C\83Y\82Í\81A\83o\83C\83g\92P\88Ê\81B4\83o\83C\83g\90Ø\82è\8eÌ\82Ä\81B\r
+//\93à\95\94\83T\83C\83Y\82Í\81A\83G\83\93\83g\83\8a(uint=4byte)\92P\88Ê\81B\r
+\r
+DATA_FIFO32 *FIFO32_Initialize(IO_MemoryControl memctrl, uint size)\r
+{\r
+       DATA_FIFO32 *fifo;\r
+\r
+       //fifo = Memory_Allocate(memctrl, sizeof(DATA_FIFO32));\r
+       fifo = (DATA_FIFO32 *)System_CommonStruct_Allocate(SYSTEM_STRUCTID_FIFO32);\r
+\r
+       fifo->size = size >> 2;\r
+       fifo->buf = Memory_Allocate(memctrl, fifo->size << 2);\r
+       fifo->free = fifo->size;        /*freesize*/\r
+       fifo->flags.initialized = False;\r
+       fifo->flags.overflow = False;\r
+       fifo->p = 0;    /*write*/\r
+       fifo->q = 0;    /*read*/\r
+       fifo->flags.initialized = True;\r
+       return fifo;\r
+}\r
+\r
+int FIFO32_Put(DATA_FIFO32 *fifo, uint data)\r
+{\r
+       uint eflags;\r
+\r
+       if(fifo == Null){\r
+               return -1;\r
+       }\r
+\r
+       if(!fifo->flags.initialized){\r
+               return -2;\r
+       }\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       if(fifo->free == 0){\r
+               #ifdef CHNOSPROJECT_DEBUG_FIFO\r
+                       debug("FIFO32_Put:Overflow data.\n");\r
+               #endif\r
+               fifo->flags.overflow = True;\r
+               Error_Report(ERROR_FIFO_BUFFER_OVERFLOW, fifo);\r
+               return -1;\r
+       }\r
+       fifo->buf[fifo->p] = data;\r
+       fifo->p++;\r
+       if(fifo->p == fifo->size){\r
+               fifo->p = 0;\r
+       }\r
+       fifo->free--;\r
+\r
+\r
+       if(fifo->task != Null){\r
+               if(fifo->task->flags.linked && !fifo->task->flags.running){\r
+                       #ifdef CHNOSPROJECT_DEBUG_FIFO\r
+                               debug("FIFO32_Put:Task run start.\n");\r
+                       #endif\r
+                       System_MultiTask_Task_Run(fifo->task);\r
+                       #ifdef CHNOSPROJECT_DEBUG_FIFO\r
+                               debug("FIFO32_Put:Task run end.\n");\r
+                       #endif\r
+\r
+               }\r
+       }\r
+\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return 0;\r
+}\r
+\r
+int FIFO32_Put_Arguments(DATA_FIFO32 *fifo, uint args, ...)\r
+{\r
+       int i;\r
+       uint *vargs;\r
+       uint eflags;\r
+\r
+       if(fifo == Null){\r
+               return -1;\r
+       }\r
+\r
+       if(!fifo->flags.initialized){\r
+               return -2;\r
+       }\r
+\r
+       if(args == 0){\r
+               return 0;\r
+       }\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       vargs = (uint *)(&args + 1);\r
+\r
+       for(i = 0; i < args; i++){\r
+               if(fifo->free <= 1){\r
+                       i = -1;\r
+                       break;\r
+               }\r
+               FIFO32_Put(fifo, vargs[i]);\r
+       }\r
+       FIFO32_Put(fifo, SIGNAL_ARGUMENTS_END);\r
+\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return i; \r
+}\r
+\r
+void FIFO32_Set_Task(DATA_FIFO32 *fifo, UI_Task *task)\r
+{\r
+       if(fifo == Null){\r
+               return;\r
+       }\r
+\r
+       fifo->task = task;\r
+       return;\r
+}\r
+\r
+uint FIFO32_Get(DATA_FIFO32 *fifo)\r
+{\r
+       int data;\r
+\r
+       if(fifo == Null){\r
+               return 0;\r
+       }\r
+\r
+       if(!fifo->flags.initialized){\r
+               return 0;\r
+       }\r
+\r
+       if (fifo->free == fifo->size) { /*\83o\83b\83t\83@\82ª\8bó\82Ì\8e\9e\82Í\81A\8dÅ\8cã\82É\93Ç\82Ý\82Æ\82ç\82ê\82½\83f\81[\83^\82ð\8cJ\82è\95Ô\82µ\95Ô\82·*/\r
+               if(fifo->q == 0){       /*\93Ç\82Ý\82¾\82µ\83|\83C\83\93\83g\82ª\8dÅ\8f\89\82Ì\82Æ\82«\82Í\81A\8dÅ\8cã\82É\93Ç\82Ý\82Æ\82ç\82ê\82½\83f\81[\83^\82Í\8fI\92[\82É\82 \82é*/\r
+                       return fifo->buf[fifo->size];\r
+               }\r
+               return fifo->buf[fifo->q - 1];\r
+       }\r
+       data = fifo->buf[fifo->q];\r
+       fifo->q++;\r
+       if (fifo->q == fifo->size) {    /*\93Ç\82Ý\8fo\82µ\83|\83C\83\93\83g\82ª\8fI\92[\82Ü\82Å\8ds\82Á\82½\82Ì\82Å\81A\90æ\93ª\82É\96ß\82·*/\r
+               fifo->q = 0;\r
+       }\r
+       fifo->free++;\r
+       return data;\r
+}\r
+\r
+uint FIFO32_Status(DATA_FIFO32 *fifo)\r
+{\r
+       if(fifo == Null){\r
+               return 0;\r
+       }\r
+\r
+       if(!fifo->flags.initialized){\r
+               return 0;\r
+       }\r
+\r
+       return fifo->size - fifo->free; /*\83o\83b\83t\83@\82É\91\8dÝ\82·\82é\83f\81[\83^\82Ì\83G\83\93\83g\83\8a\90\94(\83G\83\93\83g\83\8a\90\94=uint\82Ì\8cÂ\90\94->\83G\83\93\83g\83\8a\90\94*4=\8eg\82í\82ê\82Ä\82¢\82é\83o\83C\83g\90\94)*/\r
+}\r
+\r
+void FIFO32_Free(DATA_FIFO32 *fifo)\r
+{\r
+       if(fifo == Null){\r
+               return;\r
+       }\r
+\r
+       if(!fifo->flags.initialized){\r
+               return;\r
+       }\r
+\r
+       System_Memory_Free(fifo->buf, fifo->size << 2);\r
+\r
+       fifo->size = 0;\r
+       fifo->buf = 0;\r
+       fifo->free = 0; /*freesize*/\r
+       fifo->flags.initialized = False;\r
+       fifo->p = 0;    /*write*/\r
+       fifo->q = 0;    /*read*/\r
+\r
+       System_CommonStruct_Free(&fifo->common_tag);\r
+       return;\r
+}\r
+\r
+uint FIFO32_MyTaskFIFO_Status(void)\r
+{\r
+       return FIFO32_Status(System_MultiTask_GetNowTask()->fifo);\r
+}\r
+\r
+uint FIFO32_MyTaskFIFO_Get(void)\r
+{\r
+       return FIFO32_Get(System_MultiTask_GetNowTask()->fifo);\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/file.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/file.c
new file mode 100644 (file)
index 0000000..772c370
--- /dev/null
@@ -0,0 +1,34 @@
+\r
+#include "core.h"\r
+\r
+IO_File *File_Initilaize(void)\r
+{\r
+       IO_File *file;\r
+\r
+       file = (IO_File *)System_CommonStruct_Allocate(SYSTEM_STRUCTID_FILE);\r
+\r
+       file->flags.bit.initialized = True;\r
+\r
+       return file;\r
+}\r
+\r
+uint File_Free(IO_File *file)\r
+{\r
+       uint i;\r
+\r
+       if(file == Null){\r
+               return 1;\r
+       }\r
+       if(file->img != Null){\r
+               System_Memory_Free(file->img, file->size);\r
+       }\r
+       if(file->path != Null){\r
+               for(i = 0; file->path[i] != 0x00; i++){\r
+\r
+               }\r
+               System_Memory_Free(file->path, i + 1);\r
+       }\r
+\r
+       System_CommonStruct_Free(&file->common_tag);\r
+       return 0;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/floppy.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/floppy.c
new file mode 100644 (file)
index 0000000..d0c2971
--- /dev/null
@@ -0,0 +1,165 @@
+\r
+#include "core.h"\r
+\r
+IO_FloppyDisk *FloppyDisk_Initialize(void *img)\r
+{\r
+       IO_FloppyDisk *fd;\r
+\r
+       fd = (IO_FloppyDisk *)System_CommonStruct_Allocate(SYSTEM_STRUCTID_FLOPPYDISK);\r
+\r
+       fd->img = img;\r
+       fd->files = (IO_FloppyDisk_DirectoryEntry *)(fd->img + FLOPPYDISK_RDE_OFFSET);\r
+       fd->userdataarea = (sector *)(fd->img + FLOPPYDISK_RDE_OFFSET + sizeof(IO_FloppyDisk_DirectoryEntry) * FLOPPYDISK_RDE_ENTRIES);\r
+//fat16\r
+       fd->fat = System_Memory_Allocate(FLOPPYDISK_SECTORS * sizeof(ushort));\r
+       FloppyDisk_Decode_FAT16(fd, False);\r
+\r
+       return fd;\r
+}\r
+\r
+uint FloppyDisk_Decode_FAT16(IO_FloppyDisk *fd, bool backup)\r
+{\r
+       uint i;\r
+       uchar *fatimg;\r
+\r
+       i = 0;\r
+\r
+       if(fd == Null){\r
+               return 1;\r
+       }\r
+       if(fd->img == Null){\r
+               return 2;\r
+       }\r
+       if(fd->fat == Null){\r
+               return 3;\r
+       }\r
+\r
+       if(backup){\r
+               fatimg = fd->img + FLOPPYDISK_FAT1_OFFSET;\r
+       } else{\r
+               fatimg = fd->img + FLOPPYDISK_FAT0_OFFSET;\r
+       }\r
+\r
+       for(i = 0; i < 2880; i += 2){\r
+               fd->fat[i + 0] = (fatimg[(i >> 1) * 3 + 0] | fatimg[(i >> 1) * 3 + 1] << 8) & 0xfff;\r
+               fd->fat[i + 1] = (fatimg[(i >> 1) * 3 + 1] >> 4 | fatimg[(i >> 1) * 3 + 2] << 4) & 0xfff;\r
+       }\r
+       return 0;\r
+}\r
+\r
+bool FloppyDisk_IsPathExist(IO_FloppyDisk *fd, const uchar path[])\r
+{\r
+       if(fd == Null){\r
+               return False;\r
+       }\r
+\r
+       if(FloppyDisk_Internal_GetDirectoryEntryFromPath(fd, path) != Null){\r
+               return True;\r
+       }\r
+\r
+       return False;\r
+}\r
+\r
+uint FloppyDisk_LoadFile(IO_FloppyDisk *fd, IO_File *file, const uchar path[])\r
+{\r
+       IO_FloppyDisk_DirectoryEntry *dir_entry;\r
+       uint i, now_size;\r
+       ushort now_cluster;\r
+\r
+       if(fd == Null){\r
+               return 1;\r
+       }\r
+       if(fd->fat == Null){\r
+               return 2;\r
+       }\r
+       if(file == Null){\r
+               return 3;\r
+       }\r
+       if(!file->flags.bit.initialized){\r
+               return 4;\r
+       }\r
+\r
+       dir_entry = FloppyDisk_Internal_GetDirectoryEntryFromPath(fd, path);\r
+\r
+       if(dir_entry == Null){\r
+               return 5;\r
+       }\r
+\r
+       for(i = 0; i < FILE_PATH_LENGTH_MAX; i++){\r
+               if(path[i] == 0x00){\r
+                       break;\r
+               }\r
+       }\r
+\r
+       file->path = System_Memory_Allocate(i + 1);\r
+       CFunction_MemoryMove(file->path, i + 1, path, i);\r
+       file->path[i] = 0x00;\r
+\r
+       file->img = System_Memory_Allocate(dir_entry->size);\r
+       file->size = dir_entry->size;\r
+\r
+       now_cluster = dir_entry->cluster;\r
+       now_size = dir_entry->size;\r
+\r
+       for(i = 0; ; i++){\r
+               if(now_size <= 512){\r
+                       CFunction_MemoryMove(&((uchar *)file->img)[i * sizeof(sector)], file->size - (i * sizeof(sector)), &fd->userdataarea[now_cluster - 2], now_size);\r
+                       break;\r
+               }\r
+               CFunction_MemoryMove(&((uchar *)file->img)[i * sizeof(sector)], file->size - (i * sizeof(sector)), &fd->userdataarea[now_cluster - 2], sizeof(sector));\r
+               now_size -= sizeof(sector);\r
+               now_cluster = fd->fat[now_cluster];\r
+       }\r
+\r
+       file->flags.bit.img_loaded = True;\r
+\r
+       return 0;\r
+}\r
+\r
+IO_FloppyDisk_DirectoryEntry *FloppyDisk_Internal_GetDirectoryEntryFromPath(IO_FloppyDisk *fd, const uchar path[])\r
+{\r
+       uchar filename[11];\r
+       uint i, j;\r
+       IO_FloppyDisk_DirectoryEntry_Attribute rdeattr;\r
+\r
+       if(fd == Null){\r
+               return Null;\r
+       }\r
+\r
+       for(i = 0; i < 11; i++){\r
+               filename[i] = ' ';\r
+       }\r
+\r
+       j = 0;\r
+       for(i = 0; i < 11; i++){\r
+               if(j >= 11){\r
+                       break;\r
+               }\r
+               if(path[i] == 0x00){\r
+                       break;\r
+               }\r
+               if(path[i] == '.'){\r
+                       j = 8;\r
+               } else{\r
+                       filename[j] = path[i];\r
+                       if('a' <= filename[j] && filename[j] <= 'z'){\r
+                               filename[j] -= 0x20;\r
+                       }\r
+                       j++;\r
+               }\r
+       }\r
+\r
+       for(i = 0; i < FLOPPYDISK_RDE_ENTRIES; i++){\r
+               if(fd->files[i].name[0] == 0x00){\r
+                       break;\r
+               }\r
+               rdeattr.attribute = fd->files[i].attribute;\r
+               if(fd->files[i].name[0] != 0xe5 && fd->files[i].name[0] != 0x05 && !rdeattr.bit.volumelabel && !rdeattr.bit.directory){\r
+                       if(CFunction_CompareStrings_n(fd->files[i].name, filename, 11)){\r
+                               return &fd->files[i];\r
+                       }\r
+               }\r
+       }\r
+       return Null;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/fmt_bmp.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/fmt_bmp.c
new file mode 100644 (file)
index 0000000..9d1f795
--- /dev/null
@@ -0,0 +1,117 @@
+\r
+#include "core.h"\r
+\r
+//\83p\83f\83B\83\93\83O\82Ì\8aÖ\8cW\82Å\82±\82ñ\82È\82±\82Æ\82É\82È\82Á\82Ä\82é\r
+typedef struct DATA_FORMAT_BMP_FILE_HEADER {\r
+       uchar sign[2];\r
+       uchar filesize[4];\r
+       uchar reserved0[2];\r
+       uchar reserved1[2];\r
+       uchar offset_to_data[4];\r
+} DATA_Format_BMP_FileHeader;\r
+\r
+//OS/2 Type\r
+typedef struct DATA_FORMAT_BMP_CORE_HEADER {\r
+       uint headersize;\r
+       short xsize;\r
+       short ysize;\r
+       ushort planes;\r
+       ushort bpp;\r
+} DATA_Format_BMP_CoreHeader;\r
+\r
+//Windows Type\r
+typedef struct DATA_FORMAT_BMP_INFO_HEADER {\r
+       uint headersize;\r
+       int xsize;\r
+       int ysize;\r
+       ushort planes;\r
+       ushort bpp;\r
+       uint compression_type;  //0:no compression, 1:RLE8 2:RLE4 3:bit field\r
+       uint image_data_size;\r
+       uint pixel_per_meter_x;\r
+       uint pixel_per_meter_y;\r
+       uint colors_in_palette;\r
+       uint index_of_important_color;\r
+} DATA_Format_BMP_InformationHeader;\r
+\r
+typedef struct DATA_FORMAT_BMP_RGB24 {\r
+       uchar b;\r
+       uchar g;\r
+       uchar r;\r
+} DATA_Format_BMP_RGB24;\r
+\r
+uint Format_BMP_DrawPicture(void *vram, uint xsize, uint x, uint y, uint pxsize, uint pysize, void *bmp)\r
+{\r
+       uchar s[128];\r
+       DATA_Format_BMP_FileHeader *fheader;\r
+       DATA_Format_BMP_InformationHeader *infoheader;\r
+       uint *read32;\r
+       DATA_Format_BMP_RGB24 *rgb24;\r
+       uint ix, iy;\r
+\r
+       uint offset_to_data, filesize;\r
+\r
+       fheader = (DATA_Format_BMP_FileHeader *)bmp;\r
+\r
+       if(fheader->sign[0] != 'B' || fheader->sign[1] != 'M'){\r
+               Drawing_Put_String(vram, xsize, x, y, 0x000000, "BMP:Unknown File Format.");\r
+               return 1;\r
+       }\r
+\r
+       read32 = (uint *)(&fheader->filesize[0]);\r
+       filesize = *read32;\r
+       read32 = (uint *)(&fheader->offset_to_data[0]);\r
+       offset_to_data = *read32;\r
+\r
+       //snprintf(s, sizeof(s), "size:%d offset:%d", filesize, offset_to_data);\r
+       //Drawing_Put_String(vram, xsize, x, y, 0x000000, s);\r
+\r
+       read32 = (uint *)(bmp + 0x0e);\r
+\r
+       if(*read32 == 12){\r
+               Drawing_Put_String(vram, xsize, x, y + 16 * 1, 0x000000, "BMP Core Header.(not implemented.)");\r
+               return 2;\r
+       } else if(*read32 == 40){\r
+               //Drawing_Put_String(vram, xsize, x, y + 16 * 1, 0x000000, "BMP INFO Header.");\r
+               infoheader = (DATA_Format_BMP_InformationHeader *)(bmp + 0x0e);\r
+               if(infoheader->ysize > 0){\r
+                       //Drawing_Put_String(vram, xsize, x, y + 16 * 2, 0x000000, "Bottom Up.");\r
+               } else{\r
+                       Drawing_Put_String(vram, xsize, x, y + 16 * 2, 0x000000, "Top Down (not implemented).");\r
+                       return 5;\r
+               }\r
+\r
+               if(infoheader->compression_type == 0){\r
+                       //Drawing_Put_String(vram, xsize, x, y + 16 * 3, 0x000000, "No compression.");\r
+               } else{\r
+                       Drawing_Put_String(vram, xsize, x, y + 16 * 3, 0x000000, "Compressed (not implemented).");\r
+                       return 4;\r
+               }\r
+\r
+               if(infoheader->bpp == 24){\r
+                       //Drawing_Put_String(vram, xsize, x, y + 16 * 4, 0x000000, "24 bpp.");\r
+               } else{\r
+                       snprintf(s, sizeof(s), "%d bpp(not implemented).", infoheader->bpp);\r
+                       Drawing_Put_String(vram, xsize, x, y + 16 * 4, 0x000000, s);\r
+                       return 6;\r
+               }\r
+\r
+               //snprintf(s, sizeof(s), "xsize:%d ysize:%d", infoheader->xsize, infoheader->ysize);\r
+               //Drawing_Put_String(vram, xsize, x, y + 16 * 5, 0x000000, s);\r
+\r
+               rgb24 = (DATA_Format_BMP_RGB24 *)(bmp + offset_to_data);\r
+\r
+               for(iy = infoheader->ysize; iy > 0; iy--){\r
+                       for(ix = 0; ix < infoheader->xsize; ix++){\r
+                               Drawing_Draw_Point(vram, xsize, x + ix, y + iy - 1, rgb24->r << 16 | rgb24->g << 8 | rgb24->b);\r
+                               rgb24 = (DATA_Format_BMP_RGB24 *)((uint)rgb24 + 3);\r
+                       }\r
+                       rgb24 = (DATA_Format_BMP_RGB24 *)((uint)rgb24 + ((infoheader->xsize + 3) & ~3) - infoheader->xsize);\r
+               }\r
+       } else{\r
+               Drawing_Put_String(vram, xsize, x, y + 16 * 1, 0x000000, "Unknown BMP Header.");\r
+               return 3;\r
+       }\r
+\r
+       return 0;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/hankaku.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/hankaku.txt
new file mode 100644 (file)
index 0000000..6d5bb91
--- /dev/null
@@ -0,0 +1,4653 @@
+\r
+char 0x00\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x01\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.....*.\r
+*.....*.\r
+*.*.*.*.\r
+*..*..*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+........\r
+\r
+char 0x02\r
+........\r
+........\r
+..***...\r
+.*****..\r
+*******.\r
+**.*.**.\r
+**.*.**.\r
+*******.\r
+*******.\r
+**.*.**.\r
+***.***.\r
+.*****..\r
+..***...\r
+........\r
+........\r
+........\r
+\r
+char 0x03\r
+........\r
+........\r
+........\r
+........\r
+.**.**..\r
+*******.\r
+*******.\r
+*******.\r
+.*****..\r
+..***...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x04\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*****..\r
+*******.\r
+.*****..\r
+..***...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x05\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*******.\r
+.*.*.*..\r
+...*....\r
+..***...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x06\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*****..\r
+*******.\r
+**.*.**.\r
+...*....\r
+..***...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x07\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+..****..\r
+..****..\r
+...**...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x08\r
+********\r
+********\r
+********\r
+********\r
+********\r
+********\r
+***..***\r
+**....**\r
+**....**\r
+***..***\r
+********\r
+********\r
+********\r
+********\r
+********\r
+********\r
+\r
+char 0x09\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..****..\r
+.**..**.\r
+.*....*.\r
+.*....*.\r
+.**..**.\r
+..****..\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x0a\r
+********\r
+********\r
+********\r
+********\r
+********\r
+**....**\r
+*..**..*\r
+*.****.*\r
+*.****.*\r
+*..**..*\r
+**....**\r
+********\r
+********\r
+********\r
+********\r
+********\r
+\r
+char 0x0b\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x0c\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x0d\r
+........\r
+........\r
+....**..\r
+....***.\r
+....*.**\r
+....*.**\r
+....*.*.\r
+....*...\r
+....*...\r
+...**...\r
+.****...\r
+*****...\r
+.***....\r
+........\r
+........\r
+........\r
+\r
+char 0x0e\r
+........\r
+........\r
+...*****\r
+...*****\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+.***.***\r
+********\r
+.**..**.\r
+........\r
+........\r
+........\r
+\r
+char 0x0f\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+.*.*.*..\r
+..***...\r
+..*.*...\r
+..***...\r
+.*.*.*..\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x10\r
+........\r
+*.......\r
+**......\r
+***.....\r
+****....\r
+*****...\r
+******..\r
+*******.\r
+******..\r
+*****...\r
+****....\r
+***.....\r
+**......\r
+*.......\r
+........\r
+........\r
+\r
+char 0x11\r
+........\r
+......*.\r
+.....**.\r
+....***.\r
+...****.\r
+..*****.\r
+.******.\r
+*******.\r
+.******.\r
+..*****.\r
+...****.\r
+....***.\r
+.....**.\r
+......*.\r
+........\r
+........\r
+\r
+char 0x12\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+...*....\r
+........\r
+........\r
+........\r
+\r
+char 0x13\r
+........\r
+........\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+........\r
+........\r
+.*...*..\r
+.*...*..\r
+........\r
+........\r
+\r
+char 0x14\r
+........\r
+..*****.\r
+.*..*.*.\r
+*...*.*.\r
+*...*.*.\r
+*...*.*.\r
+*...*.*.\r
+.*..*.*.\r
+..***.*.\r
+....*.*.\r
+....*.*.\r
+....*.*.\r
+....*.*.\r
+....*.*.\r
+........\r
+........\r
+\r
+char 0x15\r
+.*****..\r
+*.....*.\r
+.*......\r
+..*.....\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+....*...\r
+.....*..\r
+*.....*.\r
+.*****..\r
+........\r
+\r
+char 0x16\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+*******.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x17\r
+........\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x18\r
+........\r
+...*....\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x19\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+...*....\r
+........\r
+........\r
+\r
+char 0x1a\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+....*...\r
+.....*..\r
+*******.\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1b\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..*.....\r
+.*......\r
+*******.\r
+.*......\r
+..*.....\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1c\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*.......\r
+*.......\r
+*******.\r
+........\r
+........\r
+\r
+char 0x1d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..*.*...\r
+.*...*..\r
+*******.\r
+.*...*..\r
+..*.*...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1e\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+...*....\r
+..***...\r
+..***...\r
+.*****..\r
+.*****..\r
+*******.\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x1f\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+*******.\r
+.*****..\r
+.*****..\r
+..***...\r
+..***...\r
+...*....\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x20\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x21\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x22\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x23\r
+........\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+*******.\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+*******.\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+........\r
+........\r
+\r
+char 0x24\r
+...*....\r
+..***.*.\r
+.*.*.**.\r
+*..*..*.\r
+*..*..*.\r
+*..*....\r
+.*.*....\r
+..***...\r
+...*.*..\r
+...*..*.\r
+*..*..*.\r
+*..*..*.\r
+**.*.*..\r
+*.***...\r
+...*....\r
+...*....\r
+\r
+char 0x25\r
+.**...*.\r
+*..*..*.\r
+*..*.*..\r
+*..*.*..\r
+.**.*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.**..\r
+.*.*..*.\r
+.*.*..*.\r
+*..*..*.\r
+*...**..\r
+........\r
+........\r
+\r
+char 0x26\r
+........\r
+.***....\r
+*...*...\r
+*...*...\r
+*...*...\r
+*..*....\r
+.**.....\r
+.*...***\r
+*.*...*.\r
+*..*..*.\r
+*...*.*.\r
+*....*..\r
+.*...**.\r
+..***..*\r
+........\r
+........\r
+\r
+char 0x27\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x28\r
+......*.\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+....*...\r
+.....*..\r
+......*.\r
+........\r
+\r
+char 0x29\r
+*.......\r
+.*......\r
+..*.....\r
+..*.....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+*.......\r
+........\r
+\r
+char 0x2a\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+*..*..*.\r
+.*.*.*..\r
+..***...\r
+.*.*.*..\r
+*..*..*.\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x2b\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x2c\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+....*...\r
+....*...\r
+...*....\r
+\r
+char 0x2d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x2e\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x2f\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*......\r
+.*......\r
+*.......\r
+*.......\r
+\r
+char 0x30\r
+........\r
+...**...\r
+..*..*..\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x31\r
+........\r
+....*...\r
+...**...\r
+..*.*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x32\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*......\r
+.******.\r
+........\r
+........\r
+\r
+char 0x33\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+......*.\r
+......*.\r
+.....*..\r
+...**...\r
+.....*..\r
+......*.\r
+......*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x34\r
+........\r
+....**..\r
+....**..\r
+....**..\r
+...*.*..\r
+...*.*..\r
+...*.*..\r
+..*..*..\r
+..*..*..\r
+.*...*..\r
+.******.\r
+.....*..\r
+.....*..\r
+...****.\r
+........\r
+........\r
+\r
+char 0x35\r
+........\r
+.*****..\r
+.*......\r
+.*......\r
+.*......\r
+.*.**...\r
+.**..*..\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x36\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*......\r
+.*.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x37\r
+........\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..***...\r
+........\r
+........\r
+\r
+char 0x38\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x39\r
+........\r
+...**...\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..**.\r
+...**.*.\r
+......*.\r
+.*....*.\r
+..*..*..\r
+...**...\r
+........\r
+........\r
+\r
+char 0x3a\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x3b\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+........\r
+........\r
+...**...\r
+...**...\r
+....*...\r
+....*...\r
+...*....\r
+\r
+char 0x3c\r
+........\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*......\r
+*.......\r
+*.......\r
+.*......\r
+..*.....\r
+...*....\r
+....*...\r
+.....*..\r
+......*.\r
+........\r
+\r
+char 0x3d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+........\r
+........\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x3e\r
+........\r
+*.......\r
+.*......\r
+..*.....\r
+...*....\r
+....*...\r
+.....*..\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*......\r
+*.......\r
+........\r
+\r
+char 0x3f\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.....*..\r
+....*...\r
+...*....\r
+...*....\r
+........\r
+........\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x40\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*..**.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*.*.*.*.\r
+*..***..\r
+*.......\r
+.*...**.\r
+..***...\r
+........\r
+........\r
+\r
+char 0x41\r
+........\r
+...**...\r
+...**...\r
+...**...\r
+...**...\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x42\r
+........\r
+****....\r
+.*..*...\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+.*..*...\r
+.****...\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...*..\r
+*****...\r
+........\r
+........\r
+\r
+char 0x43\r
+........\r
+..***.*.\r
+.*...**.\r
+.*....*.\r
+*.....*.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.....*.\r
+.*....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x44\r
+........\r
+*****...\r
+.*...*..\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...*..\r
+.*...*..\r
+*****...\r
+........\r
+........\r
+\r
+char 0x45\r
+........\r
+*******.\r
+.*....*.\r
+.*....*.\r
+.*......\r
+.*......\r
+.*...*..\r
+.*****..\r
+.*...*..\r
+.*......\r
+.*......\r
+.*....*.\r
+.*....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x46\r
+........\r
+*******.\r
+.*....*.\r
+.*....*.\r
+.*......\r
+.*......\r
+.*...*..\r
+.*****..\r
+.*...*..\r
+.*...*..\r
+.*......\r
+.*......\r
+.*......\r
+****....\r
+........\r
+........\r
+\r
+char 0x47\r
+........\r
+..***.*.\r
+.*...**.\r
+.*....*.\r
+*.....*.\r
+*.......\r
+*.......\r
+*..****.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+.*...**.\r
+..***...\r
+........\r
+........\r
+\r
+char 0x48\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x49\r
+........\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x4a\r
+........\r
+...*****\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+*....*..\r
+.*..*...\r
+..**....\r
+........\r
+\r
+char 0x4b\r
+........\r
+***..***\r
+.*....*.\r
+.*...*..\r
+.*..*...\r
+.*.*....\r
+.*.*....\r
+.**.....\r
+.*.*....\r
+.*.*....\r
+.*..*...\r
+.*...*..\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x4c\r
+........\r
+****....\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*....*.\r
+.*....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x4d\r
+........\r
+**....**\r
+.*....*.\r
+.**..**.\r
+.**..**.\r
+.**..**.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x4e\r
+........\r
+**...***\r
+.*....*.\r
+.**...*.\r
+.**...*.\r
+.*.*..*.\r
+.*.*..*.\r
+.*.*..*.\r
+.*..*.*.\r
+.*..*.*.\r
+.*..*.*.\r
+.*...**.\r
+.*...**.\r
+***...*.\r
+........\r
+........\r
+\r
+char 0x4f\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x50\r
+........\r
+*****...\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...*..\r
+.****...\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+****....\r
+........\r
+........\r
+\r
+char 0x51\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*..*..*.\r
+*...*.*.\r
+.*...*..\r
+..***.*.\r
+........\r
+........\r
+\r
+char 0x52\r
+........\r
+******..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*****..\r
+.*...*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x53\r
+........\r
+..***.*.\r
+.*...**.\r
+*.....*.\r
+*.....*.\r
+*.......\r
+.*......\r
+..***...\r
+.....*..\r
+......*.\r
+*.....*.\r
+*.....*.\r
+**...*..\r
+*.***...\r
+........\r
+........\r
+\r
+char 0x54\r
+........\r
+*******.\r
+*..*..*.\r
+*..*..*.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x55\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..****..\r
+........\r
+........\r
+\r
+char 0x56\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+...**...\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x57\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+........\r
+........\r
+\r
+char 0x58\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+***..***\r
+........\r
+........\r
+\r
+char 0x59\r
+........\r
+***.***.\r
+.*...*..\r
+.*...*..\r
+.*...*..\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x5a\r
+........\r
+*******.\r
+*....*..\r
+*....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*....*.\r
+*.....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x5b\r
+........\r
+..*****.\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*****.\r
+........\r
+\r
+char 0x5c\r
+*.......\r
+*.......\r
+.*......\r
+.*......\r
+..*.....\r
+..*.....\r
+..*.....\r
+...*....\r
+...*....\r
+....*...\r
+....*...\r
+.....*..\r
+.....*..\r
+.....*..\r
+......*.\r
+......*.\r
+\r
+char 0x5d\r
+........\r
+.*****..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.*****..\r
+........\r
+\r
+char 0x5e\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+*.....*.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x5f\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+........\r
+\r
+char 0x60\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x61\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.***....\r
+....*...\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+*...**..\r
+.***.**.\r
+........\r
+........\r
+\r
+char 0x62\r
+**......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.**..*..\r
+.*.**...\r
+........\r
+........\r
+\r
+char 0x63\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..**....\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*.......\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x64\r
+....**..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+..**.*..\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+.*..**..\r
+..**.**.\r
+........\r
+........\r
+\r
+char 0x65\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+******..\r
+*.......\r
+*.....*.\r
+.*....*.\r
+..****..\r
+........\r
+........\r
+\r
+char 0x66\r
+....***.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+........\r
+........\r
+\r
+char 0x67\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..**.**.\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+.*..**..\r
+..**.*..\r
+.....*..\r
+.....*..\r
+.****...\r
+\r
+char 0x68\r
+**......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***...**\r
+........\r
+........\r
+\r
+char 0x69\r
+........\r
+...*....\r
+...*....\r
+........\r
+........\r
+..**....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..***...\r
+........\r
+........\r
+\r
+char 0x6a\r
+........\r
+.....*..\r
+.....*..\r
+........\r
+........\r
+....**..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+..**....\r
+\r
+char 0x6b\r
+**......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*..***.\r
+.*...*..\r
+.*..*...\r
+.*.*....\r
+.**.....\r
+.*.*....\r
+.*..*...\r
+.*...*..\r
+***..**.\r
+........\r
+........\r
+\r
+char 0x6c\r
+..**....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..***...\r
+........\r
+........\r
+\r
+char 0x6d\r
+........\r
+........\r
+........\r
+........\r
+........\r
+****.**.\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+**.**.**\r
+........\r
+........\r
+\r
+char 0x6e\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+***...**\r
+........\r
+........\r
+\r
+char 0x6f\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x70\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**.**...\r
+.**..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.**..*..\r
+.*.**...\r
+.*......\r
+***.....\r
+\r
+char 0x71\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..**.*..\r
+.*..**..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+.*..**..\r
+..**.*..\r
+.....*..\r
+....***.\r
+\r
+char 0x72\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**.***..\r
+.**...*.\r
+.*....*.\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+***.....\r
+........\r
+........\r
+\r
+char 0x73\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.****.*.\r
+*....**.\r
+*.....*.\r
+**......\r
+..***...\r
+.....**.\r
+*.....*.\r
+**....*.\r
+*.****..\r
+........\r
+........\r
+\r
+char 0x74\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....***.\r
+........\r
+........\r
+\r
+char 0x75\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**...**.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*...**.\r
+..***.**\r
+........\r
+........\r
+\r
+char 0x76\r
+........\r
+........\r
+........\r
+........\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+...**...\r
+........\r
+........\r
+\r
+char 0x77\r
+........\r
+........\r
+........\r
+........\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+.*.**.*.\r
+.*.**.*.\r
+.*.**.*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+........\r
+........\r
+\r
+char 0x78\r
+........\r
+........\r
+........\r
+........\r
+........\r
+**...**.\r
+.*...*..\r
+..*.*...\r
+..*.*...\r
+...*....\r
+..*.*...\r
+..*.*...\r
+.*...*..\r
+**...**.\r
+........\r
+........\r
+\r
+char 0x79\r
+........\r
+........\r
+........\r
+........\r
+........\r
+***..***\r
+.*....*.\r
+.*....*.\r
+..*..*..\r
+..*..*..\r
+..*..*..\r
+...**...\r
+...**...\r
+...*....\r
+...*....\r
+.**.....\r
+\r
+char 0x7a\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*******.\r
+*.....*.\r
+*....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*....*.\r
+*.....*.\r
+*******.\r
+........\r
+........\r
+\r
+char 0x7b\r
+........\r
+.....**.\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+.**.....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+.....**.\r
+........\r
+........\r
+\r
+char 0x7c\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+\r
+char 0x7d\r
+........\r
+.**.....\r
+...*....\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+.....**.\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+.**.....\r
+........\r
+........\r
+\r
+char 0x7e\r
+........\r
+.***..*.\r
+*...**..\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x7f\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+*.....*.\r
+*******.\r
+*.....*.\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0x80\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+...*....\r
+..*.....\r
+\r
+char 0x81\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x82\r
+....**..\r
+....*...\r
+...*....\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x83\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x84\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x85\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x86\r
+........\r
+...**...\r
+..*..*..\r
+...**...\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x87\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..****..\r
+.*....*.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+.*....*.\r
+..****..\r
+....*...\r
+...*....\r
+\r
+char 0x88\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x89\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x8a\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.......\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x8b\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x8c\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x8d\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x8e\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+........\r
+........\r
+\r
+char 0x8f\r
+........\r
+..***...\r
+.*...*..\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*******.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+........\r
+........\r
+\r
+char 0x90\r
+....**..\r
+....*...\r
+...*....\r
+*******.\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*****...\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*******.\r
+........\r
+........\r
+\r
+char 0x91\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.**.....\r
+...***..\r
+...*..*.\r
+.***..*.\r
+*..****.\r
+*..*....\r
+*..*....\r
+*..*..*.\r
+.**.**..\r
+........\r
+........\r
+\r
+char 0x92\r
+....**..\r
+...*....\r
+..*.....\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+*******.\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+........\r
+........\r
+\r
+char 0x93\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x94\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x95\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x96\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x97\r
+...*....\r
+....*...\r
+.....*..\r
+........\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*....*.\r
+..*****.\r
+........\r
+........\r
+\r
+char 0x98\r
+........\r
+........\r
+..*..*..\r
+..*..*..\r
+........\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+.*...*..\r
+..*.*...\r
+..*.*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+\r
+char 0x99\r
+..*..*..\r
+..*..*..\r
+........\r
+..***...\r
+.*...*..\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x9a\r
+..*..*..\r
+..*..*..\r
+........\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..***...\r
+........\r
+........\r
+\r
+char 0x9b\r
+........\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+..****..\r
+.**.*.*.\r
+*.*.*...\r
+*.*.*...\r
+*.*.*...\r
+*.*.*...\r
+*.*.*...\r
+.**.*.*.\r
+..****..\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+\r
+char 0x9c\r
+........\r
+....**..\r
+...*..*.\r
+..*.....\r
+..*.....\r
+..*.....\r
+******..\r
+..*.....\r
+..*.....\r
+..*.....\r
+.**.....\r
+*.*.....\r
+*.**..*.\r
+.*..**..\r
+........\r
+........\r
+\r
+char 0x9d\r
+........\r
+*.....*.\r
+*.....*.\r
+.*...*..\r
+..*.*...\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+char 0x9e\r
+........\r
+***.....\r
+*..*....\r
+*...*...\r
+*...*...\r
+*...*...\r
+*..*.*..\r
+***..*..\r
+*..*****\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+*....*..\r
+........\r
+........\r
+\r
+char 0x9f\r
+........\r
+....**..\r
+...*..*.\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+*..*....\r
+.**.....\r
+........\r
+........\r
+\r
+char 0xa0\r
+....**..\r
+....*...\r
+...*....\r
+........\r
+........\r
+.****...\r
+.....*..\r
+.....*..\r
+..****..\r
+.*...*..\r
+*....*..\r
+*....*..\r
+.*...*..\r
+..*****.\r
+........\r
+........\r
+\r
+char 0xa1\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.**.....\r
+*..*....\r
+*..*....\r
+.**.....\r
+\r
+char 0xa2\r
+****....\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+*.......\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xa3\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+....****\r
+\r
+char 0xa4\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+*.......\r
+*.......\r
+.*......\r
+..*.....\r
+...*....\r
+\r
+char 0xa5\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xa6\r
+........\r
+********\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+*******.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+.**.....\r
+........\r
+\r
+char 0xa7\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.*******\r
+.......*\r
+....*.*.\r
+....*...\r
+...*....\r
+..*.....\r
+........\r
+\r
+char 0xa8\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+......**\r
+....**..\r
+..**....\r
+**..*...\r
+....*...\r
+....*...\r
+........\r
+\r
+char 0xa9\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+********\r
+*......*\r
+......*.\r
+.....*..\r
+....*...\r
+........\r
+\r
+char 0xaa\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+........\r
+........\r
+\r
+char 0xab\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+....*...\r
+*******.\r
+...**...\r
+..*.*...\r
+.*..*...\r
+*...*...\r
+....*...\r
+\r
+char 0xac\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+..*.....\r
+..*.****\r
+****..*.\r
+..*..*..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+\r
+char 0xad\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.****...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+********\r
+........\r
+\r
+char 0xae\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+.......*\r
+********\r
+.......*\r
+.......*\r
+********\r
+\r
+char 0xaf\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.*..*..*\r
+.*..*..*\r
+.......*\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+\r
+char 0xb0\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+.......*\r
+*******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xb1\r
+........\r
+........\r
+********\r
+.......*\r
+...*..*.\r
+...*.*..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*......\r
+*.......\r
+........\r
+\r
+char 0xb2\r
+........\r
+........\r
+.......*\r
+......**\r
+....**..\r
+..**....\r
+**..*...\r
+*...*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+....*...\r
+........\r
+........\r
+\r
+char 0xb3\r
+........\r
+........\r
+...*....\r
+...*....\r
+********\r
+*......*\r
+*......*\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+..*.....\r
+........\r
+\r
+\r
+char 0xb4\r
+........\r
+........\r
+.*****..\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+*******.\r
+........\r
+........\r
+\r
+\r
+char 0xb5\r
+........\r
+........\r
+........\r
+....*...\r
+....*...\r
+********\r
+...**...\r
+...**...\r
+..*.*...\r
+..*.*...\r
+.*..*...\r
+.*..*...\r
+*...*...\r
+...**...\r
+....*...\r
+........\r
+\r
+\r
+char 0xb6\r
+........\r
+........\r
+...*....\r
+...*....\r
+********\r
+...*...*\r
+..*....*\r
+..*....*\r
+..*....*\r
+..*....*\r
+.*.....*\r
+.*....*.\r
+*..*..*.\r
+....**.\r
+.....*..\r
+........\r
+\r
+\r
+char 0xb7\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*.***\r
+..***...\r
+**.*....\r
+....*.**\r
+...***..\r
+***.*...\r
+....*...\r
+....*...\r
+....*...\r
+.....*..\r
+.....*..\r
+........\r
+\r
+\r
+char 0xb8\r
+........\r
+........\r
+........\r
+...*****\r
+...*...*\r
+...*...*\r
+...*...*\r
+...*...*\r
+..*....*.\r
+..*....*.\r
+.*....*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+........\r
+\r
+\r
+char 0xb9\r
+........\r
+........\r
+..*.....\r
+..*.....\r
+..******\r
+..*...*.\r
+.*....*.\r
+.*....*.\r
+*....*..\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+..*.....\r
+........\r
+\r
+\r
+char 0xba\r
+........\r
+........\r
+........\r
+........\r
+.*******\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.*******\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xbb\r
+........\r
+........\r
+.*...*..\r
+.*...*..\r
+********\r
+.*...*..\r
+*....*..\r
+*....*..\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+........\r
+\r
+\r
+char 0xbc\r
+........\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.......*\r
+.**....*\r
+...**..*\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xbd\r
+........\r
+........\r
+........\r
+******..\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.*...\r
+..*.*...\r
+.*...*..\r
+.*...*..\r
+*.....*.\r
+........\r
+\r
+\r
+char 0xbe\r
+........\r
+........\r
+........\r
+..*.....\r
+..*.....\r
+..*.....\r
+..******\r
+***....*\r
+..*...*.\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+...*****\r
+........\r
+........\r
+\r
+\r
+char 0xbf\r
+........\r
+........\r
+........\r
+.*.....*\r
+..*....*\r
+..*....*\r
+...*...*\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+\r
+char 0xc0\r
+........\r
+........\r
+..******\r
+..*....*\r
+..*....*\r
+.*.....*\r
+.*.**..*\r
+*....**.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+........\r
+\r
+\r
+char 0xc1\r
+........\r
+........\r
+........\r
+....**..\r
+..***...\r
+....*...\r
+....*...\r
+********\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xc2\r
+........\r
+........\r
+........\r
+.*..*..*\r
+.*..*..*\r
+.*..*..*\r
+.......*\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+\r
+\r
+char 0xc3\r
+........\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+********\r
+....*...\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xc4\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+...**...\r
+...*.*..\r
+...*.*..\r
+...*..*.\r
+...*..*.\r
+...*....\r
+...*....\r
+...*....\r
+........\r
+\r
+\r
+char 0xc5\r
+........\r
+........\r
+........\r
+....*...\r
+....*...\r
+....*...\r
+********\r
+....*...\r
+...*....\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+..*.....\r
+.*......\r
+........\r
+\r
+\r
+char 0xc6\r
+........\r
+........\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+........\r
+........\r
+........\r
+********\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xc7\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+......*.\r
+......*.\r
+..*..*..\r
+...*.*..\r
+....*...\r
+....**..\r
+...*..*.\r
+...*....\r
+..*.....\r
+..*.....\r
+........\r
+\r
+\r
+\r
+char 0xc8\r
+........\r
+........\r
+...*....\r
+...*....\r
+.******.\r
+......*.\r
+.....*..\r
+....*...\r
+...***..\r
+..*.*.*.\r
+.*..*..*\r
+*...*...\r
+....*...\r
+....*...\r
+....*...\r
+........\r
+\r
+\r
+char 0xc9\r
+........\r
+........\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+........\r
+\r
+\r
+\r
+char 0xca\r
+........\r
+........\r
+........\r
+........\r
+..*..*..\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+*......*\r
+*......*\r
+*......*\r
+*......*\r
+*......*\r
+*......*\r
+........\r
+........\r
+\r
+\r
+char 0xcb\r
+........\r
+........\r
+........\r
+..*.....\r
+..*.....\r
+..*..***\r
+..***...\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+..*.....\r
+...*....\r
+....****\r
+........\r
+\r
+\r
+char 0xcc\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+...*....\r
+........\r
+\r
+\r
+char 0xcd\r
+........\r
+........\r
+........\r
+........\r
+...*....\r
+..*.*...\r
+.*...*..\r
+*....*..\r
+......*.\r
+......*.\r
+.......*\r
+.......*\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xce\r
+........\r
+........\r
+...*....\r
+...*....\r
+...*....\r
+********\r
+...*....\r
+...*....\r
+.*.*.*..\r
+.*.*.*..\r
+*..*..*.\r
+*..*..*.\r
+...*....\r
+...*....\r
+........\r
+........\r
+\r
+\r
+char 0xcf\r
+........\r
+........\r
+........\r
+********\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+.*...*..\r
+..*.*...\r
+...**...\r
+....*...\r
+.....*..\r
+......*.\r
+.......*\r
+........\r
+\r
+\r
+char 0xd0\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.....**.\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.....**.\r
+........\r
+........\r
+.**.....\r
+...**...\r
+.....**.\r
+........\r
+\r
+\r
+char 0xd1\r
+........\r
+........\r
+........\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+..*.....\r
+..*.....\r
+.*......\r
+.*...*..\r
+.*....*.\r
+.*..**.*\r
+****...*\r
+........\r
+........\r
+\r
+\r
+char 0xd2\r
+........\r
+........\r
+.....*..\r
+.....*..\r
+.*..*...\r
+..*.*...\r
+...*....\r
+...**...\r
+...*.*..\r
+..*...*.\r
+..*.....\r
+.*......\r
+.*......\r
+*.......\r
+*.......\r
+........\r
+\r
+\r
+char 0xd3\r
+........\r
+........\r
+........\r
+........\r
+********\r
+...*....\r
+...*....\r
+...*....\r
+********\r
+...*....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+.....***\r
+........\r
+\r
+\r
+char 0xd4\r
+........\r
+........\r
+.*......\r
+.*....**\r
+.*..**.*\r
+..**..*.\r
+***.....\r
+..*.....\r
+...*....\r
+...*....\r
+...*....\r
+....*...\r
+....*...\r
+....*...\r
+.....*..\r
+........\r
+\r
+\r
+char 0xd5\r
+........\r
+........\r
+........\r
+........\r
+.******.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+********\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xd6\r
+........\r
+........\r
+.******.\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.******.\r
+......*.\r
+......*.\r
+......*.\r
+......*.\r
+.******.\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xd7\r
+........\r
+........\r
+.******.\r
+........\r
+........\r
+********\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+........\r
+\r
+\r
+char 0xd8\r
+........\r
+........\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+...*....\r
+........\r
+\r
+\r
+char 0xd9\r
+........\r
+........\r
+....*...\r
+..*.*...\r
+..*.*...\r
+..*.*...\r
+.*..*...\r
+.*..*...\r
+.*..*...\r
+*...*..*\r
+*...*.*.\r
+*...**..\r
+....*...\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xda\r
+........\r
+........\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*......\r
+.*.....*\r
+.*....*.\r
+.*...*..\r
+.*..*...\r
+.*.*....\r
+.**.....\r
+........\r
+........\r
+\r
+\r
+char 0xdb\r
+........\r
+........\r
+........\r
+.******.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.*....*.\r
+.******.\r
+.*....*.\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xdc\r
+........\r
+........\r
+........\r
+.*******\r
+.*.....*\r
+.*.....*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+....*...\r
+........\r
+\r
+\r
+char 0xdd\r
+........\r
+........\r
+........\r
+***....*\r
+...**..*\r
+.......*\r
+.......*\r
+......*.\r
+......*.\r
+.....*..\r
+.....*..\r
+....*...\r
+....*...\r
+...*....\r
+.**.....\r
+........\r
+\r
+\r
+\r
+char 0xde\r
+........\r
+..*.....\r
+*..*....\r
+.*......\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+\r
+char 0xdf\r
+........\r
+.*......\r
+*.*.....\r
+.*......\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe0\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe1\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe2\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe3\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe4\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe5\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe6\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe7\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe8\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xe9\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xea\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xeb\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xec\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xed\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xee\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xef\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf0\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf1\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf2\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf3\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf4\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf5\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf6\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf7\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf8\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xf9\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfa\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfb\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfc\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfd\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xfe\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+\r
+char 0xff\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
+........\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/intrpt.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/intrpt.c
new file mode 100644 (file)
index 0000000..693d76d
--- /dev/null
@@ -0,0 +1,80 @@
+\r
+#include "core.h"\r
+\r
+void Initialize_ProgrammableInterruptController(void)\r
+{\r
+       /*\r
+       IRR\81F\83C\83\93\83^\83\89\83v\83g\83\8a\83N\83G\83X\83g\83\8c\83W\83X\83\r
+               .IRQ\83s\83\93\82Ì\8fó\91Ô\82ð\95\\82·\81B\83|\81[\83g\82ð\93Ç\82ñ\82¾\82Æ\82«\82É\81AIRR\82É\82È\82é\82©ISR\82É\82È\82é\82©\82Í\81AOCW3\82Å\91I\91ð\82·\82é\81B\r
+               .1\82É\82È\82Á\82Ä\82¢\82é\83r\83b\83g\82Í\81A\8c»\8dÝ\97v\8b\81\82ª\97\88\82Ä\82¢\82é\81i\82à\82µ\82­\82Í\8f\88\97\9d\92\86\82Ì\81j\8a\84\82è\8d\9e\82Ý\81B\r
+       ISR\81F\83C\83\93\83T\81[\83r\83X\83\8c\83W\83X\83\r
+               .\8c»\8dÝ\8f\88\97\9d\92\86\82Ì\8a\84\82è\8d\9e\82Ý\82ª\82Ç\82ê\82Å\82 \82é\82©\82ð\8e¦\82·\81B\83|\81[\83g\82ð\93Ç\82ñ\82¾\82Æ\82«\82É\81AIRR\82É\82È\82é\82©ISR\82É\82È\82é\82©\82Í\81AOCW3\82Å\91I\91ð\82·\82é\81B\r
+               .1\82É\82È\82Á\82Ä\82¢\82é\83r\83b\83g\82Í\81A\8c»\8dÝ\8f\88\97\9d\92\86\82Ì\8a\84\82è\8d\9e\82Ý\81B\8f\88\97\9d\92\86\82Æ\82¢\82¤\82Ì\82Í\81ACPU\82É\91Î\82µ\82ÄINT\96½\97ß\82ð\94­\8ds\82µ\82½\82ª\81AEOI\81i\8a\84\82è\8d\9e\82Ý\8fI\97¹\96½\97ß\81j\82ð\8eó\82¯\8eæ\82Á\82Ä\82¢\82È\82¢\8a\84\82è\8d\9e\82Ý\81B\r
+       IMR\81F\83C\83\93\83^\83\89\83v\83g\83}\83X\83N\83\8c\83W\83X\83\r
+               .\82±\82ê\82ª1\82É\82È\82Á\82Ä\82¢\82é\8a\84\82è\8d\9e\82Ý\82Í\81AIRR\82ª1\82É\82È\82Á\82Ä\82¢\82Ä\82à\81A\94½\89\9e\82µ\82È\82¢\81\r
+       */\r
+\r
+       IO_Out8(PIC0_IMR, 0xff);        /*\8a\84\82è\8d\9e\82Ý\91S\95\94\96³\8e\8b\81i\83}\83X\83^\81j*/\r
+       IO_Out8(PIC1_IMR, 0xff);        /*\8a\84\82è\8d\9e\82Ý\91S\95\94\96³\8e\8b\81i\83X\83\8c\81[\83u\81j*/\r
+\r
+       IO_Out8(PIC0_ICW1, 0x11);       /*\83G\83b\83W\83g\83\8a\83K\83\82\81[\83h\82É\90Ý\92è\81i\83}\83X\83^\81j*/\r
+       IO_Out8(PIC0_ICW2, 0x20);       /*\8a\84\82è\8d\9e\82Ý\94Ô\8d\86\82ð\81A20~27\82É\90Ý\92è\81B\81i\83}\83X\83^\81j*/\r
+       IO_Out8(PIC0_ICW3, 1 << 2);     /*00000100 \82Â\82Ü\82è\81A\83X\83\8c\81[\83u\82ÍIRQ2\82É\82Â\82È\82ª\82Á\82Ä\82Ü\82·\82æ\82Æ\82¢\82¤\82±\82Æ\81B*/\r
+       IO_Out8(PIC0_ICW4, 0x01);       /*\83m\83\93\83o\83b\83t\83@\83\82\81[\83h\81i\83}\83X\83^\81j*/\r
+\r
+       IO_Out8(PIC1_ICW1, 0x11);       /*\83G\83b\83W\83g\83\8a\83K\83\82\81[\83h\82É\90Ý\92è\81i\83X\83\8c\81[\83u\81j*/\r
+       IO_Out8(PIC1_ICW2, 0x28);       /*\8a\84\82è\8d\9e\82Ý\94Ô\8d\86\82ð\81A28~2f\82É\90Ý\92è\81B\81i\83X\83\8c\81[\83u\81j*/\r
+       IO_Out8(PIC1_ICW3, 2);          /*\8e©\95ª\82Í\83}\83X\83^\82ÌIRQ2\94Ô\82É\82Â\82È\82ª\82Á\82Ä\82Ü\82·\82Æ\82¢\82¤\82±\82Æ\81B*/\r
+       IO_Out8(PIC1_ICW4, 0x01);       /*\83m\83\93\83o\83b\83t\83@\83\82\81[\83h\81i\83X\83\8c\81[\83u\81j*/\r
+\r
+       IO_Out8(PIC0_IMR, 0xff);        /*\8a\84\82è\8d\9e\82Ý\91S\95\94\96³\8e\8b\81i\83}\83X\83^\81j*/\r
+       IO_Out8(PIC1_IMR, 0xff);        /*\8a\84\82è\8d\9e\82Ý\91S\95\94\96³\8e\8b\81i\83X\83\8c\81[\83u\81j*/\r
+\r
+       System_GateDescriptor_Set(0x27, (uint)asm_InterruptHandler27, 0x02, AR_INTGATE32);      /*IRQ-07\91Î\8dô*/\r
+       ProgrammableInterruptController_InterruptMask_Clear(0x07);\r
+\r
+       return;\r
+}\r
+\r
+void ProgrammableInterruptController_InterruptMask_Clear(uint irq)\r
+{\r
+       uint mask;\r
+\r
+       mask = 1;\r
+\r
+       if(irq >= 16){\r
+               return;\r
+       }\r
+\r
+       if(irq < 8){    /*For Master*/\r
+               IO_Out8(PIC0_IMR, IO_In8(PIC0_IMR) & ~(mask << irq));\r
+       } else{ /*For Slave*/\r
+               irq -= 8;\r
+               IO_Out8(PIC1_IMR, IO_In8(PIC1_IMR) & ~(mask << irq));\r
+               IO_Out8(PIC0_IMR, IO_In8(PIC0_IMR) & ~(mask << 2));\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void ProgrammableInterruptController_InterruptRequest_Complete(uint irq)\r
+{\r
+       if(irq >= 16){\r
+               return;\r
+       }\r
+\r
+       if(irq < 8){    /*For Master*/\r
+               IO_Out8(PIC0_OCW2, 0x60 + irq);\r
+       } else{ /*For Slave (and Master IRQ2)*/\r
+               irq -= 8;\r
+               IO_Out8(PIC1_OCW2, 0x60 + irq);\r
+               IO_Out8(PIC0_OCW2, 0x60 + 0x02);\r
+       }\r
+       return;\r
+}\r
+\r
+void InterruptHandler27(uint *esp)\r
+{\r
+       ProgrammableInterruptController_InterruptRequest_Complete(0x07);\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/keyboard.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/keyboard.c
new file mode 100644 (file)
index 0000000..07c4ba6
--- /dev/null
@@ -0,0 +1,615 @@
+\r
+#include "core.h"\r
+\r
+uint kbd_data0;\r
+DATA_FIFO32 *kbd_fifo;\r
+\r
+union  STATE_KEYLOCK {\r
+       uchar keylock;\r
+       struct STATE_KEYLOCK_KEY {\r
+               unsigned scroll : 1;\r
+               unsigned num : 1;\r
+               unsigned caps : 1;\r
+       } key;\r
+} state_keylock;\r
+\r
+union  STATE_KEYSHIFT {\r
+       uchar keyshift;\r
+       struct STATE_KEYSHIFT_KEY {\r
+               unsigned L : 1;\r
+               unsigned R : 1;\r
+       } key;\r
+} state_keyshift;\r
+\r
+union  STATE_KEYCTRL {\r
+       uchar keyctrl;\r
+       struct STATE_KEYCTRL_KEY {\r
+               unsigned L : 1;\r
+               unsigned R : 1;\r
+       } key;\r
+} state_keyctrl;\r
+\r
+union  STATE_KEYALT {\r
+       uchar keyalt;\r
+       struct STATE_KEYALT_KEY {\r
+               unsigned L : 1;\r
+               unsigned R : 1;\r
+       } key;\r
+} state_keyalt;\r
+\r
+ushort state_shift;\r
+\r
+uint key_decode_phase;\r
+uchar key_decode_buf[4];\r
+uchar kbc_retv;\r
+\r
+/*\83L\81[\83R\81[\83h\95Ï\8a·\83e\81[\83u\83\8b*/\r
+ushort Keyboard_KeyCodeTable[0x80] = {\r
+       KEYID_MASK_EXTENDED | KEYID_KBD_ERROR,\r
+       KEYID_MASK_EXTENDED | KEYID_ESC,\r
+       '1',\r
+       '2',\r
+       '3',\r
+       '4',\r
+       '5',\r
+       '6',\r
+       '7',\r
+       '8',\r
+       '9',\r
+       '0',\r
+       '-',\r
+       '^',\r
+       KEYID_MASK_EXTENDED | KEYID_BACKSPACE,\r
+       KEYID_MASK_EXTENDED | KEYID_TAB,\r
+/*0x10*/\r
+       'Q',\r
+       'W',\r
+       'E',\r
+       'R',\r
+       'T',\r
+       'Y',\r
+       'U',\r
+       'I',\r
+       'O',\r
+       'P',\r
+       '@',\r
+       '[',\r
+       KEYID_MASK_EXTENDED | KEYID_ENTER,\r
+       KEYID_MASK_EXTENDED | KEYID_CTRL_L,\r
+       'A',\r
+       'S',\r
+/*0x20*/\r
+       'D',\r
+       'F',\r
+       'G',\r
+       'H',\r
+       'J',\r
+       'K',\r
+       'L',\r
+       ';',\r
+       ':',\r
+       KEYID_MASK_EXTENDED | KEYID_KANJI,\r
+       KEYID_MASK_EXTENDED | KEYID_SHIFT_L,\r
+       ']',\r
+       'Z',\r
+       'X',\r
+       'C',\r
+       'V',\r
+/*0x30*/\r
+       'B',\r
+       'N',\r
+       'M',\r
+       ',',\r
+       '.',\r
+       '/',\r
+       KEYID_MASK_EXTENDED | KEYID_SHIFT_R,\r
+       KEYID_MASK_TENKEY | '*',\r
+       KEYID_MASK_EXTENDED | KEYID_ALT_L,\r
+       ' ',\r
+       KEYID_MASK_EXTENDED | KEYID_LOCK_CAPS,\r
+       KEYID_MASK_EXTENDED | KEYID_F1,\r
+       KEYID_MASK_EXTENDED | KEYID_F2,\r
+       KEYID_MASK_EXTENDED | KEYID_F3,\r
+       KEYID_MASK_EXTENDED | KEYID_F4,\r
+       KEYID_MASK_EXTENDED | KEYID_F5,\r
+/*0x40*/\r
+       KEYID_MASK_EXTENDED | KEYID_F6,\r
+       KEYID_MASK_EXTENDED | KEYID_F7,\r
+       KEYID_MASK_EXTENDED | KEYID_F8,\r
+       KEYID_MASK_EXTENDED | KEYID_F9,\r
+       KEYID_MASK_EXTENDED | KEYID_F10,\r
+       KEYID_MASK_EXTENDED | KEYID_LOCK_NUM,\r
+       KEYID_MASK_EXTENDED | KEYID_LOCK_SCROOL,\r
+       KEYID_MASK_TENKEY | '7',\r
+       KEYID_MASK_TENKEY | '8',\r
+       KEYID_MASK_TENKEY | '9',\r
+       KEYID_MASK_TENKEY | '-',\r
+       KEYID_MASK_TENKEY | '4',\r
+       KEYID_MASK_TENKEY | '5',\r
+       KEYID_MASK_TENKEY | '6',\r
+       KEYID_MASK_TENKEY | '+',\r
+       KEYID_MASK_TENKEY | '1',\r
+/*0x50*/\r
+       KEYID_MASK_TENKEY | '2',\r
+       KEYID_MASK_TENKEY | '3',\r
+       KEYID_MASK_TENKEY | '0',\r
+       KEYID_MASK_TENKEY | '.',\r
+       KEYID_MASK_EXTENDED | KEYID_SYS_RQ,\r
+       0x0000,\r
+       0x0000,\r
+       KEYID_MASK_EXTENDED | KEYID_F11,\r
+       KEYID_MASK_EXTENDED | KEYID_F12,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+/*0x60*/\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+/*0x70*/\r
+       KEYID_MASK_EXTENDED | KEYID_HIRAGANA,\r
+       0x0000,\r
+       0x0000,\r
+       '_',\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       0x0000,\r
+       KEYID_MASK_EXTENDED | KEYID_HENKAN,\r
+       0x0000,\r
+       KEYID_MASK_EXTENDED | KEYID_MUHENKAN,\r
+       0x0000,\r
+       '\\',\r
+//     0x5c,   // ='\' for mikan-trap.\r
+       0x0000,\r
+       0x0000\r
+};\r
+\r
+//\83[\83\8d\82Ì\8f\8a\82Í\83V\83t\83g\95\8e\9a\82ª\96³\82¢\82Ì\82Å\81A\83e\81[\83u\83\8b0\82ð\8eQ\8fÆ\r
+uchar Keyboard_KeyCodeTable_Shift[0x80] = {\r
+       0x00,\r
+       0x00,\r
+       '!',\r
+       0x22,   //double quote\r
+       '#',\r
+       '$',\r
+       '%',\r
+       '&',\r
+       0x27,   //single quote\r
+       '(',\r
+       ')',\r
+       '~',\r
+       '=',\r
+       '~',\r
+       0x00,\r
+       0x00,\r
+/*0x10*/\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       '`',\r
+       '{',\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+/*0x20*/\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       '+',\r
+       '*',\r
+       0x00,\r
+       0x00,\r
+       '}',\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+/*0x30*/\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       '<',\r
+       '>',\r
+       '?',\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+/*0x40*/\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+/*0x50*/\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+/*0x60*/\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+/*0x70*/\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       '_',\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       0x00,\r
+       '|',\r
+       0x00,\r
+       0x00\r
+};\r
+\r
+void Initialize_Keyboard(void)\r
+{\r
+       System_GateDescriptor_Set(0x21, (uint)asm_InterruptHandler21, 0x02, AR_INTGATE32);\r
+       ProgrammableInterruptController_InterruptMask_Clear(0x01);\r
+       kbd_data0 = 0;\r
+       kbd_fifo = 0;\r
+       state_keylock.keylock = 0;\r
+       state_keyshift.keyshift = 0;\r
+       state_keyctrl.keyctrl = 0;\r
+       state_keyalt.keyalt = 0;\r
+       key_decode_phase = 0;\r
+\r
+       KeyboardController_Wait_SendReady();\r
+       IO_Out8(PORT_KEYCMD, KEYCMD_WRITE_8042_MODE_REG);\r
+       KeyboardController_Wait_SendReady();\r
+       IO_Out8(PORT_KEYDATA, KBC_MODE);\r
+\r
+       return;\r
+}\r
+\r
+void InterruptHandler21(uint *esp)\r
+{\r
+       uint data;\r
+\r
+       data = IO_In8(PORT_KEYDATA);\r
+\r
+       ProgrammableInterruptController_InterruptRequest_Complete(0x01);\r
+\r
+       if(kbd_fifo != 0){\r
+               FIFO32_Put(kbd_fifo, data + kbd_data0);\r
+       }\r
+\r
+       if(data == KEYDATA_ACK || data == KEYDATA_RESEND){\r
+               kbc_retv = data;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Keyboard_Set_ReceiveFIFO(DATA_FIFO32 *fifo, uint data0)\r
+{\r
+       kbd_data0 = data0;\r
+       kbd_fifo = fifo;\r
+\r
+       return; \r
+}\r
+\r
+ushort Keyboard_Decode_KeyCode(uchar keycode)\r
+{\r
+       ushort keyid;\r
+       ushort table;\r
+       keyid = 0;\r
+       table = 0;\r
+\r
+       if(keycode == KEYDATA_ACK || keycode == KEYDATA_RESEND){\r
+               return 0;\r
+       }\r
+\r
+       key_decode_buf[key_decode_phase] = keycode;\r
+\r
+       switch(key_decode_phase){\r
+               case 0:\r
+\r
+                       if(key_decode_buf[0] == 0xe0){\r
+                               key_decode_phase = 1;\r
+                               break;\r
+                       } else if(key_decode_buf[0] == 0xe1){\r
+                               key_decode_phase = 2;\r
+                               break;\r
+                       } else{\r
+                               if(state_keylock.key.caps){\r
+                                       if(!state_keyshift.keyshift){\r
+                                               table = 1;\r
+                                       }\r
+                               } else{\r
+                                       if(state_keyshift.keyshift){\r
+                                               table = 1;\r
+                                       }\r
+                               }\r
+\r
+                               if(state_keyshift.keyshift){\r
+                                       keyid = Keyboard_KeyCodeTable_Shift[(key_decode_buf[0] & KEYID_MASK_ID)];\r
+                                       if(keyid == 0){\r
+                                               keyid = Keyboard_KeyCodeTable[(key_decode_buf[0] & KEYID_MASK_ID)];\r
+                                       }\r
+                               } else{\r
+                                       keyid = Keyboard_KeyCodeTable[(key_decode_buf[0] & KEYID_MASK_ID)];\r
+                               }\r
+\r
+                               if(!table && ('A' <= keyid && keyid <= 'Z')){\r
+                                       keyid += 0x20;\r
+                               }\r
+\r
+                               if(keyid & KEYID_MASK_EXTENDED){\r
+                                       if(keyid == (KEYID_MASK_EXTENDED | KEYID_CTRL_L)){\r
+                                               if((key_decode_buf[0] & KEYID_MASK_BREAK)){\r
+                                                       state_keyctrl.key.L = False;\r
+                                               } else{\r
+                                                       state_keyctrl.key.L = True;\r
+                                               }\r
+                                       } else if(keyid == (KEYID_MASK_EXTENDED | KEYID_SHIFT_L)){\r
+                                               if((key_decode_buf[0] & KEYID_MASK_BREAK)){\r
+                                                       state_keyshift.key.L = False;\r
+                                               } else{\r
+                                                       state_keyshift.key.L = True;\r
+                                               }\r
+                                       } else if(keyid == (KEYID_MASK_EXTENDED | KEYID_SHIFT_R)){\r
+                                               if((key_decode_buf[0] & KEYID_MASK_BREAK)){\r
+                                                       state_keyshift.key.R = False;\r
+                                               } else{\r
+                                                       state_keyshift.key.R = True;\r
+                                               }\r
+                                       } else if(keyid == (KEYID_MASK_EXTENDED | KEYID_ALT_L)){\r
+                                               if((key_decode_buf[0] & KEYID_MASK_BREAK)){\r
+                                                       state_keyalt.key.L = False;\r
+                                               } else{\r
+                                                       state_keyalt.key.L = True;\r
+                                               }\r
+                                       } else if(keyid == (KEYID_MASK_EXTENDED | KEYID_LOCK_CAPS)){\r
+                                               if(!(key_decode_buf[0] & KEYID_MASK_BREAK)){\r
+                                                       if(state_keylock.key.caps){\r
+                                                               state_keylock.key.caps = False;\r
+                                                       } else{\r
+                                                               state_keylock.key.caps = True;\r
+                                                       }\r
+                                                       KeyboardController_SetLED(state_keylock.keylock);\r
+                                               }\r
+                                       } else if(keyid == (KEYID_MASK_EXTENDED | KEYID_LOCK_NUM)){\r
+                                               if(!(key_decode_buf[0] & KEYID_MASK_BREAK)){\r
+                                                       if(state_keylock.key.num){\r
+                                                               state_keylock.key.num = False;\r
+                                                       } else{\r
+                                                               state_keylock.key.num = True;\r
+                                                       }\r
+                                                       KeyboardController_SetLED(state_keylock.keylock);\r
+                                               }\r
+                                       } else if(keyid == (KEYID_MASK_EXTENDED | KEYID_LOCK_SCROOL)){\r
+                                               if(!(key_decode_buf[0] & KEYID_MASK_BREAK)){\r
+                                                       if(state_keylock.key.scroll){\r
+                                                               state_keylock.key.scroll = False;\r
+                                                       } else{\r
+                                                               state_keylock.key.scroll = True;\r
+                                                       }\r
+                                                       KeyboardController_SetLED(state_keylock.keylock);\r
+                                               }\r
+                                       }\r
+                               }\r
+\r
+                               if(keyid != 0 && (key_decode_buf[0] & KEYID_MASK_BREAK)){\r
+                                       keyid |= KEYID_MASK_BREAK;\r
+                               }\r
+\r
+                       }\r
+                       key_decode_phase = 0;\r
+                       break;\r
+               case 1: //E0\8ag\92£\83L\81[\83R\81[\83h\r
+                       if((key_decode_buf[1] & KEYID_MASK_ID) == 0x1c){\r
+                               keyid |= KEYID_MASK_TENKEY | KEYID_ENTER;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x1d){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_CTRL_R;\r
+                               if((key_decode_buf[1] & KEYID_MASK_BREAK)){\r
+                                       state_keyctrl.key.R = False;\r
+                               } else{\r
+                                       state_keyctrl.key.R = True;\r
+                               }\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x35){\r
+                               keyid |= KEYID_MASK_TENKEY | '/';\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x37){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_PRINT_SCREEN;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x38){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_ALT_R;\r
+                               if((key_decode_buf[1] & KEYID_MASK_BREAK)){\r
+                                       state_keyalt.key.R = False;\r
+                               } else{\r
+                                       state_keyalt.key.R = True;\r
+                               }\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x46){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_BREAK;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x47){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_HOME;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x48){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_CURSOR_U;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x49){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_PAGE_UP;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x4b){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_CURSOR_L;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x4d){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_CURSOR_R;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x4f){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_END;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x50){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_CURSOR_D;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x51){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_PAGE_DOWN;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x52){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_INSERT;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x53){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_DELETE;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x5b){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_ICON_L;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x5c){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_ICON_R;\r
+                       } else if((key_decode_buf[1] & KEYID_MASK_ID) == 0x5d){\r
+                               keyid |= KEYID_MASK_EXTENDED | KEYID_MENU;\r
+                       }\r
+\r
+                       if(keyid != 0 && (key_decode_buf[1] & KEYID_MASK_BREAK)){\r
+                               keyid |= KEYID_MASK_BREAK;\r
+                       }\r
+\r
+                       key_decode_phase = 0;\r
+                       break;\r
+               case 2: //E1\8ag\92£\83L\81[\83R\81[\83h\83t\83F\81[\83Y0\r
+                       key_decode_phase = 3;\r
+                       break;\r
+               case 3: //E1\8ag\92£\83L\81[\83R\81[\83h\83t\83F\81[\83Y1\r
+                       if((key_decode_buf[1] == 0x1d) && (key_decode_buf[2] == 0x45)){ //Pause-Key Make\r
+                               keyid = KEYID_MASK_EXTENDED | KEYID_PAUSE;\r
+                       } else if((key_decode_buf[1] == 0x9d) && (key_decode_buf[2] == 0xc5)){  //Pause-Key Break\r
+                               keyid = KEYID_MASK_EXTENDED | KEYID_MASK_BREAK | KEYID_PAUSE;\r
+                       }\r
+                       key_decode_phase = 0;\r
+                       break;\r
+       }\r
+\r
+       if(keyid != 0){\r
+               if(state_keyshift.keyshift){\r
+                       keyid |= KEYID_MASK_STATE_SHIFT;\r
+               }\r
+               if(state_keyctrl.keyctrl){\r
+                       keyid |= KEYID_MASK_STATE_CTRL;\r
+               }\r
+               if(state_keyalt.keyalt){\r
+                       keyid |= KEYID_MASK_STATE_ALT;\r
+               }\r
+               keyid |= ((ushort)state_keylock.keylock << 12);\r
+       }\r
+\r
+       return keyid;\r
+}\r
+\r
+void KeyboardController_SetLED(uchar leds)\r
+{\r
+       KeyboardController_SendData(KEYCMD_LED);\r
+       KeyboardController_SendData(leds);\r
+       return;\r
+}\r
+\r
+void KeyboardController_Wait_SendReady(void)\r
+{\r
+       for(;;){\r
+               if((IO_In8(PORT_KEYSTA) & KEYSTA_SEND_NOTREADY) == 0) {\r
+                       break;\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+void KeyboardController_SendData(uchar data)\r
+{\r
+       for(;;){\r
+               kbc_retv = 0;\r
+               KeyboardController_Wait_SendReady();\r
+               IO_Out8(PORT_KEYDATA, data);\r
+               for(;;){\r
+                       if(kbc_retv == KEYDATA_ACK){\r
+                               return;\r
+                       }\r
+                       if(kbc_retv == KEYDATA_RESEND){\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+}\r
+\r
+void KeyboardController_SendCommand(uchar cmd)\r
+{\r
+       for(;;){\r
+               kbc_retv = 0;\r
+               KeyboardController_Wait_SendReady();\r
+               IO_Out8(PORT_KEYCMD, cmd);\r
+               for(;;){\r
+                       if(kbc_retv == KEYDATA_ACK){\r
+                               return;\r
+                       }\r
+                       if(kbc_retv == KEYDATA_RESEND){\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/keyid.h b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/keyid.h
new file mode 100644 (file)
index 0000000..69dd98b
--- /dev/null
@@ -0,0 +1,119 @@
+\r
+/*KeyIdentifier \83L\81[ID\90é\8c¾*/\r
+\r
+//16bit\82ð\8eg\97p\81B\82Â\82Ü\82è\81A0-65535,0x0000-0xffff\r
+//bit00-06     :ASCII\83R\81[\83h(\8ag\92£\83t\83\89\83O\82ª0\82Ì\82Æ\82«)\r
+//             :\8ag\92£\83L\81[ID(\8ag\92£\83t\83\89\83O\82ª1\82Ì\82Æ\82«)                \r
+//bit07                :Make,Break\8eí\95Ê(0:Make,1:Break)(0:\8eí\95Ê\82È\82µ)\r
+//bit08                :\83e\83\93\83L\81[\8eí\95Ê(0:\83t\83\8b\83L\81[,1:\83e\83\93\83L\81[)(0:\8eí\95Ê\82È\82µ)\r
+//bit09                :Shift\83L\81[\8fó\91Ô(0:\83I\83t,1:\83I\83\93)\r
+//bit10                :Ctrl\83L\81[\8fó\91Ô(0:\83I\83t,1:\83I\83\93)\r
+//bit11                :Alt\83L\81[\8fó\91Ô(0:\83I\83t,1:\83I\83\93)\r
+//bit12                :ScrollLock\8fó\91Ô(0:\83I\83t,1:\83I\83\93)\r
+//bit13                :NumLock\8fó\91Ô(0:\83I\83t,1:\83I\83\93)\r
+//bit14                :CapsLock\8fó\91Ô(0:\83I\83t,1:\83I\83\93)\r
+//bit15                :\8ag\92£\83t\83\89\83O(0:ASCII,1:\8ag\92£\83L\81[\83R\81[\83h)\r
+\r
+//\82Â\82Ü\82è\81AFIFO\82Å\8eó\82¯\8eæ\82Á\82Ä\81A\83o\83C\83A\83X\82ð\88ø\82¢\82½\82ç\81AKEYID_EXTENDED\83t\83\89\83O\82ð\92²\82×\82é\81B\r
+//\8e\9f\82É\81ABREAK\83t\83\89\83O\82ð\92²\82×\82é\81B\r
+//\82»\82µ\82Ä\81A\89º\88Ê7\83r\83b\83g\82Ì\82Ý\82ð\8eQ\8fÆ\82·\82é\81B\r
+//KEYID==0x0000\82Í\81AID\96¢\8f\88\97\9d\82Å\82 \82é\82±\82Æ\82ð\8e¦\82µ\81A\82Ç\82Ì\95\8e\9a\82ð\95\\82·\82±\82Æ\82à\82È\82¢\81B\r
+\r
+#define KEYID_MASK_ID                  0x007f\r
+#define KEYID_MASK_BREAK               0x0080\r
+#define KEYID_MASK_TENKEY              0x0100\r
+#define KEYID_MASK_STATE_SHIFT         0x0200\r
+#define KEYID_MASK_STATE_CTRL          0x0400\r
+#define KEYID_MASK_STATE_ALT           0x0800\r
+#define KEYID_MASK_STATE_LOCK_SCROOL   0x1000\r
+#define KEYID_MASK_STATE_LOCK_NUM      0x2000\r
+#define KEYID_MASK_STATE_LOCK_CAPS     0x4000\r
+#define KEYID_MASK_EXTENDED            0x8000\r
+\r
+#define KEYID_ASCII_NUL                0x0000\r
+#define KEYID_ASCII_SOH                0x0001\r
+#define KEYID_ASCII_STX                0x0002\r
+#define KEYID_ASCII_ETX                0x0003\r
+#define KEYID_ASCII_EOT                0x0004\r
+#define KEYID_ASCII_ENQ                0x0005\r
+#define KEYID_ASCII_ACK                0x0006\r
+#define KEYID_ASCII_BEL                0x0007\r
+#define KEYID_ASCII_BS         0x0008  /*0x0e*/\r
+#define KEYID_ASCII_HT         0x0009  /*0x0f*/\r
+#define KEYID_ASCII_LF         0x000a  /*0x1c*/\r
+#define KEYID_ASCII_VT         0x000b\r
+#define KEYID_ASCII_FF         0x000c\r
+#define KEYID_ASCII_CR         0x000d\r
+#define KEYID_ASCII_SO         0x000e\r
+#define KEYID_ASCII_SI         0x000f\r
+#define KEYID_ASCII_DLE                0x0010\r
+#define KEYID_ASCII_DC1                0x0011\r
+#define KEYID_ASCII_DC2                0x0012\r
+#define KEYID_ASCII_DC3                0x0013\r
+#define KEYID_ASCII_DC4                0x0014\r
+#define KEYID_ASCII_NAK                0x0015\r
+#define KEYID_ASCII_SYN                0x0016\r
+#define KEYID_ASCII_ETB                0x0017\r
+#define KEYID_ASCII_CAN                0x0018\r
+#define KEYID_ASCII_EM         0x0019\r
+#define KEYID_ASCII_SUB                0x001a\r
+#define KEYID_ASCII_ESC                0x001b\r
+#define KEYID_ASCII_FS         0x001c\r
+#define KEYID_ASCII_GS         0x001d\r
+#define KEYID_ASCII_RS         0x001e\r
+#define KEYID_ASCII_US         0x001f\r
+#define KEYID_ASCII_CHAR_START 0x0020\r
+#define KEYID_ASCII_CHAR_END   0x007e\r
+#define KEYID_ASCII_DEL                0x007f\r
+\r
+#define KEYID_ESC              0x0000\r
+#define KEYID_F1               0x0001\r
+#define KEYID_F2               0x0002\r
+#define KEYID_F3               0x0003\r
+#define KEYID_F4               0x0004\r
+#define KEYID_F5               0x0005\r
+#define KEYID_F6               0x0006\r
+#define KEYID_F7               0x0007\r
+#define KEYID_F8               0x0008\r
+#define KEYID_F9               0x0009\r
+#define KEYID_F10              0x000a\r
+#define KEYID_F11              0x000b\r
+#define KEYID_F12              0x000c\r
+#define KEYID_LOCK_NUM         0x000d\r
+#define KEYID_LOCK_SCROOL      0x000e\r
+#define KEYID_LOCK_CAPS                0x000f\r
+#define KEYID_SHIFT_L          0x0010\r
+#define KEYID_SHIFT_R          0x0011\r
+#define KEYID_CTRL_L           0x0012\r
+#define KEYID_CTRL_R           0x0013\r
+#define KEYID_ALT_L            0x0014\r
+#define KEYID_ALT_R            0x0015\r
+#define KEYID_DELETE           0x0016\r
+#define KEYID_INSERT           0x0017\r
+#define KEYID_PAUSE            0x0018\r
+#define KEYID_BREAK            0x0019\r
+#define KEYID_PRINT_SCREEN     0x001a\r
+#define KEYID_SYS_RQ           0x001b\r
+#define KEYID_CURSOR_U         0x001c\r
+#define KEYID_CURSOR_D         0x001d\r
+#define KEYID_CURSOR_L         0x001e\r
+#define KEYID_CURSOR_R         0x001f\r
+#define KEYID_PAGE_UP          0x0020\r
+#define KEYID_PAGE_DOWN                0x0021\r
+#define KEYID_HOME             0x0022\r
+#define KEYID_END              0x0023\r
+#define KEYID_ICON_L           0x0024\r
+#define KEYID_ICON_R           0x0025\r
+#define KEYID_MENU             0x0026\r
+#define KEYID_KANJI            0x0027\r
+#define KEYID_HIRAGANA         0x0028\r
+#define KEYID_HENKAN           0x0029\r
+#define KEYID_MUHENKAN         0x002a\r
+\r
+#define KEYID_BACKSPACE                0x0040\r
+#define KEYID_TAB              0x0041\r
+#define KEYID_ENTER            0x0042\r
+\r
+#define KEYID_KBD_ERROR                0x007e\r
+#define KEYID_UNKNOWN          0x007f\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/makeset.txt b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/makeset.txt
new file mode 100644 (file)
index 0000000..510384e
--- /dev/null
@@ -0,0 +1,3 @@
+\r
+OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj nasfunc2.obj hankaku.obj callbios.obj cfunc.obj color.obj console.obj debug.obj display.obj draw08.obj draw16.obj draw32.obj drawing.obj dsctbl.obj emu86.obj emu86asm.obj error.obj fifo.obj file.obj floppy.obj fmt_bmp.obj intrpt.obj keyboard.obj memory.obj mouse.obj mtask.obj pci.obj serial.obj sheet.obj sht08.obj sht16.obj sht32.obj shtdraw.obj shtfunc.obj struct.obj system.obj textbox.obj timer.obj vgatmode.obj xception.obj bootpack.obj\r
+HEADS_BOOTPACK = core.h coredef0.h coredef1.h coredef2.h coredef3.h keyid.h\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/memory.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/memory.c
new file mode 100644 (file)
index 0000000..16dd7b9
--- /dev/null
@@ -0,0 +1,315 @@
+\r
+#include "core.h"\r
+\r
+uint Memory_Test(uint start, uint end)\r
+{\r
+       uchar flg486 = 0;\r
+       uint i;\r
+       CPU_EFlags eflg;\r
+       CPU_ControlRegister0 cr0;\r
+\r
+       eflg.eflags = IO_Load_EFlags();\r
+       eflg.bit.AC = True;\r
+       IO_Store_EFlags(eflg.eflags);\r
+\r
+       eflg.eflags = IO_Load_EFlags();\r
+       if(eflg.bit.AC){\r
+               flg486 = 1;\r
+       }\r
+       eflg.bit.AC = False;\r
+       IO_Store_EFlags(eflg.eflags);\r
+\r
+       if(flg486 != 0){\r
+               cr0.cr0 = Load_CR0();\r
+               cr0.bit.NW = True;\r
+               cr0.bit.CD = True;\r
+               Store_CR0(cr0.cr0);\r
+       }\r
+       i = Memory_Test_Sub(start, end);\r
+       if(flg486 != 0){\r
+               cr0.cr0 = Load_CR0();\r
+               cr0.bit.NW = False;\r
+               cr0.bit.CD = False;\r
+               Store_CR0(cr0.cr0);\r
+       }\r
+       return i;\r
+}\r
+\r
+//Memory Control System\r
+//ctrl[0].addr = 0;\r
+//ctrl[0].size = tags;\r
+//Memory Control\94z\97ñ\82Í\81A\8aÇ\97\9d\91Î\8fÛ\82Ì\83\81\83\82\83\8a\82Ì\8fI\92[\82É\94z\92u\82³\82ê\82é\81B\r
+\r
+IO_MemoryControl Memory_Initialize_Control(void *start, uint size, uint tags)\r
+{\r
+       IO_MemoryControl ctrl;\r
+\r
+       start = (void *)(((uint)start + 7) & ~7);\r
+       size = (size + 7) & ~7;\r
+\r
+//Memory Control\94z\97ñ\82ª\93ü\82é\95ª\82æ\82è\91½\82­\81A\8aÇ\97\9d\91Î\8fÛ\82Ì\83\81\83\82\83\8a\82ð\97^\82¦\82ç\82ê\82Ä\82¢\82é\82©\83`\83F\83b\83N\81B\r
+       if((tags * sizeof(IO_MemoryControlTag)) > size){\r
+               return 0;\r
+       }\r
+\r
+//\8aÇ\97\9d\82Ì\93s\8d\87\8fã\81A3\83^\83O\88È\8fã\82È\82¢\82Æ\8aÇ\97\9d\82ª\90¬\97§\82µ\82È\82¢\82Ì\82Å\81A\82»\82Ì\83`\83F\83b\83N\81B\r
+       if(tags < 3){\r
+               return 0;\r
+       }\r
+\r
+//\8aÇ\97\9d\91Î\8fÛ\83\81\83\82\83\8a\94Í\88Í\82Ì\8dÅ\8cã\82©\82ç\81AMemory Control\94z\97ñ\82Ì\91å\82«\82³\95ª\82¾\82¯\82³\82©\82Ì\82Ú\82Á\82½\92n\93_\82ðMemoryControl\94z\97ñ\82Ì\90æ\93ª\82Æ\82·\82é\81B\r
+       ctrl = (IO_MemoryControl)(start + (size - (tags * sizeof(IO_MemoryControlTag))));\r
+       ctrl[0].addr = 0;\r
+       ctrl[0].size = tags;\r
+\r
+       ctrl[1].addr = start;\r
+       ctrl[1].size = size - (tags * sizeof(IO_MemoryControlTag));\r
+\r
+       ctrl[2].addr = 0;\r
+       ctrl[2].size = 0xffffffff;\r
+\r
+       return ctrl;\r
+}\r
+\r
+void Memory_Free(IO_MemoryControl ctrl, void *addr, uint size)\r
+{\r
+       uint i, j, k, minsize;\r
+       uint eflags;\r
+\r
+       size = (size + 7) & ~7;\r
+\r
+#ifdef CHNOSPROJECT_DEBUG_MEMORY\r
+       debug("DEBUG:MemoryFree:Start ctrl:0x%08X addr:0x%08X size 0x%08X\n", ctrl, addr, size);\r
+#endif\r
+\r
+       if(size == 0){\r
+               return;\r
+       }\r
+\r
+       eflags = IO_Load_EFlags();\r
+\r
+       IO_CLI();\r
+\r
+       j = 0;\r
+       k = 0;\r
+       minsize = 0xffffffff;\r
+       for(i = 1; i < ctrl[0].size; i++){\r
+               if(ctrl[i].size == 0xffffffff){ /*\8fI\92[*/\r
+                       break;\r
+               }\r
+               if(ctrl[i].size < minsize){     /*\8dÅ\8f¬\8bó\82«\83\81\83\82\83\8a\82Ì\8c\9f\8dõ*/\r
+                       k = i;\r
+               }\r
+               if(addr + size <= ctrl[i].addr){        /*\89ð\95ú\82µ\82æ\82¤\82Æ\82µ\82Ä\82¢\82é\8bó\82«\83\81\83\82\83\8a\82Ì\8e\9f\82É\97\88\82é\82×\82«\8bó\82«\83\81\83\82\83\8a*/\r
+#ifdef CHNOSPROJECT_DEBUG_MEMORY\r
+       debug("DEBUG:MemoryFree:Found NextTagIndex:%d\n", i);\r
+#endif\r
+                       j = i;\r
+                       break;\r
+               }\r
+       }\r
+       for(i--; i < ctrl[0].size; i++){\r
+               if(ctrl[i].size == 0xffffffff){ /*\8fI\92[*/\r
+                       break;\r
+               }\r
+               if(ctrl[i].size < minsize){     /*\8dÅ\8f¬\8bó\82«\83\81\83\82\83\8a\82Ì\8c\9f\8dõ*/\r
+                       k = i;\r
+               }\r
+       }\r
+#ifdef CHNOSPROJECT_DEBUG_MEMORY\r
+       debug("DEBUG:MemoryFree:Loop EndTagIndex:%d\n", i);\r
+#endif\r
+       if(j == 0){     /*\8e©\95ª\82æ\82è\82à\83A\83h\83\8c\83X\82Ì\8f¬\82³\82È\8bó\82«\8fî\95ñ\82ª\8c©\82Â\82©\82ç\82È\82©\82Á\82½*/\r
+               j = i;\r
+       }\r
+       if(i == ctrl[0].size){  /*\8bó\82«\83\81\83\82\83\8a\94z\97ñ\82ª\96\9e\94t*/\r
+               Error_Report(ERROR_NO_MORE_FREE_TAG, ctrl);     /*\96{\93\96\82Í\82±\82±\82Å\81Actrl[0].addr\82ð\97\98\97p\82µ\82Ä\81A\95Ð\95û\8cü\83\8a\83X\83g\82É\93o\98^\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\81B*/\r
+               if(ctrl[k].size >= size){       /*\8dÅ\8f¬\82Ì\8bó\82«\83\81\83\82\83\8a\82Í\81A\89ð\95ú\82µ\82æ\82¤\82Æ\82µ\82Ä\82¢\82é\8bó\82«\83\81\83\82\83\8a\82¾\82Á\82½\82Ì\82Å\81A\93o\98^\92\86\8e~*/\r
+                       IO_Store_EFlags(eflags);\r
+                       return;\r
+               } else if(j <= k){      /*\8dÅ\8f¬\82Ì\8bó\82«\83\81\83\82\83\8a\82Í\81A\89ð\95ú\82µ\82æ\82¤\82Æ\82µ\82Ä\82¢\82é\8bó\82«\83\81\83\82\83\8a\82Ì\91}\93ü\88Ê\92u\82æ\82è\82à\8cã\82É\82 \82é*/\r
+                       for(; k > j; k--){\r
+                               ctrl[k] = ctrl[k - 1];\r
+                       }\r
+               } else if(j > k){       /*\8dÅ\8f¬\82Ì\8bó\82«\83\81\83\82\83\8a\82Í\81A\89ð\95ú\82µ\82æ\82¤\82Æ\82µ\82Ä\82¢\82é\8bó\82«\83\81\83\82\83\8a\82Ì\91}\93ü\88Ê\92u\82æ\82è\82à\91O\82É\82 \82é*/\r
+                       for(; k < j - 1; k++){\r
+                               ctrl[k] = ctrl[k + 1];\r
+                       }\r
+                       j--;\r
+               }\r
+       } else{ /*\8bó\82«\82Í\8f\\95ª\82 \82é\82Ì\82Å\82¸\82ç\82·*/\r
+               if(i + 1 != ctrl[0].size - 1){\r
+                       ctrl[i + 1].addr = 0;\r
+                       ctrl[i + 1].size = 0xffffffff;\r
+               }\r
+               for(; i > j; i--){\r
+                       ctrl[i] = ctrl[i - 1];\r
+               }\r
+       }\r
+       ctrl[j].addr = addr;\r
+       ctrl[j].size = size;\r
+\r
+       Memory_Free_Sub(ctrl, j);\r
+\r
+       IO_Store_EFlags(eflags);\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_MEMORY_ALLOCATE_AND_FREE\r
+               debug("Memory_Free:ctrl:[0x%X] addr:[0x%X] size:0x%X\n", ctrl, addr, size);\r
+       #endif\r
+\r
+       return;\r
+}\r
+\r
+void Memory_Free_Sub(IO_MemoryControl ctrl, uint tagno)\r
+{\r
+       uint i, j, k;\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+\r
+       IO_CLI();\r
+\r
+       if(1 < tagno && tagno < ctrl[0].size - 1){\r
+               i = tagno - 1;\r
+               j = tagno + 1;\r
+       } else if(tagno == 1){\r
+               i = 1;\r
+               j = 2;\r
+       } else if(tagno == ctrl[0].size - 1){\r
+               i = ctrl[0].size - 2;\r
+               j = ctrl[0].size - 1;\r
+       } else{\r
+               Error_Report(ERROR_INVALID_FREE_MEMORY_INDEX, ctrl, tagno);\r
+               IO_Store_EFlags(eflags);\r
+               return;\r
+       }\r
+\r
+       for(; i < j; i++){\r
+               if(ctrl[i].addr + ctrl[i].size >= ctrl[i + 1].addr){    /*ctrl[i]\82Ì\8cã\82ë\82É\81Actrl[i + 1]\82ª\82Â\82È\82ª\82é*/\r
+                       if(ctrl[i].addr + ctrl[i].size > ctrl[i + 1].addr){     /*\94Í\88Í\82ª\8fd\82È\82Á\82Ä\82¢\82é*/\r
+                               Error_Report(ERROR_MEMORY_FREE_RANGE_OVERLAPPED, ctrl, i);\r
+                               ctrl[i].size = (uint)ctrl[i + 1].addr - (uint)ctrl[i].addr;\r
+                       }\r
+                       ctrl[i].size += ctrl[i + 1].size;\r
+                       for(k = i + 1; k < ctrl[0].size - 1; k++){\r
+                               if(ctrl[k].size == 0xffffffff){\r
+                                       break;\r
+                               }\r
+                               ctrl[k] = ctrl[k + 1];\r
+                       }\r
+                       if(k != ctrl[0].size - 1){\r
+                               ctrl[k].addr = 0;\r
+                               ctrl[k].size = 0xffffffff;\r
+                       }\r
+                       i -= 2;\r
+                       j--;\r
+               }\r
+       }\r
+       IO_Store_EFlags(eflags);\r
+       return;\r
+}\r
+\r
+void *Memory_Allocate(IO_MemoryControl ctrl, uint size)\r
+{\r
+       uint i;\r
+       void *addr;\r
+       uint eflags;\r
+\r
+       size = (size + 7) & ~7;\r
+\r
+#ifdef CHNOSPROJECT_DEBUG_MEMORY\r
+       debug("DEBUG:MemoryAllocate:Start ctrl:0x%08X size 0x%08X\n", ctrl, size);\r
+#endif\r
+\r
+       eflags = IO_Load_EFlags();\r
+\r
+       IO_CLI();\r
+\r
+       for(i = 1; i < ctrl[0].size; i++){\r
+               if(ctrl[i].size == 0xffffffff){ /*\8fI\92[*/\r
+                       break;\r
+               }\r
+               if(ctrl[i].size >= size){       /*\8f\\95ª\82È\8bó\82«\82ð\94­\8c©*/\r
+#ifdef CHNOSPROJECT_DEBUG_MEMORY\r
+       debug("DEBUG:MemoryAllocate:Found index:%d\n", i);\r
+#endif\r
+                       addr = ctrl[i].addr;\r
+                       if(ctrl[i].size == size){       /*\82Ò\82Á\82½\82è\82¾\82Á\82½\82Ì\82Å\8bó\82«\8fî\95ñ\82ð\94j\8aü*/\r
+                               for(; i < ctrl[0].size - 1; i++){\r
+                                       //\8fI\92[\82ð\94­\8c©\82µ\82½\82çBreak.\r
+                                       if(ctrl[i].size == 0xffffffff){\r
+                                               break;\r
+                                       }\r
+                                       //\83^\83O\82ð\83R\83s\81[\82µ\82Ä\91O\82É\8bl\82ß\82é\81B\r
+                                       ctrl[i] = ctrl[i + 1];\r
+                               }\r
+                               //\8bl\82ß\82½\8c\8b\89Ê\81A\8fI\92[\83^\83O\82ª\95K\97v\82¾\82Á\82½\82ç\92Ç\89Á\82·\82é\81i\82»\82ñ\82È\82±\82Æ\82È\82¢\82Í\82¸\82¾\82æ\82Ë\81H\81c\81j\r
+                               //if(i != ctrl[0].size){\r
+                               //      ctrl[i].addr = 0;\r
+                               //      ctrl[i].size = 0xffffffff;\r
+                               //}\r
+                       } else{ /*\82Ü\82¾\8ec\82Á\82Ä\82¢\82é\82Ì\82Å\8bó\82«\8fî\95ñ\82ð\92²\90®*/\r
+                               ctrl[i].addr += size;\r
+                               ctrl[i].size -= size;\r
+                       }\r
+                       IO_Store_EFlags(eflags);\r
+                       //\83\81\83\82\83\8a\82ð\83[\83\8d\83N\83\8a\83A\81B\r
+                       MOVSD_ZeroFill(addr, size);\r
+\r
+                       #ifdef CHNOSPROJECT_DEBUG_MEMORY_ALLOCATE_AND_FREE\r
+                                               debug("Memory_Alloc:ctrl:[0x%X] addr:[0x%X] size:0x%X\n", ctrl, addr, size);\r
+                       #endif\r
+\r
+                       return addr;\r
+               }\r
+       }\r
+\r
+       Error_Report(ERROR_NOT_ENOUGH_FREE_MEMORY, ctrl, size);\r
+\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return 0;\r
+}\r
+\r
+void *Memory_Allocate_Aligned(IO_MemoryControl ctrl, uint size, uint align)\r
+/*align\82Í2\82Ì\99p\8fæ\94{\82Æ\82µ\82Ä\89ð\8eß\82·\82é\81B2\82Ì\99p\8fæ\94{\82Å\82È\82¢\8fê\8d\87\82Í\81A\8dÅ\91å\82Ì\83Z\83b\83g\82³\82ê\82Ä\82¢\82é\83r\83b\83g\82É\91Î\89\9e\82·\82é\92l\82Å\83A\83\89\83C\83\93\82³\82ê\82é*/\r
+{\r
+       uint i;\r
+       void *notaligned;\r
+       void *aligned;\r
+\r
+       if(align != 0){\r
+               for(i = 0; i < 32; i++){\r
+                       align = align >> 1;\r
+                       if(align == 0){\r
+                               break;\r
+                       }\r
+               }\r
+               notaligned = Memory_Allocate(ctrl, size + (1 << i) - 1);\r
+               aligned = (void *)((((uint)notaligned + (1 << i) - 1) >> i) << i);\r
+               Memory_Free(ctrl, notaligned, (uint)aligned - (uint)notaligned);\r
+               Memory_Free(ctrl, aligned + size, ((uint)notaligned + size + (1 << i) - 1) - ((uint)aligned + size));\r
+       } else{\r
+               aligned = Memory_Allocate(ctrl, size);\r
+       }\r
+\r
+       return aligned;\r
+}\r
+\r
+uint Memory_Get_FreeSize(IO_MemoryControl ctrl)\r
+{\r
+       uint i, size;\r
+\r
+       size = 0;\r
+       for(i = 1; i < ctrl[0].size; i++){\r
+               if(ctrl[i].size == 0xffffffff){\r
+                       break;\r
+               }\r
+               size += ctrl[i].size;\r
+       }\r
+\r
+       return size;\r
+}\r
+\r
+\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/mouse.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/mouse.c
new file mode 100644 (file)
index 0000000..7f42599
--- /dev/null
@@ -0,0 +1,356 @@
+\r
+#include "core.h"\r
+\r
+uint mouse_data0;\r
+DATA_FIFO32 *mouse_fifo;\r
+uint mouse_retv;\r
+\r
+uchar Mouse_Pattern_Standard[24][24] = {\r
+       ".**.....................",\r
+       "*O**....................",\r
+       "*OO**...................",\r
+       "*OOO**..................",\r
+       "*OOOO**.................",\r
+       "*OOOOO**................",\r
+       "*OOOOOO**...............",\r
+       "*OOOOOOO**..............",\r
+       "*OOOOOOOO**.............",\r
+       "*OOOOOOOOO**............",\r
+       "*OOOOOOOOOO**...........",\r
+       "*OOOOOOOOOOO**..........",\r
+       "*OOOOOOOOOOOO**.........",\r
+       "*OOOOOOOOOOOOO**........",\r
+       "*OOOOOOOOOOOOOO**.......",\r
+       "*OOOOOOOOOOOOOOO**......",\r
+       "*OOOOOOOOOOOOOOOO**.....",\r
+       "*OOOOOO************.....",\r
+       "*OOOOO**................",\r
+       "*OOOO**.................",\r
+       "*OOO**..................",\r
+       "*OO**...................",\r
+       "*O**....................",\r
+       "***.....................",\r
+};\r
+\r
+IO_MouseControl *Initialize_Mouse(void)\r
+{\r
+       IO_MouseControl *mctrl;\r
+\r
+       mouse_data0 = 0;\r
+       mouse_fifo = Null;\r
+       mouse_retv = 0;\r
+\r
+       mctrl = (IO_MouseControl *)System_Memory_Allocate(sizeof(IO_MouseControl));\r
+\r
+       IO_CLI();\r
+       System_GateDescriptor_Set(0x2c, (uint)asm_InterruptHandler2c, 0x02, AR_INTGATE32);\r
+       ProgrammableInterruptController_InterruptMask_Clear(0x0c);\r
+       IO_STI();\r
+\r
+       return mctrl;\r
+}\r
+\r
+void InterruptHandler2c(uint *esp)\r
+{\r
+       uint data;\r
+\r
+       data = IO_In8(PORT_KEYDATA);\r
+\r
+       ProgrammableInterruptController_InterruptRequest_Complete(0x0c);\r
+\r
+       if(mouse_fifo != 0){\r
+               FIFO32_Put(mouse_fifo, data + mouse_data0);\r
+       }\r
+\r
+       if(data == KEYDATA_ACK || data == KEYDATA_RESEND){\r
+               mouse_retv = data;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Mouse_Set_ReceiveFIFO(DATA_FIFO32 *fifo, uint data0)\r
+{\r
+       mouse_data0 = data0;\r
+       mouse_fifo = fifo;\r
+\r
+       return; \r
+}\r
+\r
+void Mouse_SendCommand(uint cmd)\r
+{\r
+       KeyboardController_Wait_SendReady();\r
+       IO_Out8(PORT_KEYCMD, KEYCMD_SENDTO_MOUSE);\r
+\r
+       for(;;){\r
+               mouse_retv = 0;\r
+               KeyboardController_Wait_SendReady();\r
+               IO_Out8(PORT_KEYDATA, cmd);\r
+               for(;;){\r
+                       if(mouse_retv == KEYDATA_ACK){\r
+                               return;\r
+                       }\r
+                       if(mouse_retv == KEYDATA_RESEND){\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+       return;\r
+}\r
+\r
+UI_MouseCursor *MouseCursor_Initialize(UI_Sheet *parent)\r
+{\r
+       UI_MouseCursor *mcursor;\r
+       uint x, y;\r
+\r
+       if(parent == Null){\r
+               return Null;\r
+       }\r
+\r
+       mcursor = System_Memory_Allocate(sizeof(UI_MouseCursor));\r
+       mcursor->cursor_sheet = Sheet_Initialize();\r
+\r
+       mcursor->cursors[0] = System_Memory_Allocate(24 * 24 * (8 >> 3));\r
+       for(y = 0; y < 24; y++){\r
+               for(x = 0; x < 24; x++){\r
+                       if(Mouse_Pattern_Standard[y][x] == '.'){\r
+                               (mcursor->cursors[0])[y * 24 + x] = RGB_32_To_08(0x00ff00);\r
+                       } else if(Mouse_Pattern_Standard[y][x] == 'O'){\r
+                               (mcursor->cursors[0])[y * 24 + x] = RGB_32_To_08(0xffffff);\r
+                       } else if(Mouse_Pattern_Standard[y][x] == '*'){\r
+                               (mcursor->cursors[0])[y * 24 + x] = RGB_32_To_08(0x000000);\r
+                       }\r
+               }\r
+       }\r
+\r
+       Sheet_SetBuffer(mcursor->cursor_sheet, mcursor->cursors[0], 24, 24, 8);\r
+       Sheet_SetParent(mcursor->cursor_sheet, parent);\r
+       Sheet_Enable_InvisibleColor(mcursor->cursor_sheet, 0x00ff00);\r
+       Sheet_SetTopmost(mcursor->cursor_sheet, True);\r
+       Sheet_Slide_Absolute(mcursor->cursor_sheet, mcursor->cursor_sheet->parent->size.x >> 1, mcursor->cursor_sheet->parent->size.y >> 1);\r
+\r
+       return mcursor;\r
+}\r
+\r
+uint MouseCursor_Show(UI_MouseCursor *mcursor)\r
+{\r
+       if(mcursor == Null){\r
+               return 1;\r
+       }\r
+\r
+       if(mcursor->cursor_sheet->location.x < 0){\r
+               mcursor->cursor_sheet->location.x = 0;\r
+       } else if((uint)mcursor->cursor_sheet->location.x > mcursor->cursor_sheet->parent->size.x - 1){\r
+               mcursor->cursor_sheet->location.x = mcursor->cursor_sheet->parent->size.x - 1;\r
+       }\r
+\r
+       if(mcursor->cursor_sheet->location.y < 0){\r
+               mcursor->cursor_sheet->location.y = 0;\r
+       } else if((uint)mcursor->cursor_sheet->location.y > mcursor->cursor_sheet->parent->size.y - 1){\r
+               mcursor->cursor_sheet->location.y = mcursor->cursor_sheet->parent->size.y - 1;\r
+       }\r
+\r
+       Sheet_Show(mcursor->cursor_sheet, SHEET_MAX_CHILDREN, SHEET_LOCATION_NOCHANGE, SHEET_LOCATION_NOCHANGE);\r
+\r
+       return 0;\r
+}\r
+\r
+uint MouseCursor_Move_Relative(UI_MouseCursor *mcursor, int rpx, int rpy)\r
+{\r
+       if(mcursor == Null){\r
+               return 1;\r
+       }\r
+\r
+       rpx += mcursor->cursor_sheet->location.x;\r
+       rpy += mcursor->cursor_sheet->location.y;\r
+\r
+       if(rpx < 0){\r
+               rpx = 0;\r
+       } else if((uint)rpx > mcursor->cursor_sheet->parent->size.x - 1){\r
+               rpx = mcursor->cursor_sheet->parent->size.x - 1;\r
+       }\r
+\r
+       if(rpy < 0){\r
+               rpy = 0;\r
+       } else if((uint)rpy > mcursor->cursor_sheet->parent->size.y - 1){\r
+               rpy = mcursor->cursor_sheet->parent->size.y - 1;\r
+       }\r
+\r
+       Sheet_Slide_Absolute(mcursor->cursor_sheet, rpx, rpy);\r
+\r
+       return 0;\r
+}\r
+\r
+uint MouseCursor_Move_Absolute(UI_MouseCursor *mcursor, int apx, int apy)\r
+{\r
+       if(mcursor == Null){\r
+               return 1;\r
+       }\r
+\r
+       if(apx < 0){\r
+               apx = 0;\r
+       } else if((uint)apx > mcursor->cursor_sheet->parent->size.x - 1){\r
+               apx = mcursor->cursor_sheet->parent->size.x - 1;\r
+       }\r
+\r
+       if(apy < 0){\r
+               apy = 0;\r
+       } else if((uint)apy > mcursor->cursor_sheet->parent->size.y - 1){\r
+               apy = mcursor->cursor_sheet->parent->size.y - 1;\r
+       }\r
+\r
+       Sheet_Slide_Absolute(mcursor->cursor_sheet, apx, apy);\r
+\r
+       return 0;\r
+}\r
+\r
+bool Mouse_Decode(IO_MouseControl *mctrl, uint data)\r
+{\r
+       switch(mctrl->decode_phase){\r
+//マウス初期化及びスクロールマウス識別\r
+               case 0:\r
+                       Mouse_SendCommand(MOUSECMD_RESET);\r
+                       mctrl->decode_phase++;\r
+                       break;\r
+               case 1:\r
+                       if(data == KEYDATA_ACK){\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 2:\r
+                       if(data == KEYDATA_TEST_SUCCEEDED){\r
+                               Mouse_SendCommand(MOUSECMD_SET_SAMPLE_RATE);\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 3:\r
+                       if(data == KEYDATA_ACK){\r
+                               Mouse_SendCommand(200);\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 4:\r
+                       if(data == KEYDATA_ACK){\r
+                               Mouse_SendCommand(MOUSECMD_SET_SAMPLE_RATE);\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 5:\r
+                       if(data == KEYDATA_ACK){\r
+                               Mouse_SendCommand(100);\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 6:\r
+                       if(data == KEYDATA_ACK){\r
+                               Mouse_SendCommand(MOUSECMD_SET_SAMPLE_RATE);\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 7:\r
+                       if(data == KEYDATA_ACK){\r
+                               Mouse_SendCommand(80);\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 8:\r
+                       if(data == KEYDATA_ACK){\r
+                               Mouse_SendCommand(MOUSECMD_GET_DEVICE_ID);\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 9:\r
+                       if(data == KEYDATA_ACK){\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 10:\r
+                       if(data == MOUSE_TYPE_3BUTTON){\r
+                               mctrl->decode_phase = 20;\r
+                               Mouse_SendCommand(MOUSECMD_ENABLE_DATA_REPORTING);\r
+                       } else if(data == MOUSE_TYPE_3BUTTON_SCROLL){\r
+                               mctrl->flags.scroll = True;\r
+                               mctrl->decode_phase = 30;\r
+                               Mouse_SendCommand(MOUSECMD_ENABLE_DATA_REPORTING);\r
+                       }\r
+                       break;\r
+//3ボタンマウス解析\r
+               case 20:\r
+                       if(data == KEYDATA_ACK){\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 21:\r
+                       //1バイト目が、00XY1CRLの形式になっているかどうかチェック\r
+                       //0xc8=11001000なので、ANDすると必ず00001000になるはずである\r
+                       if((data & 0xc8) == 0x08){      //1バイト目が、00xx1xxxの形式になっているかどうかチェック 0xc8=11001000なので、ANDすると必ず00001000になるはずである\r
+                               mctrl->decode_buf[0] = data;\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 22:\r
+                       mctrl->decode_buf[1] = data;\r
+                       mctrl->decode_phase++;\r
+                       break;\r
+               case 23:\r
+                       mctrl->decode_buf[2] = data;\r
+                       mctrl->decode_phase = 21;\r
+                       mctrl->button.button = mctrl->decode_buf[0] & 0x07;\r
+                       mctrl->move.x = mctrl->decode_buf[1];\r
+                       mctrl->move.y = mctrl->decode_buf[2];\r
+                       if(mctrl->decode_buf[0] & 0x10){\r
+                               mctrl->move.x |= 0xffffff00;\r
+                       }\r
+                       if(mctrl->decode_buf[0] & 0x20){\r
+                               mctrl->move.y |= 0xffffff00;\r
+                       }\r
+                       mctrl->move.y = -mctrl->move.y;\r
+                       return True;\r
+//3ボタンスクロールマウス解析\r
+               case 30:\r
+                       if(data == KEYDATA_ACK){\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 31:\r
+                       //1バイト目が、00XY1CRLの形式になっているかどうかチェック\r
+                       //0xc8=11001000なので、ANDすると必ず00001000になるはずである\r
+                       if((data & 0xc8) == 0x08){      //1バイト目が、00xx1xxxの形式になっているかどうかチェック 0xc8=11001000なので、ANDすると必ず00001000になるはずである\r
+                               mctrl->decode_buf[0] = data;\r
+                               mctrl->decode_phase++;\r
+                       }\r
+                       break;\r
+               case 32:\r
+                       mctrl->decode_buf[1] = data;\r
+                       mctrl->decode_phase++;\r
+                       break;\r
+               case 33:\r
+                       mctrl->decode_buf[2] = data;\r
+                       mctrl->button.button = mctrl->decode_buf[0] & 0x07;\r
+                       mctrl->move.x = mctrl->decode_buf[1];\r
+                       mctrl->move.y = mctrl->decode_buf[2];\r
+                       if(mctrl->decode_buf[0] & 0x10){\r
+                               mctrl->move.x |= 0xffffff00;\r
+                       }\r
+                       if(mctrl->decode_buf[0] & 0x20){\r
+                               mctrl->move.y |= 0xffffff00;\r
+                       }\r
+                       mctrl->move.y = -mctrl->move.y;\r
+                       mctrl->decode_phase++;\r
+                       break;\r
+               case 34:\r
+                       //はりぼて友の会などの資料には、スクロール情報は下位4バイトだけ有効であると書かれていたが、どうやら8バイト全て有効なようである。\r
+                       mctrl->decode_buf[3] = data;\r
+                       mctrl->decode_phase = 31;\r
+                       mctrl->scroll = mctrl->decode_buf[3];\r
+                       if(mctrl->scroll & 0x80){\r
+                               mctrl->scroll |= 0xffffff00;\r
+                       }\r
+                       #ifdef CHNOSPROJECT_DEBUG_MOUSE\r
+                               debug("Mouse_Decode:case34:data=0x%02X scroll=%d\n", data, mctrl->scroll);\r
+                       #endif\r
+                       return True;\r
+       }\r
+\r
+       return False;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/mtask.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/mtask.c
new file mode 100644 (file)
index 0000000..c681743
--- /dev/null
@@ -0,0 +1,284 @@
+\r
+#include "core.h"\r
+\r
+//FIFO\82É\82æ\82é\83^\83X\83N\82Ì\8e©\93®\8bN\93®\82Í\8aù\92è\82Å\97L\8cø\82Å\82·\82ª\81A\83^\83X\83N\82ª\96¾\8e¦\93I\82É\8eÀ\8ds\82³\82ê\82é\82Ü\82Å\82Í\96³\8cø\82É\82È\82Á\82Ä\82¢\82Ü\82·\81B\r
+//\83^\83X\83N\82ÍSTI\89º\82Å\8aJ\8en\82³\82ê\82Ü\82·\81i\8aO\95\94\8a\84\82è\8d\9e\82Ý\97L\8cø\81j\81B\r
+\r
+UI_TaskControl *Initialize_MultiTask_Control(IO_MemoryControl sysmemctrl)\r
+{\r
+       UI_TaskControl *ctrl;\r
+       UI_Task *maintask;\r
+\r
+       ctrl = Memory_Allocate(sysmemctrl, sizeof(UI_TaskControl));\r
+       ctrl->now = 0;\r
+       ctrl->sysmemctrl = sysmemctrl;\r
+\r
+       maintask = MultiTask_Task_Initialize(ctrl, 0);\r
+\r
+       Load_TR(maintask->selector << 3);\r
+\r
+       ctrl->start = maintask;\r
+       ctrl->now = maintask;\r
+\r
+       maintask->flags.linked = True;\r
+       maintask->flags.running = True;\r
+       maintask->flags.first_run = False;\r
+       FIFO32_Set_Task(maintask->fifo, maintask);\r
+\r
+       return ctrl;\r
+}\r
+\r
+UI_Task *MultiTask_Task_Initialize(UI_TaskControl *ctrl, uint tss_additional_size)\r
+{\r
+       UI_Task *task;\r
+\r
+       task = Memory_Allocate(ctrl->sysmemctrl, sizeof(UI_Task));\r
+       task->tss = Memory_Allocate(ctrl->sysmemctrl, sizeof(CPU_TaskStateSegment) + tss_additional_size);\r
+\r
+       task->tss->reserve00            = 0;\r
+       task->tss->reserve01            = 0;\r
+       task->tss->reserve02            = 0;\r
+       task->tss->reserve03            = 0;\r
+       task->tss->reserve04            = 0;\r
+       task->tss->reserve05            = 0;\r
+       task->tss->reserve06            = 0;\r
+       task->tss->reserve07            = 0;\r
+       task->tss->reserve08            = 0;\r
+       task->tss->reserve09            = 0;\r
+       task->tss->reserve10            = 0;\r
+       task->tss->reserve11            = 0;\r
+\r
+       task->tss->backlink             = 0;\r
+       task->tss->esp0                 = 0;\r
+       task->tss->ss0                  = 0;\r
+       task->tss->esp1                 = 0;\r
+       task->tss->ss1                  = 0;\r
+       task->tss->esp2                 = 0;\r
+       task->tss->ss2                  = 0;\r
+\r
+       task->tss->cr3                  = 0;\r
+       task->tss->eip                  = 0;\r
+       task->tss->eflags.eflags        = 0x00000202;   //bit1=True, IF=True\r
+\r
+       task->tss->eax                  = 0;\r
+       task->tss->ecx                  = 0;\r
+       task->tss->edx                  = 0;\r
+       task->tss->ebx                  = 0;\r
+       task->tss->esp                  = 0;\r
+       task->tss->ebp                  = 0;\r
+       task->tss->esi                  = 0;\r
+       task->tss->edi                  = 0;\r
+\r
+       task->tss->es                   = 0;\r
+       task->tss->cs                   = 0;\r
+       task->tss->ss                   = 0;\r
+       task->tss->ds                   = 0;\r
+       task->tss->fs                   = 0;\r
+       task->tss->gs                   = 0;\r
+\r
+       task->tss->ldtr                 = 0;\r
+       task->tss->flag_trap            = False;\r
+       task->tss->iomap_base           = 0x00004000;   //TSS\83\8a\83~\83b\83g\88È\8fã\82È\82ç\96³\8cø\r
+\r
+       task->selector = System_SegmentDescriptor_Set(sizeof(CPU_TaskStateSegment) + tss_additional_size - 1, (uint)task->tss, AR_TSS32);\r
+\r
+       task->next = 0;\r
+       task->count = 0;\r
+\r
+       task->fifo = FIFO32_Initialize(ctrl->sysmemctrl, TASK_FIFOSIZE);\r
+\r
+       task->flags.initialized = True;\r
+       task->flags.linked = False;\r
+       task->flags.first_run = True;\r
+\r
+       return task;\r
+}\r
+\r
+uint MultiTask_Internal_Task_SetLink(UI_TaskControl *ctrl, UI_Task *task)\r
+{\r
+       UI_Task **last;\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       for(last = &ctrl->start; *last != Null; last = &(*last)->next){\r
+               if(*last == task){\r
+                       #ifdef CHNOSPROJECT_DEBUG_MULTITASK\r
+                               debug("MultiTask_Internal_Task_SetLink:Task has already been linked(sel:0x%X).\n", task->selector);\r
+                       #endif\r
+                       return 1;\r
+               }\r
+       }\r
+       task->next = Null;\r
+       *last = task;\r
+       task->flags.linked = True;\r
+\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return 0;\r
+}\r
+\r
+uint MultiTask_Internal_Task_ClearLink(UI_TaskControl *ctrl, UI_Task *task)\r
+{\r
+       UI_Task **find;\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       for(find = &ctrl->start; *find != task; find = &(*find)->next){\r
+               if(*find == Null){\r
+                       #ifdef CHNOSPROJECT_DEBUG_MULTITASK\r
+                               debug("MultiTask_Internal_Task_ClearLink:Task not found(sel:0x%X).\n", task->selector);\r
+                       #endif\r
+                       return 1;\r
+               }\r
+       }\r
+       *find = task->next;\r
+       task->next = Null;\r
+       task->flags.linked = False;\r
+       task->flags.running = False;\r
+\r
+       if(ctrl->now == task){\r
+               MultiTask_TaskSwitch(ctrl);\r
+       }\r
+\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return 0;\r
+}\r
+\r
+void MultiTask_Task_Run(UI_TaskControl *ctrl, UI_Task *task)\r
+{\r
+       #ifdef CHNOSPROJECT_DEBUG_CALLLINK\r
+               debug("MultiTask_Task_Run:Called from[0x%08X].\n", *((uint *)(&ctrl - 1)));\r
+       #endif\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_MULTITASK\r
+               debug("MultiTask_Task_Run:Start Running Rq(sel:0x%X).\n", task->selector);\r
+       #endif\r
+\r
+       if(task->flags.running){\r
+               #ifdef CHNOSPROJECT_DEBUG_MULTITASK\r
+                       debug("MultiTask_Task_Run:Task has already been running(sel:0x%X).\n", task->selector);\r
+               #endif\r
+               return;\r
+       }\r
+\r
+       if(!task->flags.linked){\r
+               MultiTask_Internal_Task_SetLink(ctrl, task);\r
+       }\r
+\r
+       task->flags.running = True;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_MULTITASK\r
+               debug("MultiTask_Task_Run:Start Running(sel:0x%X).\n", task->selector);\r
+       #endif\r
+\r
+       if(task->flags.first_run){\r
+               #ifdef CHNOSPROJECT_DEBUG_MULTITASK\r
+                       debug("MultiTask_Task_Run:FIFO task autorun is enabled.\n");\r
+               #endif\r
+               FIFO32_Set_Task(task->fifo, task);\r
+               task->flags.first_run = False;\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void MultiTask_TaskSwitch(UI_TaskControl *ctrl)\r
+{\r
+       UI_Task *nexttask;\r
+       uint eflags;\r
+\r
+       eflags = IO_Load_EFlags();\r
+       IO_CLI();\r
+\r
+       for(nexttask = ctrl->now->next; ; nexttask = nexttask->next){\r
+               if(nexttask == Null){   //\83\8a\83\93\83N\8fI\92[\82É\97\88\82½\82ç\90æ\93ª\82Ö\8aª\82«\96ß\82·\r
+                       nexttask = ctrl->start;\r
+               }\r
+               if(nexttask == ctrl->now){      //\8eÀ\8ds\92\86\8fó\91Ô\82Ì\83^\83X\83N\82Í\8c»\8dÝ\8eÀ\8ds\92\86\82Ì\82±\82Ì\83^\83X\83N\82µ\82©\82È\82¢\82Ì\82Å\83^\83X\83N\83X\83C\83b\83`\82È\82µ\r
+                       return;\r
+               }\r
+               if(nexttask->flags.running){    //\8eÀ\8ds\92\86\8fó\91Ô\82Ì\82Ù\82©\82Ì\83^\83X\83N\82ª\8c©\82Â\82©\82Á\82½\82Ì\82Å\83^\83X\83N\83X\83C\83b\83`\r
+                       ctrl->now = nexttask;\r
+                       ctrl->now->count++;\r
+                       FarJMP(0, ctrl->now->selector << 3);\r
+                       break;\r
+               }\r
+       }\r
+\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return;\r
+}\r
+\r
+void MultiTask_Task_Sleep(UI_TaskControl *ctrl, UI_Task *task)\r
+{\r
+       //CPL=0\89º\82ð\91z\92è\r
+\r
+       uint eflags;\r
+\r
+       if(task == ctrl->now && task == ctrl->start){   //\8e©\95ª\82ª\97B\88ê\96³\93ñ\82Ì\83^\83X\83N\82¾\82Á\82½\8fê\8d\87\81A\83X\83\8a\81[\83v\82Í\8eÀ\8ds\82Å\82«\82È\82¢\82Ì\82ÅHLT\82·\82é\r
+               eflags = IO_Load_EFlags();\r
+               IO_STIHLT();\r
+               IO_Store_EFlags(eflags);\r
+               return;\r
+       }\r
+\r
+       task->flags.running = False;\r
+\r
+       if(ctrl->now == task){\r
+               MultiTask_TaskSwitch(ctrl);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void MultiTask_Task_Kill(UI_TaskControl *ctrl, UI_Task *task)\r
+{\r
+       //CPL=0\89º\82ð\91z\92è\r
+\r
+       if(task == ctrl->now && task == ctrl->start){   //\8e©\95ª\82ª\97B\88ê\96³\93ñ\82Ì\83^\83X\83N\82¾\82Á\82½\8fê\8d\87\81Akill\82ÍOS\8e©\91Ì\82Ì\8fI\97¹\82ð\88Ó\96¡\82·\82é\82Ì\82Å\81A\83A\83{\81[\83g\r
+               #ifdef CHNOSPROJECT_DEBUG_MULTITASK\r
+                       debug("MultiTask_Task_Stop:Attempted to stop last task. Abort.\n");\r
+               #endif\r
+               INT_3();\r
+               return;\r
+       }\r
+\r
+       MultiTask_Internal_Task_ClearLink(ctrl, task);\r
+\r
+       return;\r
+}\r
+/*\r
+void MultiTask_Task_Free(UI_TaskControl *ctrl, UI_Task *task)\r
+{\r
+       if(task->flags.linked){\r
+               MultiTask_Task_Kill(ctrl, task);\r
+       }\r
+\r
+}\r
+*/\r
+UI_Task *MultiTask_GetNowTask(UI_TaskControl *ctrl)\r
+{\r
+       return ctrl->now;\r
+}\r
+\r
+uint MultiTask_Push_Arguments(UI_Task *task, uint args, ...)\r
+{\r
+       uint *vargs;\r
+       uint i;\r
+\r
+       vargs = (uint *)(&args + 1);\r
+\r
+       task->tss->esp -= 4 * (args + 1);\r
+\r
+       for(i = 1; i < args + 1; i++){\r
+               *((uint *)(task->tss->esp + (i * 4))) = vargs[i - 1];\r
+       }\r
+\r
+       return 0;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/nasfunc0.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/nasfunc0.nas
new file mode 100644 (file)
index 0000000..6d6c257
--- /dev/null
@@ -0,0 +1,353 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+[FILE "nasfunc0.nas"]\r
+       GLOBAL  _IO_HLT\r
+       GLOBAL  _IO_CLI, _IO_STI, _IO_STIHLT\r
+       GLOBAL  _IO_In8, _IO_Out8\r
+       GLOBAL  _IO_In16, _IO_Out16\r
+       GLOBAL  _IO_In32, _IO_Out32\r
+       GLOBAL  _IO_Load_EFlags, _IO_Store_EFlags\r
+       GLOBAL  _Load_CR0, _Store_CR0\r
+       GLOBAL  _Load_CR2, _Store_CR2\r
+       GLOBAL  _Load_CR3, _Store_CR3\r
+       GLOBAL  _Load_CR4, _Store_CR4\r
+       GLOBAL  _Load_DR0, _Store_DR0\r
+       GLOBAL  _Load_DR1, _Store_DR1\r
+       GLOBAL  _Load_DR2, _Store_DR2\r
+       GLOBAL  _Load_DR3, _Store_DR3\r
+       GLOBAL  _Load_DR6, _Store_DR6\r
+       GLOBAL  _Load_DR7, _Store_DR7\r
+       GLOBAL  _Load_GDTR\r
+       GLOBAL  _Load_IDTR\r
+       GLOBAL  _Load_TR\r
+       GLOBAL  _FarJMP\r
+       GLOBAL  _FarCall\r
+       GLOBAL  _CLTS\r
+       GLOBAL  _FNSave, _FRStore\r
+       GLOBAL  _PIT_Beep_On, _PIT_Beep_Off, _PIT_Beep_Set\r
+       GLOBAL  _CPUID, _CPUID2\r
+       GLOBAL  _TSC_Read\r
+       GLOBAL  _Memory_Test_Sub\r
+       GLOBAL  _INT_3\r
+       GLOBAL  _DIV_64_32, _MOD_64_32\r
+       GLOBAL  _MOVSD_ZeroFill\r
+\r
+[SECTION .text]\r
+\r
+_IO_HLT:\r
+       hlt\r
+       ret\r
+\r
+_IO_CLI:\r
+       cli\r
+       ret\r
+\r
+_IO_STI:\r
+       sti\r
+       ret\r
+\r
+_IO_STIHLT:\r
+       sti\r
+       hlt\r
+       ret\r
+\r
+_IO_In8:\r
+       mov     edx,[esp+4]\r
+       mov     eax,0\r
+       in      al,dx\r
+       ret\r
+\r
+_IO_Out8:\r
+       mov     edx,[esp+4]\r
+       mov     al,[esp+8]\r
+       out     dx,al\r
+       ret\r
+\r
+_IO_In16:\r
+       mov     edx,[esp+4]\r
+       mov     eax,0\r
+       in      ax,dx\r
+       ret\r
+\r
+_IO_Out16:\r
+       mov     edx,[esp+4]\r
+       mov     ax,[esp+8]\r
+       out     dx,ax\r
+       ret\r
+\r
+_IO_In32:\r
+       mov     edx,[esp+4]\r
+       in      eax,dx\r
+       ret\r
+\r
+_IO_Out32:\r
+       mov     edx,[esp+4]\r
+       mov     eax,[esp+8]\r
+       out     dx,eax\r
+       ret\r
+\r
+_IO_Load_EFlags:\r
+       pushfd\r
+       pop     eax\r
+       ret\r
+\r
+_IO_Store_EFlags:\r
+       mov     eax,[esp+4]\r
+       push    eax\r
+       popfd\r
+       ret\r
+\r
+_Load_CR0:\r
+       mov     eax,cr0\r
+       ret\r
+\r
+_Store_CR0:\r
+       mov     eax,[esp+4]\r
+       mov     cr0,eax\r
+       ret\r
+\r
+_Load_CR2:\r
+       mov     eax,cr2\r
+       ret\r
+\r
+_Store_CR2:\r
+       mov     eax,[esp+4]\r
+       mov     cr2,eax\r
+       ret\r
+\r
+_Load_CR3:\r
+       mov     eax,cr3\r
+       ret\r
+\r
+_Store_CR3:\r
+       mov     eax,[esp+4]\r
+       mov     cr3,eax\r
+       ret\r
+\r
+_Load_CR4:\r
+       mov     eax,cr3\r
+       ret\r
+\r
+_Store_CR4:\r
+       mov     eax,[esp+4]\r
+       mov     cr4,eax\r
+       ret\r
+\r
+_Load_DR0:\r
+       mov     eax,dr0\r
+       ret\r
+\r
+_Store_DR0:\r
+       mov     eax,[esp+4]\r
+       mov     dr0,eax\r
+       ret\r
+\r
+_Load_DR1:\r
+       mov     eax,dr1\r
+       ret\r
+\r
+_Store_DR1:\r
+       mov     eax,[esp+4]\r
+       mov     dr1,eax\r
+       ret\r
+\r
+_Load_DR2:\r
+       mov     eax,dr2\r
+       ret\r
+\r
+_Store_DR2:\r
+       mov     eax,[esp+4]\r
+       mov     dr2,eax\r
+       ret\r
+\r
+_Load_DR3:\r
+       mov     eax,dr3\r
+       ret\r
+\r
+_Store_DR3:\r
+       mov     eax,[esp+4]\r
+       mov     dr3,eax\r
+       ret\r
+\r
+_Load_DR6:\r
+       mov     eax,dr6\r
+       ret\r
+\r
+_Store_DR6:\r
+       mov     eax,[esp+4]\r
+       mov     dr6,eax\r
+       ret\r
+\r
+_Load_DR7:\r
+       mov     eax,dr7\r
+       ret\r
+\r
+_Store_DR7:\r
+       mov     eax,[esp+4]\r
+       mov     dr7,eax\r
+       ret\r
+\r
+_Load_GDTR:\r
+       mov     ax,[esp+4]\r
+       mov     [esp+6],ax\r
+       lgdt    [esp+6]\r
+       ret\r
+\r
+_Load_IDTR:\r
+       mov     ax,[esp+4]\r
+       mov     [esp+6],ax\r
+       lidt    [esp+6]\r
+       ret\r
+\r
+_Load_TR:\r
+       ltr     [esp+4]\r
+       ret\r
+\r
+_FarJMP:\r
+       jmp     far     [esp+4]\r
+       ret\r
+\r
+_FarCall:\r
+       call    far     [esp+4]\r
+       ret\r
+\r
+_CLTS:\r
+        clts\r
+        ret\r
+\r
+_FNSave:\r
+        mov     eax,[esp+4]     ; addr\r
+        fnsave  [eax]\r
+        ret\r
+\r
+_FRStore:\r
+        mov     eax,[esp+4]     ; addr\r
+        frstor  [eax]\r
+        ret\r
+\r
+_PIT_Beep_On:\r
+       in      al,0x61\r
+       or      al,0x03\r
+       and     al,0x0f\r
+       out     0x61,al\r
+       ret\r
+\r
+_PIT_Beep_Off:\r
+       in      al,0x61\r
+       and     al,0xd\r
+       out     0x61,al\r
+       ret\r
+\r
+_PIT_Beep_Set:\r
+       mov     eax,1193180\r
+       mov     edx,0x00000000\r
+       mov     ecx,[esp+4]\r
+       div     ecx\r
+       mov     edx,eax\r
+       mov     al,0xb6\r
+       out     0x43,al\r
+       mov     eax,edx\r
+       out     0x42,al\r
+       shr     eax,8\r
+       out     0x42,al\r
+       ret\r
+\r
+_CPUID:\r
+       pushad\r
+       mov     esi,[esp+36]\r
+       mov     eax,[esp+40]\r
+       db      0x0f,0xa2\r
+       mov     [esi   ],eax\r
+       mov     [esi+ 4],ebx\r
+       mov     [esi+ 8],edx\r
+       mov     [esi+12],ecx\r
+       popad\r
+       ret\r
+\r
+_CPUID2:\r
+       pushad\r
+       mov     esi,[esp+36]\r
+       mov     eax,[esp+40]\r
+       db      0x0f,0xa2\r
+       mov     [esi   ],eax\r
+       mov     [esi+ 4],ebx\r
+       mov     [esi+ 8],ecx\r
+       mov     [esi+12],edx\r
+       popad\r
+       ret\r
+\r
+_TSC_Read:\r
+       pushad\r
+       mov     ebx,[esp+36]\r
+       db      0x0f,0x31\r
+       mov     [ebx],edx\r
+       mov     [ebx+4],eax\r
+       popad\r
+       ret\r
+\r
+_Memory_Test_Sub:\r
+       push    edi\r
+       push    esi\r
+       push    ebx\r
+       mov     esi,0xaa55aa55\r
+       mov     edi,0x55aa55aa\r
+       mov     eax,[esp+12+4]\r
+mts_loop:\r
+       mov     ebx,eax\r
+       add     ebx,0xffc\r
+       mov     edx,[ebx]\r
+       mov     [ebx],esi\r
+       xor     dword [ebx],0xffffffff\r
+       cmp     edi,[ebx]\r
+       jne     mts_fin\r
+       xor     dword [ebx],0xffffffff\r
+       cmp     esi,[ebx]\r
+       jne     mts_fin\r
+       mov     [ebx],edx\r
+       add     eax,0x1000\r
+       cmp     eax,[esp+12+8]\r
+       jbe     mts_loop\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
+mts_fin:\r
+       mov     [ebx],edx\r
+       pop     ebx\r
+       pop     esi\r
+       pop     edi\r
+       ret\r
+\r
+_INT_3:\r
+       int     3\r
+       ret\r
+\r
+_DIV_64_32:\r
+       mov     eax,[esp+4]\r
+       mov     edx,[esp+8]\r
+       div     dword[esp+12]\r
+       ret\r
+\r
+_MOD_64_32:\r
+       mov     eax,[esp+4]\r
+       mov     edx,[esp+8]\r
+       div     dword[esp+12]\r
+       mov     eax,edx\r
+       ret\r
+\r
+_MOVSD_ZeroFill:\r
+       cld\r
+       push    esi\r
+       push    edi\r
+       mov     ax, ds\r
+       mov     es, ax\r
+       mov     eax, 0x00000000\r
+       mov     edi, [esp+8+4]\r
+       mov     ecx, [esp+8+8]\r
+       shr     ecx, 2\r
+       rep stosd\r
+       pop     edi\r
+       pop     esi\r
+       ret\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/nasfunc1.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/nasfunc1.nas
new file mode 100644 (file)
index 0000000..7cc24a4
--- /dev/null
@@ -0,0 +1,691 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+[FILE "nasfunc1.nas"]\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler00\r
+       EXTERN  _CPU_ExceptionHandler00\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler01\r
+       EXTERN  _CPU_ExceptionHandler01\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler02\r
+       EXTERN  _CPU_ExceptionHandler02\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler03\r
+       EXTERN  _CPU_ExceptionHandler03\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler04\r
+       EXTERN  _CPU_ExceptionHandler04\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler05\r
+       EXTERN  _CPU_ExceptionHandler05\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler06\r
+       EXTERN  _CPU_ExceptionHandler06\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler07\r
+       EXTERN  _CPU_ExceptionHandler07\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler08\r
+       EXTERN  _CPU_ExceptionHandler08\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler09\r
+       EXTERN  _CPU_ExceptionHandler09\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0a\r
+       EXTERN  _CPU_ExceptionHandler0a\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0b\r
+       EXTERN  _CPU_ExceptionHandler0b\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0c\r
+       EXTERN  _CPU_ExceptionHandler0c\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0d\r
+       EXTERN  _CPU_ExceptionHandler0d\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0e\r
+       EXTERN  _CPU_ExceptionHandler0e\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler0f\r
+       EXTERN  _CPU_ExceptionHandler0f\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler10\r
+       EXTERN  _CPU_ExceptionHandler10\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler11\r
+       EXTERN  _CPU_ExceptionHandler11\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler12\r
+       EXTERN  _CPU_ExceptionHandler12\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler13\r
+       EXTERN  _CPU_ExceptionHandler13\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler14\r
+       EXTERN  _CPU_ExceptionHandler14\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler15\r
+       EXTERN  _CPU_ExceptionHandler15\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler16\r
+       EXTERN  _CPU_ExceptionHandler16\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler17\r
+       EXTERN  _CPU_ExceptionHandler17\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler18\r
+       EXTERN  _CPU_ExceptionHandler18\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler19\r
+       EXTERN  _CPU_ExceptionHandler19\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1a\r
+       EXTERN  _CPU_ExceptionHandler1a\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1b\r
+       EXTERN  _CPU_ExceptionHandler1b\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1c\r
+       EXTERN  _CPU_ExceptionHandler1c\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1d\r
+       EXTERN  _CPU_ExceptionHandler1d\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1e\r
+       EXTERN  _CPU_ExceptionHandler1e\r
+\r
+       GLOBAL  _asm_CPU_ExceptionHandler1f\r
+       EXTERN  _CPU_ExceptionHandler1f\r
+\r
+       GLOBAL  _asm_InterruptHandler20\r
+       EXTERN  _InterruptHandler20\r
+\r
+       GLOBAL  _asm_InterruptHandler21\r
+       EXTERN  _InterruptHandler21\r
+\r
+       GLOBAL  _asm_InterruptHandler27\r
+       EXTERN  _InterruptHandler27\r
+\r
+       GLOBAL  _asm_InterruptHandler2c\r
+       EXTERN  _InterruptHandler2c\r
+\r
+[SECTION .text]\r
+\r
+_asm_CPU_ExceptionHandler00:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler00\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler01:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler01\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler02:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler02\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler03:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler03\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler04:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler04\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler05:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler05\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler06:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler06\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler07:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler07\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler08:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler08\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler09:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler09\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0a:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0a\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0b:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0b\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0c:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0c\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0d:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0d\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       add     esp, 4\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0e:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0e\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler0f:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler0f\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler10:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler10\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler11:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler11\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler12:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler12\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler13:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler13\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler14:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler14\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler15:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler15\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler16:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler16\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler17:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler17\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler18:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler18\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler19:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler19\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1a:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1a\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1b:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1b\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1c:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1c\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1d:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1d\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1e:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1e\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_CPU_ExceptionHandler1f:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _CPU_ExceptionHandler1f\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_InterruptHandler20:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _InterruptHandler20\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_InterruptHandler21:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _InterruptHandler21\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_InterruptHandler27:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _InterruptHandler27\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
+\r
+_asm_InterruptHandler2c:\r
+       push    es\r
+       push    ds\r
+       pushad\r
+       mov     eax,esp\r
+       push    eax\r
+       mov     ax,ss\r
+       mov     ds,ax\r
+       mov     es,ax\r
+       call    _InterruptHandler2c\r
+       pop     eax\r
+       popad\r
+       pop     ds\r
+       pop     es\r
+       iretd\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/nasfunc2.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/nasfunc2.nas
new file mode 100644 (file)
index 0000000..8ad8665
--- /dev/null
@@ -0,0 +1,14 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 16]\r
+[FILE "nasfunc2.nas"]\r
+\r
+       GLOBAL  _asm_16bit_CallBIOSTask\r
+\r
+[SECTION .text]\r
+_asm_16bit_CallBIOSTask:\r
+       org     0xc200\r
+_asm_16bit_CallBIOSTask_Code:\r
+       int     0x0d\r
+_asm_16bit_CallBIOSTask_Code_End:\r
+       db      0x0f, 0x0b      ;ud2\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/pci.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/pci.c
new file mode 100644 (file)
index 0000000..45a0d1d
--- /dev/null
@@ -0,0 +1,202 @@
+\r
+#include "core.h"\r
+\r
+#define PORT_PCI_CONFIG_ADDRESS        0x0cf8  //32bit R/W\r
+#define PORT_PCI_CONFIG_DATA_BASE      0x0cfc  //4ports anysize R/W\r
+\r
+typedef union PCI_CONFIG_ADDRESS_REGISTER {\r
+       uint reg;\r
+       struct PCI_CONFIG_ADDRESS_REGISTER_BIT {\r
+               unsigned reserved0 : 2; //0\r
+               unsigned register_num : 6;\r
+               unsigned function_num : 3;\r
+               unsigned device_num : 5;\r
+               unsigned bus_num : 8;\r
+               unsigned reserved1 : 7; //0\r
+               unsigned enable : 1;    //PCI_CDRn\82É\83A\83N\83Z\83X\82·\82é\82Æ\82«\82É1\82É\82·\82é\81B\r
+       } bit;\r
+} PCI_ConfigurationAddressRegister;\r
+\r
+//\91S\83f\83o\83C\83X\8b¤\92Ê\82Ì\83R\83\93\83t\83B\83M\83\85\83\8c\81[\83V\83\87\83\93\83\8c\83W\83X\83^:\r
+//0x00:00-15:\83x\83\93\83_ID(ReadOnly)\r
+//0x00:16-31:\83f\83o\83C\83XID(ReadOnly)\r
+//0x04:00-15:\83R\83}\83\93\83h\83\8c\83W\83X\83^(R/W)\r
+//     00:I/O\8bó\8aÔ\83C\83l\81[\83u\83\8b\r
+//     01:\83\81\83\82\83\8a\8bó\8aÔ\83C\83l\81[\83u\83\8b\r
+//     02:\83o\83X\83}\83X\83^\81[\r
+//     03:\83X\83y\83V\83\83\83\8b\83T\83C\83N\83\8b\r
+//     04:\83\81\83\82\83\8a\83\89\83C\83g\81E\83C\83\93\83o\83\8a\83f\81[\83g\83C\83l\81[\83u\83\8b\r
+//     05:VGA\83p\83\8c\83b\83g\83X\83k\81[\83v\r
+//     06:\83p\83\8a\83e\83B\83G\83\89\81[\89\9e\93\9a(0\82Å\95ñ\8d\90\82È\82µ)\r
+//     07:\83E\83F\83C\83g\83T\83C\83N\83\8b\90§\8cä\r
+//     08:SERR#\83C\83l\81[\83u\83\8b\r
+//     09:\8d\82\91¬\83o\83b\83N\83c\81[\83o\83b\83N\83C\83l\81[\83u\83\8b\r
+//     10-15:\83\8a\83U\81[\83u\r
+//0x04:16-31:\83X\83e\81[\83^\83X\83\8c\83W\83X\83^(R/W Write\8e\9eTrue\82Ì\83r\83b\83g\82ª\83N\83\8a\83A\82³\82ê\82é)\r
+//     16-20:\83\8a\83U\81[\83u\r
+//     21:66MHz\91Î\89\9e\89Â\94\\r
+//     22:\83\86\81[\83U\81[\92è\8b`\8b@\94\\82 \82è\r
+//     23:\8d\82\91¬\83o\83b\83N\83c\81[\83o\83b\83N\89Â\94\\r
+//     24:\83f\81[\83^\83p\83\8a\83e\83B\83G\83\89\81[\8c\9f\92m(\83o\83X\83}\83X\83^\81[\8e\9e\82Ì\83G\83\89\81[)\r
+//     25-26:DEVSEL#\83^\83C\83~\83\93\83O(0:\8d\82\91¬ 1:\92\86\91¬ 2:\92á\91¬ 3:\97\\96ñ)\r
+//     27:\83^\81[\83Q\83b\83g\83A\83{\81[\83g\92Ê\92m\r
+//     28:\83^\81[\83Q\83b\83g\83A\83{\81[\83g\8eó\90M\r
+//     29:\83}\83X\83^\81[\83A\83{\81[\83g\8eó\90M\r
+//     30:\83V\83X\83e\83\80\83G\83\89\81[\92Ê\92m\r
+//     31:\83p\83\8a\83e\83B\83G\83\89\81[\8c\9f\92m\r
+//0x08:00-07:\83\8a\83r\83W\83\87\83\93ID(ReadOnly)\r
+//0x08:08-31:\83N\83\89\83X\83R\81[\83h(ReadOnly)\r
+//     08-15:\83v\83\8d\83O\83\89\83\80\83C\83\93\83^\81[\83t\83F\81[\83X\r
+//     16-23:\83T\83u\83N\83\89\83X\r
+//     24-31:\83x\81[\83X\83N\83\89\83X\r
+//0x0c:00-07:\83L\83\83\83b\83V\83\85\83\89\83C\83\93\83T\83C\83Y\r
+//0x0c:08-15:\83}\83X\83^\83\8c\83C\83e\83\93\83V\83^\83C\83}\r
+//0x0c:16-23:\83w\83b\83_\83^\83C\83v(ReadOnly)\r
+//     16-22:\83f\83o\83C\83X\83^\83C\83v(0:\92Ê\8fí\82ÌPCI\83f\83o\83C\83X 1:PCI-PCI\83u\83\8a\83b\83W 2:CardBus\83u\83\8a\83b\83W)\r
+//     23:\83}\83\8b\83`\83t\83@\83\93\83N\83V\83\87\83\93\83f\83o\83C\83X\r
+//0x0c:24-31:BIST\83\8c\83W\83X\83^\r
+\r
+typedef struct PCI_DEVICE_VENDOR {\r
+       uint id;\r
+       uchar *name;\r
+} PCI_Device_VendorID;\r
+\r
+typedef struct PCI_DEVICE_CLASS {\r
+       uint id;\r
+       uchar *name;\r
+} PCI_Device_Class;\r
+\r
+typedef struct PCI_DEVICE_TYPE {\r
+       uint id;\r
+       uchar *name;\r
+} PCI_Device_Type;\r
+\r
+PCI_Device_VendorID pci_device_vendor[] = {\r
+       {0x10ec, "Realtek Semiconductor Corp."},\r
+       {0x8086, "Intel"},\r
+       {0xffff, "[Unknown]"},\r
+//     {0x, ""},\r
+};\r
+\r
+PCI_Device_Class pci_device_class[] = {\r
+       {0x010100, "Ultra ATA storage controller"},\r
+       {0x010180, "bus master IDE controller (UDMA33?)"},\r
+       {0x020000, "ethernet adapter ?"},\r
+       {0x030000, "VGA compatible controller"},\r
+       {0x040100, "audio device"},\r
+       {0x060000, "CPU to PCI bridge"},\r
+       {0x060100, "PCI to ISA bridge"},\r
+       {0x068000, "power management controller"},\r
+       {0xff0000, "[Unknown]"},\r
+};\r
+\r
+PCI_Device_Type pci_device_type[] = {\r
+       {0, "Standard PCI Device"},\r
+       {1, "PCI-PCI Bridge"},\r
+       {2, "CardBus Bridge"},\r
+       {3, "[Undefined]"},\r
+};\r
+\r
+void Initialize_PCI(void)\r
+{\r
+       #ifdef CHNOSPROJECT_DEBUG_PCI\r
+               uint data, bus, device, function;\r
+       #endif\r
+\r
+//PCICAR\8f\89\8aú\89»\r
+       IO_Out32(PORT_PCI_CONFIG_ADDRESS, 0x00000000);\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_PCI\r
+               for(bus = 0; bus < 256; bus++){\r
+                       for(device = 0; device < 32; device++){\r
+                               for(function = 0; function < 8; function++){\r
+                                       PCI_ConfigurationRegister_SelectDevice(bus, device, function);\r
+                                       data = PCI_ConfigurationRegister_Read32(0x00);\r
+                                       if(data != 0xffffffff){\r
+                                               debug("PCI:Bus%d.Device%d.Function%d:\n", bus, device, function);\r
+                                               debug("PCI:    DeviceVendor:%s(0x%04X)\n", PCI_GetDeviceVendor(data & 0xffff), data & 0xffff);\r
+\r
+                                               debug("PCI:    DeviceID:0x%04X\n", data >> 16);\r
+\r
+                                               data = PCI_ConfigurationRegister_Read32(0x08);\r
+                                               data = CFunction_ExtractBits(data, 8, 31);\r
+                                               debug("PCI:    ClassCode:%s(0x%06X)\n", PCI_GetDeviceClass(data), data);\r
+\r
+                                               data = PCI_ConfigurationRegister_Read32(0x0c);\r
+                                               data = CFunction_ExtractBits(data, 16, 22);\r
+                                               debug("PCI:    DeviceType:%s(%d)\n", PCI_GetDeviceType(data), data);\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       #endif\r
+\r
+       return;\r
+}\r
+\r
+void PCI_ConfigurationRegister_SelectDevice(uint bus, uint device, uint function)\r
+{\r
+       PCI_ConfigurationAddressRegister pcicar;\r
+       pcicar.reg = IO_In32(PORT_PCI_CONFIG_ADDRESS);\r
+       pcicar.bit.bus_num = bus;\r
+       pcicar.bit.device_num = device;\r
+       pcicar.bit.function_num = function;\r
+       IO_Out32(PORT_PCI_CONFIG_ADDRESS, pcicar.reg);\r
+\r
+       return;\r
+}\r
+\r
+uint PCI_ConfigurationRegister_Read32(uint addr)\r
+{\r
+       PCI_ConfigurationAddressRegister pcicar;\r
+       uint data;\r
+\r
+       pcicar.reg = IO_In32(PORT_PCI_CONFIG_ADDRESS);\r
+       pcicar.bit.register_num = addr >> 2;\r
+       pcicar.bit.enable = True;\r
+       IO_Out32(PORT_PCI_CONFIG_ADDRESS, pcicar.reg);\r
+       data = IO_In32(PORT_PCI_CONFIG_DATA_BASE + (addr & 0x03));\r
+       pcicar.bit.enable = False;\r
+       IO_Out32(PORT_PCI_CONFIG_ADDRESS, pcicar.reg);\r
+\r
+       return data;\r
+}\r
+\r
+uchar *PCI_GetDeviceVendor(uint id)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; pci_device_vendor[i].id != 0xffff; i++){\r
+               if(pci_device_vendor[i].id == id){\r
+                       break;\r
+               }\r
+       }\r
+\r
+       return pci_device_vendor[i].name;\r
+}\r
+\r
+uchar *PCI_GetDeviceClass(uint id)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; pci_device_class[i].id != 0xff0000; i++){\r
+               if(pci_device_class[i].id == id){\r
+                       break;\r
+               }\r
+       }\r
+\r
+       return pci_device_class[i].name;\r
+}\r
+\r
+uchar *PCI_GetDeviceType(uint id)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; pci_device_type[i].id != 3; i++){\r
+               if(pci_device_type[i].id == id){\r
+                       break;\r
+               }\r
+       }\r
+\r
+       return pci_device_type[i].name;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/serial.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/serial.c
new file mode 100644 (file)
index 0000000..5274714
--- /dev/null
@@ -0,0 +1,32 @@
+\r
+#include "core.h"\r
+\r
+void Initialize_SerialPort(void)\r
+{\r
+       IO_Out8(COM1_CTRL_LINE, 0x80);  //\83{\81[\83\8c\81[\83g\90Ý\92è\8aJ\8en\r
+       IO_Out8(COM1_BAUD_LSB, 0x06);   //0x06 = 19.2bps\r
+       IO_Out8(COM1_CTRL_LINE, 0x03);  //\83{\81[\83\8c\81[\83g\90Ý\92è\8fI\97¹\81A\91\97\8eó\90M\83f\81[\83^8bit\r
+       IO_Out8(COM1_CTRL_MODEM, 0x0b); //\8a\84\82è\8d\9e\82Ý\97L\8cø\81ARTS\81ADTR\83s\83\93\82ð\83A\83N\83e\83B\83u\89»\r
+//     IO_Out8(COM1_INTR_ENBL, 0x04);  //\83\89\83C\83\93\83X\83e\81[\83^\83X\8a\84\82è\8d\9e\82Ý\r
+       IO_Out8(COM1_INTR_ENBL, 0x00);  //\8a\84\82è\8d\9e\82Ý\82È\82µ\r
+\r
+       return;\r
+}\r
+\r
+void SerialPort_Send(const uchar s[])\r
+{\r
+       for (; *s != 0x00; s++){\r
+               if(*s == '\n'){\r
+                       IO_Out8(COM1_TX, '\r');\r
+                       for(; (IO_In8(COM1_STA_LINE) & 0x40) == 0; ){\r
+\r
+                       }\r
+               }\r
+               IO_Out8(COM1_TX, *s);\r
+               for(; (IO_In8(COM1_STA_LINE) & 0x40) == 0; ){\r
+\r
+               }\r
+       }\r
+\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sheet.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sheet.c
new file mode 100644 (file)
index 0000000..1b37862
--- /dev/null
@@ -0,0 +1,577 @@
+\r
+#include "core.h"\r
+\r
+//\8ae\83V\81[\83g\82Ì\8d\8fã\82ðP\81A\8d\89º\82ðQ\81A\89E\89º\82ðR\81A\89E\8fã\82ðS\81i\82·\82×\82Ä\8f\91\82«\8d\9e\82ß\82é\8dÀ\95W\81j\82Æ\82·\82é\81B\r
+\r
+UI_Sheet *Sheet_Initialize(void)\r
+{\r
+       UI_Sheet *sheet;\r
+\r
+       sheet = (UI_Sheet *)System_CommonStruct_Allocate(SYSTEM_STRUCTID_SHEET);\r
+\r
+       sheet->flags.bit.initialized = True;\r
+       sheet->flags.bit.autorefresh_upperlevel = True;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+               debug("Sheet_Initialize:[0x%08X]\n", sheet);\r
+       #endif\r
+\r
+       sheet->Drawing.Fill_Rectangle = &Sheet_Drawing_Fill_Rectangle_Invalid;\r
+       sheet->Drawing.Put_String = &Sheet_Drawing_Put_String_Invalid;\r
+       sheet->Drawing.Draw_Point = &Sheet_Drawing_Draw_Point_Invalid;\r
+\r
+       sheet->RefreshSheet = &Sheet_Internal_RefreshSheet_Invalid;\r
+\r
+       return sheet;\r
+}\r
+\r
+uint Sheet_Free(UI_Sheet *sheet)\r
+{\r
+       UI_Sheet **search;\r
+       uint i;\r
+\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Free:Null sheet.\n");\r
+               #endif\r
+               return 0;\r
+       }\r
+       if(!sheet->flags.bit.initialized){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Free:Not Initialized sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+//\90e\82Ì\8eq\93o\98^\82ð\8dí\8f\9c\82·\82é\r
+       if(sheet->parent != Null){\r
+               search = &sheet->parent->child;\r
+               for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
+                       if(*search == sheet){\r
+                               *search = sheet->next;\r
+                               sheet->parent = Null;\r
+                               break;\r
+                       }\r
+                       search = &(*search)->next;\r
+               }\r
+               if(i == SHEET_MAX_CHILDREN){\r
+                       #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                               debug("Sheet_Free:TRAP:Sheet not found in the link for the parent.\n");\r
+                       #endif\r
+                       INT_3();\r
+               }\r
+       }\r
+\r
+//\8eq\82Ì\90e\93o\98^\82ð\8dí\8f\9c\82·\82é\r
+       if(sheet->child != Null){\r
+               search = &sheet->child;\r
+               for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
+                       if(search == Null){\r
+                               break;\r
+                       }\r
+                       (*search)->parent = Null;\r
+                       search = &(*search)->child;\r
+               }\r
+       }\r
+\r
+       if(sheet->flags.bit.vram_auto_allocated){\r
+               System_Memory_Free(sheet->vram, sheet->vramsize);\r
+       }\r
+\r
+       System_CommonStruct_Free(&sheet->common_tag);\r
+\r
+       return 0;\r
+}\r
+\r
+//vram==Null:Auto allocate\r
+uint Sheet_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp)\r
+{\r
+       uint retv;\r
+       UI_Sheet *search;\r
+\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetBuffer:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!sheet->flags.bit.initialized){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetBuffer:Not Initialized sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       for(search = sheet->child; search != Null; search = search->next){\r
+               search->RefreshSheet = &Sheet_Internal_RefreshSheet_Invalid;\r
+       }\r
+\r
+       retv = 0;\r
+       if(bpp == 8){\r
+               retv = Sheet08_Internal_SetBuffer(sheet, vram, xsize, ysize, bpp);\r
+       } else if(bpp == 16){\r
+               retv = Sheet16_Internal_SetBuffer(sheet, vram, xsize, ysize, bpp);\r
+       } else if(bpp == 32){\r
+               retv = Sheet32_Internal_SetBuffer(sheet, vram, xsize, ysize, bpp);\r
+       } else{\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetBuffer:Not implemented %d bpp. Abort.\n", bpp);\r
+               #endif\r
+               INT_3();\r
+       }\r
+\r
+       if(retv != 0){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetBuffer:Function Failed.\n");\r
+               #endif\r
+               return 10 + retv;\r
+       }\r
+\r
+       if(sheet->flags.bit.using_map){\r
+               Sheet_Internal_MapInitialize(sheet);\r
+       }\r
+\r
+       for(search = sheet->child; search != Null; search = search->next){\r
+               search->Config_Functions(search);\r
+               Sheet_RefreshSheet_All(search);\r
+       }\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+               debug("Sheet_SetBuffer:[0x%08X]\n", sheet);\r
+               debug("Sheet_SetBuffer:vram:[0x%08X] xsize:%d ysize:%d bpp:%d\n", vram, xsize, ysize, bpp);\r
+       #endif\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_SetParent(UI_Sheet *sheet, UI_Sheet *parent)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetParent:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!sheet->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetParent:Not buffer_configured sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+       if(parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetParent:Null parent.\n");\r
+               #endif\r
+               sheet->parent = Null;\r
+               \r
+               return 3;\r
+       }\r
+       if(!parent->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetParent:Not buffer_configured parent.\n");\r
+               #endif\r
+               return 4;\r
+       }\r
+\r
+       sheet->parent = parent;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+               debug("Sheet_SetParent:[0x%08X] parent:[0x%08X]\n", sheet, parent);\r
+       #endif\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_Show(UI_Sheet *sheet, uint height, int px, int py)\r
+{\r
+       uint retv;\r
+\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Show:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!sheet->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Show:Not buffer_configured sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+       if(sheet->parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Show:Null parent.\n");\r
+               #endif\r
+               return 3;\r
+       }\r
+       if(sheet->flags.bit.visible == True){\r
+               return 4;\r
+       }\r
+\r
+       retv = sheet->Config_Functions(sheet);\r
+\r
+       if(retv != 0){\r
+               return 10 + retv;\r
+       }\r
+\r
+       Sheet_Internal_ChangeHeight(sheet, height);\r
+\r
+       if(px != SHEET_LOCATION_NOCHANGE){\r
+               sheet->location.x = px;\r
+       }\r
+       if(py != SHEET_LOCATION_NOCHANGE){\r
+               sheet->location.y = py;\r
+       }\r
+       sheet->flags.bit.visible = True;\r
+\r
+       if(!sheet->parent->flags.bit.using_map){\r
+               Sheet_Internal_MapInitialize(sheet->parent);\r
+       }\r
+\r
+       Sheet_Internal_MapRefresh(sheet, sheet->location.x, sheet->location.y, sheet->location.x + sheet->size.x - 1, sheet->location.y + sheet->size.y - 1);\r
+\r
+       Sheet_RefreshSheet_All(sheet);\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+               debug("Sheet_Show:[0x%08X] height:%d\n", sheet, i);\r
+       #endif\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_ChangeHeight(UI_Sheet *sheet, uint height)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_ChangeHeight:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!sheet->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_ChangeHeight:Not buffer_configured sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+       if(sheet->parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_ChangeHeight:Null parent.\n");\r
+               #endif\r
+               return 3;\r
+       }\r
+\r
+       Sheet_Internal_ChangeHeight(sheet, height);\r
+       Sheet_RefreshAllInRange(sheet->parent, sheet->location.x, sheet->location.y, sheet->location.x + (int)sheet->size.x - 1, sheet->location.y + (int)sheet->size.y - 1);\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_RefreshSheet_All(UI_Sheet *sheet)\r
+{\r
+       #ifdef CHNOSPROJECT_DEBUG_CALLLINK\r
+               debug("Sheet_RefreshSheet_All:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));\r
+       #endif\r
+\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_RefreshSheet_All:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       return Sheet_RefreshSheet(sheet, 0, 0, sheet->size.x - 1, sheet->size.y - 1);\r
+}\r
+\r
+uint Sheet_Slide_Absolute(UI_Sheet *sheet, int apx, int apy)\r
+{\r
+       uint retv;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_CALLLINK\r
+               debug("Sheet_Slide_Absolute:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));\r
+       #endif\r
+\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Slide_Absolute:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!sheet->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Slide_Absolute:Not buffer_configured sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+       if(sheet->parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Slide_Absolute:Null parent.\n");\r
+               #endif\r
+               return 3;\r
+       }\r
+       if(!sheet->flags.bit.visible){\r
+               if(apx != SHEET_LOCATION_NOCHANGE){\r
+                       sheet->location.x = apx;\r
+               }\r
+               if(apy != SHEET_LOCATION_NOCHANGE){\r
+                       sheet->location.y = apy;\r
+               }\r
+               return 0;\r
+       }\r
+\r
+       retv = Sheet_Internal_SlideSub(sheet, apx - sheet->location.x, apy - sheet->location.y);\r
+\r
+       if(retv != 0){\r
+               return 10 + retv;\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_Slide_Relative(UI_Sheet *sheet, int rpx, int rpy)\r
+{\r
+       uint retv;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_CALLLINK\r
+               debug("Sheet_Slide_Relative:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));\r
+       #endif\r
+\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Slide_Relative:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!sheet->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Slide_Relative:Not buffer_configured sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+       if(sheet->parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Slide_Relative:Null parent.\n");\r
+               #endif\r
+               return 3;\r
+       }\r
+       if(!sheet->flags.bit.visible){\r
+               if(rpx != SHEET_LOCATION_NOCHANGE){\r
+                       sheet->location.x += rpx;\r
+               }\r
+               if(rpy != SHEET_LOCATION_NOCHANGE){\r
+                       sheet->location.y += rpy;\r
+               }\r
+               return 0;\r
+       }\r
+\r
+       retv = Sheet_Internal_SlideSub(sheet, rpx, rpy);\r
+\r
+       if(retv != 0){\r
+               return 10 + retv;\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_RefreshAllInRange(UI_Sheet *parent, int px0, int py0, int px1, int py1)\r
+{\r
+       uint i;\r
+       UI_Sheet *search;\r
+\r
+       if(parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_RefreshAllInRange:Null parent.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!parent->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_RefreshAllInRange:Not buffer_configured sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       search = parent->child;\r
+       for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
+               if(search == Null){\r
+                       break;\r
+               }\r
+               if(Sheet_Internal_IsRangeOverlappedWithSheet(search, px0, py0, px1, py1)){\r
+                       Sheet_Internal_RefreshSheet(search, px0, py0, px1, py1);\r
+               }\r
+               search = search->next;\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_RefreshSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_RefreshSheet:[0x%08X]Null sheet.\n", sheet);\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!sheet->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_RefreshSheet:[0x%08X]Not buffer_configured sheet.\n", sheet);\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       return Sheet_Internal_RefreshSheet(sheet, px0 + sheet->location.x, py0 + sheet->location.y, px1 + sheet->location.x, py1 + sheet->location.y);\r
+}\r
+\r
+uint Sheet_RefreshMap(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_RefreshMap:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!sheet->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_RefreshMap:Not buffer_configured sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       return Sheet_Internal_MapRefresh(sheet, px0 + sheet->location.x, py0 + sheet->location.y, px1 + sheet->location.x, py1 + sheet->location.y);\r
+}\r
+\r
+uint Sheet_RefreshMap_All(UI_Sheet *sheet)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_RefreshMap_All:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       return Sheet_RefreshMap(sheet, 0, 0, sheet->size.x - 1, sheet->size.y - 1);\r
+}\r
+\r
+uint Sheet_Enable_InvisibleColor(UI_Sheet *sheet, uint invcol)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Enable_InvisibleColor:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!sheet->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Enable_InvisibleColor:Not buffer_configured sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       if(sheet->bpp == 8){\r
+               sheet->invcol = RGB_32_To_08(invcol);\r
+               sheet->IsVisiblePixel = &Sheet08_Internal_IsVisiblePixel;\r
+       } else if(sheet->bpp == 16){\r
+               sheet->invcol = RGB_32_To_16(invcol);\r
+               sheet->IsVisiblePixel = &Sheet16_Internal_IsVisiblePixel;\r
+       } else if(sheet->bpp == 32){\r
+               sheet->invcol = invcol;\r
+               sheet->IsVisiblePixel = &Sheet32_Internal_IsVisiblePixel;\r
+       } else{\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Enable_InvisibleColor:Not implemented invisible-color in %d bpp.\n", sheet->bpp);\r
+               #endif\r
+               return 3;\r
+       }\r
+       sheet->flags.bit.using_invcol = True;\r
+       return 0;\r
+}\r
+\r
+uint Sheet_Disable_InvisibleColor(UI_Sheet *sheet)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Disable_InvisibleColor:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(!sheet->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Disable_InvisibleColor:Not buffer_configured sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+       sheet->flags.bit.using_invcol = False;\r
+       sheet->IsVisiblePixel = &Sheet_Internal_IsVisiblePixel_Invalid;\r
+       return sheet->invcol;\r
+}\r
+\r
+uint Sheet_SetTopmost(UI_Sheet *sheet, bool topmost)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetTopmost:Null sheet.\n");\r
+               #endif\r
+               return Null;\r
+       }\r
+\r
+       if(topmost){\r
+               sheet->flags.bit.topmost = True;\r
+               if(sheet->flags.bit.visible){\r
+                       Sheet_Show(sheet, SHEET_MAX_CHILDREN, SHEET_LOCATION_NOCHANGE, SHEET_LOCATION_NOCHANGE);\r
+               }\r
+       } else{\r
+               sheet->flags.bit.topmost = False;\r
+       }\r
+       return 0;\r
+}\r
+\r
+//use map\r
+UI_Sheet *Sheet_GetSheetFromLocation(UI_Sheet *parent, int px, int py)\r
+{\r
+       if(parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_GetSheetFromLocation:Null parent.\n");\r
+               #endif\r
+               return Null;\r
+       }\r
+       if(parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_GetSheetFromLocation:Null map.\n");\r
+               #endif\r
+               return Null;\r
+       }\r
+\r
+       if(px < 0 || py < 0 || px >= (int)parent->size.x || py >= (int)parent->size.y){\r
+               return Null;\r
+       }\r
+\r
+       return (UI_Sheet *)parent->map[py * parent->size.x + px];\r
+}\r
+\r
+uint Sheet_SetMovable(UI_Sheet *sheet, bool movable)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetMovable:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       sheet->flags.bit.movable = movable;\r
+       return 0;\r
+}\r
+\r
+uint Sheet_SetInputFIFO(UI_Sheet *sheet, DATA_FIFO32 *fifo)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_SetInputFIFO:Null sheet.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       sheet->input_fifo = fifo;\r
+\r
+       return 0;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sht08.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sht08.c
new file mode 100644 (file)
index 0000000..79595ee
--- /dev/null
@@ -0,0 +1,245 @@
+\r
+#include "core.h"\r
+\r
+uint Sheet08_Internal_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp)\r
+{\r
+       if(xsize > SHEET_MAX_XSIZE){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet08_Internal_SetBuffer:Too large xsize.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(ysize > SHEET_MAX_YSIZE){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet08_Internal_SetBuffer:Too large ysize.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       sheet->size.x = xsize;\r
+       sheet->size.y = ysize;\r
+       sheet->bpp = bpp;\r
+\r
+       if(sheet->flags.bit.vram_auto_allocated){\r
+               System_Memory_Free(sheet->vram, sheet->vramsize);\r
+               sheet->flags.bit.vram_auto_allocated = False;\r
+       }\r
+\r
+       if(vram == Null){\r
+               sheet->vram = System_Memory_Allocate(xsize * ysize * 1);\r
+               sheet->flags.bit.vram_auto_allocated = True;\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet08_Internal_SetBuffer:Auto Allocation.\n");\r
+               #endif\r
+       } else{\r
+               sheet->vram = vram;\r
+       }\r
+\r
+       sheet->vramsize = xsize * ysize * 1;\r
+       sheet->Config_Functions = &Sheet08_Config_Functions;\r
+       sheet->IsVisiblePixel = &Sheet_Internal_IsVisiblePixel_Invalid;\r
+       sheet->flags.bit.using_invcol = False;\r
+\r
+       sheet->Drawing.Fill_Rectangle = &Sheet08_Drawing_Fill_Rectangle;\r
+       sheet->Drawing.Put_String = &Sheet08_Drawing_Put_String;\r
+       sheet->Drawing.Draw_Point = &Sheet08_Drawing_Draw_Point;\r
+\r
+       sheet->flags.bit.buffer_configured = True;\r
+\r
+       return 0;\r
+}\r
+\r
+//set function address from parent's bpp and own bpp.\r
+uint Sheet08_Config_Functions(UI_Sheet *sheet)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet08_Config_Functions:Null sheet.\n");\r
+               #endif\r
+               return 0;\r
+       }\r
+       if(sheet->parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet08_Config_Functions:Null parent.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(sheet->parent->bpp == 8){\r
+               sheet->RefreshSheet = &Sheet08_Internal_RefreshSheet_To_08;\r
+       } else if(sheet->parent->bpp == 16){\r
+               sheet->RefreshSheet = &Sheet08_Internal_RefreshSheet_To_16;\r
+       } else if(sheet->parent->bpp == 32){\r
+               sheet->RefreshSheet = &Sheet08_Internal_RefreshSheet_To_32;\r
+       } else{\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet08_Config_Functions:Not implemented refresh function to bpp %d.\n", sheet->parent->bpp);\r
+               #endif\r
+       }\r
+       return 0;\r
+}\r
+\r
+uint Sheet08_Internal_RefreshSheet_To_08(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       DATA_Location2D p, r;\r
+       int x, y;\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet08_Internal_RefreshSheet_To_08:Null map.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       for(y = p.y; y <= r.y; y++){\r
+               for(x = p.x; x <= r.x; x++){\r
+                       if(sheet->parent->map[y * sheet->parent->size.x + x] == (uint)sheet){\r
+                               ((uchar *)sheet->parent->vram)[y * sheet->parent->size.x + x] = ((uchar *)sheet->vram)[(y - sheet->location.y) * sheet->size.x + (x - sheet->location.x)];\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet08_Internal_RefreshSheet_To_16(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       DATA_Location2D p, r;\r
+       int x, y;\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet08_Internal_RefreshSheet_To_16:Null map.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       for(y = p.y; y <= r.y; y++){\r
+               for(x = p.x; x <= r.x; x++){\r
+                       if(sheet->parent->map[y * sheet->parent->size.x + x] == (uint)sheet){\r
+                               ((ushort *)sheet->parent->vram)[y * sheet->parent->size.x + x] = RGB_08_To_16(((uchar *)sheet->vram)[(y - sheet->location.y) * sheet->size.x + (x - sheet->location.x)]);\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet08_Internal_RefreshSheet_To_32(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       DATA_Location2D p, r;\r
+       int x, y;\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet08_Internal_RefreshSheet_To_32:Null map.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       for(y = p.y; y <= r.y; y++){\r
+               for(x = p.x; x <= r.x; x++){\r
+                       if(sheet->parent->map[y * sheet->parent->size.x + x] == (uint)sheet){\r
+                               ((uint *)sheet->parent->vram)[y * sheet->parent->size.x + x] = RGB_08_To_32(((uchar *)sheet->vram)[(y - sheet->location.y) * sheet->size.x + (x - sheet->location.x)]);\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+bool Sheet08_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py)\r
+{\r
+       if(((uchar *)(sheet->vram))[(py - sheet->location.y) * (int)sheet->size.x + (px - sheet->location.x)] == sheet->invcol){\r
+               return False;\r
+       }\r
+\r
+       return True;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sht16.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sht16.c
new file mode 100644 (file)
index 0000000..c3769bb
--- /dev/null
@@ -0,0 +1,245 @@
+\r
+#include "core.h"\r
+\r
+uint Sheet16_Internal_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp)\r
+{\r
+       if(xsize > SHEET_MAX_XSIZE){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet16_Internal_SetBuffer:Too large xsize.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(ysize > SHEET_MAX_YSIZE){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet16_Internal_SetBuffer:Too large ysize.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       sheet->size.x = xsize;\r
+       sheet->size.y = ysize;\r
+       sheet->bpp = bpp;\r
+\r
+       if(sheet->flags.bit.vram_auto_allocated){\r
+               System_Memory_Free(sheet->vram, sheet->vramsize);\r
+               sheet->flags.bit.vram_auto_allocated = False;\r
+       }\r
+\r
+       if(vram == Null){\r
+               sheet->vram = System_Memory_Allocate(xsize * ysize * 2);\r
+               sheet->flags.bit.vram_auto_allocated = True;\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet16_Internal_SetBuffer:Auto Allocation.\n");\r
+               #endif\r
+       } else{\r
+               sheet->vram = vram;\r
+       }\r
+\r
+       sheet->vramsize = xsize * ysize * 2;\r
+       sheet->Config_Functions = &Sheet16_Config_Functions;\r
+       sheet->IsVisiblePixel = &Sheet_Internal_IsVisiblePixel_Invalid;\r
+       sheet->flags.bit.using_invcol = False;\r
+\r
+       sheet->Drawing.Fill_Rectangle = &Sheet16_Drawing_Fill_Rectangle;\r
+       sheet->Drawing.Put_String = &Sheet16_Drawing_Put_String;\r
+       sheet->Drawing.Draw_Point = &Sheet16_Drawing_Draw_Point;\r
+\r
+       sheet->flags.bit.buffer_configured = True;\r
+\r
+       return 0;\r
+}\r
+\r
+//set function address from parent's bpp and own bpp.\r
+uint Sheet16_Config_Functions(UI_Sheet *sheet)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet16_Config_Functions:Null sheet.\n");\r
+               #endif\r
+               return 0;\r
+       }\r
+       if(sheet->parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet16_Config_Functions:Null parent.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(sheet->parent->bpp == 16){\r
+               sheet->RefreshSheet = &Sheet16_Internal_RefreshSheet_To_16;\r
+       } else if(sheet->parent->bpp == 8){\r
+               sheet->RefreshSheet = &Sheet16_Internal_RefreshSheet_To_08;\r
+       } else if(sheet->parent->bpp == 32){\r
+               sheet->RefreshSheet = &Sheet16_Internal_RefreshSheet_To_32;\r
+       } else{\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet16_Config_Functions:Not implemented refresh function to bpp %d.\n", sheet->parent->bpp);\r
+               #endif\r
+       }\r
+       return 0;\r
+}\r
+\r
+uint Sheet16_Internal_RefreshSheet_To_16(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       DATA_Location2D p, r;\r
+       int x, y;\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet16_Internal_RefreshSheet_To_16:Null map.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       for(y = p.y; y <= r.y; y++){\r
+               for(x = p.x; x <= r.x; x++){\r
+                       if(sheet->parent->map[y * sheet->parent->size.x + x] == (uint)sheet){\r
+                               ((ushort *)sheet->parent->vram)[y * sheet->parent->size.x + x] = ((ushort *)sheet->vram)[(y - sheet->location.y) * sheet->size.x + (x - sheet->location.x)];\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet16_Internal_RefreshSheet_To_08(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       DATA_Location2D p, r;\r
+       int x, y;\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet16_Internal_RefreshSheet_To_08:Null map.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       for(y = p.y; y <= r.y; y++){\r
+               for(x = p.x; x <= r.x; x++){\r
+                       if(sheet->parent->map[y * sheet->parent->size.x + x] == (uint)sheet){\r
+                               ((uchar *)sheet->parent->vram)[y * sheet->parent->size.x + x] = RGB_16_To_08(((ushort *)sheet->vram)[(y - sheet->location.y) * sheet->size.x + (x - sheet->location.x)]);\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet16_Internal_RefreshSheet_To_32(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       DATA_Location2D p, r;\r
+       int x, y;\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet16_Internal_RefreshSheet_To_32:Null map.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       for(y = p.y; y <= r.y; y++){\r
+               for(x = p.x; x <= r.x; x++){\r
+                       if(sheet->parent->map[y * sheet->parent->size.x + x] == (uint)sheet){\r
+                               ((uint *)sheet->parent->vram)[y * sheet->parent->size.x + x] = RGB_16_To_32(((ushort *)sheet->vram)[(y - sheet->location.y) * sheet->size.x + (x - sheet->location.x)]);\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+bool Sheet16_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py)\r
+{\r
+       if(((ushort *)(sheet->vram))[(py - sheet->location.y) * (int)sheet->size.x + (px - sheet->location.x)] == sheet->invcol){\r
+               return False;\r
+       }\r
+\r
+       return True;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sht32.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/sht32.c
new file mode 100644 (file)
index 0000000..1314378
--- /dev/null
@@ -0,0 +1,250 @@
+\r
+#include "core.h"\r
+\r
+uint Sheet32_Internal_SetBuffer(UI_Sheet *sheet, void *vram, uint xsize, uint ysize, uint bpp)\r
+{\r
+       if(xsize > SHEET_MAX_XSIZE){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet32_Internal_SetBuffer:Too large xsize.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+       if(ysize > SHEET_MAX_YSIZE){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet32_Internal_SetBuffer:Too large ysize.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       sheet->size.x = xsize;\r
+       sheet->size.y = ysize;\r
+       sheet->bpp = bpp;\r
+\r
+       if(sheet->flags.bit.vram_auto_allocated){\r
+               System_Memory_Free(sheet->vram, sheet->vramsize);\r
+               sheet->flags.bit.vram_auto_allocated = False;\r
+       }\r
+\r
+       if(vram == Null){\r
+               sheet->vram = System_Memory_Allocate(xsize * ysize * 4);\r
+               sheet->flags.bit.vram_auto_allocated = True;\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet32_Internal_SetBuffer:Auto Allocation.\n");\r
+               #endif\r
+       } else{\r
+               sheet->vram = vram;\r
+       }\r
+\r
+       sheet->vramsize = xsize * ysize * 4;\r
+       sheet->Config_Functions = &Sheet32_Config_Functions;\r
+       sheet->IsVisiblePixel = &Sheet_Internal_IsVisiblePixel_Invalid;\r
+       sheet->flags.bit.using_invcol = False;\r
+\r
+       sheet->Drawing.Fill_Rectangle = &Sheet32_Drawing_Fill_Rectangle;\r
+       sheet->Drawing.Put_String = &Sheet32_Drawing_Put_String;\r
+       sheet->Drawing.Draw_Point = &Sheet32_Drawing_Draw_Point;\r
+\r
+       sheet->flags.bit.buffer_configured = True;\r
+\r
+       return 0;\r
+}\r
+\r
+//set function address from parent's bpp and own bpp.\r
+uint Sheet32_Config_Functions(UI_Sheet *sheet)\r
+{\r
+       if(sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet32_Config_Functions:Null sheet.\n");\r
+               #endif\r
+               return 0;\r
+       }\r
+       if(sheet->parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet32_Config_Functions:Null parent.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(sheet->parent->bpp == 32){\r
+               sheet->RefreshSheet = &Sheet32_Internal_RefreshSheet_To_32;\r
+       } else if(sheet->parent->bpp == 16){\r
+               sheet->RefreshSheet = &Sheet32_Internal_RefreshSheet_To_16;\r
+       } else if(sheet->parent->bpp == 8){\r
+               sheet->RefreshSheet = &Sheet32_Internal_RefreshSheet_To_08_xy;\r
+       } else{\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet32_Config_Functions:Not implemented refresh function to bpp %d.\n", sheet->parent->bpp);\r
+               #endif\r
+       }\r
+       return 0;\r
+}\r
+\r
+uint Sheet32_Internal_RefreshSheet_To_32(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       DATA_Location2D p, r;\r
+       int x, y;\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet32_Internal_RefreshSheet_To_32:Null map.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       for(y = p.y; y <= r.y; y++){\r
+               for(x = p.x; x <= r.x; x++){\r
+                       if(sheet->parent->map[y * sheet->parent->size.x + x] == (uint)sheet){\r
+                               ((uint *)sheet->parent->vram)[y * sheet->parent->size.x + x] = ((uint *)sheet->vram)[(y - sheet->location.y) * sheet->size.x + (x - sheet->location.x)];\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet32_Internal_RefreshSheet_To_16(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       DATA_Location2D p, r;\r
+       int x, y;\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet32_Internal_RefreshSheet_To_16:Null map.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       for(y = p.y; y <= r.y; y++){\r
+               for(x = p.x; x <= r.x; x++){\r
+                       if(sheet->parent->map[y * sheet->parent->size.x + x] == (uint)sheet){\r
+                               ((ushort *)sheet->parent->vram)[y * sheet->parent->size.x + x] = RGB_32_To_16(((uint *)sheet->vram)[(y - sheet->location.y) * sheet->size.x + (x - sheet->location.x)]);\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+\r
+uint Sheet32_Internal_RefreshSheet_To_08_xy(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       DATA_Location2D p, r;\r
+       int x, y;\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet32_Internal_RefreshSheet_To_08_xy:Null map.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       for(y = p.y; y <= r.y; y++){\r
+               for(x = p.x; x <= r.x; x++){\r
+                       if(sheet->parent->map[y * sheet->parent->size.x + x] == (uint)sheet){\r
+                               ((uchar *)sheet->parent->vram)[y * sheet->parent->size.x + x] = RGB_32_To_08_xy(((uint *)sheet->vram)[(y - sheet->location.y) * sheet->size.x + (x - sheet->location.x)], x, y);\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+bool Sheet32_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py)\r
+{\r
+       if(((uint *)(sheet->vram))[(py - sheet->location.y) * (int)sheet->size.x + (px - sheet->location.x)] >> 24 == 0xff){\r
+               return False;\r
+       }\r
+\r
+       if(((uint *)(sheet->vram))[(py - sheet->location.y) * (int)sheet->size.x + (px - sheet->location.x)] == sheet->invcol){\r
+               return False;\r
+       }\r
+\r
+       return True;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/shtdraw.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/shtdraw.c
new file mode 100644 (file)
index 0000000..9d68596
--- /dev/null
@@ -0,0 +1,141 @@
+\r
+#include "core.h"\r
+\r
+uint Sheet_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1)\r
+{\r
+       if(sheet == Null){\r
+               return 1;\r
+       }\r
+\r
+       if(sheet->vram == Null){\r
+               return 2;\r
+       }\r
+\r
+       return sheet->Drawing.Fill_Rectangle(sheet, c, px0, py0, px1, py1);\r
+}\r
+\r
+uint Sheet_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[])\r
+{\r
+       if(sheet == Null){\r
+               return 1;\r
+       }\r
+\r
+       if(sheet->vram == Null){\r
+               return 2;\r
+       }\r
+\r
+       return sheet->Drawing.Put_String(sheet, x, y, fc, s);\r
+}\r
+\r
+uint Sheet_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c)\r
+{\r
+       if(sheet == Null){\r
+               return 1;\r
+       }\r
+\r
+       if(sheet->vram == Null){\r
+               return 2;\r
+       }\r
+\r
+       return sheet->Drawing.Draw_Point(sheet, x, y, c);\r
+}\r
+\r
+uint Sheet_Drawing_Scroll_Vertical(UI_Sheet *sheet, int vpx)\r
+{\r
+       if(sheet == Null){\r
+               return 1;\r
+       }\r
+\r
+       if(sheet->vram == Null){\r
+               return 2;\r
+       }\r
+\r
+       if(vpx > 0){\r
+               if((uint)vpx >= sheet->size.y){\r
+                       return 3;\r
+               }\r
+               CFunction_MemoryMove(sheet->vram, sheet->vramsize, (void *)((uint)sheet->vram + (sheet->size.x * vpx * (sheet->bpp >> 3))), sheet->vramsize - (sheet->size.x * vpx * (sheet->bpp >> 3)));\r
+       } else if(vpx < 0){\r
+               vpx = -vpx;\r
+               if((uint)vpx >= sheet->size.y){\r
+                       return 4;\r
+               }\r
+               CFunction_MemoryMove((void *)((uint)sheet->vram + (sheet->size.x * vpx * (sheet->bpp >> 3))), sheet->vramsize - (sheet->size.x * vpx * (sheet->bpp >> 3)), sheet->vram, sheet->vramsize);\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+//invalid\r
+uint Sheet_Drawing_Fill_Rectangle_Invalid(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1)\r
+{\r
+       return 0;\r
+}\r
+\r
+uint Sheet_Drawing_Put_String_Invalid(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[])\r
+{\r
+       return 0;\r
+}\r
+\r
+uint Sheet_Drawing_Draw_Point_Invalid(UI_Sheet *sheet, int x, int y, uint c)\r
+{\r
+       return 0;\r
+}\r
+\r
+\r
+//8-bit\r
+uint Sheet08_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1)\r
+{\r
+       Drawing08_Fill_Rectangle(sheet->vram, sheet->size.x, c, (uint)px0, (uint)py0, (uint)px1, (uint)py1);\r
+       return 0;\r
+}\r
+\r
+uint Sheet08_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[])\r
+{\r
+       Drawing08_Put_String(sheet->vram, sheet->size.x, (uint)x, (uint)y, fc, s);\r
+       return 0;\r
+}\r
+\r
+uint Sheet08_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c)\r
+{\r
+       Drawing08_Draw_Point(sheet->vram, sheet->size.x, (uint)x, (uint)y, c);\r
+       return 0;\r
+}\r
+\r
+//16-bit\r
+uint Sheet16_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1)\r
+{\r
+       Drawing16_Fill_Rectangle(sheet->vram, sheet->size.x, c, (uint)px0, (uint)py0, (uint)px1, (uint)py1);\r
+       return 0;\r
+}\r
+\r
+uint Sheet16_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[])\r
+{\r
+       Drawing16_Put_String(sheet->vram, sheet->size.x, (uint)x, (uint)y, fc, s);\r
+       return 0;\r
+}\r
+\r
+uint Sheet16_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c)\r
+{\r
+       Drawing16_Draw_Point(sheet->vram, sheet->size.x, (uint)x, (uint)y, c);\r
+       return 0;\r
+}\r
+\r
+//32-bit\r
+uint Sheet32_Drawing_Fill_Rectangle(UI_Sheet *sheet, uint c, int px0, int py0, int px1, int py1)\r
+{\r
+       Drawing32_Fill_Rectangle(sheet->vram, sheet->size.x, c, (uint)px0, (uint)py0, (uint)px1, (uint)py1);\r
+       return 0;\r
+}\r
+\r
+uint Sheet32_Drawing_Put_String(UI_Sheet *sheet, int x, int y, uint fc, const uchar s[])\r
+{\r
+       Drawing32_Put_String(sheet->vram, sheet->size.x, (uint)x, (uint)y, fc, s);\r
+       return 0;\r
+}\r
+\r
+uint Sheet32_Drawing_Draw_Point(UI_Sheet *sheet, int x, int y, uint c)\r
+{\r
+       Drawing32_Draw_Point(sheet->vram, sheet->size.x, (uint)x, (uint)y, c);\r
+       return 0;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/shtfunc.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/shtfunc.c
new file mode 100644 (file)
index 0000000..f7da5a5
--- /dev/null
@@ -0,0 +1,718 @@
+\r
+#include "core.h"\r
+\r
+//\83V\81[\83g\90§\8cä\97p\93à\95\94\8aÖ\90\94\81Bsheet.c\88È\8aO\82©\82ç\82Í\8cÄ\82Ñ\8fo\82µ\8bÖ\8e~\81B\r
+//\82»\82Ì\91ã\82í\82è\81A\83V\81[\83g\97L\8cø\90«\83`\83F\83b\83N\82Í\82 \82é\92ö\93x\8fÈ\82­\81B\r
+//\8cÄ\82Ñ\8fo\82µ\91¤\82Ì\8aÖ\90\94\82Å\81A\83V\81[\83g\82ª\97L\8cø\82Å\82 \82é\82±\82Æ\82ð\8am\94F\82µ\82Ä\82©\82ç\93n\82·\82±\82Æ\81B\r
+\r
+//uint Sheet_Internal_GetLocation[P,Q,R,S](UI_Sheet *sheet, DATA_Location2D *dest);\r
+//\8f\91\82«\8d\9e\82Ý\89Â\94\\82È\82à\82Á\82Æ\82à\92[\82Ì\8ae\8dÀ\95W\82ð\90e\83V\81[\83g\82Å\82Ì\8dÀ\95W\82Å\8b\81\82ß\82é\81Bdest\82É\8dÀ\95W\82ð\8ai\94[\81B\r
+//\90e\82ª\82È\82¢\83V\81[\83g\82Ì\8fê\8d\87\82Í\81A\96ß\82è\92l\82ª1\82É\82È\82è\81Alocation\82ª(0,0)\82Å\82 \82é\82Æ\89¼\92è\82³\82ê\82é\81B\r
+//\90e\82Ì\82 \82é\83V\81[\83g\82Ì\8fê\8d\87\82Í\81A\96ß\82è\92l\82ª0\82É\82È\82è\81A\8ae\8dÀ\95W\82ª\8ai\94[\82³\82ê\82é\81B\r
+\r
+uint Sheet_Internal_GetLocationP(UI_Sheet *sheet, DATA_Location2D *dest)\r
+{\r
+       if(sheet->parent == Null){\r
+               dest->x = 0;\r
+               dest->y = 0;\r
+               return 1;\r
+       }\r
+       dest->x = sheet->location.x;\r
+       dest->y = sheet->location.y;\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_Internal_GetLocationQ(UI_Sheet *sheet, DATA_Location2D *dest)\r
+{\r
+       if(sheet->parent == Null){\r
+               dest->x = 0;\r
+               dest->y = (int)sheet->size.y - 1;\r
+               return 1;\r
+       }\r
+       dest->x = sheet->location.x;\r
+       dest->y = sheet->location.y + (int)sheet->size.y - 1;\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_Internal_GetLocationR(UI_Sheet *sheet, DATA_Location2D *dest)\r
+{\r
+       if(sheet->parent == Null){\r
+               dest->x = (int)sheet->size.x - 1;\r
+               dest->y = (int)sheet->size.y - 1;\r
+               return 1;\r
+       }\r
+       dest->x = sheet->location.x + (int)sheet->size.x - 1;\r
+       dest->y = sheet->location.y + (int)sheet->size.y - 1;\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_Internal_GetLocationS(UI_Sheet *sheet, DATA_Location2D *dest)\r
+{\r
+       if(sheet->parent == Null){\r
+               dest->x = (int)sheet->size.x - 1;\r
+               dest->y = 0;\r
+               return 1;\r
+       }\r
+       dest->x = sheet->location.x + (int)sheet->size.x - 1;\r
+       dest->y = sheet->location.y;\r
+\r
+       return 0;\r
+}\r
+\r
+//uint Sheet_Internal_MapInitialize(UI_Sheet *parent);\r
+//map\82ð\8f\89\8aú\89»\82·\82é\81B\r
+//\82·\82Å\82É\83}\83b\83v\82ª\8am\95Û\82³\82ê\82Ä\82¢\82½\8fê\8d\87\82Í\81A\89ð\95ú\82µ\82½\8cã\82É\8dÄ\8am\95Û\82·\82é\81B\r
+//\83}\83b\83v\82Ì\8dÄ\8d\\90¬\82à\8e©\93®\82Å\8ds\82¤\81B\r
+\r
+uint Sheet_Internal_MapInitialize(UI_Sheet *parent)\r
+{\r
+       if(parent->flags.bit.using_map){\r
+               parent->flags.bit.using_map = False;\r
+               System_Memory_Free(parent->map, parent->mapsize);\r
+       }\r
+\r
+       parent->mapsize = parent->size.x * parent->size.y * 4;\r
+       parent->map = (uint *)System_Memory_Allocate(parent->mapsize);\r
+       parent->flags.bit.using_map = True;\r
+\r
+       Sheet_Internal_MapRebuild(parent, 0, 0, parent->size.x - 1, parent->size.y - 1);\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+               debug("Sheet_Internal_MapInitialize:[0x%08X] map:[0x%08X]\n", parent, parent->map);\r
+       #endif\r
+\r
+       return 0;\r
+}\r
+\r
+//uint Sheet_Internal_Map[Write, Clear]FromSheet(UI_Sheet *sheet, bool force);\r
+//\8ae\83V\81[\83g\82Ì\94Í\88Í\93à\82Ì\83}\83b\83v\82ð\90\90¬\82·\82é\81B\r
+//force\82ªFalse\82Ì\8e\9e\82Í\81Amap\82ÌNull\82Ü\82½\82Í\8e©\95ª\82Ì\83A\83h\83\8c\83X\82Ì\95\94\95ª\82µ\82©\82¢\82\82ç\82È\82¢\81B\r
+//force\82ªTrue\82Ì\8e\9e\82Í\81Amap\82Ì\94Í\88Í\93à\82É\8b­\90§\93I\82É\8f\91\82«\8d\9e\82Þ\81B\r
+\r
+uint Sheet_Internal_MapWriteFromSheet(UI_Sheet *sheet, bool force, int px0, int py0, int px1, int py1)\r
+{\r
+       int x, y;\r
+       DATA_Location2D p, r;\r
+\r
+       if(sheet->parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Internal_MapWriteFromSheet:Null parent.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Internal_MapWriteFromSheet:Null map.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       if(!sheet->flags.bit.visible){\r
+               return 0;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       if(force){\r
+               if(sheet->flags.bit.using_invcol){\r
+                       for(y = p.y; y <= r.y; y++){\r
+                               for(x = p.x; x <= r.x; x++){\r
+                                       if(sheet->IsVisiblePixel(sheet, x, y)){\r
+                                               sheet->parent->map[y * sheet->parent->size.x + x] = (uint)sheet;\r
+                                       }\r
+                               }\r
+                       }\r
+               } else{\r
+                       for(y = p.y; y <= r.y; y++){\r
+                               for(x = p.x; x <= r.x; x++){\r
+                                       sheet->parent->map[y * sheet->parent->size.x + x] = (uint)sheet;\r
+                               }\r
+                       }\r
+               }\r
+       } else{\r
+               if(sheet->flags.bit.using_invcol){\r
+                       for(y = p.y; y <= r.y; y++){\r
+                               for(x = p.x; x <= r.x; x++){\r
+                                       if(sheet->parent->map[y * sheet->parent->size.x + x] == Null && sheet->IsVisiblePixel(sheet, x, y)){\r
+                                               sheet->parent->map[y * sheet->parent->size.x + x] = (uint)sheet;\r
+                                       }\r
+                               }\r
+                       }\r
+               } else{\r
+                       for(y = p.y; y <= r.y; y++){\r
+                               for(x = p.x; x <= r.x; x++){\r
+                                       if(sheet->parent->map[y * sheet->parent->size.x + x] == Null){\r
+                                               sheet->parent->map[y * sheet->parent->size.x + x] = (uint)sheet;\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint Sheet_Internal_MapClearFromSheet(UI_Sheet *sheet, bool force, int px0, int py0, int px1, int py1)\r
+{\r
+       int x, y;\r
+       DATA_Location2D p, r;\r
+\r
+       if(sheet->parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Internal_MapClearFromSheet:Null parent.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(sheet->parent->map == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Internal_MapClearFromSheet:Null map.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       Sheet_Internal_GetLocationP(sheet, &p);\r
+       Sheet_Internal_GetLocationR(sheet, &r);\r
+\r
+       if(p.x < px0){\r
+               p.x = px0;\r
+       }\r
+       if(p.y < py0){\r
+               p.y = py0;\r
+       }\r
+       if(r.x > px1){\r
+               r.x = px1;\r
+       }\r
+       if(r.y > py1){\r
+               r.y = py1;\r
+       }\r
+\r
+       if(p.x < 0){\r
+               p.x = 0;\r
+       }\r
+       if(p.y < 0){\r
+               p.y = 0;\r
+       }\r
+       if(r.x >= (int)sheet->parent->size.x){\r
+               r.x = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(r.y >= (int)sheet->parent->size.y){\r
+               r.y = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       if(force){\r
+               for(y = p.y; y <= r.y; y++){\r
+                       for(x = p.x; x <= r.x; x++){\r
+                               sheet->parent->map[y * sheet->parent->size.x + x] = Null;\r
+                       }\r
+               }\r
+       } else{\r
+               for(y = p.y; y <= r.y; y++){\r
+                       for(x = p.x; x <= r.x; x++){\r
+                               if(sheet->parent->map[y * sheet->parent->size.x + x] == (uint)sheet){\r
+                                       sheet->parent->map[y * sheet->parent->size.x + x] = Null;\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+//bool Sheet_Internal_IsLocationInRangeOfSheet(UI_Sheet *sheet, int px, int py);\r
+//\82»\82Ì\83V\81[\83g\82ª\81A\82»\82Ì\83V\81[\83g\82Ì\90e\93à\95\94\82Å\82Ì\8dÀ\95W\82Å\82 \82é(px, py)\82ð\8aÜ\82Þ\82©\82Ç\82¤\82©\82ð\95Ô\82·\81B\r
+//\83V\81[\83g\82ª\96³\8cø\82Å\82à\81AFalse\82ð\95Ô\82·\82¾\82¯\82Å\82 \82é\81B\r
+//\90e\82ª\82¢\82È\82¢\83V\81[\83g\82Å\82±\82Ì\8aÖ\90\94\82ð\8eÀ\8ds\82µ\82Ä\82à\96³\88Ó\96¡\82¾\82Æ\8ev\82í\82ê\82é\82Ì\82Å\81AFalse\82ð\95Ô\82·\82¾\82¯\82Å\82 \82é\81B\r
+\r
+bool Sheet_Internal_IsLocationInRangeOfSheet(UI_Sheet *sheet, int px, int py)\r
+{\r
+       if(sheet == Null){\r
+               return False;\r
+       }\r
+       if(sheet->parent == Null){\r
+               return False;\r
+       }\r
+\r
+       if(sheet->location.x > px || sheet->location.y > py){\r
+               return False;\r
+       }\r
+       if(sheet->location.x + (int)sheet->size.x - 1 < px || sheet->location.y + (int)sheet->size.y - 1 < py){\r
+               return False;\r
+       }\r
+\r
+       return True;\r
+}\r
+\r
+//bool Sheet_Internal_IsRangeOverlappedWithSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+//\8ew\92è\82³\82ê\82½\83V\81[\83g\82ª\88ø\90\94\82Ì\8dÀ\95W\94Í\88Í\93à\82É\8fd\82È\82é\82©\82Ç\82¤\82©\82ð\95Ô\82·\81B\r
+\r
+bool Sheet_Internal_IsRangeOverlappedWithSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       if(sheet == Null){\r
+               return False;\r
+       }\r
+       if(sheet->parent == Null){\r
+               return False;\r
+       }\r
+\r
+       if(sheet->location.x > px1){\r
+               return False;\r
+       }\r
+\r
+       if(sheet->location.y > py1){\r
+               return False;\r
+       }\r
+\r
+       if(sheet->location.x + (int)sheet->size.x - 1 < px0){\r
+               return False;\r
+       }\r
+\r
+       if(sheet->location.y + (int)sheet->size.y - 1 < py0){\r
+               return False;\r
+       }\r
+\r
+       return True;\r
+}\r
+\r
+//UI_Sheet *Sheet_Internal_GetSheetFromLocation(UI_Sheet *parent, int px, int py)\r
+//\90e\93à\95\94\82Å\82Ì(px, py)\82É\82¨\82¯\82é\81A\89Â\8e\8b\8fó\91Ô\82Ì\82à\82Á\82Æ\82à\8d\82\82¢\8d\82\82³\82Ì\83V\81[\83g\82ð\95Ô\82·\81B\r
+//\82±\82Ì\8aÖ\90\94\82Í\82«\82Á\82Æ\92x\82¢\82Ì\82Å\81Amap\82ª\97\98\97p\82Å\82«\82È\82¢\8e\9e\82Ì\82Ý\81A\8eg\97p\82·\82é\82×\82«\82Å\82 \82é\81B\r
+//\83G\83\89\81[\82ª\94­\90\82µ\82½\8e\9e\82Í\81ANull\82ð\95Ô\82·\82¾\82¯\82Å\82 \82é\81B\r
+\r
+UI_Sheet *Sheet_Internal_GetSheetFromLocation(UI_Sheet *parent, int px, int py)\r
+{\r
+       uint i;\r
+       UI_Sheet *sheet, *search;\r
+\r
+       sheet = Null;\r
+\r
+       search = parent->child;\r
+       for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
+               if(search == Null){\r
+                       break;\r
+               }\r
+               if(Sheet_Internal_IsLocationInRangeOfSheet(search, px, py) && search->flags.bit.visible){\r
+                       sheet = search;\r
+               }\r
+               search = search->next;\r
+       }\r
+\r
+       return sheet;\r
+}\r
+\r
+//uint Sheet_Internal_MapRebuild(UI_Sheet *parent, int px0, int py0, int px1, int py1);\r
+//\82»\82Ì\94Í\88Í\93à\82Ì\83}\83b\83v\82ð\8a®\91S\82É\8dÄ\8d\\90¬\82·\82é\81B\r
+uint Sheet_Internal_MapRebuild(UI_Sheet *parent, int px0, int py0, int px1, int py1)\r
+{\r
+       uint i;\r
+       UI_Sheet *search;\r
+\r
+       search = parent->child;\r
+       for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
+               if(search == Null){\r
+                       break;\r
+               }\r
+               if(Sheet_Internal_IsRangeOverlappedWithSheet(search, px0, py0, px1, py1)){\r
+                       Sheet_Internal_MapWriteFromSheet(search, True, px0, py0, px1, py1);\r
+               }\r
+               search = search->next;\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+//uint Sheet_Internal_MapRefresh(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+//\82»\82Ì\94Í\88Í\93à\82Ì\83}\83b\83v\82ð\81Asheet\82É\95Ï\8dX\82ª\82 \82Á\82½\82Æ\82µ\82Ä\81A\8dÅ\8f¬\8cÀ\82Å\8dÄ\8d\\90¬\82·\82é\81B\r
+//\8dÀ\95W\82Ímap(parent)\82È\82Ì\82Å\92\8d\88Ó\81B\r
+//sheet\82Ì\8d\82\82³\82Ü\82Å\82Í\82·\82×\82Ä\8dÄ\8d\\90¬\82·\82é\81B\r
+//\93¯\8e\9e\82É\81A\8dX\90V\82µ\82½\83V\81[\83g\82É\91Î\82µ\82Ä\8dÄ\95`\89æ\82ð\82©\82¯\82é\81B\r
+uint Sheet_Internal_MapRefresh(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       UI_Sheet *search;\r
+       //int x, y;\r
+       uint i;\r
+       UI_Sheet **write_sheet;\r
+       uint write_sheets;\r
+\r
+       write_sheet = (UI_Sheet **)System_Memory_Allocate(4 * SHEET_MAX_CHILDREN);\r
+\r
+       if(px0 < 0){\r
+               px0 = 0;\r
+       }\r
+       if(py0 < 0){\r
+               py0 = 0;\r
+       }\r
+       if(px1 >= (int)sheet->parent->size.x){\r
+               px1 = (int)sheet->parent->size.x - 1;\r
+       }\r
+       if(py1 >= (int)sheet->parent->size.y){\r
+               py1 = (int)sheet->parent->size.y - 1;\r
+       }\r
+\r
+       write_sheets = 0;\r
+\r
+       search = sheet->parent->child;\r
+       for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
+               if(search == Null){\r
+                       break;\r
+               }\r
+               if(Sheet_Internal_IsRangeOverlappedWithSheet(search, px0, py0, px1, py1)){\r
+                       Sheet_Internal_MapClearFromSheet(search, False, px0, py0, px1, py1);\r
+                       write_sheet[write_sheets] = search;\r
+                       write_sheets++;\r
+               }\r
+               if(search == sheet){\r
+                       break;\r
+               }\r
+               search = search->next;\r
+       }\r
+\r
+\r
+       for(; write_sheets != 0; ){\r
+               write_sheets--;\r
+               Sheet_Internal_MapWriteFromSheet(write_sheet[write_sheets], False, px0, py0, px1, py1);\r
+               Sheet_Internal_RefreshSheet(write_sheet[write_sheets], px0, py0, px1, py1);\r
+       }\r
+\r
+/*\r
+       for(y = py0; y <= py1; y++){\r
+               for(x = px0; x <= px1; x++){\r
+                       if(sheet->parent->map[y * sheet->parent->size.x + x] == Null){\r
+                               search = Sheet_Internal_GetSheetFromLocation(sheet->parent, x, y);\r
+                               if(search != Null){\r
+                                       Sheet_Internal_MapWriteFromSheet(search, False, px0, py0, px1, py1);\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+*/\r
+\r
+       System_Memory_Free(write_sheet, 4 * SHEET_MAX_CHILDREN);\r
+\r
+       return 0;\r
+}\r
+\r
+//uint Sheet_Internal_RefreshSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1);\r
+//\90e\83O\83\8d\81[\83o\83\8b\8dÀ\95W\82Å\82Ì\83V\81[\83gvram\83\8a\83t\83\8c\83b\83V\83\85\81B\r
+uint Sheet_Internal_RefreshSheet(UI_Sheet *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       uint retv;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_CALLLINK\r
+               debug("Sheet_Internal_RefreshSheet:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));\r
+       #endif\r
+\r
+       if(sheet->parent == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Internal_RefreshSheet:[0x%08X]Null parent.\n", sheet);\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(!sheet->parent->flags.bit.buffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Internal_RefreshSheet:[0x%08X]Not buffer_configured parent.\n", sheet);\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       if(sheet->RefreshSheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Internal_RefreshSheet:[0x%08X]Null Refresh function.\n", sheet);\r
+               #endif\r
+               return 3;\r
+       }\r
+\r
+       if(!sheet->flags.bit.visible){\r
+               return 0;\r
+       }\r
+\r
+       retv = sheet->RefreshSheet(sheet, px0, py0, px1, py1);\r
+\r
+       if(sheet->flags.bit.autorefresh_upperlevel && sheet->parent->parent != Null){\r
+               //\96³\8cÀ\8dÄ\8bA\82ð\96h\82®\82½\82ß\81A\88ê\8e\9e\93I\82É\8fã\88Ê\8aK\91w\83I\81[\83g\83\8a\83t\83\8c\83b\83V\83\85\82ð\96³\8cø\82É\82·\82é\r
+               sheet->flags.bit.autorefresh_upperlevel = False;\r
+               Sheet_RefreshSheet(sheet->parent, px0, py0, px1, py1);\r
+               sheet->flags.bit.autorefresh_upperlevel = True;\r
+       }\r
+\r
+       if(retv != 0){\r
+               return 10 + retv;\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+//uint Sheet_Internal_SlideSub(UI_Sheet *sheet, int rpx, int rpy);\r
+//slide\8d\82\91¬\89»\83T\83u\8aÖ\90\94\81B\83V\81[\83g\82Ì\8dÀ\95W\82à\95Ï\8dX\82·\82é\81B\88ø\90\94\82Í\81A\88Ú\93®\97Ê\82ð\8e¦\82·\95\84\8d\86\82 \82è\90®\90\94\81B\r
+uint Sheet_Internal_SlideSub(UI_Sheet *sheet, int rpx, int rpy)\r
+{\r
+       int xsize, ysize;\r
+       DATA_Location2D A, B;\r
+       int apx, apy;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_CALLLINK\r
+               debug("Sheet_Internal_SlideSub:Called from[0x%08X].\n", *((uint *)(&sheet - 1)));\r
+       #endif\r
+\r
+       xsize = (int)sheet->size.x;\r
+       ysize = (int)sheet->size.y;\r
+\r
+       if(rpx < 0){\r
+               apx = -rpx;\r
+       } else{\r
+               apx = rpx;\r
+       }\r
+\r
+       if(rpy < 0){\r
+               apy = -rpy;\r
+       } else{\r
+               apy = rpy;\r
+       }\r
+\r
+       sheet->flags.bit.visible = False;\r
+\r
+       if(apx >= xsize || apy >= ysize){\r
+               Sheet_Internal_MapRefresh(sheet, sheet->location.x, sheet->location.y, sheet->location.x + xsize - 1, sheet->location.y + ysize - 1);\r
+               sheet->location.x += rpx;\r
+               sheet->location.y += rpy;\r
+               sheet->flags.bit.visible = True;\r
+               Sheet_Internal_MapRefresh(sheet, sheet->location.x, sheet->location.y, sheet->location.x + xsize - 1, sheet->location.y + ysize - 1);\r
+\r
+               Sheet_RefreshSheet_All(sheet);\r
+               return 0;\r
+       }\r
+\r
+       if(rpx == 0){\r
+               //x\95û\8cü\82É\88Ú\93®\82µ\82È\82¢\r
+               if(rpy < 0){\r
+                       //y\82Ì\95\89\82Ì\95û\8cü\82É\88Ú\93®=\8fã\95û\8cü\r
+                       A.x = sheet->location.x;\r
+                       A.y = sheet->location.y + ysize - apy;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+                       sheet->location.x += rpx;\r
+                       sheet->location.y += rpy;\r
+                       sheet->flags.bit.visible = True;\r
+                       A.y -= ysize;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+               } else if(rpy > 0){\r
+                       //y\82Ì\90³\82Ì\95û\8cü\82É\88Ú\93®=\89º\95û\8cü\r
+                       A.x = sheet->location.x;\r
+                       A.y = sheet->location.y;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+                       sheet->location.x += rpx;\r
+                       sheet->location.y += rpy;\r
+                       sheet->flags.bit.visible = True;\r
+                       A.y += ysize;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+               } else{\r
+                       //y\95û\8cü\82É\82à\88Ú\93®\82µ\82È\82¢=\82»\82Ì\82Ü\82Ü\r
+                       sheet->flags.bit.visible = True;\r
+               }\r
+       } else if(rpx < 0){\r
+               //x\82Ì\95\89\82Ì\95û\8cü\82É\88Ú\93®\r
+               if(rpy < 0){\r
+                       //y\82Ì\95\89\82Ì\95û\8cü\82É\88Ú\93®=\8d\8fã\95û\8cü\r
+                       A.x = sheet->location.x;\r
+                       A.y = sheet->location.y + ysize - apy;\r
+                       B.x = sheet->location.x + xsize - apx;\r
+                       B.y = sheet->location.y;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+                       Sheet_Internal_MapRefresh(sheet, B.x, B.y, B.x + apx - 1, B.y + ysize - apy);\r
+                       sheet->location.x += rpx;\r
+                       sheet->location.y += rpy;\r
+                       sheet->flags.bit.visible = True;\r
+                       A.x -= apx;\r
+                       A.y -= ysize;\r
+                       B.x -= xsize;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+                       Sheet_Internal_MapRefresh(sheet, B.x, B.y, B.x + apx - 1, B.y + ysize - apy);\r
+               } else if(rpy > 0){\r
+                       //y\82Ì\90³\82Ì\95û\8cü\82É\88Ú\93®=\8d\89º\95û\8cü\r
+                       A.x = sheet->location.x;\r
+                       A.y = sheet->location.y;\r
+                       B.x = sheet->location.x + xsize - apx;\r
+                       B.y = sheet->location.y + apy;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+                       Sheet_Internal_MapRefresh(sheet, B.x, B.y, B.x + apx - 1, B.y + ysize - apy);\r
+                       sheet->location.x += rpx;\r
+                       sheet->location.y += rpy;\r
+                       sheet->flags.bit.visible = True;\r
+                       A.x -= apx;\r
+                       A.y += ysize;\r
+                       B.x -= xsize;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+                       Sheet_Internal_MapRefresh(sheet, B.x, B.y, B.x + apx - 1, B.y + ysize - apy);\r
+               } else{\r
+                       //y\95û\8cü\82É\88Ú\93®\82µ\82È\82¢=\8d\95û\8cü\r
+                       A.x = sheet->location.x + xsize - apx;\r
+                       A.y = sheet->location.y;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + apx - 1, A.y + ysize - 1);\r
+                       sheet->location.x += rpx;\r
+                       sheet->location.y += rpy;\r
+                       sheet->flags.bit.visible = True;\r
+                       A.x -= xsize;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + apx - 1, A.y + ysize - 1);\r
+               }\r
+       } else{\r
+               //x\82Ì\90³\82Ì\95û\8cü\82É\88Ú\93®\r
+               if(rpy < 0){\r
+                       //y\82Ì\95\89\82Ì\95û\8cü\82É\88Ú\93®=\89E\8fã\95û\8cü\r
+                       A.x = sheet->location.x;\r
+                       A.y = sheet->location.y + ysize - apy;\r
+                       B.x = sheet->location.x;\r
+                       B.y = sheet->location.y;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+                       Sheet_Internal_MapRefresh(sheet, B.x, B.y, B.x + apx - 1, B.y + ysize - apy);\r
+                       sheet->location.x += rpx;\r
+                       sheet->location.y += rpy;\r
+                       sheet->flags.bit.visible = True;\r
+                       A.x += apx;\r
+                       A.y -= ysize;\r
+                       B.x += xsize;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+                       Sheet_Internal_MapRefresh(sheet, B.x, B.y, B.x + apx - 1, B.y + ysize - apy);\r
+               } else if(rpy > 0){\r
+                       //y\82Ì\90³\82Ì\95û\8cü\82É\88Ú\93®=\89E\89º\95û\8cü\r
+                       A.x = sheet->location.x;\r
+                       A.y = sheet->location.y;\r
+                       B.x = sheet->location.x;\r
+                       B.y = sheet->location.y + apy;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+                       Sheet_Internal_MapRefresh(sheet, B.x, B.y, B.x + apx - 1, B.y + ysize - apy);\r
+                       sheet->location.x += rpx;\r
+                       sheet->location.y += rpy;\r
+                       sheet->flags.bit.visible = True;\r
+                       A.x += apx;\r
+                       A.y += ysize;\r
+                       B.x += xsize;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + xsize - 1, A.y + apy - 1);\r
+                       Sheet_Internal_MapRefresh(sheet, B.x, B.y, B.x + apx - 1, B.y + ysize - apy);\r
+               } else{\r
+                       //y\95û\8cü\82É\88Ú\93®\82µ\82È\82¢=\89E\95û\8cü\r
+                       A.x = sheet->location.x;\r
+                       A.y = sheet->location.y;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + apx - 1, A.y + ysize - 1);\r
+                       sheet->location.x += rpx;\r
+                       sheet->location.y += rpy;\r
+                       sheet->flags.bit.visible = True;\r
+                       A.x += xsize;\r
+                       Sheet_Internal_MapRefresh(sheet, A.x, A.y, A.x + apx - 1, A.y + ysize - 1);\r
+               }\r
+       }\r
+\r
+       Sheet_RefreshMap_All(sheet);\r
+       return 0;\r
+}\r
+\r
+uint Sheet_Internal_ChangeHeight(UI_Sheet *sheet, uint height)\r
+{\r
+       UI_Sheet **search;\r
+       uint i;\r
+\r
+//At First, clear old height link.\r
+       search = &sheet->parent->child;\r
+       for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
+               if(*search == sheet){\r
+                       *search = sheet->next;\r
+                       break;\r
+               }\r
+               search = &(*search)->next;\r
+       }\r
+\r
+//Next, set new height link.\r
+       if(!sheet->flags.bit.topmost){\r
+               search = &sheet->parent->child;\r
+               for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
+                       if(i == height){\r
+                               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                                       debug("Sheet_Internal_ChangeHeight:Search:Break(height).\n");\r
+                               #endif\r
+                               break;\r
+                       }\r
+                       if(*search == Null){\r
+                               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                                       debug("Sheet_Internal_ChangeHeight:Search:Break(End of link).\n");\r
+                               #endif\r
+                               break;\r
+                       }\r
+                       if((*search)->flags.bit.topmost){\r
+                               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                                       debug("Sheet_Internal_ChangeHeight:Search:Break(Under topmost sheet).\n");\r
+                               #endif\r
+                               break;\r
+                       }\r
+                       search = &(*search)->next;\r
+               }\r
+       } else{ /*topmost sheet. ignore height.*/\r
+               search = &sheet->parent->child;\r
+               for(i = 0; i < SHEET_MAX_CHILDREN; i++){\r
+                       if(*search == Null){\r
+                               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                                       debug("Sheet_Internal_ChangeHeight:Search:Break(Top most).\n");\r
+                               #endif\r
+                               break;\r
+                       }\r
+                       search = &(*search)->next;\r
+               }\r
+       }\r
+       if(i == SHEET_MAX_CHILDREN){\r
+               #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+                       debug("Sheet_Internal_ChangeHeight:Number of sheets is over SHEET_MAX_CHILDREN.\n");\r
+               #endif\r
+               return 3;\r
+       }\r
+       sheet->next = *search;\r
+       *search = sheet;\r
+\r
+       return 0;\r
+}\r
+\r
+//SheetXX_Internal_IsVisiblePixel(UI_Sheet *sheet, int px, int py)\r
+//\90e\83V\81[\83g\93à\8dÀ\95W\82É\82¨\82¯\82é\81A\8ew\92è\82³\82ê\82½\83V\81[\83g\82Ì\83s\83N\83Z\83\8b(px, py)\82ª\89Â\8e\8b\8fó\91Ô\82Å\82 \82é\82©\82Ç\82¤\82©\82ð\95Ô\82·\81B\r
+//\88ø\90\94\83`\83F\83b\83N\82Í\82·\82×\82Ä\8fÈ\97ª\82µ\82Ä\82¢\82é\82Ì\82Å\81A\8cÄ\82Ñ\8fo\82µ\8c³\82Å\8cµ\96§\82É\83`\83F\83b\83N\82·\82é\95K\97v\82ª\82 \82é\81B\r
+\r
+//\89º\82Ì\8aÖ\90\94\82Í\81A\93§\96¾\90F\83\82\81[\83h\83I\83t\8e\9e\82É\8ew\92è\82³\82ê\82é\81A\83_\83~\81[\8aÖ\90\94\82Å\82 \82é\81B\r
+bool Sheet_Internal_IsVisiblePixel_Invalid(UI_Sheet *sheet, int px, int py)\r
+{\r
+       return True;\r
+}\r
+\r
+uint Sheet_Internal_RefreshSheet_Invalid(struct UI_SHEET *sheet, int px0, int py0, int px1, int py1)\r
+{\r
+       #ifdef CHNOSPROJECT_DEBUG_SHEET\r
+               debug("Sheet_Internal_RefreshSheet_Invalid:Invalid refresh request.\n");\r
+       #endif\r
+       return 0;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/struct.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/struct.c
new file mode 100644 (file)
index 0000000..c88090b
--- /dev/null
@@ -0,0 +1,65 @@
+\r
+/*\83V\83X\83e\83\80\8d\\91¢\91Ì\8b¤\92Ê\8aÇ\97\9d\83\8b\81[\83`\83\93*/\r
+\r
+#include "core.h"\r
+\r
+System_CommonStruct *System_CommonStruct_Allocate(uint structid)\r
+{\r
+       uint strsize;\r
+       System_CommonStruct *str;\r
+\r
+       strsize = 0;\r
+       switch(structid){\r
+               case SYSTEM_STRUCTID_SHEET:\r
+                       strsize = sizeof(UI_Sheet);\r
+                       break;\r
+               case SYSTEM_STRUCTID_FIFO32:\r
+                       strsize = sizeof(DATA_FIFO32);\r
+                       break;\r
+               case SYSTEM_STRUCTID_TEXTBOX:\r
+                       strsize = sizeof(UI_TextBox);\r
+                       break;\r
+               case SYSTEM_STRUCTID_CONSOLE:\r
+                       strsize = sizeof(UI_Console);\r
+                       break;\r
+               case SYSTEM_STRUCTID_FLOPPYDISK:\r
+                       strsize = sizeof(IO_FloppyDisk);\r
+                       break;\r
+               case SYSTEM_STRUCTID_FILE:\r
+                       strsize = sizeof(IO_File);\r
+                       break;\r
+               default:\r
+                       #ifdef CHNOSPROJECT_DEBUG_COMMON_STRUCT\r
+                               debug("System_CommonStruct_Allocate:Unknown Struct.\n");\r
+                       #endif\r
+                       return Null;\r
+       }\r
+\r
+       str = System_Memory_Allocate(strsize);\r
+       str->structid = structid;\r
+       str->structsize = strsize;\r
+\r
+       return str;\r
+}\r
+\r
+uint System_CommonStruct_Free(System_CommonStruct *str)\r
+{\r
+       switch(str->structid){\r
+               case SYSTEM_STRUCTID_SHEET:\r
+               case SYSTEM_STRUCTID_FIFO32:\r
+               case SYSTEM_STRUCTID_TEXTBOX:\r
+               case SYSTEM_STRUCTID_CONSOLE:\r
+               case SYSTEM_STRUCTID_FLOPPYDISK:\r
+               case SYSTEM_STRUCTID_FILE:\r
+                       break;\r
+               default:\r
+                       #ifdef CHNOSPROJECT_DEBUG_COMMON_STRUCT\r
+                               debug("System_CommonStruct_Free:Unknown Struct.\n");\r
+                       #endif\r
+               return 1;\r
+       }\r
+       str->structid = SYSTEM_STRUCTID_UNDEFINED;\r
+       System_Memory_Free(str, str->structsize);\r
+       return 0;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/structid.h b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/structid.h
new file mode 100644 (file)
index 0000000..aab04d9
--- /dev/null
@@ -0,0 +1,9 @@
+\r
+#define SYSTEM_STRUCTID_UNDEFINED      0\r
+#define SYSTEM_STRUCTID_SHEET          1\r
+#define SYSTEM_STRUCTID_FIFO32         2\r
+#define SYSTEM_STRUCTID_TEXTBOX                3\r
+#define SYSTEM_STRUCTID_CONSOLE                4\r
+#define SYSTEM_STRUCTID_FLOPPYDISK     5\r
+#define SYSTEM_STRUCTID_FILE           6\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/system.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/system.c
new file mode 100644 (file)
index 0000000..d156e1a
--- /dev/null
@@ -0,0 +1,496 @@
+\r
+#include "core.h"\r
+\r
+#define PHYSICAL_MEMORY_ALLOCATION_START_ADDRESS       0x00400000\r
+#define SYSTEM_MEMORY_CONTROL_TAGS     1024\r
+//\r
+typedef union CPUID_FUNCTION_FLAGS {\r
+       struct CPUID_FUNCTION_FLAGS_REG {\r
+               uint edx;\r
+               uint ecx;\r
+       } reg;\r
+       struct CPUID_FUNCTION_FLAGS_BITS {\r
+               /*EAX=1,EDX*/\r
+               unsigned FPU : 1;\r
+               unsigned VME : 1;\r
+               unsigned DE : 1;\r
+               unsigned PSE : 1;\r
+               unsigned TSC : 1;\r
+               unsigned MSR : 1;\r
+               unsigned PAE : 1;\r
+               unsigned MCE : 1;\r
+               unsigned CX8 : 1;\r
+               unsigned APIC : 1;\r
+               unsigned edx_bit10 : 1;\r
+               unsigned SEP : 1;\r
+               unsigned MTRR : 1;\r
+               unsigned PGE : 1;\r
+               unsigned MCA : 1;\r
+               unsigned CMOV : 1;\r
+               unsigned PAT : 1;\r
+               unsigned PSE36 : 1;\r
+               unsigned PSN : 1;\r
+               unsigned CLFSH : 1;\r
+               unsigned edx_bit20 : 1;\r
+               unsigned DS : 1;\r
+               unsigned ACPI : 1;\r
+               unsigned MMX : 1;\r
+               unsigned FXSR : 1;\r
+               unsigned SSE : 1;\r
+               unsigned SSE2 : 1;\r
+               unsigned SS : 1;\r
+               unsigned HTT : 1;\r
+               unsigned TM : 1;\r
+               unsigned edx_bit30 : 1;\r
+               unsigned PBE : 1;\r
+               /*EAX=1,ECX*/\r
+               unsigned SSE3 : 1;\r
+               unsigned ecx_bit1 : 1;\r
+               unsigned ecx_bit2 : 1;\r
+               unsigned MONITOR : 1;\r
+               unsigned DSCPL : 1;\r
+               unsigned ecx_bit5 : 1;\r
+               unsigned ecx_bit6 : 1;\r
+               unsigned EST : 1;\r
+               unsigned TM2 : 1;\r
+               unsigned ecx_bit9 : 1;\r
+               unsigned CID : 1;\r
+               unsigned ecx_bit11 : 1;\r
+               unsigned ecx_bit12 : 1;\r
+               unsigned CX16 : 1;\r
+               unsigned XTPR : 1;\r
+               unsigned ecx_bit15 : 1;\r
+               unsigned ecx_bit16 : 1;\r
+               unsigned ecx_bit17 : 1;\r
+               unsigned ecx_bit18 : 1;\r
+               unsigned ecx_bit19 : 1;\r
+               unsigned ecx_bit20 : 1;\r
+               unsigned ecx_bit21 : 1;\r
+               unsigned ecx_bit22 : 1;\r
+               unsigned ecx_bit23 : 1;\r
+               unsigned ecx_bit24 : 1;\r
+               unsigned ecx_bit25 : 1;\r
+               unsigned ecx_bit26 : 1;\r
+               unsigned ecx_bit27 : 1;\r
+               unsigned ecx_bit28 : 1;\r
+               unsigned ecx_bit29 : 1;\r
+               unsigned ecx_bit30 : 1;\r
+               unsigned ecx_bit31 : 1;\r
+       } bit;\r
+} CPUID_FunctionFlags;\r
+\r
+typedef struct SYSTEM_COMMONDATA {\r
+       uint RunningPhase;\r
+       DATA_FIFO32 *InputFocus;\r
+       struct SYSTEM_COMMONDATA_CONTROLLER {\r
+               IO_MemoryControl Memory;\r
+               UI_TaskControl *Task;\r
+               IO_CallBIOSControl *CallBIOS;\r
+               IO_DisplayControl *Display;\r
+       } Controller;\r
+       struct SYSTEM_COMMONDATA_ENVIRONMENT {\r
+               struct SYSTEM_COMMONDATA_ENVIRONMENT_MEMORY {\r
+                       uint PhysicalSize;\r
+               } Memory;\r
+               struct SYSTEM_COMMONDATA_ENVIRONMENT_CPUID {\r
+                       uint max_id;\r
+                       uint max_eid;\r
+                       CPUID_FunctionFlags function_flags;\r
+               } CPUID;\r
+       } Environment;\r
+       struct SYSTEM_COMMONDATA_CORETASK {\r
+               UI_Task *Main;\r
+               UI_Task *KeyboardControl;\r
+               UI_Task *MouseControl;\r
+       } CoreTask;\r
+} System_CommonData;\r
+//\r
+System_CommonData System;\r
+\r
+uchar *SystemRunningPhaseText[] = {\r
+       " 0:Initialising System (Protected 32bit Text Mode)"\r
+};\r
+//\r
+void System_Check_Memory(void);\r
+uint System_CPUID(void *addr, uint id);\r
+\r
+void Initialize_System(void)\r
+{\r
+       uint i;\r
+       uchar s[128];\r
+       uint cpuid_buf[4];\r
+       CPU_EFlags eflags;\r
+       CPU_ControlRegister4 cr4;\r
+\r
+       IO_CLI();\r
+\r
+       TextMode_Clear_Screen();\r
+       Error_Set_Enable_Display_TextMode(True);\r
+\r
+       TextMode_Put_String("Welcome to CHNOSProject!\n", green);\r
+\r
+       System_Set_RunningPhase(0);\r
+\r
+       TextMode_Put_String("\tInitialising SerialPort...\n", white);\r
+       Initialize_SerialPort();\r
+       Error_Set_Enable_SerialPort(True);\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG\r
+               debug("%s:%d\n", __FILE__, __LINE__);\r
+               debug("CHNOSProject is Running in Debug Mode.\n");\r
+       #endif\r
+\r
+//Config Control Register4\r
+       cr4.cr4 = Load_CR4();\r
+       cr4.bit.DE = True;\r
+       Store_CR4(cr4.cr4);\r
+\r
+       TextMode_Put_String("\tInitialising Memory...\n", white);\r
+       System_Check_Memory();\r
+       i = System_Get_PhisycalMemorySize();\r
+       snprintf(s, sizeof(s), "\tMemory:%uByte %uKiB %uMib\n", i, i >> 10, i >> 20);\r
+       TextMode_Put_String(s, white);\r
+       System.Controller.Memory = Memory_Initialize_Control((void *)PHYSICAL_MEMORY_ALLOCATION_START_ADDRESS, i - PHYSICAL_MEMORY_ALLOCATION_START_ADDRESS, SYSTEM_MEMORY_CONTROL_TAGS);\r
+\r
+       i = Memory_Get_FreeSize(System.Controller.Memory);\r
+       snprintf(s, sizeof(s), "\tFreeMemory:%uByte %uKiB %uMib\n", i, i >> 10, i >> 20);\r
+       TextMode_Put_String(s, white);\r
+\r
+       TextMode_Put_String("\tInitialising GDT...\n", white);\r
+       Initialize_GlobalDescriptorTable();\r
+\r
+       TextMode_Put_String("\tInitialising IDT...\n", white);\r
+       Initialize_InterruptDescriptorTable();\r
+\r
+       TextMode_Put_String("\tInitialising PIC...\n", white);\r
+       Initialize_ProgrammableInterruptController();\r
+\r
+       TextMode_Put_String("\tInitialising PIT...\n", white);\r
+       Initialize_ProgrammableIntervalTimer();\r
+\r
+       TextMode_Put_String("\tInitialising Keyboard...\n", white);\r
+       Initialize_Keyboard();\r
+\r
+       TextMode_Put_String("\tInitialising MultiTask...\n", white);\r
+       System.Controller.Task = Initialize_MultiTask_Control(System.Controller.Memory);\r
+       Timer_Set_TaskSwitch(&System_TaskSwitch);\r
+       System.CoreTask.Main = System_MultiTask_GetNowTask();\r
+       System.InputFocus = System.CoreTask.Main->fifo;\r
+\r
+       TextMode_Put_String("\tInitialising CallBIOS...\n", white);\r
+       System.Controller.CallBIOS = Initialize_CallBIOS();\r
+\r
+       TextMode_Put_String("\tReading CPU Identification...\n", white);\r
+       eflags.eflags = IO_Load_EFlags();\r
+       eflags.bit.ID = True;\r
+       IO_Store_EFlags(eflags.eflags);\r
+       eflags.eflags = IO_Load_EFlags();\r
+       if(!eflags.bit.ID){\r
+               TextMode_Put_String("\t\tCPUID is Disabled.\n", white);\r
+               System.Environment.CPUID.max_id = 0xffffffff;\r
+               System.Environment.CPUID.max_eid = 0;\r
+       } else{\r
+               eflags.bit.ID = False;\r
+               IO_Store_EFlags(eflags.eflags);\r
+               eflags.eflags = IO_Load_EFlags();\r
+               if(eflags.bit.ID){\r
+                       TextMode_Put_String("\t\tCPUID is Disabled.\n", white);\r
+                       System.Environment.CPUID.max_id = 0xffffffff;\r
+                       System.Environment.CPUID.max_eid = 0;\r
+               }\r
+       }\r
+       if(System.Environment.CPUID.max_id != 0xffffffff){\r
+               System.Environment.CPUID.max_id = 0;\r
+               TextMode_Put_String("\t\tCPUID is Enabled.\n", white);\r
+               CPUID(cpuid_buf, 0);\r
+               System.Environment.CPUID.max_id = cpuid_buf[0];\r
+               snprintf(s, sizeof(s), "\t\tMaxID =0x%X\n", System.Environment.CPUID.max_id);\r
+               TextMode_Put_String(s, white);\r
+               CPUID(cpuid_buf, 0x80000000);\r
+               if((cpuid_buf[0] & 0x80000000) == 0){\r
+                       TextMode_Put_String("\t\tExtended CPUID is Disabled.\n", white);\r
+               } else{\r
+                       TextMode_Put_String("\t\tExtended CPUID is Enabled.\n", white);\r
+                       System.Environment.CPUID.max_eid = cpuid_buf[0];\r
+                       snprintf(s, sizeof(s), "\t\tMaxEID=0x%X\n", System.Environment.CPUID.max_eid);\r
+                       TextMode_Put_String(s, white);\r
+               }\r
+               CPUID(s, 0);\r
+               s[16] = 0x00;\r
+               TextMode_Put_String("\t\t", white);\r
+               TextMode_Put_String(s + 4, white);\r
+               TextMode_Put_String("\n", white);\r
+               CPUID(cpuid_buf, 1);\r
+               System.Environment.CPUID.function_flags.reg.edx = cpuid_buf[2];\r
+               System.Environment.CPUID.function_flags.reg.ecx = cpuid_buf[3];\r
+               snprintf(s, sizeof(s), "\t\tVME:%d\n", System.Environment.CPUID.function_flags.bit.VME);\r
+               TextMode_Put_String(s, white);\r
+       }\r
+\r
+       TextMode_Put_String("\tInitialising PCI...\n", white);\r
+       Initialize_PCI();\r
+\r
+       TextMode_Put_String("\tSystem Initialising Phase End.\n", white);\r
+\r
+       IO_STI();\r
+\r
+       System.Controller.Display = Initialize_Display();\r
+\r
+//Core Task Run.\r
+\r
+       System.CoreTask.KeyboardControl = System_MultiTask_Task_Initialize(0);\r
+       System.CoreTask.KeyboardControl->tss->eip = (uint)&KeyboardControlTask;\r
+       System.CoreTask.KeyboardControl->tss->cs = SYSTEM_CS << 3;\r
+       System.CoreTask.KeyboardControl->tss->ss = SYSTEM_DS << 3;\r
+       System.CoreTask.KeyboardControl->tss->ds = SYSTEM_DS << 3;\r
+       System.CoreTask.KeyboardControl->tss->esp = (uint)System_Memory_Allocate(1024 * 32) + (1024 * 32);\r
+       MultiTask_Push_Arguments(System.CoreTask.KeyboardControl, 1, &System.InputFocus);\r
+       System_MultiTask_Task_Run(System.CoreTask.KeyboardControl);\r
+\r
+       System.CoreTask.MouseControl = System_MultiTask_Task_Initialize(0);\r
+       System.CoreTask.MouseControl->tss->eip = (uint)&MouseControlTask;\r
+       System.CoreTask.MouseControl->tss->cs = SYSTEM_CS << 3;\r
+       System.CoreTask.MouseControl->tss->ss = SYSTEM_DS << 3;\r
+       System.CoreTask.MouseControl->tss->ds = SYSTEM_DS << 3;\r
+       System.CoreTask.MouseControl->tss->esp = (uint)System_Memory_Allocate(1024 * 32) + (1024 * 32);\r
+       MultiTask_Push_Arguments(System.CoreTask.MouseControl, 2, &System.InputFocus, MouseCursor_Initialize(System.Controller.Display->vramsheet));\r
+       System_MultiTask_Task_Run(System.CoreTask.MouseControl);\r
+\r
+       return;\r
+}\r
+\r
+void System_Set_RunningPhase(uint phase)\r
+{\r
+       System.RunningPhase = phase;\r
+       TextMode_Put_String("\nNow SystemRunningPhase is", white);\r
+       TextMode_Put_String(SystemRunningPhaseText[System.RunningPhase], skyblue);\r
+       TextMode_Put_String("\n", white);\r
+\r
+       return;\r
+}\r
+\r
+uint System_Get_RunningPhase(void)\r
+{\r
+       return System.RunningPhase;\r
+}\r
+\r
+uint System_Get_PhisycalMemorySize(void)\r
+{\r
+       return System.Environment.Memory.PhysicalSize;\r
+}\r
+\r
+void System_SegmentDescriptor_Set_Absolute(uint selector, uint limit, uint base, uint ar)\r
+{\r
+       IO_SegmentDescriptor *gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       if(selector >= 8192){\r
+               return;\r
+       }\r
+\r
+       SegmentDescriptor_Set(&gdt[selector], limit, base, ar);\r
+\r
+       return;\r
+}\r
+\r
+uint System_SegmentDescriptor_Get_Base(uint selector)\r
+{\r
+       IO_SegmentDescriptor *gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       if(selector >= 8192){\r
+               return 0;\r
+       }\r
+\r
+       return SegmentDescriptor_Get_Base(&gdt[selector]);\r
+}\r
+\r
+uint System_SegmentDescriptor_Get_Limit(uint selector)\r
+{\r
+       IO_SegmentDescriptor *gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       if(selector >= 8192){\r
+               return 0;\r
+       }\r
+\r
+       return SegmentDescriptor_Get_Limit(&gdt[selector]);\r
+}\r
+\r
+uint System_SegmentDescriptor_Get_AccessRight(uint selector)\r
+{\r
+       IO_SegmentDescriptor *gdt = (IO_SegmentDescriptor *)ADR_GDT;\r
+\r
+       if(selector >= 8192){\r
+               return 0;\r
+       }\r
+\r
+       return SegmentDescriptor_Get_AccessRight(&gdt[selector]);\r
+}\r
+\r
+uint System_SegmentDescriptor_Set(uint limit, uint base, uint ar)\r
+{\r
+       uint *retaddr;\r
+       uint i;\r
+\r
+       retaddr = &limit - 1;\r
+\r
+       for(i = 1; i < 8192; i++){\r
+               if(System_SegmentDescriptor_Get_Limit(i) == 0){\r
+                       System_SegmentDescriptor_Set_Absolute(i, limit, base, ar);\r
+                       return i;\r
+               }\r
+       }\r
+\r
+       Error_Report(ERROR_NO_MORE_SEGMENT, *retaddr);\r
+\r
+       return 0;\r
+}\r
+\r
+void System_GateDescriptor_Set(uint irq, uint offset, uint selector, uint ar)\r
+{\r
+       IO_GateDescriptor *idt = (IO_GateDescriptor *)ADR_IDT;\r
+\r
+       GateDescriptor_Set(&idt[irq], offset, selector, ar);\r
+\r
+       return;\r
+}\r
+\r
+void System_TaskSwitch(void)\r
+{\r
+       MultiTask_TaskSwitch(System.Controller.Task);\r
+       return;\r
+}\r
+\r
+UI_Task *System_MultiTask_Task_Initialize(uint tss_additional_size)\r
+{\r
+       return MultiTask_Task_Initialize(System.Controller.Task, tss_additional_size);\r
+}\r
+\r
+void System_MultiTask_Task_Run(UI_Task *task)\r
+{\r
+       #ifdef CHNOSPROJECT_DEBUG_CALLLINK\r
+               debug("System_MultiTask_Task_Run:Called from[0x%08X].\n", *((uint *)(&task - 1)));\r
+       #endif\r
+       MultiTask_Task_Run(System.Controller.Task, task);\r
+       return;\r
+}\r
+\r
+void *System_Memory_Allocate(uint size)\r
+{\r
+       return Memory_Allocate(System.Controller.Memory, size);\r
+}\r
+\r
+UI_Task *System_MultiTask_GetNowTask(void)\r
+{\r
+       return MultiTask_GetNowTask(System.Controller.Task);\r
+}\r
+\r
+IO_CallBIOSControl *System_CallBIOS_Get_Controller(void)\r
+{\r
+       return System.Controller.CallBIOS;\r
+}\r
+\r
+void System_CallBIOS_Execute(uchar intn, DATA_FIFO32 *fifo, uint endsignal)\r
+{\r
+       CallBIOS_Execute(System.Controller.CallBIOS, intn, fifo, endsignal);\r
+       return;\r
+}\r
+\r
+void System_Memory_Free(void *addr, uint size)\r
+{\r
+       Memory_Free(System.Controller.Memory, addr, size);\r
+       return;\r
+}\r
+\r
+void System_CallBIOS_Send_End_Of_Operation(uint abort)\r
+{\r
+       CallBIOS_Send_End_Of_Operation(System.Controller.CallBIOS, abort);\r
+       return;\r
+}\r
+\r
+void System_MultiTask_Task_Sleep(UI_Task *task)\r
+{\r
+       MultiTask_Task_Sleep(System.Controller.Task, task);\r
+       return;\r
+}\r
+\r
+void System_MultiTask_Task_Kill(UI_Task *task)\r
+{\r
+       MultiTask_Task_Kill(System.Controller.Task, task);\r
+       return;\r
+}\r
+\r
+DATA_FIFO32 *System_FIFO32_Initialize(uint size)\r
+{\r
+       return FIFO32_Initialize(System.Controller.Memory, size);\r
+}\r
+\r
+uint System_Display_VESA_Set_VideoMode(uint index)\r
+{\r
+       return Display_VESA_Set_VideoMode(System.Controller.Display, index);\r
+}\r
+\r
+IO_DisplayControl *System_Display_Get_Controller(void)\r
+{\r
+       return System.Controller.Display;\r
+}\r
+\r
+uint System_Memory_Get_FreeSize(void)\r
+{\r
+       return Memory_Get_FreeSize(System.Controller.Memory);\r
+}\r
+\r
+uint System_TaskControlMessage_Send_AllTask(uint message)\r
+{\r
+       UI_Task *task;\r
+       uint sended_tasks;\r
+\r
+       sended_tasks = 0;\r
+       for(task = System.Controller.Task->start; task != Null; task = task->next){\r
+               if(task->fifo != Null){\r
+                       sended_tasks++;\r
+                       FIFO32_Put(task->fifo, message);\r
+               }\r
+       }\r
+\r
+       return sended_tasks;\r
+}\r
+\r
+uint System_Sheet_SetParentToVRAM(UI_Sheet *sheet)\r
+{\r
+       return Sheet_SetParent(sheet, System.Controller.Display->vramsheet);\r
+}\r
+\r
+uint System_InputFocus_Change(DATA_FIFO32 *fifo)\r
+{\r
+       if(System.InputFocus != fifo){\r
+               FIFO32_Put(System.InputFocus, INPUTSIGNAL_OFFSET + INPUTSIGNAL_FOCUS_LOST);\r
+               System.InputFocus = fifo;\r
+               FIFO32_Put(System.InputFocus, INPUTSIGNAL_OFFSET + INPUTSIGNAL_FOCUS_GOT);\r
+       }\r
+       return 0;\r
+}\r
+\r
+UI_TaskControl *System_MultiTask_GetController(void)\r
+{\r
+       return System.Controller.Task;\r
+}\r
+\r
+//\r
+void System_Check_Memory(void)\r
+{\r
+       System.Environment.Memory.PhysicalSize = Memory_Test(0x00400000, 0xbfffffff);\r
+       return;\r
+}\r
+\r
+uint System_CPUID(void *addr, uint id) //addr\94Ô\92n\82Ìuint[4]\82É\81ACPU\82Ì\8e¯\95Ê\8fî\95ñid\94Ô\82ðEAX\81EEBX\81EEDX\81EECX\82Ì\8f\87\94Ô\82Å\8ai\94[\82·\82é\81B\r
+{                                      //CPUID\82ª\97\98\97p\95s\89Â\82Ì\8fê\8d\87\82Í\81A\96ß\82è\92l\82Í0xffffffff\81A\97\98\97p\89Â\94\\82È\82ç\81A\8dÅ\91å\93ü\97Í\92l\81i\8aî\96{\8fî\95ñ\82Ì\8fê\8d\87\81j\82ð\95Ô\82·\81B\r
+       if(System.Environment.CPUID.max_id == 0xffffffff){\r
+               return 0;\r
+       }\r
+\r
+       if(id <= System.Environment.CPUID.max_id || (0x80000000 <= id && id <= System.Environment.CPUID.max_eid)){\r
+               CPUID(addr, id);\r
+       }\r
+\r
+       return System.Environment.CPUID.max_id;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/textbox.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/textbox.c
new file mode 100644 (file)
index 0000000..1402d47
--- /dev/null
@@ -0,0 +1,355 @@
+\r
+#include "core.h"\r
+\r
+UI_TextBox *TextBox_Initialize(void)\r
+{\r
+       UI_TextBox *textbox;\r
+\r
+       textbox = (UI_TextBox *)System_CommonStruct_Allocate(SYSTEM_STRUCTID_TEXTBOX);\r
+       textbox->flags.bit.initialized = True;\r
+\r
+       textbox->forecol = 0xffffff;\r
+       textbox->backcol = 0xc6c6c6;\r
+\r
+       return textbox;\r
+}\r
+\r
+//bpp==0:\8e©\93®\91I\91ð(\8c»\8dÝ\82Ì\83V\83X\83e\83\80\83V\81[\83g\82Ì\90Ý\92è\82É\8d\87\82í\82¹\82é)\r
+uint TextBox_SetBuffer(UI_TextBox *textbox, uint xchars, uint ychars, uint bpp, UI_Sheet *parent)\r
+{\r
+       if(textbox == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_SetBuffer:Null textbox.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(xchars < 4 + 1 || ychars < 1){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_SetBuffer:Too small textbox.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       textbox->chars.x = xchars;\r
+       textbox->chars.y = ychars;\r
+       textbox->size_text_buf = textbox->chars.x * textbox->chars.y;\r
+\r
+       textbox->sheet = Sheet_Initialize();\r
+       Sheet_SetBuffer(textbox->sheet, Null, xchars << 3, ychars << 4, bpp);\r
+       Sheet_SetParent(textbox->sheet, parent);\r
+\r
+       Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, 0, 0, (int)textbox->sheet->size.x - 1, (int)textbox->sheet->size.y - 1);\r
+\r
+       textbox->text_buf = System_Memory_Allocate(textbox->size_text_buf);\r
+       textbox->text_buf[0] = 0x00;\r
+\r
+       textbox->flags.bit.textbuffer_configured = True;\r
+\r
+       return 0;\r
+}\r
+\r
+uint TextBox_Show(UI_TextBox *textbox, uint height, int px, int py)\r
+{\r
+       if(textbox == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_Show:Null textbox.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(textbox->sheet == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_Show:Null textbox sheet.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       return Sheet_Show(textbox->sheet, height, px, py);\r
+}\r
+\r
+//char\82ð\93n\82·\82±\82Æ\82à\89Â\94\\81B\r
+//Break\8e\9e\82Ì\83L\81[\83R\81[\83h\82Í\96³\8e\8b\82µ\82Ä\89½\82à\93ü\97Í\82µ\82È\82¢\81ikeyid\82ð\92¼\90Ú\93n\82·\82¾\82¯\82Å\93ü\97Í\82ª\82Å\82«\82é\82æ\82¤\82É\82·\82é\82½\82ß\81j\81B\r
+//\83^\83u\95\8e\9a\82Í\81A\8bL\98^\82ª\83I\83t\82Ì\8e\9e\82Ì\82Ý\93ü\97Í\89Â\94\\81B\r
+uint TextBox_Put_Key(UI_TextBox *textbox, ushort keyid)\r
+{\r
+       if(textbox == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_Put_Key:Null textbox.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(!textbox->flags.bit.textbuffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_Put_Key:Buffer not configured.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       if(!(keyid & KEYID_MASK_BREAK)){\r
+               if(keyid & KEYID_MASK_EXTENDED){        /*\90§\8cä\95\8e\9a*/\r
+                       switch(keyid & KEYID_MASK_ID){\r
+                               case KEYID_ENTER:\r
+                                       TextBox_Internal_Put_Character(textbox, '\n');\r
+                                       break;\r
+                               case KEYID_BACKSPACE:\r
+                                       TextBox_Internal_Put_Character(textbox, '\b');\r
+                                       break;\r
+                               case KEYID_TAB:\r
+                                       TextBox_Internal_Put_Character(textbox, '\t');\r
+                                       break;\r
+                       }\r
+                       return 0;\r
+               } else{ /*ASCII\95\8e\9a*/\r
+                       TextBox_Internal_Put_Character(textbox, keyid & KEYID_MASK_ID);\r
+               }\r
+       }\r
+\r
+       return 0;\r
+}\r
+\r
+uint TextBox_Put_String(UI_TextBox *textbox, const uchar s[])\r
+{\r
+       uint i;\r
+\r
+       if(textbox == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_Put_String:Null textbox.\n");\r
+               #endif\r
+               return 0;\r
+       }\r
+\r
+       if(!textbox->flags.bit.textbuffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_Put_String:Buffer not configured.\n");\r
+               #endif\r
+               return 0;\r
+       }\r
+\r
+       for(i = 0; s[i] != 0x00; i++){\r
+               TextBox_Internal_Put_Character(textbox, s[i]);\r
+       }\r
+       return i;\r
+}\r
+\r
+uint TextBox_Put_Character(UI_TextBox *textbox, uchar c)\r
+{\r
+       if(textbox == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_Put_Character:Null textbox.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(!textbox->flags.bit.textbuffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_Put_Character:Buffer not configured.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       return TextBox_Internal_Put_Character(textbox, c);\r
+}\r
+\r
+//False->True\82Å\83o\83b\83t\83@\83\8a\83Z\83b\83g\81B\r
+bool TextBox_SetEnable_RecordInputText(UI_TextBox *textbox, bool enable)\r
+{\r
+       bool old;\r
+\r
+       if(textbox == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_SetEnable_RecordInputText:Null textbox.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(!textbox->flags.bit.textbuffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_SetEnable_RecordInputText:Buffer not configured.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       old = textbox->flags.bit.record_input_text;\r
+\r
+       if(old != enable){\r
+               if(enable){\r
+                       textbox->text_buf[0] = 0x00;\r
+                       textbox->using_text_buf = 0;\r
+                       textbox->location_cursor_record_started = textbox->location_cursor;\r
+               }\r
+               textbox->flags.bit.record_input_text = enable;\r
+       }\r
+\r
+       return old;\r
+}\r
+\r
+uint TextBox_SetEnable_CursorBlink(UI_TextBox *textbox, bool enable)\r
+{\r
+       if(textbox == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_SetEnable_CursorBlink:Null textbox.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(!textbox->flags.bit.textbuffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_SetEnable_CursorBlink:Buffer not configured.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       textbox->flags.bit.cursor_blink = enable;\r
+       textbox->flags.bit.cursor_state = False;\r
+       TextBox_Internal_DrawCursor(textbox, False);\r
+       return 0;\r
+}\r
+\r
+uint TextBox_Cursor_Blink(UI_TextBox *textbox)\r
+{\r
+       if(textbox == Null){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_Cursor_Blink:Null textbox.\n");\r
+               #endif\r
+               return 1;\r
+       }\r
+\r
+       if(!textbox->flags.bit.textbuffer_configured){\r
+               #ifdef CHNOSPROJECT_DEBUG_TEXTBOX\r
+                       debug("TextBox_Cursor_Blink:Buffer not configured.\n");\r
+               #endif\r
+               return 2;\r
+       }\r
+\r
+       if(!textbox->flags.bit.cursor_blink){\r
+               return 3;\r
+       }\r
+\r
+       textbox->flags.bit.cursor_state = !textbox->flags.bit.cursor_state;\r
+       TextBox_Internal_DrawCursor(textbox, textbox->flags.bit.cursor_state);\r
+       return 0;\r
+}\r
+\r
+//--------//\r
+\r
+uint TextBox_Internal_Put_Character(UI_TextBox *textbox, uchar c)\r
+{\r
+       uint i;\r
+       uchar s[2];\r
+\r
+       s[1] = 0x00;\r
+\r
+       if(textbox->flags.bit.cursor_blink){\r
+               Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);\r
+               Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);\r
+       }\r
+       /*ASCII\95\8e\9a*/\r
+       if(c == '\n'){\r
+               if(TextBox_Internal_Put_Character_TextBuffer(textbox, '\n')){\r
+                       textbox->location_cursor.x = 0;\r
+                       textbox->location_cursor.y += 16;\r
+               }\r
+       } else if(c == '\b'){\r
+               if(!(textbox->location_cursor.x <= 0 && textbox->location_cursor.y <= 0)){\r
+                       if(TextBox_Internal_Put_Character_TextBuffer(textbox, '\b')){\r
+                               textbox->location_cursor.x -= 8;\r
+                       }\r
+                       if(textbox->location_cursor.x < 0){\r
+                               textbox->location_cursor.x = 0;\r
+                               textbox->location_cursor.y -= 16;\r
+                               if(textbox->flags.bit.record_input_text){\r
+                                       for(i = 0; i < textbox->using_text_buf; i++){\r
+                                               if(textbox->text_buf[textbox->using_text_buf - i - 1] == '\n'){\r
+                                                       break;\r
+                                               }\r
+                                               textbox->location_cursor.x += 8;\r
+                                               if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){\r
+                                                       textbox->location_cursor.x = 0;\r
+                                               }\r
+                                       }\r
+                                       if(i == textbox->using_text_buf){\r
+                                               textbox->location_cursor.x += textbox->location_cursor_record_started.x;\r
+                                               if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){\r
+                                                       textbox->location_cursor.x -= textbox->sheet->size.x;\r
+                                               }\r
+                                       }\r
+                               } else{\r
+                                       textbox->location_cursor.x = (int)textbox->sheet->size.x - 8;\r
+                               }\r
+                       }\r
+               }\r
+       } else if(c == '\t'){\r
+               if(!textbox->flags.bit.record_input_text && TextBox_Internal_Put_Character_TextBuffer(textbox, '\t')){\r
+                       textbox->location_cursor.x += 8 * (4 - ((textbox->location_cursor.x >> 3) & 3));\r
+               }\r
+               if(textbox->location_cursor.x > (int)textbox->sheet->size.x){\r
+                       textbox->location_cursor.x = 8 * 4;\r
+                       textbox->location_cursor.y += 16;\r
+               } else if(textbox->location_cursor.x == (int)textbox->sheet->size.x){\r
+                       textbox->location_cursor.x = 0;\r
+                       textbox->location_cursor.y += 16;\r
+               }\r
+       } else if(c == '\r'){\r
+\r
+       } else if(TextBox_Internal_Put_Character_TextBuffer(textbox, c)){\r
+               s[0] = c;\r
+               Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);\r
+               Sheet_Drawing_Put_String(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->forecol, s);\r
+               Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);\r
+               textbox->location_cursor.x += 8;\r
+               if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){\r
+                       textbox->location_cursor.x = 0;\r
+                       textbox->location_cursor.y += 16;\r
+               }\r
+       }\r
+       if(textbox->location_cursor.y >= (int)textbox->sheet->size.y - (16 - 1)){\r
+               Sheet_Drawing_Scroll_Vertical(textbox->sheet, 16);\r
+               Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, 0, (int)textbox->sheet->size.y - 16, (int)textbox->sheet->size.x - 1, (int)textbox->sheet->size.y - 1);\r
+               textbox->location_cursor.y -= 16;\r
+               Sheet_RefreshSheet_All(textbox->sheet);\r
+       }\r
+       Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);\r
+       Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);\r
+\r
+       return 0;\r
+}\r
+\r
+bool TextBox_Internal_Put_Character_TextBuffer(UI_TextBox *textbox, uchar c)\r
+{\r
+       if(!textbox->flags.bit.record_input_text){\r
+               return True;\r
+       }\r
+\r
+       switch(c){\r
+               case '\b':\r
+                       if(textbox->using_text_buf > 0){\r
+                               textbox->using_text_buf--;\r
+                               textbox->text_buf[textbox->using_text_buf] = 0x00;\r
+                               return True;\r
+                       }\r
+                       break;\r
+               default:\r
+                       if(textbox->using_text_buf < textbox->size_text_buf - 1){\r
+                               textbox->text_buf[textbox->using_text_buf] = c;\r
+                               textbox->using_text_buf++;\r
+                               textbox->text_buf[textbox->using_text_buf] = 0x00;\r
+                               return True;\r
+                       }\r
+                       break;\r
+       }\r
+       return False;\r
+}\r
+\r
+uint TextBox_Internal_DrawCursor(UI_TextBox *textbox, bool cursor)\r
+{\r
+       if(cursor){\r
+               Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->forecol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);\r
+       } else{\r
+               Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);\r
+       }\r
+       Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);\r
+\r
+       return 0;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/timer.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/timer.c
new file mode 100644 (file)
index 0000000..c28c066
--- /dev/null
@@ -0,0 +1,184 @@
+\r
+#include "core.h"\r
+\r
+UI_TimerControl *timerctrl;\r
+\r
+UI_TimerControl *Initialize_ProgrammableIntervalTimer(void)\r
+{\r
+       timerctrl = (UI_TimerControl *)System_Memory_Allocate(sizeof(UI_TimerControl));\r
+\r
+       timerctrl->tick_10ms = 0;\r
+       timerctrl->TaskSwitch = &Timer_TaskSwitch_Invalid;\r
+\r
+//config watch\r
+       timerctrl->timer_root = Timer_Initialize();\r
+       Timer_Config(timerctrl->timer_root, 0xfffffff, Null, 0, True);\r
+       timerctrl->timer_root->timeout = 0xffffffff;\r
+       timerctrl->timer_root->flags.bit.running = True;\r
+\r
+//config PIT\r
+       IO_Out8(PIT_CTRL, 0x34);\r
+       IO_Out8(PIT_CNT0, 0x9c);\r
+       IO_Out8(PIT_CNT0, 0x2e);\r
+       System_GateDescriptor_Set(0x20, (uint)asm_InterruptHandler20, 0x02, AR_INTGATE32);\r
+       ProgrammableInterruptController_InterruptMask_Clear(0x00);\r
+\r
+       return timerctrl;\r
+}\r
+\r
+void InterruptHandler20(uint *esp)\r
+{\r
+       ProgrammableInterruptController_InterruptRequest_Complete(0x00);\r
+       timerctrl->tick_10ms++;\r
+\r
+       if(timerctrl->timer_root->timeout <= timerctrl->tick_10ms){\r
+               Timer_TimeOut();\r
+       }\r
+\r
+       if((timerctrl->tick_10ms & 0x00000003) == 0){\r
+               timerctrl->TaskSwitch();\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void Timer_Set_TaskSwitch(void (*TaskSwitchFunction)(void))\r
+{\r
+       if(TaskSwitchFunction != Null){\r
+               timerctrl->TaskSwitch = TaskSwitchFunction;\r
+       } else{\r
+               timerctrl->TaskSwitch = Timer_TaskSwitch_Invalid;\r
+       }\r
+       return;\r
+}\r
+\r
+void Timer_TaskSwitch_Invalid(void)\r
+{\r
+       return;\r
+}\r
+\r
+UI_Timer *Timer_Initialize(void)\r
+{\r
+       UI_Timer *timer;\r
+\r
+       timer = System_Memory_Allocate(sizeof(UI_Timer));\r
+\r
+       timer->flags.bit.initialized = True;\r
+\r
+       #ifdef CHNOSPROJECT_DEBUG_TIMER\r
+               debug("Timer_Initialize:[0x%08X]\n", timer);\r
+       #endif\r
+\r
+       return timer;\r
+}\r
+\r
+uint Timer_Config(UI_Timer *timer, uint tick_ms, DATA_FIFO32 *fifo, uint fifo_putdata, bool interval)\r
+{\r
+       if(timer == Null){\r
+               return 1;\r
+       }\r
+\r
+       if(!timer->flags.bit.initialized){\r
+               return 2;\r
+       }\r
+\r
+       timer->tick = tick_ms / 10;\r
+       timer->fifo = fifo;\r
+       timer->fifo_putdata = fifo_putdata;\r
+       timer->flags.bit.interval = interval;\r
+\r
+       timer->flags.bit.configured = True;\r
+\r
+       return 0;\r
+}\r
+\r
+uint Timer_Run(UI_Timer *timer)\r
+{\r
+       uint eflags;\r
+       UI_Timer **search;\r
+\r
+       if(timer == Null){\r
+               return 1;\r
+       }\r
+\r
+       if(!timer->flags.bit.configured){\r
+               return 2;\r
+       }\r
+\r
+       if(timer->flags.bit.running){\r
+               return 3;\r
+       }\r
+\r
+       timer->timeout = timer->tick + timerctrl->tick_10ms;\r
+       search = &timerctrl->timer_root;\r
+\r
+       eflags = IO_Load_EFlags();\r
+\r
+       for(;;){\r
+               if((*search) == Null){\r
+                       #ifdef CHNOSPROJECT_DEBUG_TIMER\r
+                               debug("Timer_Run:Invalid link. Abort.\n");\r
+                       #endif\r
+                       INT_3();\r
+               }\r
+               if((*search)->timeout > timer->timeout){\r
+                       IO_CLI();\r
+                       timer->root_next = *search;\r
+                       *search = timer;\r
+                       timer->tree_next = Null;\r
+                       timer->flags.bit.running = True;\r
+                       break;\r
+               }\r
+               if((*search)->timeout == timer->timeout){\r
+                       IO_CLI();\r
+                       search = &(*search)->tree_next;\r
+                       for(;;){\r
+                               if(*search == Null){\r
+                                       break;\r
+                               }\r
+                               search = &(*search)->tree_next;\r
+                       }\r
+                       timer->root_next = Null;\r
+                       *search = timer;\r
+                       timer->tree_next = Null;\r
+                       timer->flags.bit.running = True;\r
+                       break;\r
+               }\r
+               search = &(*search)->root_next;\r
+       }\r
+\r
+       IO_Store_EFlags(eflags);\r
+\r
+       return 0;\r
+}\r
+\r
+uint Timer_TimeOut(void)\r
+{\r
+       UI_Timer *search, *old;\r
+\r
+       search = timerctrl->timer_root;\r
+       timerctrl->timer_root = timerctrl->timer_root->root_next;\r
+\r
+       for(;;){\r
+               if(search->fifo != Null){\r
+                       FIFO32_Put(search->fifo, search->fifo_putdata);\r
+               }\r
+               old = search;\r
+               search = old->tree_next;\r
+               old->tree_next = 0;\r
+               old->flags.bit.running = False;\r
+               if(old->flags.bit.interval){\r
+                       Timer_Run(old);\r
+               }\r
+               if(search == Null){\r
+                       break;\r
+               }\r
+       }\r
+       return 0;\r
+}\r
+\r
+uint Timer_GetTick(void)\r
+{\r
+       return timerctrl->tick_10ms;\r
+}\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/vgatmode.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/vgatmode.c
new file mode 100644 (file)
index 0000000..0aee28c
--- /dev/null
@@ -0,0 +1,136 @@
+\r
+#include "core.h"\r
+\r
+uchar VGA_CRTController_ReadRegister(uchar regno)\r
+{\r
+       IO_Out8(VGA_CRTC_R_NUMBER, regno);\r
+       return IO_In8(VGA_CRTC_R_DATA);\r
+}\r
+\r
+void VGA_CRTController_WriteRegister(uchar regno, uchar data)\r
+{\r
+       IO_Out8(VGA_CRTC_R_NUMBER, regno);\r
+       IO_Out8(VGA_CRTC_R_DATA, data);\r
+       return;\r
+}\r
+\r
+void TextMode_Write_TextRAM(ushort index, uchar data)\r
+{\r
+       uchar *textram;\r
+\r
+       textram = (uchar *)VGA_TEXTMODE_ADR;\r
+\r
+       if(index < 80 * 25 * 2){\r
+               textram[index] = data;\r
+       }\r
+       return;\r
+}\r
+\r
+void TextMode_Put_Character_Absolute(uchar c, col_text col, ushort location)\r
+{\r
+       TextMode_Write_TextRAM(location * 2 + 0, c);\r
+       TextMode_Write_TextRAM(location * 2 + 1, (uchar)col);\r
+       return;\r
+}\r
+\r
+void TextMode_Put_String_Absolute(const uchar s[], col_text col, uint x, uint y)\r
+{\r
+       ushort location;\r
+       uint i;\r
+\r
+       for(i = 0; s[i] != 0x00; i++){\r
+\r
+       }\r
+\r
+       if((x + i - 1) >= 80 || y >= 25){\r
+               return;\r
+       }\r
+\r
+       location = (y * 80) + x;\r
+\r
+       for(i = 0; s[i] != 0x00; i++){\r
+               TextMode_Put_Character_Absolute(s[i], col, location + i);\r
+       }\r
+       return;\r
+}\r
+\r
+void TextMode_Clear_Screen(void)\r
+{\r
+       uint i;\r
+\r
+       for(i = 0; i < 80 * 25; i++){\r
+               TextMode_Put_Character_Absolute(' ', white, i);\r
+       }\r
+\r
+       TextMode_Set_CursorLocation(0);\r
+\r
+       return;\r
+}\r
+\r
+ushort TextMode_Get_CursorLocation(void)\r
+{\r
+       ushort location;\r
+\r
+       location = VGA_CRTController_ReadRegister(VGA_CRTC_R_CURSOR_LOCATION_HIGH);\r
+\r
+       location = location << 8;\r
+\r
+       location |= VGA_CRTController_ReadRegister(VGA_CRTC_R_CURSOR_LOCATION_LOW);\r
+\r
+       return location;\r
+}\r
+\r
+void TextMode_Set_CursorLocation(ushort location)\r
+{\r
+       VGA_CRTController_WriteRegister(VGA_CRTC_R_CURSOR_LOCATION_HIGH, location >> 8);\r
+       VGA_CRTController_WriteRegister(VGA_CRTC_R_CURSOR_LOCATION_LOW, location & 0x00ff);\r
+\r
+       return;\r
+}\r
+\r
+void TextMode_Put_Character(uchar c, col_text col)\r
+{\r
+       ushort location;\r
+\r
+       location = TextMode_Get_CursorLocation();\r
+       if(c == '\n'){\r
+               if(80 * 24 <= location && location < 80 * 25){\r
+                       TextMode_Newline();\r
+                       TextMode_Set_CursorLocation(24 * 80);\r
+               } else{\r
+                       TextMode_Set_CursorLocation(((location / 80) + 1) * 80);\r
+               }\r
+       } else if(c == '\t'){\r
+               TextMode_Set_CursorLocation(((location >> 2) << 2) + 4);\r
+       } else{\r
+               TextMode_Put_Character_Absolute(c, col, location);\r
+               TextMode_Set_CursorLocation(location + 1);\r
+       }\r
+       return;\r
+}\r
+\r
+void TextMode_Newline(void)\r
+{\r
+       uint *textram;\r
+       uint i;\r
+\r
+       textram = (uint *)VGA_TEXTMODE_ADR;\r
+\r
+       for(i = 0; i < 80 * 24 * 2 / 4; i++){\r
+               textram[i] = textram[i + 80 * 2 / 4];\r
+       }\r
+\r
+       for(i = 0; i < 80; i++){\r
+               TextMode_Put_Character_Absolute(' ', white, (80 * 24) + i);\r
+       }\r
+\r
+       return;\r
+}\r
+\r
+void TextMode_Put_String(const uchar s[], col_text col)\r
+{\r
+       for(; *s != 0x00; s++){\r
+               TextMode_Put_Character(*s, col);\r
+       }\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/xception.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/xception.c
new file mode 100644 (file)
index 0000000..46e88af
--- /dev/null
@@ -0,0 +1,194 @@
+\r
+#include "core.h"\r
+\r
+void CPU_ExceptionHandler00(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_00, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler01(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_01, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler02(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_02, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler03(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_03, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler04(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_04, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler05(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_05, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler06(uint *esp)\r
+{\r
+       IO_CallBIOSControl *callbios;\r
+\r
+       callbios = System_CallBIOS_Get_Controller();\r
+/*Invalid Opcode Exception*/\r
+       if(System_MultiTask_GetNowTask() == callbios->CallBIOS_Task){   /*\82à\82µ\81A\97á\8aO\82ð\8bN\82±\82µ\82½\83^\83X\83N\82ªCallBIOS\82¾\82Á\82½\82ç*/\r
+               #ifdef CHNOSPROJECT_DEBUG_CALLBIOS\r
+                       debug("Exception_0x06:UD2 Opcode Found in v8086mode.\n");\r
+               #endif\r
+               callbios->retvalue.eip = esp[0x0a];\r
+               callbios->retvalue.eax = esp[0x07];\r
+               callbios->retvalue.ecx = esp[0x06];\r
+               callbios->retvalue.edx = esp[0x05];\r
+               callbios->retvalue.ebx = esp[0x04];\r
+               callbios->retvalue.esp = esp[0x03];\r
+               callbios->retvalue.ebp = esp[0x02];\r
+               callbios->retvalue.esi = esp[0x01];\r
+               callbios->retvalue.edi = esp[0x00];\r
+               callbios->retvalue.es = esp[0x09];\r
+               callbios->retvalue.cs = esp[0x0b];\r
+               callbios->retvalue.ss = esp[0x0e];\r
+               callbios->retvalue.ds = esp[0x08];\r
+               callbios->retvalue.eflags.eflags = esp[0x0c];\r
+\r
+               System_CallBIOS_Send_End_Of_Operation(False);\r
+               System_MultiTask_Task_Kill(System_MultiTask_GetNowTask());\r
+       } else{\r
+               Error_Report(ERROR_CPU_EXCEPTION_06, esp);\r
+       }\r
+}\r
+\r
+void CPU_ExceptionHandler07(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_07, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler08(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_08, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler09(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_09, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler0a(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_0A, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler0b(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_0B, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler0c(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_0C, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler0d(uint *esp)\r
+{\r
+/*General Protection Exception*/\r
+       if(System_MultiTask_GetNowTask() != System_CallBIOS_Get_Controller()->CallBIOS_Task){   /*\82à\82µ\81A\97á\8aO\82ð\8bN\82±\82µ\82½\83^\83X\83N\82ªCallBIOS\82¾\82Á\82½\82ç*/\r
+               Error_Report(ERROR_CPU_EXCEPTION_0D, esp);\r
+       }\r
+       CallBIOS_Check_Privileged_Operation(esp);\r
+       return;\r
+}\r
+\r
+void CPU_ExceptionHandler0e(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_0E, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler0f(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_0F, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler10(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_10, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler11(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_11, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler12(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_12, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler13(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_13, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler14(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_14, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler15(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_15, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler16(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_16, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler17(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_17, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler18(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_18, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler19(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_19, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1a(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_1A, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1b(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_1B, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1c(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_1C, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1d(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_1D, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1e(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_1E, esp);\r
+}\r
+\r
+void CPU_ExceptionHandler1f(uint *esp)\r
+{\r
+       Error_Report(ERROR_CPU_EXCEPTION_1F, esp);\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/Makefile
new file mode 100644 (file)
index 0000000..6e1d790
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = crack1\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/crack1.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/crack1.c
new file mode 100644 (file)
index 0000000..415300d
--- /dev/null
@@ -0,0 +1,9 @@
+\r
+#include "../chnapi.h"\r
+\r
+void CHNMain(void)\r
+{\r
+       api_putchar('C');\r
+       *((uchar *)0x00102600) = 0;\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack1/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/Makefile
new file mode 100644 (file)
index 0000000..0953369
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = crack2\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/crack2.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/crack2.nas
new file mode 100644 (file)
index 0000000..4d74abd
--- /dev/null
@@ -0,0 +1,15 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+\r
+       GLOBAL  _CHNMain\r
+\r
+[SECTION .text]\r
+\r
+_CHNMain:\r
+       mov     eax,1*8\r
+       mov     ds,ax\r
+       mov     byte[0x102600],0\r
+       mov     edx, 4\r
+       int     0x40\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack2/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/Makefile
new file mode 100644 (file)
index 0000000..5719e2d
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = crack3\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/crack3.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/crack3.nas
new file mode 100644 (file)
index 0000000..82c7dec
--- /dev/null
@@ -0,0 +1,18 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+\r
+       GLOBAL  _CHNMain\r
+\r
+[SECTION .text]\r
+\r
+_CHNMain:\r
+       mov     al,0x34\r
+       out     0x43,al\r
+       mov     al,0xff\r
+       out     0x40,al\r
+       mov     al,0xff\r
+       out     0x40,al\r
+       mov     edx, 4\r
+       int     0x40\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack3/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/Makefile
new file mode 100644 (file)
index 0000000..230e505
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = crack4\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/crack4.nas b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/crack4.nas
new file mode 100644 (file)
index 0000000..c503275
--- /dev/null
@@ -0,0 +1,14 @@
+[FORMAT "WCOFF"]\r
+[INSTRSET "i486p"]\r
+[BITS 32]\r
+\r
+       GLOBAL  _CHNMain\r
+\r
+[SECTION .text]\r
+\r
+_CHNMain:\r
+       cli\r
+fin:\r
+       hlt\r
+       jmp     fin\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/crack4/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/!clean.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/!clean.bat
new file mode 100644 (file)
index 0000000..3fc907c
--- /dev/null
@@ -0,0 +1 @@
+make.bat clean\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/!src_only.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/!src_only.bat
new file mode 100644 (file)
index 0000000..d5349ce
--- /dev/null
@@ -0,0 +1 @@
+make.bat src_only
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/Makefile b/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/Makefile
new file mode 100644 (file)
index 0000000..d31c4a5
--- /dev/null
@@ -0,0 +1,6 @@
+# .chn\83A\83v\83\8a\97pMakefile\r
+\r
+APP      = ctest\r
+OBJS_APP = $(APP).obj\r
+\r
+include ../chnmake.txt\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/ctest.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/ctest.c
new file mode 100644 (file)
index 0000000..b115ebf
--- /dev/null
@@ -0,0 +1,9 @@
+\r
+#include "../chnapi.h"\r
+\r
+void CHNMain(void)\r
+{\r
+       api_putchar('C');\r
+       api_putstr("TESTtest...\nNewLine.");\r
+       api_end();\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/ctest/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/chnos_010/make.bat b/CHNOSProject/chnos/tolset_chn_000/chnos_010/make.bat
new file mode 100644 (file)
index 0000000..e489766
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/CHNOSP.rul b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/CHNOSP.rul
new file mode 100644 (file)
index 0000000..624bda4
--- /dev/null
@@ -0,0 +1,19 @@
+format:\r
+       /* \82±\82Ì\83Z\83N\83V\83\87\83\93\82Å\83\8a\83\93\83N\82Ì\95û\90j\82ð\8bL\8fq */\r
+       code(align:1, logic:0x24,      file:0x24);\r
+       data(align:4, logic:stack_end, file:code_end);\r
+\r
+file:\r
+       /* \82±\82Ì\83Z\83N\83V\83\87\83\93\82Å\83R\83}\83\93\83h\83\89\83C\83\93\82É\8f\91\82«\82«\82ê\82È\82©\82Á\82½\r
+               .ojb\83t\83@\83C\83\8b\81A.lib\83t\83@\83C\83\8b\82ð\8bL\8dÚ */\r
+       /* \82È\82¨\81A\82±\82Ì\83Z\83N\83V\83\87\83\93\82Í\83t\83\8b\83p\83X\82Å\8f\91\82¢\82Ä\82à\82æ\82¢\81B */\r
+       /* \97á\81F  c:/osask/gg00libc.lib;  */\r
+       ../../z_tools/CHNOSProject/chnlibc.lib;\r
+       ../../z_tools/CHNOSProject/golibc.lib;\r
+\r
+label:\r
+       /* \95K\82¸\83\8a\83\93\83N\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\83\89\83x\83\8b\82ð\8ew\92è */\r
+       /* \83G\83\93\83g\83\8a\83|\83C\83\93\83g\82ð\8ew\92è\82·\82ê\82Î\82¢\82¢\82Æ\8ev\82Á\82Ä\82­\82¾\82³\82¢ */\r
+       _CHNStartup;\r
+\r
+       /* \8fã\8bL3\83Z\83N\83V\83\87\83\93\82Ì\8f\87\8f\98\82Í\93ü\82ê\91Ö\82¦\82Ä\82Í\82¢\82¯\82Ü\82¹\82ñ! */\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/apilib.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/apilib.lib
new file mode 100644 (file)
index 0000000..c755010
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/apilib.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/chn010.rul b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/chn010.rul
new file mode 100644 (file)
index 0000000..1e8a163
--- /dev/null
@@ -0,0 +1,19 @@
+format:\r
+       /* \82±\82Ì\83Z\83N\83V\83\87\83\93\82Å\83\8a\83\93\83N\82Ì\95û\90j\82ð\8bL\8fq */\r
+       code(align:1, logic:0x24,      file:0x24);\r
+       data(align:4, logic:stack_end, file:code_end);\r
+\r
+file:\r
+       /* \82±\82Ì\83Z\83N\83V\83\87\83\93\82Å\83R\83}\83\93\83h\83\89\83C\83\93\82É\8f\91\82«\82«\82ê\82È\82©\82Á\82½\r
+               .ojb\83t\83@\83C\83\8b\81A.lib\83t\83@\83C\83\8b\82ð\8bL\8dÚ */\r
+       /* \82È\82¨\81A\82±\82Ì\83Z\83N\83V\83\87\83\93\82Í\83t\83\8b\83p\83X\82Å\8f\91\82¢\82Ä\82à\82æ\82¢\81B */\r
+       /* \97á\81F  c:/osask/gg00libc.lib;  */\r
+       ../../z_tools/CHNOSProject/chnlibc.lib;\r
+       /*../../z_tools/CHNOSProject/golibc.lib;*/\r
+\r
+label:\r
+       /* \95K\82¸\83\8a\83\93\83N\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\83\89\83x\83\8b\82ð\8ew\92è */\r
+       /* \83G\83\93\83g\83\8a\83|\83C\83\93\83g\82ð\8ew\92è\82·\82ê\82Î\82¢\82¢\82Æ\8ev\82Á\82Ä\82­\82¾\82³\82¢ */\r
+       _CHNStartup;\r
+\r
+       /* \8fã\8bL3\83Z\83N\83V\83\87\83\93\82Ì\8f\87\8f\98\82Í\93ü\82ê\91Ö\82¦\82Ä\82Í\82¢\82¯\82Ü\82¹\82ñ! */\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/chnlibc.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/chnlibc.lib
new file mode 100644 (file)
index 0000000..a5decaa
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/chnlibc.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/errno.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/errno.h
new file mode 100644 (file)
index 0000000..c1ffd85
--- /dev/null
@@ -0,0 +1,20 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(ERRNO_H))\r
+\r
+#define ERRNO_H        1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+extern int errno;\r
+\r
+#define        ENOENT          2       /* No such file or directory */\r
+#define        ERANGE          34      /* Result too large (or too small) */\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/float.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/float.h
new file mode 100644 (file)
index 0000000..943ba62
--- /dev/null
@@ -0,0 +1,26 @@
+/* copyright(C) 2002 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(FLOAT_H))\r
+\r
+#define FLOAT_H                        1\r
+\r
+#define FLT_RADIX              2\r
+#define FLT_ROUNDS             1 /* nearest */\r
+#define FLT_DIG                        6\r
+#define FLT_EPSILON            1.19209290e-07F\r
+#define FLT_MANT_DIG   24\r
+#define FLT_MAX                        3.40282347e+38F\r
+#define FLT_MAX_EXP            (+128)\r
+#define FLT_MIN                        1.17549435e-38F\r
+#define FLT_MIN_EXP            (-125)\r
+\r
+#define DBL_DIG                        15\r
+#define DBL_EPSILON            2.2204460492503131e-16\r
+#define DBL_MANT_DIG   53\r
+#define DBL_MAX                        1.7976931348623157e+308\r
+#define DBL_MAX_EXP            1024\r
+#define DBL_MIN                        2.2250738585072014e-308\r
+#define DBL_MIN_EXP            (-1021)\r
+\r
+#endif\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/golibc.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/golibc.lib
new file mode 100644 (file)
index 0000000..9651ab1
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/golibc.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/limits.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/limits.h
new file mode 100644 (file)
index 0000000..f4d9f73
--- /dev/null
@@ -0,0 +1,23 @@
+/* copyright(C) 2002 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(LIMITS_H))\r
+\r
+#define LIMITS_H       1\r
+\r
+#define CHAR_BIT       8\r
+#define        CHAR_MAX        (+127)\r
+#define CHAR_MIN       0\r
+#define INT_MAX                (+0x7fffffff)\r
+#define INT_MIN                (-0x7fffffff)\r
+#define LONG_MAX    INT_MAX\r
+#define        LONG_MIN        INT_MIN\r
+#define SCHAR_MAX      (+127)\r
+#define        SCHAR_MIN       (-127)\r
+#define        SHRT_MAX        (+0x7fff)\r
+#define SHRT_MIN       (-0x7fff)\r
+#define UCHAR_MAX      (+0xff)\r
+#define UINT_MAX       (+0xffffffff)\r
+#define ULONG_MAX      UINT_MAX\r
+#define USHRT_MAX      (+0xffff)\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/math.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/math.h
new file mode 100644 (file)
index 0000000..9df151a
--- /dev/null
@@ -0,0 +1,42 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(MATH_H))\r
+\r
+#define MATH_H 1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+double sin(double);\r
+double cos(double);\r
+double sqrt(double);\r
+double ldexp(double x, int n);\r
+double frexp(double x, int *exp);\r
+\r
+extern __inline__ double sin(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fsin" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+extern __inline__ double cos(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fcos" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+extern __inline__ double sqrt(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fsqrt" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/setjmp.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/setjmp.h
new file mode 100644 (file)
index 0000000..5512f36
--- /dev/null
@@ -0,0 +1,20 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(SETJMP_H))\r
+\r
+#define SETJMP_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+typedef int jmp_buf[3]; /* EBP, EIP, ESP */\r
+\r
+#define setjmp(env)                    __builtin_setjmp(env)\r
+#define longjmp(env, val)      __builtin_longjmp(env, val)\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/stdarg.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/stdarg.h
new file mode 100644 (file)
index 0000000..ab6b2a9
--- /dev/null
@@ -0,0 +1,21 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDARG_H))\r
+\r
+#define STDARG_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#define va_start(v,l)  __builtin_stdarg_start((v),l)\r
+#define va_end                 __builtin_va_end\r
+#define va_arg                 __builtin_va_arg\r
+#define va_copy(d,s)   __builtin_va_copy((d),(s))\r
+#define        va_list                 __builtin_va_list\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/stddef.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/stddef.h
new file mode 100644 (file)
index 0000000..95727bc
--- /dev/null
@@ -0,0 +1,17 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDDEF_H))\r
+\r
+#define STDDEF_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+typedef unsigned int size_t;\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/stdio.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/stdio.h
new file mode 100644 (file)
index 0000000..9999635
--- /dev/null
@@ -0,0 +1,24 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDIO_H))\r
+\r
+#define STDIO_H        1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#if (!defined(NULL))\r
+       #define NULL    ((void *) 0)\r
+#endif\r
+\r
+#include <stdarg.h>\r
+\r
+int sprintf(char *s, const char *format, ...);\r
+int vsprintf(char *s, const char *format, va_list arg);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/string.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/CHNOSProject/string.h
new file mode 100644 (file)
index 0000000..62bd804
--- /dev/null
@@ -0,0 +1,38 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STRING_H))\r
+\r
+#define STRING_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#include <stddef.h>            /* size_t */\r
+\r
+char *strcpy(char *s, const char *ct);\r
+char *strncpy(char *s, const char *ct, size_t n);\r
+char *strcat(char *s, const char *ct);\r
+char *strncat(char *s, const char *ct, size_t n);\r
+int strcmp(const char *cs, const char *ct);\r
+int strncmp(const char *cs, const char *ct, size_t n);\r
+char *strchr(const char *cs, int c);\r
+char *strrchr(const char *cs, int c);\r
+size_t strspn(const char *s, const char *accept);\r
+size_t strcspn(const char *s, const char *reject);\r
+char *strpbrk(const char *s, const char *accept);\r
+char *strstr(const char *cs, const char *ct);\r
+size_t strlen(const char *cs);\r
+\r
+void *memcpy(void *s, const void *ct, size_t n);\r
+void *memmove(void *s, const void *ct, size_t n);\r
+int memcmp(const void *cs, const void *ct, size_t n);\r
+void *memchr(const void *cs, int c, size_t n);\r
+void *memset(void *s, int c, size_t n);\r
+char *strdup(const char *s);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/GPL.txt b/CHNOSProject/chnos/tolset_chn_000/z_tools/GPL.txt
new file mode 100644 (file)
index 0000000..d60c31a
--- /dev/null
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/LGPL.txt b/CHNOSProject/chnos/tolset_chn_000/z_tools/LGPL.txt
new file mode 100644 (file)
index 0000000..6b0b797
--- /dev/null
@@ -0,0 +1,504 @@
+                 GNU LESSER GENERAL PUBLIC LICENSE\r
+                      Version 2.1, February 1999\r
+\r
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.\r
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ Everyone is permitted to copy and distribute verbatim copies\r
+ of this license document, but changing it is not allowed.\r
+\r
+[This is the first released version of the Lesser GPL.  It also counts\r
+ as the successor of the GNU Library Public License, version 2, hence\r
+ the version number 2.1.]\r
+\r
+                           Preamble\r
+\r
+  The licenses for most software are designed to take away your\r
+freedom to share and change it.  By contrast, the GNU General Public\r
+Licenses are intended to guarantee your freedom to share and change\r
+free software--to make sure the software is free for all its users.\r
+\r
+  This license, the Lesser General Public License, applies to some\r
+specially designated software packages--typically libraries--of the\r
+Free Software Foundation and other authors who decide to use it.  You\r
+can use it too, but we suggest you first think carefully about whether\r
+this license or the ordinary General Public License is the better\r
+strategy to use in any particular case, based on the explanations below.\r
+\r
+  When we speak of free software, we are referring to freedom of use,\r
+not price.  Our General Public Licenses are designed to make sure that\r
+you have the freedom to distribute copies of free software (and charge\r
+for this service if you wish); that you receive source code or can get\r
+it if you want it; that you can change the software and use pieces of\r
+it in new free programs; and that you are informed that you can do\r
+these things.\r
+\r
+  To protect your rights, we need to make restrictions that forbid\r
+distributors to deny you these rights or to ask you to surrender these\r
+rights.  These restrictions translate to certain responsibilities for\r
+you if you distribute copies of the library or if you modify it.\r
+\r
+  For example, if you distribute copies of the library, whether gratis\r
+or for a fee, you must give the recipients all the rights that we gave\r
+you.  You must make sure that they, too, receive or can get the source\r
+code.  If you link other code with the library, you must provide\r
+complete object files to the recipients, so that they can relink them\r
+with the library after making changes to the library and recompiling\r
+it.  And you must show them these terms so they know their rights.\r
+\r
+  We protect your rights with a two-step method: (1) we copyright the\r
+library, and (2) we offer you this license, which gives you legal\r
+permission to copy, distribute and/or modify the library.\r
+\r
+  To protect each distributor, we want to make it very clear that\r
+there is no warranty for the free library.  Also, if the library is\r
+modified by someone else and passed on, the recipients should know\r
+that what they have is not the original version, so that the original\r
+author's reputation will not be affected by problems that might be\r
+introduced by others.\r
+\f\r
+  Finally, software patents pose a constant threat to the existence of\r
+any free program.  We wish to make sure that a company cannot\r
+effectively restrict the users of a free program by obtaining a\r
+restrictive license from a patent holder.  Therefore, we insist that\r
+any patent license obtained for a version of the library must be\r
+consistent with the full freedom of use specified in this license.\r
+\r
+  Most GNU software, including some libraries, is covered by the\r
+ordinary GNU General Public License.  This license, the GNU Lesser\r
+General Public License, applies to certain designated libraries, and\r
+is quite different from the ordinary General Public License.  We use\r
+this license for certain libraries in order to permit linking those\r
+libraries into non-free programs.\r
+\r
+  When a program is linked with a library, whether statically or using\r
+a shared library, the combination of the two is legally speaking a\r
+combined work, a derivative of the original library.  The ordinary\r
+General Public License therefore permits such linking only if the\r
+entire combination fits its criteria of freedom.  The Lesser General\r
+Public License permits more lax criteria for linking other code with\r
+the library.\r
+\r
+  We call this license the "Lesser" General Public License because it\r
+does Less to protect the user's freedom than the ordinary General\r
+Public License.  It also provides other free software developers Less\r
+of an advantage over competing non-free programs.  These disadvantages\r
+are the reason we use the ordinary General Public License for many\r
+libraries.  However, the Lesser license provides advantages in certain\r
+special circumstances.\r
+\r
+  For example, on rare occasions, there may be a special need to\r
+encourage the widest possible use of a certain library, so that it becomes\r
+a de-facto standard.  To achieve this, non-free programs must be\r
+allowed to use the library.  A more frequent case is that a free\r
+library does the same job as widely used non-free libraries.  In this\r
+case, there is little to gain by limiting the free library to free\r
+software only, so we use the Lesser General Public License.\r
+\r
+  In other cases, permission to use a particular library in non-free\r
+programs enables a greater number of people to use a large body of\r
+free software.  For example, permission to use the GNU C Library in\r
+non-free programs enables many more people to use the whole GNU\r
+operating system, as well as its variant, the GNU/Linux operating\r
+system.\r
+\r
+  Although the Lesser General Public License is Less protective of the\r
+users' freedom, it does ensure that the user of a program that is\r
+linked with the Library has the freedom and the wherewithal to run\r
+that program using a modified version of the Library.\r
+\r
+  The precise terms and conditions for copying, distribution and\r
+modification follow.  Pay close attention to the difference between a\r
+"work based on the library" and a "work that uses the library".  The\r
+former contains code derived from the library, whereas the latter must\r
+be combined with the library in order to run.\r
+\f\r
+                 GNU LESSER GENERAL PUBLIC LICENSE\r
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
+\r
+  0. This License Agreement applies to any software library or other\r
+program which contains a notice placed by the copyright holder or\r
+other authorized party saying it may be distributed under the terms of\r
+this Lesser General Public License (also called "this License").\r
+Each licensee is addressed as "you".\r
+\r
+  A "library" means a collection of software functions and/or data\r
+prepared so as to be conveniently linked with application programs\r
+(which use some of those functions and data) to form executables.\r
+\r
+  The "Library", below, refers to any such software library or work\r
+which has been distributed under these terms.  A "work based on the\r
+Library" means either the Library or any derivative work under\r
+copyright law: that is to say, a work containing the Library or a\r
+portion of it, either verbatim or with modifications and/or translated\r
+straightforwardly into another language.  (Hereinafter, translation is\r
+included without limitation in the term "modification".)\r
+\r
+  "Source code" for a work means the preferred form of the work for\r
+making modifications to it.  For a library, complete source code means\r
+all the source code for all modules it contains, plus any associated\r
+interface definition files, plus the scripts used to control compilation\r
+and installation of the library.\r
+\r
+  Activities other than copying, distribution and modification are not\r
+covered by this License; they are outside its scope.  The act of\r
+running a program using the Library is not restricted, and output from\r
+such a program is covered only if its contents constitute a work based\r
+on the Library (independent of the use of the Library in a tool for\r
+writing it).  Whether that is true depends on what the Library does\r
+and what the program that uses the Library does.\r
+  \r
+  1. You may copy and distribute verbatim copies of the Library's\r
+complete source code as you receive it, in any medium, provided that\r
+you conspicuously and appropriately publish on each copy an\r
+appropriate copyright notice and disclaimer of warranty; keep intact\r
+all the notices that refer to this License and to the absence of any\r
+warranty; and distribute a copy of this License along with the\r
+Library.\r
+\r
+  You may charge a fee for the physical act of transferring a copy,\r
+and you may at your option offer warranty protection in exchange for a\r
+fee.\r
+\f\r
+  2. You may modify your copy or copies of the Library or any portion\r
+of it, thus forming a work based on the Library, and copy and\r
+distribute such modifications or work under the terms of Section 1\r
+above, provided that you also meet all of these conditions:\r
+\r
+    a) The modified work must itself be a software library.\r
+\r
+    b) You must cause the files modified to carry prominent notices\r
+    stating that you changed the files and the date of any change.\r
+\r
+    c) You must cause the whole of the work to be licensed at no\r
+    charge to all third parties under the terms of this License.\r
+\r
+    d) If a facility in the modified Library refers to a function or a\r
+    table of data to be supplied by an application program that uses\r
+    the facility, other than as an argument passed when the facility\r
+    is invoked, then you must make a good faith effort to ensure that,\r
+    in the event an application does not supply such function or\r
+    table, the facility still operates, and performs whatever part of\r
+    its purpose remains meaningful.\r
+\r
+    (For example, a function in a library to compute square roots has\r
+    a purpose that is entirely well-defined independent of the\r
+    application.  Therefore, Subsection 2d requires that any\r
+    application-supplied function or table used by this function must\r
+    be optional: if the application does not supply it, the square\r
+    root function must still compute square roots.)\r
+\r
+These requirements apply to the modified work as a whole.  If\r
+identifiable sections of that work are not derived from the Library,\r
+and can be reasonably considered independent and separate works in\r
+themselves, then this License, and its terms, do not apply to those\r
+sections when you distribute them as separate works.  But when you\r
+distribute the same sections as part of a whole which is a work based\r
+on the Library, the distribution of the whole must be on the terms of\r
+this License, whose permissions for other licensees extend to the\r
+entire whole, and thus to each and every part regardless of who wrote\r
+it.\r
+\r
+Thus, it is not the intent of this section to claim rights or contest\r
+your rights to work written entirely by you; rather, the intent is to\r
+exercise the right to control the distribution of derivative or\r
+collective works based on the Library.\r
+\r
+In addition, mere aggregation of another work not based on the Library\r
+with the Library (or with a work based on the Library) on a volume of\r
+a storage or distribution medium does not bring the other work under\r
+the scope of this License.\r
+\r
+  3. You may opt to apply the terms of the ordinary GNU General Public\r
+License instead of this License to a given copy of the Library.  To do\r
+this, you must alter all the notices that refer to this License, so\r
+that they refer to the ordinary GNU General Public License, version 2,\r
+instead of to this License.  (If a newer version than version 2 of the\r
+ordinary GNU General Public License has appeared, then you can specify\r
+that version instead if you wish.)  Do not make any other change in\r
+these notices.\r
+\f\r
+  Once this change is made in a given copy, it is irreversible for\r
+that copy, so the ordinary GNU General Public License applies to all\r
+subsequent copies and derivative works made from that copy.\r
+\r
+  This option is useful when you wish to copy part of the code of\r
+the Library into a program that is not a library.\r
+\r
+  4. You may copy and distribute the Library (or a portion or\r
+derivative of it, under Section 2) in object code or executable form\r
+under the terms of Sections 1 and 2 above provided that you accompany\r
+it with the complete corresponding machine-readable source code, which\r
+must be distributed under the terms of Sections 1 and 2 above on a\r
+medium customarily used for software interchange.\r
+\r
+  If distribution of object code is made by offering access to copy\r
+from a designated place, then offering equivalent access to copy the\r
+source code from the same place satisfies the requirement to\r
+distribute the source code, even though third parties are not\r
+compelled to copy the source along with the object code.\r
+\r
+  5. A program that contains no derivative of any portion of the\r
+Library, but is designed to work with the Library by being compiled or\r
+linked with it, is called a "work that uses the Library".  Such a\r
+work, in isolation, is not a derivative work of the Library, and\r
+therefore falls outside the scope of this License.\r
+\r
+  However, linking a "work that uses the Library" with the Library\r
+creates an executable that is a derivative of the Library (because it\r
+contains portions of the Library), rather than a "work that uses the\r
+library".  The executable is therefore covered by this License.\r
+Section 6 states terms for distribution of such executables.\r
+\r
+  When a "work that uses the Library" uses material from a header file\r
+that is part of the Library, the object code for the work may be a\r
+derivative work of the Library even though the source code is not.\r
+Whether this is true is especially significant if the work can be\r
+linked without the Library, or if the work is itself a library.  The\r
+threshold for this to be true is not precisely defined by law.\r
+\r
+  If such an object file uses only numerical parameters, data\r
+structure layouts and accessors, and small macros and small inline\r
+functions (ten lines or less in length), then the use of the object\r
+file is unrestricted, regardless of whether it is legally a derivative\r
+work.  (Executables containing this object code plus portions of the\r
+Library will still fall under Section 6.)\r
+\r
+  Otherwise, if the work is a derivative of the Library, you may\r
+distribute the object code for the work under the terms of Section 6.\r
+Any executables containing that work also fall under Section 6,\r
+whether or not they are linked directly with the Library itself.\r
+\f\r
+  6. As an exception to the Sections above, you may also combine or\r
+link a "work that uses the Library" with the Library to produce a\r
+work containing portions of the Library, and distribute that work\r
+under terms of your choice, provided that the terms permit\r
+modification of the work for the customer's own use and reverse\r
+engineering for debugging such modifications.\r
+\r
+  You must give prominent notice with each copy of the work that the\r
+Library is used in it and that the Library and its use are covered by\r
+this License.  You must supply a copy of this License.  If the work\r
+during execution displays copyright notices, you must include the\r
+copyright notice for the Library among them, as well as a reference\r
+directing the user to the copy of this License.  Also, you must do one\r
+of these things:\r
+\r
+    a) Accompany the work with the complete corresponding\r
+    machine-readable source code for the Library including whatever\r
+    changes were used in the work (which must be distributed under\r
+    Sections 1 and 2 above); and, if the work is an executable linked\r
+    with the Library, with the complete machine-readable "work that\r
+    uses the Library", as object code and/or source code, so that the\r
+    user can modify the Library and then relink to produce a modified\r
+    executable containing the modified Library.  (It is understood\r
+    that the user who changes the contents of definitions files in the\r
+    Library will not necessarily be able to recompile the application\r
+    to use the modified definitions.)\r
+\r
+    b) Use a suitable shared library mechanism for linking with the\r
+    Library.  A suitable mechanism is one that (1) uses at run time a\r
+    copy of the library already present on the user's computer system,\r
+    rather than copying library functions into the executable, and (2)\r
+    will operate properly with a modified version of the library, if\r
+    the user installs one, as long as the modified version is\r
+    interface-compatible with the version that the work was made with.\r
+\r
+    c) Accompany the work with a written offer, valid for at\r
+    least three years, to give the same user the materials\r
+    specified in Subsection 6a, above, for a charge no more\r
+    than the cost of performing this distribution.\r
+\r
+    d) If distribution of the work is made by offering access to copy\r
+    from a designated place, offer equivalent access to copy the above\r
+    specified materials from the same place.\r
+\r
+    e) Verify that the user has already received a copy of these\r
+    materials or that you have already sent this user a copy.\r
+\r
+  For an executable, the required form of the "work that uses the\r
+Library" must include any data and utility programs needed for\r
+reproducing the executable from it.  However, as a special exception,\r
+the materials to be distributed need not include anything that is\r
+normally distributed (in either source or binary form) with the major\r
+components (compiler, kernel, and so on) of the operating system on\r
+which the executable runs, unless that component itself accompanies\r
+the executable.\r
+\r
+  It may happen that this requirement contradicts the license\r
+restrictions of other proprietary libraries that do not normally\r
+accompany the operating system.  Such a contradiction means you cannot\r
+use both them and the Library together in an executable that you\r
+distribute.\r
+\f\r
+  7. You may place library facilities that are a work based on the\r
+Library side-by-side in a single library together with other library\r
+facilities not covered by this License, and distribute such a combined\r
+library, provided that the separate distribution of the work based on\r
+the Library and of the other library facilities is otherwise\r
+permitted, and provided that you do these two things:\r
+\r
+    a) Accompany the combined library with a copy of the same work\r
+    based on the Library, uncombined with any other library\r
+    facilities.  This must be distributed under the terms of the\r
+    Sections above.\r
+\r
+    b) Give prominent notice with the combined library of the fact\r
+    that part of it is a work based on the Library, and explaining\r
+    where to find the accompanying uncombined form of the same work.\r
+\r
+  8. You may not copy, modify, sublicense, link with, or distribute\r
+the Library except as expressly provided under this License.  Any\r
+attempt otherwise to copy, modify, sublicense, link with, or\r
+distribute the Library is void, and will automatically terminate your\r
+rights under this License.  However, parties who have received copies,\r
+or rights, from you under this License will not have their licenses\r
+terminated so long as such parties remain in full compliance.\r
+\r
+  9. You are not required to accept this License, since you have not\r
+signed it.  However, nothing else grants you permission to modify or\r
+distribute the Library or its derivative works.  These actions are\r
+prohibited by law if you do not accept this License.  Therefore, by\r
+modifying or distributing the Library (or any work based on the\r
+Library), you indicate your acceptance of this License to do so, and\r
+all its terms and conditions for copying, distributing or modifying\r
+the Library or works based on it.\r
+\r
+  10. Each time you redistribute the Library (or any work based on the\r
+Library), the recipient automatically receives a license from the\r
+original licensor to copy, distribute, link with or modify the Library\r
+subject to these terms and conditions.  You may not impose any further\r
+restrictions on the recipients' exercise of the rights granted herein.\r
+You are not responsible for enforcing compliance by third parties with\r
+this License.\r
+\f\r
+  11. If, as a consequence of a court judgment or allegation of patent\r
+infringement or for any other reason (not limited to patent issues),\r
+conditions are imposed on you (whether by court order, agreement or\r
+otherwise) that contradict the conditions of this License, they do not\r
+excuse you from the conditions of this License.  If you cannot\r
+distribute so as to satisfy simultaneously your obligations under this\r
+License and any other pertinent obligations, then as a consequence you\r
+may not distribute the Library at all.  For example, if a patent\r
+license would not permit royalty-free redistribution of the Library by\r
+all those who receive copies directly or indirectly through you, then\r
+the only way you could satisfy both it and this License would be to\r
+refrain entirely from distribution of the Library.\r
+\r
+If any portion of this section is held invalid or unenforceable under any\r
+particular circumstance, the balance of the section is intended to apply,\r
+and the section as a whole is intended to apply in other circumstances.\r
+\r
+It is not the purpose of this section to induce you to infringe any\r
+patents or other property right claims or to contest validity of any\r
+such claims; this section has the sole purpose of protecting the\r
+integrity of the free software distribution system which is\r
+implemented by public license practices.  Many people have made\r
+generous contributions to the wide range of software distributed\r
+through that system in reliance on consistent application of that\r
+system; it is up to the author/donor to decide if he or she is willing\r
+to distribute software through any other system and a licensee cannot\r
+impose that choice.\r
+\r
+This section is intended to make thoroughly clear what is believed to\r
+be a consequence of the rest of this License.\r
+\r
+  12. If the distribution and/or use of the Library is restricted in\r
+certain countries either by patents or by copyrighted interfaces, the\r
+original copyright holder who places the Library under this License may add\r
+an explicit geographical distribution limitation excluding those countries,\r
+so that distribution is permitted only in or among countries not thus\r
+excluded.  In such case, this License incorporates the limitation as if\r
+written in the body of this License.\r
+\r
+  13. The Free Software Foundation may publish revised and/or new\r
+versions of the Lesser General Public License from time to time.\r
+Such new versions will be similar in spirit to the present version,\r
+but may differ in detail to address new problems or concerns.\r
+\r
+Each version is given a distinguishing version number.  If the Library\r
+specifies a version number of this License which applies to it and\r
+"any later version", you have the option of following the terms and\r
+conditions either of that version or of any later version published by\r
+the Free Software Foundation.  If the Library does not specify a\r
+license version number, you may choose any version ever published by\r
+the Free Software Foundation.\r
+\f\r
+  14. If you wish to incorporate parts of the Library into other free\r
+programs whose distribution conditions are incompatible with these,\r
+write to the author to ask for permission.  For software which is\r
+copyrighted by the Free Software Foundation, write to the Free\r
+Software Foundation; we sometimes make exceptions for this.  Our\r
+decision will be guided by the two goals of preserving the free status\r
+of all derivatives of our free software and of promoting the sharing\r
+and reuse of software generally.\r
+\r
+                           NO WARRANTY\r
+\r
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\r
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\r
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\r
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY\r
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\r
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\r
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\r
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\r
+\r
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\r
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\r
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\r
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\r
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\r
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\r
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\r
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\r
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\r
+DAMAGES.\r
+\r
+                    END OF TERMS AND CONDITIONS\r
+\f\r
+           How to Apply These Terms to Your New Libraries\r
+\r
+  If you develop a new library, and you want it to be of the greatest\r
+possible use to the public, we recommend making it free software that\r
+everyone can redistribute and change.  You can do so by permitting\r
+redistribution under these terms (or, alternatively, under the terms of the\r
+ordinary General Public License).\r
+\r
+  To apply these terms, attach the following notices to the library.  It is\r
+safest to attach them to the start of each source file to most effectively\r
+convey the exclusion of warranty; and each file should have at least the\r
+"copyright" line and a pointer to where the full notice is found.\r
+\r
+    <one line to give the library's name and a brief idea of what it does.>\r
+    Copyright (C) <year>  <name of author>\r
+\r
+    This library is free software; you can redistribute it and/or\r
+    modify it under the terms of the GNU Lesser General Public\r
+    License as published by the Free Software Foundation; either\r
+    version 2 of the License, or (at your option) any later version.\r
+\r
+    This library is distributed in the hope that it will be useful,\r
+    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+    Lesser General Public License for more details.\r
+\r
+    You should have received a copy of the GNU Lesser General Public\r
+    License along with this library; if not, write to the Free Software\r
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+\r
+Also add information on how to contact you by electronic and paper mail.\r
+\r
+You should also get your employer (if you work as a programmer) or your\r
+school, if any, to sign a "copyright disclaimer" for the library, if\r
+necessary.  Here is a sample; alter the names:\r
+\r
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the\r
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.\r
+\r
+  <signature of Ty Coon>, 1 April 1990\r
+  Ty Coon, President of Vice\r
+\r
+That's all there is to it!\r
+\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/RWFD.EXE b/CHNOSProject/chnos/tolset_chn_000/z_tools/RWFD.EXE
new file mode 100644 (file)
index 0000000..83fca63
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/RWFD.EXE differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/RWFD.TXT b/CHNOSProject/chnos/tolset_chn_000/z_tools/RWFD.TXT
new file mode 100644 (file)
index 0000000..bdc8434
--- /dev/null
@@ -0,0 +1,96 @@
+\r
+\r
+                        Read/Write FD  Ver.0.13\r
+                   Copyright (C) 1999-2003  K.Takata\r
+\r
+\r
+\82P\81D\8aT\97v\r
+    \81@\83t\83\8d\83b\83s\81[\83f\83B\83X\83N\82È\82Ç\82Ì\83h\83\89\83C\83u\82ð\8aÛ\82²\82Æ\83t\83@\83C\83\8b\89»\82µ\82Ü\82·\81B\82Ü\82½\81A\82»\r
+    \82Ì\83t\83@\83C\83\8b\82ð\8c³\82Ì\83h\83\89\83C\83u\82É\8f\91\82«\8d\9e\82Ý\82Ü\82·\81B\81i32MB \88È\8fã\82Ì\83h\83\89\83C\83u\82É\82à\91Î\r
+    \89\9e\81B\81j\r
+    \81@\83_\83C\83\8c\83N\83g\83f\83B\83X\83N\83A\83N\83Z\83X\82Ì\83e\83X\83g\83v\83\8d\83O\83\89\83\80\82Æ\82µ\82Ä\8dì\82Á\82½\95¨\82È\82Ì\82Å\r
+    CUI \82ð\8dÌ\97p\82µ\82Ä\82¢\82Ü\82·\81B\r
+    \81@\83\\81[\83X\83t\83@\83C\83\8b\82à\93¯\8d«\82µ\82Ä\82¢\82Ü\82·\81B\r
+\r
+\r
+\82Q\81D\93®\8dì\8aÂ\8b«\r
+    \81EWindows95/98/NT/2000  \81iPC-98, PC/AT \8cÝ\8a·\8b\97¼\91Î\89\9e\81j\r
+    \81EWinME/XP \82Å\82Í\93®\82­\82Í\82¸\82Å\82·\82ª\81A\89¼\82É\93®\82©\82È\82­\82Ä\82à\91Î\89\9e\82³\82¹\82é\97\\92è\82Í\82 \82è\r
+      \82Ü\82¹\82ñ\81B\81iPC-98 \82Å\93®\82©\82È\82¢ OS \82É\97p\82Í\82È\82¢\81I\81j\r
+\r
+\r
+\82R\81D\8eg\97p\95û\96@\r
+    (1) \93Ç\82Ý\8d\9e\82Ý\r
+    \81@> rwfd drive: filename\r
+    \81@drive: \82ð\93Ç\82Ý\8d\9e\82ñ\82Å\8aÛ\82²\82Æ\81i\91S\83Z\83N\83^\82ð\82»\82Ì\82Ü\82Ü\81jfilename \82É\8f\91\82«\8fo\82µ\r
+    \82Ü\82·\81B\r
+\r
+    (2) \8f\91\82«\8d\9e\82Ý\r
+    \81@> rwfd filename drive: [-f]\r
+    \81@filename \82ð drive: \82É\8f\91\82«\8d\9e\82Ý\82Ü\82·\81Bdrive: \82Í filename \82Æ\93¯\82\8c`\8e®\82Å\r
+    \83t\83H\81[\83}\83b\83g\82³\82ê\82Ä\82¢\82é\95K\97v\82ª\82 \82è\82Ü\82·\81B\8f\91\82«\8d\9e\82Þ\83t\83@\83C\83\8b\82Í\81A\91S\83Z\83N\83^\82ð\r
+    \82»\82Ì\82Ü\82Ü\8f\91\82«\8fo\82µ\82½\83t\83@\83C\83\8b\82È\82ç\82Πrwfd \82Å\8dì\90¬\82³\82ê\82½\82à\82Ì\82Å\82È\82­\82Ä\82à\8f\91\82«\r
+    \8d\9e\82Þ\82±\82Æ\82ª\82Å\82«\82Ü\82·\81B\97á\82¦\82ΠFreeBSD \82Ì\83C\83\93\83X\83g\81[\83\8b\83t\83\8d\83b\83s\81[\82Å\8eg\82í\82ê\r
+    \82Ä\82¢\82é *.flp \8c`\8e®\82à\81A\83t\83@\83C\83\8b\83T\83C\83Y\82ª 1,474,560bytes \82Ü\82½\82Í\r
+    1,228,800bytes \82Ì\82à\82Ì\82È\82ç\82Î\8f\91\82«\8d\9e\82Ý\89Â\94\\82Å\82·\81B\82½\82¾\82µ rwfd \82ª\94F\8e¯\82Å\82«\r
+    \82é\83t\83\8d\83b\83s\81[\82Í MS-DOS \8c`\8e®\82Å\83t\83H\81[\83}\83b\83g\82³\82ê\82½\82à\82Ì\82¾\82¯\82Å\82·\82Ì\82Å\81A\88ê\93x\r
+    FreeBSD \8c`\8e®\82È\82Ç\82Å\8f\91\82«\8d\9e\82ñ\82¾\83t\83\8d\83b\83s\81[\82É\91Î\82µ\82Ä\82à\82¤\88ê\93x\8f\91\82«\8d\9e\82Þ\8fê\8d\87\82Í\r
+    \83t\83H\81[\83}\83b\83g\82µ\92¼\82·\95K\97v\82ª\82 \82è\82Ü\82·\81B\r
+    \81@-f \83I\83v\83V\83\87\83\93\82ð\8ew\92è\82·\82é\82Æ\81A\83C\83\81\81[\83W\83t\83@\83C\83\8b\82Ì\83t\83H\81[\83}\83b\83g\82Æ\81A\83h\83\89\r
+    \83C\83u\82Ì\83t\83H\81[\83}\83b\83g\82ª\88ê\92v\82µ\82Ä\82¢\82È\82­\82Ä\82à\8b­\90§\93I\82É\8f\91\82«\8d\9e\82Ý\82Ü\82·\81B\r
+    FreeBSD(98) \82Å\82Í 2HC(1.21MB) \97p\82Ì\83C\83\81\81[\83W\83t\83@\83C\83\8b\82ð 2HD(1.44MB) \82É\8f\91\r
+    \82«\8d\9e\82ñ\82Å\82à\93®\8dì\82·\82é\82æ\82¤\82Å\82·\82Ì\82Å\81A\82»\82Ì\82æ\82¤\82È\82Æ\82«\82Ì\82½\82ß\82Ì\83I\83v\83V\83\87\83\93\82Å\82·\81B\r
+\r
+    \81i\92\8d\82P\81jVer.0.11 \82©\82ç 32MB \88È\8fã\82Ì\83h\83\89\83C\83u\82Ì\83t\83@\83C\83\8b\89»\82à\82Å\82«\82é\82æ\82¤\82É\r
+    \82È\82è\82Ü\82µ\82½\81B\96ñ 2GB \82Ü\82Å\82Í\96â\91è\82È\82­\8eg\82¦\82é\82Í\82¸\82Å\82·\81B\82¤\82Ü\82­\82¢\82¯\82Î\96ñ 4GB\r
+    \82Ü\82Å\8eg\82¦\82é\82©\82à\82µ\82ê\82Ü\82¹\82ñ\82ª\8am\94F\82Í\82µ\82Ä\82¢\82Ü\82¹\82ñ\81B\8f­\82È\82­\82Æ\82à 540MB MO \82Ì\r
+    \83t\83@\83C\83\8b\89»\82ª\82Å\82«\82é\82±\82Æ\82Í\8am\94F\82µ\82Ä\82¢\82Ü\82·\81B\r
+\r
+    \81i\92\8d\82Q\81jWin9x \82Å\83h\83\89\83C\83u\82Ö\82Ì\8f\91\82«\8d\9e\82Ý\92\86\82É\82Í\81A\82Å\82«\82é\82¾\82¯\91¼\82Ì\8dì\8bÆ\82ð\82µ\82È\r
+    \82¢\82±\82Æ\82ð\82¨\8a©\82ß\82µ\82Ü\82·\81B\82Ü\82ê\82É Win9x \82Ì\93®\8dì\82ª\95s\88À\92è\82É\82È\82é\82±\82Æ\82ª\82 \82é\82æ\r
+    \82¤\82Å\82·\81B\81iVer.0.12 \82Å\8f­\82µ\89ü\91P\82µ\82½\82Â\82à\82è\81B\81j\r
+\r
+\r
+\82S\81D\83R\83\93\83p\83C\83\8b\r
+    \81@\83R\83\93\83p\83C\83\89\82Í VC++ 6.0 \82ð\97\98\97p\82µ\82Ä\82¢\82Ü\82·\81B\83R\83}\83\93\83h\83\89\83C\83\93\82©\82ç\r
+    \81@> nmake -f rwfd.make\r
+    \81@\82Æ\82·\82é\82Æ\83R\83\93\83p\83C\83\8b\82Å\82«\82Ü\82·\81B\r
+\r
+\r
+\82T\81D\8dX\90V\97\9a\97ð\r
+    2000/01/06  Ver.0.01\r
+        \81E\8dÅ\8f\89\82Ì\8cö\8aJ\83o\81[\83W\83\87\83\93\81B\r
+\r
+    2000/05/28  Ver.0.10\r
+        \81EWin2k \82É\91Î\89\9e\81B\82»\82ê\82É\94º\82¢\83\\81[\83X\82ð\88ê\95\94 C \82©\82ç C++ \82É\95Ï\8dX\81B\r
+        \81E\94ñ MS-DOS \8c`\8e®\83C\83\81\81[\83W\83t\83@\83C\83\8b\82Ì\8f\91\82«\8d\9e\82Ý\82É\8eb\92è\91Î\89\9e\81B\r
+\r
+    2000/07/02  Ver.0.11\r
+        \81E32MB \88È\8fã\82Ì\83h\83\89\83C\83u\82ð\83t\83@\83C\83\8b\89»\82Å\82«\82é\82æ\82¤\82É\95Ï\8dX\81B\r
+        \81E\8d×\82©\82¢\83o\83O\8fC\90³\81B\r
+\r
+    2001/11/24  Ver.0.12\r
+        \81E\83t\83H\81[\83}\83b\83g\8c`\8e®\82ª\88á\82¤\8fê\8d\87\82Å\82à\8b­\90§\93I\82É\8f\91\82«\8d\9e\82Ý\82ð\8ds\82¤ -f \83I\83v\83V\r
+          \83\87\83\93\82ð\90V\90Ý\81B\r
+        \81EWin9x \82Å\83h\83\89\83C\83u\82Ö\8f\91\82«\8d\9e\82Þ\8dÛ\82É\81A\91¼\82Ì\83A\83v\83\8a\82Ì\93®\8dì\82ª\92x\82­\82È\82é\82Ì\82ð\r
+          \8f­\82µ\89ü\91P\81B\r
+        \81E\82È\82º\82©\8eÀ\8ds\83t\83@\83C\83\8b\82Ì\83T\83C\83Y\82ª\82â\82½\82ç\82Æ\91å\82«\82­\82È\82Á\82Ä\82µ\82Ü\82Á\82½\81B\r
+\r
+    2003/01/08  Ver.0.13\r
+        \81EWinNT \82É\91Î\89\9e\81B\81iNT \82Å\82Í GetDiskFreeSpace \82Ì\88ø\90\94\82É NULL \82ð\8ew\92è\r
+          \82µ\82Ä\82Í\82¢\82¯\82È\82¢\82æ\82¤\82¾\81B\81j\r
+\r
+\r
+\82U\81D\92\8d\88Ó\8e\96\8d\80\81A\82»\82Ì\91¼\r
+    \81E\82±\82Ì\83v\83\8d\83O\83\89\83\80\82Í\83t\83\8a\81[\83\\83t\83g\83E\83F\83A\82Å\82·\81B\r
+    \81E\82±\82Ì\83v\83\8d\83O\83\89\83\80\82Ì\92\98\8dì\8c \82Í\8dì\8eÒ\82Å\82 \82é\8e\84 K.Takata\81i\8d\82\93\8cª\81j\82É\8bA\91®\82µ\82Ü\r
+      \82·\81B\r
+    \81E\82à\82µ\82±\82Ì\83v\83\8d\83O\83\89\83\80\82ð\8eg\97p\82·\82é\82±\82Æ\82Å\89½\82ç\82©\82Ì\96â\91è\82ª\94­\90\82µ\82Ä\82à\8dì\8eÒ\82Í\82¢\r
+      \82Á\82³\82¢\82Ì\90Ó\94C\82ð\95\89\82¢\82Ü\82¹\82ñ\81B\8ae\8e©\82Ì\90Ó\94C\82Å\8eg\97p\82µ\82Ä\82­\82¾\82³\82¢\81B\r
+    \81E\83A\81[\83J\83C\83u\82ð\95Ï\8dX\82µ\82È\82¢\8cÀ\82è\94z\95z\81^\93]\8dÚ\82Í\8e©\97R\82Å\82·\81B\r
+    \81E\83\\81[\83X\83t\83@\83C\83\8b\82Ì\8eg\97p\82Í\94ñ\8f¤\97p\82É\8cÀ\82è\8e©\97R\82Å\82·\81B\r
+\r
+        \8dì\8eÒ   : K.Takata\81i\8d\82\93\8cª\81j\r
+        E-mail : kentkt@anet.ne.jp, HZL03275@nifty.ne.jp\r
+        URL    : http://webs.to/ken/\r
+                 http://member.nifty.ne.jp/k-takata/\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/aksa.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/aksa.exe
new file mode 100644 (file)
index 0000000..8ed7db9
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/aksa.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/aska.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/aska.exe
new file mode 100644 (file)
index 0000000..44904f7
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/aska.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/bim2bin.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/bim2bin.exe
new file mode 100644 (file)
index 0000000..815262a
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/bim2bin.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/bim2chn.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/bim2chn.exe
new file mode 100644 (file)
index 0000000..66fead4
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/bim2chn.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/bim2hrb.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/bim2hrb.exe
new file mode 100644 (file)
index 0000000..2c39baa
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/bim2hrb.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/bin2obj.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/bin2obj.exe
new file mode 100644 (file)
index 0000000..3f10aaa
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/bin2obj.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/Makefile b/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/Makefile
new file mode 100644 (file)
index 0000000..01a2f59
--- /dev/null
@@ -0,0 +1,2 @@
+default :\r
+       -bochs-smp.exe -q\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bios.bin b/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bios.bin
new file mode 100644 (file)
index 0000000..fe9816e
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bios.bin differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bochs-smp.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bochs-smp.exe
new file mode 100644 (file)
index 0000000..d1103c7
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bochs-smp.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bochsrc.txt b/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/bochsrc.txt
new file mode 100644 (file)
index 0000000..e4f9954
--- /dev/null
@@ -0,0 +1,25 @@
+romimage: file=bios.bin, address=0xf0000\r
+cpu: count=1, ips=1000000\r
+megs: 32\r
+vgaromimage: file=vgabios.bin\r
+vga: extension=vbe\r
+floppya: 1_44=fdimage0.bin, status=inserted\r
+boot: floppy\r
+clock: sync=realtime, time0=local\r
+floppy_bootsig_check: disabled=0\r
+log: bochsout.txt\r
+com1: enabled=1, mode=file, dev=seriout.txt\r
+panic: action=ask\r
+error: action=report\r
+info: action=report\r
+debug: action=ignore\r
+debugger_log: debugger.out\r
+parport1: enabled=1, file="parport.out"\r
+vga_update_interval: 300000\r
+keyboard_serial_delay: 250\r
+keyboard_paste_delay: 100000\r
+mouse: enabled=0\r
+private_colormap: enabled=0\r
+keyboard_mapping: enabled=0, map=\r
+i440fxsupport: enabled=1\r
+display_library: win32, options="legacyF12" # use F12 to toggle mouse\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/readme.txt b/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/readme.txt
new file mode 100644 (file)
index 0000000..1bb28f1
--- /dev/null
@@ -0,0 +1,11 @@
+tolset\97p bochs 2.2.6\8ag\92£\83p\83b\83P\81[\83W\r
+\r
+\82±\82Ì\83t\83H\83\8b\83_\82ðqemu\82Æ\89ü\96¼\82µ\82Ä\81Atolset/z_tools/qemu\82Æ\93ü\82ê\91Ö\82¦\82ê\82Î\81A\r
+\81i\8b\8c\93à\97e\82Íqemu_nt\82Æ\82Å\82à\82µ\82Ä\82¨\82­\82Æ\82æ\82¢\82¾\82ë\82¤\81j\r
+\81umake run\81v\82Åbochs\82ª\93®\82­\82æ\82¤\82É\82È\82è\82Ü\82·\81B\r
+\r
+bochs\82Å\82Í\81AF12\82ð\89\9f\82·\8e\96\82Å\83}\83E\83X\82ª\83G\83~\83\85\83\8c\81[\83^\82Ì\92\86\82É\93ü\82Á\82½\82è\8fo\82Ä\82«\82½\82è\82µ\82Ü\82·\81B\r
+\r
+bochs\82ð\8fI\97¹\82³\82¹\82é\82Æ\82«\82Í\81A\89æ\96Ê\8fã\95\94\83A\83C\83R\83\93\82Ì\89E\92[\82Ì\81upower\81v\83{\83^\83\93\82ð\89\9f\82µ\82Ä\82­\82¾\82³\82¢\81B\r
+\r
+\83\89\83C\83Z\83\93\83X\82Í\81Abochs-smp.exe\82Æbios.bin\82ÍLGPL\82Å\81A\82»\82Ì\91¼\82ÍKL-01\82Å\82·\81B\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/vgabios.bin b/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/vgabios.bin
new file mode 100644 (file)
index 0000000..78e9c9c
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/bochs/vgabios.bin differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/cc1.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/cc1.exe
new file mode 100644 (file)
index 0000000..b6b55f7
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/cc1.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/Makefile b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/Makefile
new file mode 100644 (file)
index 0000000..bbf53fb
--- /dev/null
@@ -0,0 +1,40 @@
+# \83\89\83C\83u\83\89\83\8a\90\90¬\97pMakefile\r
+\r
+TARGET   = chnlibc.lib\r
+OBJS     = startup.obj\r
+\r
+TOOLPATH = ../../z_tools/\r
+INCPATH  = ../../z_tools/CHNOSProject/\r
+\r
+SJISCONV = $(TOOLPATH)sjisconv.exe -s\r
+CC1      = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet\r
+GAS2NASK = $(TOOLPATH)gas2nask.exe -a\r
+NASK     = $(TOOLPATH)nask.exe\r
+GOLIB    = $(TOOLPATH)golib00.exe\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+DELE     = del\r
+\r
+ALL :\r
+       $(MAKE) $(TARGET)\r
+\r
+%.ca : %.c Makefile\r
+       $(SJISCONV) $*.c $*.ca\r
+\r
+%.gas : %.ca Makefile\r
+       $(CC1) -o $*.gas $*.ca\r
+\r
+%.nas : %.gas Makefile\r
+       $(GAS2NASK) $*.gas $*.nas\r
+\r
+%.obj : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj\r
+\r
+$(TARGET) : $(OBJS) Makefile\r
+       $(GOLIB) out:$(TARGET) $(OBJS)\r
+\r
+clean :\r
+       -$(DELE) *.obj\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DELE) $(TARGET)\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/chnlibc.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/chnlibc.lib
new file mode 100644 (file)
index 0000000..a5decaa
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/chnlibc.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/make.bat b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/make.bat
new file mode 100644 (file)
index 0000000..6b0dbfc
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/startup.c b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/startup.c
new file mode 100644 (file)
index 0000000..5d1cbd2
--- /dev/null
@@ -0,0 +1,12 @@
+void CHNMain(void);\r
+\r
+void CHNStartup(void)\r
+{\r
+       /* \8f«\97\88CHNMain\82Ì\8eÀ\8ds\82É\90æ\97§\82Á\82Ä\89½\82©\82µ\82½\82­\82È\82Á\82½\82ç\81A\82±\82±\82É\8f\91\82«\91«\82· */\r
+\r
+       CHNMain();\r
+\r
+       /* \8f«\97\88CHNMain\82Ì\8fI\97¹\8cã\82É\89½\82©\8f\88\97\9d\82ð\82³\82¹\82½\82­\82È\82Á\82½\82ç\81A\82±\82±\82É\8f\91\82«\91«\82· */\r
+\r
+       return;\r
+}\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/startup.obj b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/startup.obj
new file mode 100644 (file)
index 0000000..b36da76
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnlib000/startup.obj differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/chnos.img b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnos.img
new file mode 100644 (file)
index 0000000..8032e3e
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/chnos.img differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/com_mak.txt b/CHNOSProject/chnos/tolset_chn_000/z_tools/com_mak.txt
new file mode 100644 (file)
index 0000000..33cdcca
--- /dev/null
@@ -0,0 +1,89 @@
+TOOLPATH = ../z_tools/\r
+RULEFILE = ../z_tools/guigui00/guigui00.rul\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+SJISCONV = $(TOOLPATH)sjisconv.exe -s\r
+CC1      = $(TOOLPATH)cc1.exe -I$(INCPATH) $(CC1OPT) -Os -Wall -quiet\r
+GAS2NASK = $(TOOLPATH)gas2nask.exe -a\r
+NASK     = $(TOOLPATH)nask.exe\r
+OBJ2BIM  = $(TOOLPATH)obj2bim.exe\r
+BIM2BIN  = $(TOOLPATH)bim2bin.exe\r
+CPP0     = $(TOOLPATH)cpp0.exe -P -I$(INCPATH)\r
+ASKA     = $(TOOLPATH)aska.exe\r
+NASKCNV  = $(TOOLPATH)naskcnv0.exe -l -s -w\r
+GOLIB    = $(TOOLPATH)golib00.exe\r
+LINK     = $(TOOLPATH)ld.exe -s -Bdynamic --stack $(STACKSIZE)\r
+EDIMG    = $(TOOLPATH)edimg.exe\r
+SARTOL   = $(TOOLPATH)sartol.exe\r
+DELE     = del\r
+COPY     = copy\r
+\r
+LIBPATH  = $(INCPATH)\r
+LIBS     = $(LIBPATH)w32clibc.lib $(LIBPATH)golibc.lib $(LIBPATH)libmingw.lib\r
+\r
+# \88È\8fã\82Ì\8d\80\96Ú\82Í\82 \82È\82½\82Ì\83f\83B\83\8c\83N\83g\83\8a\8d\\90¬\82É\82 \82í\82¹\82Ä\8f\91\82«\8a·\82¦\82é\r
+\r
+ALL:\r
+       $(MAKE) $(TARGET).$(MODE)\r
+\r
+%.ca : %.c Makefile\r
+       $(SJISCONV) $*.c $*.ca\r
+\r
+%.gas : %.ca Makefile\r
+       $(CC1) -o $*.gas $*.ca\r
+\r
+%.nas : %.gas Makefile\r
+       $(GAS2NASK) $*.gas $*.nas\r
+\r
+%.obj : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj\r
+\r
+%.ias : %.ask Makefile\r
+       $(CPP0) -o $*.ias $*.ask\r
+\r
+%.3as : %.ias Makefile\r
+       $(ASKA) $*.ias $*.3as\r
+\r
+%.nas : %.3as Makefile\r
+       $(NASKCNV) $*.3as $*.nas\r
+\r
+%.lst : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj $*.lst\r
+\r
+$(TARGET).bim : $(OBJS) Makefile\r
+       $(OBJ2BIM) @$(RULEFILE) out:$(TARGET).bim stack:$(STACKSIZE) map:$(TARGET).map $(OBJS)\r
+\r
+%.bin : %.bim Makefile\r
+       $(BIM2BIN) in:$*.bim out:$*.org malloc:$(MALLOCSIZE) mmarea:$(MMAREA) $(BIMOPT0)\r
+       $(BIM2BIN) -osacmp in:$*.org out:$*.bin $(BIMOPT1)\r
+\r
+$(TARGET).lib : $(OBJS) Makefile\r
+       $(GOLIB) out:$@ $(OBJS)\r
+\r
+$(TARGET).dll : $(TARGET).bim Makefile\r
+       $(OBJ2BIM) @$(RULEFILE) out:$(TARGET).bim map:$(TARGET).map $(OBJS)\r
+       $(BIM2BIN) -osacmp -tek1 in:$(TARGET).bim out:$(TARGET).dll\r
+\r
+$(TARGET).exe : $(OBJS) Makefile\r
+       $(LINK) -o $(TARGET).exe -Map $(TARGET).map $(OBJS) $(LIBS)\r
+\r
+clean :\r
+       -$(DELE) *.obj\r
+       -$(DELE) $(TARGET).bim\r
+       -$(DELE) $(TARGET).map\r
+       -$(DELE) $(TARGET).org\r
+\r
+run :\r
+       $(MAKE) $(TARGET).$(MODE)\r
+       $(COPY) $(TARGET).$(MODE) ..\z_tools\!built.bin\r
+       $(MAKE) -C $(TOOLPATH)osa_qemu\r
+       $(EDIMG) @$(TOOLPATH)edimgopt.txt $(EDIMGOPT) imgout:../z_tools/qemu/fdimage0.bin\r
+       $(MAKE) -C $(TOOLPATH)qemu\r
+\r
+arc :\r
+       $(MAKE) $(TARGET).$(MODE)\r
+       $(SARTOL) e $(ARCORG) . @-4k ARCINFO0.TXT $(ARCFLIES)\r
+       $(BIM2BIN) -osacmp in:$(ARCORG) out:$(ARCTEK) $(BIMOPT2)\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DELE) $(TARGET).$(MODE)\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/comcom.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/comcom.exe
new file mode 100644 (file)
index 0000000..23fef43
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/comcom.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/cpp0.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/cpp0.exe
new file mode 100644 (file)
index 0000000..9db19b4
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/cpp0.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/cygwin1.dll b/CHNOSProject/chnos/tolset_chn_000/z_tools/cygwin1.dll
new file mode 100644 (file)
index 0000000..f1a22fe
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/cygwin1.dll differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/dsar.bat b/CHNOSProject/chnos/tolset_chn_000/z_tools/dsar.bat
new file mode 100644 (file)
index 0000000..bf597d5
--- /dev/null
@@ -0,0 +1,23 @@
+@echo off\r
+\r
+set dsar_sartol=sartol.exe\r
+set dsar_bpath="%USERPROFILE%/\83f\83X\83N\83g\83b\83v/"\r
+set dsar_autorun="%SystemRoot%\explorer.exe"\r
+\r
+rem \81|\97á\81|\r
+rem set dsar_bpath="%USERPROFILE%/\83f\83X\83N\83g\83b\83v/"\r
+rem set dsar_bpath="%USERPROFILE%/\83f\83X\83N\83g\83b\83v"\r
+rem set dsar_bpath=..@arcpath/\r
+rem set dsar_bpath=..@arcpath\r
+\r
+rem \81|\97á\81|\r
+rem set dsar_autorun="%SystemRoot%\explorer.exe"\r
+rem set dsar_autorun=\r
+rem \92\8d\88Ó\81Idsar_bpath\82Å\82Í\83p\83X\82Ì\8bæ\90Ø\82è\82É\\82ð\8eg\82¤\82±\82Æ\r
+\r
+:loop\r
+if %1.==. goto end\r
+%dsar_sartol% d %1 %dsar_bpath% %dsar_autorun%\r
+shift\r
+goto loop\r
+:end
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/edimg.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/edimg.exe
new file mode 100644 (file)
index 0000000..7102c0f
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/edimg.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/edimgopt.txt b/CHNOSProject/chnos/tolset_chn_000/z_tools/edimgopt.txt
new file mode 100644 (file)
index 0000000..7fbdb7f
--- /dev/null
@@ -0,0 +1,5 @@
+opt imgin:../z_tools/osa_qemu/osaimgqe.bin\r
+copy from:../z_tools/OSASK0.PSF to:@:\r
+copy from:../z_tools/!built.bin to:@:\r
+\r
+opt imgout:../z_tools/qemu/fdimage0.bin\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/esart5.bat b/CHNOSProject/chnos/tolset_chn_000/z_tools/esart5.bat
new file mode 100644 (file)
index 0000000..e00f927
--- /dev/null
@@ -0,0 +1,19 @@
+@echo off\r
+\r
+set esar_sartol=sartol.exe\r
+set esar_bim2bin=bim2bin.exe\r
+set esar_wce=wce.exe\r
+\r
+if exist %1.sar goto end\r
+\r
+if %2.==. goto all\r
+%esar_wce% %esar_sartol% e %1.sar %1 !1 #b=%1 %2 %3 %4 %5 %6 %7 %8 %9\r
+goto tek5\r
+\r
+:all\r
+%esar_wce% %esar_sartol% e %1.sar %1 !1 #b=%1 *\r
+\r
+:tek5\r
+%esar_wce% %esar_bim2bin% -osacmp -tek5 in:%1.sar out:%1.sar\r
+\r
+:end
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/fdimg0at.tek b/CHNOSProject/chnos/tolset_chn_000/z_tools/fdimg0at.tek
new file mode 100644 (file)
index 0000000..34cee8d
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/fdimg0at.tek differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/fdimg0tw.tek b/CHNOSProject/chnos/tolset_chn_000/z_tools/fdimg0tw.tek
new file mode 100644 (file)
index 0000000..e9651d0
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/fdimg0tw.tek differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/gas2nask.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/gas2nask.exe
new file mode 100644 (file)
index 0000000..937e91a
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/gas2nask.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/golib00.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/golib00.exe
new file mode 100644 (file)
index 0000000..f319667
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/golib00.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/errno.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/errno.h
new file mode 100644 (file)
index 0000000..c1ffd85
--- /dev/null
@@ -0,0 +1,20 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(ERRNO_H))\r
+\r
+#define ERRNO_H        1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+extern int errno;\r
+\r
+#define        ENOENT          2       /* No such file or directory */\r
+#define        ERANGE          34      /* Result too large (or too small) */\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/float.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/float.h
new file mode 100644 (file)
index 0000000..943ba62
--- /dev/null
@@ -0,0 +1,26 @@
+/* copyright(C) 2002 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(FLOAT_H))\r
+\r
+#define FLOAT_H                        1\r
+\r
+#define FLT_RADIX              2\r
+#define FLT_ROUNDS             1 /* nearest */\r
+#define FLT_DIG                        6\r
+#define FLT_EPSILON            1.19209290e-07F\r
+#define FLT_MANT_DIG   24\r
+#define FLT_MAX                        3.40282347e+38F\r
+#define FLT_MAX_EXP            (+128)\r
+#define FLT_MIN                        1.17549435e-38F\r
+#define FLT_MIN_EXP            (-125)\r
+\r
+#define DBL_DIG                        15\r
+#define DBL_EPSILON            2.2204460492503131e-16\r
+#define DBL_MANT_DIG   53\r
+#define DBL_MAX                        1.7976931348623157e+308\r
+#define DBL_MAX_EXP            1024\r
+#define DBL_MIN                        2.2250738585072014e-308\r
+#define DBL_MIN_EXP            (-1021)\r
+\r
+#endif\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/gg00libc.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/gg00libc.lib
new file mode 100644 (file)
index 0000000..313e8a2
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/gg00libc.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/gg00old0.rul b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/gg00old0.rul
new file mode 100644 (file)
index 0000000..a11d589
--- /dev/null
@@ -0,0 +1,20 @@
+format:\r
+       /* \82±\82Ì\83Z\83N\83V\83\87\83\93\82Å\83\8a\83\93\83N\82Ì\95û\90j\82ð\8bL\8fq */\r
+       code(align:1, logic:0x48,      file:0x48);\r
+       data(align:4, logic:stack_end, file:code_end);\r
+\r
+file:\r
+       /* \82±\82Ì\83Z\83N\83V\83\87\83\93\82Å\83R\83}\83\93\83h\83\89\83C\83\93\82É\8f\91\82«\82«\82ê\82È\82©\82Á\82½\r
+               .ojb\83t\83@\83C\83\8b\81A.lib\83t\83@\83C\83\8b\82ð\8bL\8dÚ */\r
+       /* \82È\82¨\81A\82±\82Ì\83Z\83N\83V\83\87\83\93\82Í\83t\83\8b\83p\83X\82Å\8f\91\82¢\82Ä\82à\82æ\82¢\81B */\r
+       /* \97á\81F  c:/osask/gg00libc.lib;  */\r
+       ../z_tools/guigui00/gg00libc.lib;\r
+       ../z_tools/guigui00/golibc.lib;\r
+\r
+label:\r
+       /* \95K\82¸\83\8a\83\93\83N\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\83\89\83x\83\8b\82ð\8ew\92è */\r
+       /* \83G\83\93\83g\83\8a\83|\83C\83\93\83g\82ð\8ew\92è\82·\82ê\82Î\82¢\82¢\82Æ\8ev\82Á\82Ä\82­\82¾\82³\82¢ */\r
+       _main;\r
+\r
+\r
+       /* \8fã\8bL3\83Z\83N\83V\83\87\83\93\82Ì\8f\87\8f\98\82Í\93ü\82ê\91Ö\82¦\82Ä\82Í\82¢\82¯\82Ü\82¹\82ñ! */\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/golibc.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/golibc.lib
new file mode 100644 (file)
index 0000000..9651ab1
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/golibc.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/guigui00.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/guigui00.h
new file mode 100644 (file)
index 0000000..1df36f4
--- /dev/null
@@ -0,0 +1,586 @@
+#ifndef __GUIGUI00_H\r
+#define __GUIGUI00_H\r
+\r
+/* gg00lib+ ver.0.8 */\r
+/* gg00lib9\82ð\83x\81[\83X\82É\82µ\82Ä\82¢\82é */\r
+\r
+struct LIB_WORK {\r
+       int data[256 / 4];\r
+};\r
+\r
+struct LIB_WINDOW {\r
+       int data[128 / 4];\r
+};\r
+\r
+struct LIB_TEXTBOX {\r
+       int data[64 / 4];\r
+};\r
+\r
+struct LIB_SIGHNDLREG {\r
+       int ES, DS, FS, GS;\r
+       int EDI, ESI, EBP, ESP;\r
+       int EBX, EDX, ECX, EAX;\r
+       int EIP, CS, EFLAGS;\r
+};\r
+\r
+struct LIB_GRAPHBOX {\r
+       int reserve[64 / 4];\r
+};\r
+\r
+struct LIB_LINES1 {\r
+       int x0, y0, dx, dy, length, color;\r
+};\r
+\r
+struct LIB_LINES0 {\r
+       int x0, y0, x1, y1, dummy, color;\r
+};\r
+\r
+struct LIB_POINTS {\r
+       int x, y, color;\r
+};\r
+\r
+//void lib_execcmd(void *EBX);\r
+\r
+extern __inline__ void lib_execcmd(void *EBX)\r
+{\r
+       __asm__ (" .byte 154 \n\t"\r
+                        " .byte 0   \n\t"\r
+                        " .byte 0   \n\t"\r
+                        " .byte 0   \n\t"\r
+                        " .byte 0   \n\t"\r
+                        " .byte 199 \n\t"\r
+                        " .byte 0   \n\t"\r
+                        : : "b" (EBX) );\r
+}\r
+\r
+void lib_execcmd0(int cmd, ...);\r
+#if 0\r
+extern __inline__ void lib_execcmd0(int cmd, ...)\r
+{\r
+       __asm__ (" movl %%esp,%%ebx \n\t"\r
+                        " .byte 154 \n\t"\r
+                        " .byte 0   \n\t"\r
+                        " .byte 0   \n\t"\r
+                        " .byte 0   \n\t"\r
+                        " .byte 0   \n\t"\r
+                        " .byte 199 \n\t"\r
+                        " .byte 0   \n\t"\r
+                        : : : "%ebx");\r
+}\r
+#endif\r
+\r
+int lib_execcmd1(int ret, int cmd, ...);\r
+int lib_execcmd2(int ret, int cmd, ...);\r
+\r
+void *malloc(const unsigned int nbytes);\r
+\r
+#if 0\r
+       /* \88È\89º\82Ì\8aÖ\90\94\82Í\83}\83N\83\8d\82Å\8eÀ\8c»\82³\82ê\82Ä\82¢\82é(\8d\82\91¬\89»\82Æ\83R\83\93\83p\83N\83g\89»\82Ì\82½\82ß) */\r
+       /* \88ø\90\94\82Ì\8c^\82È\82Ç\82ª\95ª\82©\82è\82â\82·\82¢\82æ\82¤\82É\81A\8aÖ\90\94\8c^\90é\8c¾\82ð\92\90\8eß\82Æ\82µ\82Ä\8ec\82µ\82Ä\82 \82é */\r
+\r
+struct LIB_WORK *lib_init(struct LIB_WORK *work);\r
+void lib_init_nm(struct LIB_WORK *work);\r
+struct LIB_WORK *lib_init_am(struct LIB_WORK *work);\r
+void lib_waitsignal(int opt, int signaldw, int nest);\r
+struct LIB_WINDOW *lib_openwindow(struct LIB_WINDOW *window, int slot, int x_size, int y_size);\r
+void lib_openwindow_nm(struct LIB_WINDOW *window, int slot, int x_size, int y_size);\r
+void lib_openwindow_am(struct LIB_WINDOW *window, int slot, int x_size, int y_size);\r
+struct LIB_TEXTBOX *lib_opentextbox(int opt, struct LIB_TEXTBOX *textbox, int backcolor,\r
+       int x_size, int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window, int charset,\r
+       int init_char);\r
+void lib_opentextbox_nm(int opt, struct LIB_TEXTBOX *textbox, int backcolor, int x_size,\r
+       int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window, int charset, int init_char);\r
+void lib_opentextbox_am(int opt, struct LIB_TEXTBOX *textbox, int backcolor, int x_size,\r
+       int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window, int charset, int init_char);\r
+void lib_waitsignaltime(int opt, int signaldw, int nest, unsigned int time0, unsigned int time1,\r
+       unsigned int time2);\r
+int *lib_opensignalbox(int bytes, int *signalbox, int eos, int rewind);\r
+void lib_opensignalbox_nm(int bytes, int *signalbox, int eos, int rewind);\r
+int *lib_opensignalbox_am(int bytes, int *signalbox, int eos, int rewind);\r
+void lib_definesignal0p0(int opt, int default_assign0, int default_assign1, int default_assign2);\r
+void lib_definesignal1p0(int opt, int default_assign0, int default_assign1,\r
+       struct LIB_WINDOW *default_assign2, int signal);\r
+void lib_opentimer(int slot);\r
+void lib_closetimer(int slot);\r
+void lib_settimertime(int opt, int slot, unsigned int time0, unsigned int time1,\r
+       unsigned int time2);\r
+void lib_settimer(int opt, int slot);\r
+void lib_opensoundtrack(int slot);\r
+void lib_controlfreq(int slot, int freq);\r
+struct LIB_WINDOW *lib_openwindow1(struct LIB_WINDOW *window, int slot, int x_size, int y_size,\r
+       int flags, int base);\r
+void lib_openwindow1_nm(struct LIB_WINDOW *window, int slot, int x_size, int y_size, int flags,\r
+       int base);\r
+void lib_openwindow1_am(struct LIB_WINDOW *window, int slot, int x_size, int y_size, int flags,\r
+       int base);\r
+void lib_closewindow(int opt, struct LIB_WINDOW *window);\r
+void lib_controlwindow(int opt, struct LIB_WINDOW *window);\r
+void lib_close(int opt);\r
+void lib_loadfontset(int opt, int slot, int len, void *font);\r
+void lib_loadfontset0(int opt, int slot);\r
+void lib_makecharset(int opt, int charset, int fontset, int len, int from, int base);\r
+void lib_drawline(int opt, struct LIB_WINDOW *window, int color, int x0, int y0, int x1, int y1);\r
+void lib_closetextbox(int opt, struct LIB_TEXTBOX *textbox);\r
+void lib_mapmodule(int opt, int slot, int attr, int size, void *addr, int ofs);\r
+void lib_unmapmodule(int opt, int size, void *addr);\r
+void lib_initmodulehandle(int opt, int slot);\r
+void lib_putblock1(struct LIB_WINDOW *win, int x, int y, int sx, int sy, int skip, void *p);\r
+struct LIB_GRAPHBOX *lib_opengraphbox(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
+       int x_size, int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window);\r
+void lib_opengraphbox_nm(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
+       int x_size, int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window);\r
+struct LIB_GRAPHBOX *lib_opengraphbox_am(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
+       int x_size, int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window);\r
+void lib_flushgraphbox(int opt, struct LIB_WINDOW *win, int x, int y, int sx, int sy, int skip,\r
+       void *p);\r
+void lib_drawline0(int opt, struct LIB_GRAPHBOX *gbox, int color, int x0, int y0, int x1, int y1);\r
+void lib_drawlines0(int opt, struct LIB_GRAPHBOX *gbox, int x0, int y0, int xsize, int ysize,\r
+       int lines, const struct LIB_LINES1 *ofs);\r
+void lib_convlines(int opt, int lines, struct LIB_LINES0 *src, struct LIB_LINES1 *dest);\r
+void lib_initmodulehandle0(int opt, int slot);\r
+void lib_putblock02001(struct LIB_GRAPHBOX *gbox, void *buf, int vx0, int vy0);\r
+struct LIB_GRAPHBOX *lib_opengraphbox2(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
+       int x_bsize, int y_bsize, int x_vsize, int y_vsize, int x_pos, int y_pos,\r
+       struct LIB_WINDOW *window);\r
+void lib_opengraphbox2_nm(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
+       int x_bsize, int y_bsize, int x_vsize, int y_vsize, int x_pos, int y_pos,\r
+       struct LIB_WINDOW *window);\r
+struct LIB_GRAPHBOX *lib_opengraphbox2_am(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
+       int x_bsize, int y_bsize, int x_vsize, int y_vsize, int x_pos, int y_pos,\r
+       struct LIB_WINDOW *window);\r
+void lib_putblock03001(struct LIB_GRAPHBOX *gbox, void *buf, int vx0, int vy0, void *tbuf,\r
+       int tbuf_skip, int tcol0);\r
+void lib_drawpoints0(int opt, struct LIB_GRAPHBOX *gbox, int x0, int y0, int xsize, int ysize,\r
+       int points, const struct LIB_POINTS *ofs);\r
+void lib_wsjis2gg00jpn0(int len, const char *sjis, int *gg00jpn, int ankbase, int jpnbase);\r
+void lib_loadfontset1(int opt, int slot, int sig);\r
+void lib_drawlines1(int opt, struct LIB_WINDOW *win, int x0, int y0, int xsize, int ysize,\r
+       int lines, const struct LIB_LINES1 *ofs);\r
+void lib_drawpoints1(int opt, struct LIB_WINDOW *win, int x0, int y0, int xsize, int ysize,\r
+       int points, const struct LIB_POINTS *ofs);\r
+void lib_seuc2gg00(int len, const char *seuc, int *gg00, int ankbase, int rightbase);\r
+void lib_resizemodule(int opt, int slot, int newsize, int sig);\r
+void lib_drawpoint0(int opt, struct LIB_GRAPHBOX *gbox, int color, int x, int y);\r
+const int lib_getrandseed();\r
+void lib_putstring0(int opt, int x_pos, int y_pos, struct LIB_TEXTBOX *textbox,\r
+       int color, int bcolor, int len, const int *str);\r
+void lib_putstring1(int opt, int x_pos, int y_pos, struct LIB_TEXTBOX *tbox,\r
+       int col, int bcol, int base, int len, const int *str);\r
+\r
+#endif\r
+\r
+void lib_putstring_ASCII(int opt, int x_pos, int y_pos, struct LIB_TEXTBOX *textbox, int color,\r
+       int backcolor, const char *str);\r
+void lib_definesignalhandler(void (*lib_signalhandler)(struct LIB_SIGHNDLREG *));\r
+int lib_readCSb(int offset);\r
+int lib_readCSd(int offset);\r
+int lib_readmodulesize(int slot);\r
+void lib_initmodulehandle1(int slot, int num, int sig);\r
+void lib_steppath0(int opt, int slot, const char *name, int sig);\r
+int lib_decodel2d3(int size, int src_ofs, int src_sel, int dest_ofs, int dest_sel);\r
+void lib_putstring_SJIS0(int opt, int x_pos, int y_pos, struct LIB_TEXTBOX *textbox,\r
+       int color, int backcolor, const char *str);\r
+int lib_decodetek0(int size, int src_ofs, int src_sel, int dest_ofs, int dest_sel);\r
+void lib_settimertime2(int opt, int slot0, int slot1, unsigned int *time);\r
+\r
+#define        lib_init(work) \\r
+       (struct LIB_WORK *) lib_execcmd2(1 * 4 + 4, 0x0004, \\r
+       (work) ? (void *) (work) : malloc(sizeof (struct LIB_WORK)), 0x0000)\r
+\r
+#define        lib_init_nm(work) \\r
+       lib_execcmd0(0x0004, (void *) (work), 0x0000)\r
+\r
+#define        lib_init_am(work) \\r
+       (struct LIB_WORK *) lib_execcmd2(1 * 4 + 4, 0x0004, \\r
+       malloc(sizeof (struct LIB_WORK)), 0x0000)\r
+\r
+#define        lib_waitsignal(opt, signaldw, nest) \\r
+       lib_execcmd0(0x0018, (int) (opt), (int) (signaldw), (int) (nest), 0x0000)\r
+\r
+#define        lib_openwindow(window, slot, x_size, y_size) \\r
+       (struct LIB_WINDOW *) lib_execcmd2(1 * 4 + 4, 0x0020, \\r
+       (window) ? (void *) (window) : malloc(sizeof (struct LIB_WINDOW)), \\r
+       (int) (slot), (int) (x_size), (int) (y_size), 0x0000)\r
+\r
+#define        lib_openwindow_nm(window, slot, x_size, y_size) \\r
+       lib_execcmd0(0x0020, (void *) (window), (int) (slot), (int) (x_size), \\r
+       (int) (y_size), 0x0000)\r
+\r
+#define        lib_openwindow_am(window, slot, x_size, y_size) \\r
+       (struct LIB_WINDOW *) lib_execcmd2(1 * 4 + 4, 0x0020, \\r
+       malloc(sizeof (struct LIB_WINDOW)), \\r
+       (int) (slot), (int) (x_size), (int) (y_size), 0x0000)\r
+\r
+#define        lib_opentextbox(opt, textbox, backcolor, x_size, y_size, x_pos, y_pos, window, charset, init_char) \\r
+       (struct LIB_TEXTBOX *) lib_execcmd2(2 * 4 + 4, 0x0028, (int) (opt), \\r
+       (textbox) ? (void *) (textbox) : malloc(sizeof (struct LIB_TEXTBOX) + 8 * (x_size) * (y_size)), \\r
+       (int) (backcolor), (int) (x_size), (int) (y_size), (int) (x_pos), \\r
+       (int) (y_pos), (void *) (window), (int) (charset), (int) (init_char), \\r
+       0x0000)\r
+\r
+#define        lib_opentextbox_nm(opt, textbox, backcolor, x_size, y_size, x_pos, y_pos, window, charset, init_char) \\r
+       lib_execcmd0(0x0028, (int) (opt), (void *) (textbox), (int) (backcolor), \\r
+       (int) (x_size), (int) (y_size), (int) (x_pos), (int) (y_pos), \\r
+       (void *) (window), (int) (charset), (int) (init_char), 0x0000)\r
+\r
+#define        lib_opentextbox_am(opt, textbox, backcolor, x_size, y_size, x_pos, y_pos, window, charset, init_char) \\r
+       (struct LIB_TEXTBOX *) lib_execcmd2(2 * 4 + 4, 0x0028, (int) (opt), \\r
+       malloc(sizeof (struct LIB_TEXTBOX) + 8 * (x_size) * (y_size)), \\r
+       (int) (backcolor), (int) (x_size), (int) (y_size), (int) (x_pos), \\r
+       (int) (y_pos), (void *) (window), (int) (charset), (int) (init_char), \\r
+       0x0000)\r
+\r
+#define        lib_waitsignaltime(opt, signaldw, nest, time0, time1, time2) \\r
+       lib_execcmd0(0x0018, (int) (opt), (int) (signaldw), (int) (nest), \\r
+       (int) (time0), (int) (time1), (int) (time2), 0x0000)\r
+\r
+#define        lib_opensignalbox(bytes, signalbox, eos, rewind) \\r
+       (int *) lib_execcmd2(2 * 4 + 4, 0x0060, (int) (bytes), \\r
+       (signalbox) ? (void *) (signalbox) : malloc(bytes), (int) (eos), \\r
+       (int) (rewind), 0x0000)\r
+\r
+#define        lib_opensignalbox_nm(bytes, signalbox, eos, rewind) \\r
+       lib_execcmd0(0x0060, (int) (bytes), (void *) (signalbox), (int) (eos), \\r
+       (int) (rewind), 0x0000)\r
+\r
+#define        lib_opensignalbox_am(bytes, signalbox, eos, rewind) \\r
+       (int *) lib_execcmd2(2 * 4 + 4, 0x0060, (int) (bytes), \\r
+       malloc(bytes), (int) (eos), (int) (rewind), 0x0000)\r
+\r
+#define        lib_definesignal0p0(opt, default_assign0, default_assign1, default_assign2) \\r
+       lib_execcmd0(0x0068, (int) (opt), (int) (default_assign0), \\r
+       (int) (default_assign1), (int) (default_assign2), 0, 0, 0x0000)\r
+\r
+#define        lib_definesignal1p0(opt, default_assign0, default_assign1, default_assign2, signal) \\r
+       lib_execcmd0(0x0068, (int) (opt), (int) (default_assign0), \\r
+       (int) (default_assign1), (int) (default_assign2), 1, (int) (signal), \\r
+       0, 0x0000)\r
+\r
+#define        lib_opentimer(slot) \\r
+       lib_execcmd0(0x0070, (int) (slot), 0x0000)\r
+\r
+#define        lib_closetimer(slot) \\r
+       lib_execcmd0(0x0074, (int) (slot), 0x0000)\r
+\r
+#define        lib_settimertime(opt, slot, time0, time1, time2) \\r
+       lib_execcmd0(0x0078, (int) (opt), (int) (slot), (int) (time0), \\r
+       (int) (time1), (int) (time2), 0x0000)\r
+\r
+#define        lib_settimer(opt, slot) \\r
+       lib_execcmd0(0x0078, (int) (opt), (int) (slot), 0x0000)\r
+\r
+#define        lib_opensoundtrack(slot) \\r
+       lib_execcmd0(0x0080, (int) (slot), 0, 0x0000)\r
+\r
+#define        lib_controlfreq(slot, freq) \\r
+       lib_execcmd0(0x008c, (int) (slot), (int) (freq), 0x0000)\r
+\r
+#define        lib_openwindow1(window, slot, x_size, y_size, flags, base) \\r
+       (struct LIB_WINDOW *) lib_execcmd2(1 * 4 + 4, 0x0020, \\r
+       (window) ? (void *) (window) : malloc(sizeof (struct LIB_WINDOW)), \\r
+       (int) (slot) | 0x01, (int) (x_size), (int) (y_size), \\r
+       0x01 | (int) (flags) << 8, (int) (base), 0x0000)\r
+\r
+#define        lib_openwindow1_nm(window, slot, x_size, y_size, flags, base) \\r
+       lib_execcmd0(0x0020, (void *) (window), (int) (slot) | 0x01, \\r
+       (int) (x_size), (int) (y_size), 0x01 | (int) (flags) << 8, (int) (base), \\r
+       0x0000)\r
+\r
+#define        lib_openwindow1_am(window, slot, x_size, y_size, flags, base) \\r
+       (struct LIB_WINDOW *) lib_execcmd2(1 * 4 + 4, 0x0020, \\r
+       malloc(sizeof (struct LIB_WINDOW)), \\r
+       (int) (slot) | 0x01, (int) (x_size), (int) (y_size), \\r
+       0x01 | (int) (flags) << 8, (int) (base), 0x0000)\r
+\r
+#define        lib_closewindow(opt, window) \\r
+       lib_execcmd0(0x0024, (int) (opt), (void *) (window), 0x0000)\r
+\r
+#define        lib_controlwindow(opt, window) \\r
+       lib_execcmd0(0x003c, (int) (opt), (void *) (window), 0x0000)\r
+\r
+#define        lib_close(opt) \\r
+       lib_execcmd0(0x0008, (int) (opt), 0x0000)\r
+\r
+#define        lib_loadfontset(opt, slot, len, font) \\r
+       lib_execcmd0(0x00e0, (int) (opt), (int) (slot), (int) (len), (int) (font), \\r
+       0x000c, 0x0000)\r
+\r
+#define        lib_loadfontset0(opt, slot) \\r
+       lib_execcmd0(0x00e0, (int) (opt), (int) (slot), 0x0000)\r
+\r
+#define        lib_loadfontset1(opt, slot, sig) \\r
+       lib_execcmd0(0x00e0, (int) (opt), (int) (slot), 1, (int) (sig), 0x0000)\r
+\r
+#define        lib_makecharset(opt, charset, fontset, len, from, base) \\r
+       lib_execcmd0(0x00e8, (int) (opt), (int) (charset), (int) (fontset), \\r
+       (int) (len), (int) (from), (int) (base), 0x0000)\r
+\r
+#define        lib_drawline(opt, window, color, x0, y0, x1, y1) \\r
+       lib_execcmd0(0x0044, (int) (opt), (void *) (window), (int) (color), \\r
+       (int) (x0), (int) (y0), (int) (x1), (int) (y1), 0x0000)\r
+\r
+#define        lib_closetextbox(opt, textbox) \\r
+       lib_execcmd0(0x002c, (int) (opt), (int) (textbox), 0x0000)\r
+\r
+#define        lib_mapmodule(opt, slot, attr, size, addr, ofs) \\r
+       lib_execcmd0(0x00c0, (int) (opt), (int) (slot), (int) (size), \\r
+       (void *) (addr), 0x000c, (int) ((ofs) | (attr)), 0x0000)\r
+\r
+#define        lib_unmapmodule(opt, size, addr) \\r
+       lib_execcmd0(0x00c4, (int) (opt), (int) (size), (void *) (addr), 0x000c, \\r
+       0x0000)\r
+\r
+#define        lib_initmodulehandle(opt, slot) \\r
+       lib_execcmd0(0x00a0, (int) (opt), (int) (slot), 0x0000)\r
+\r
+#define        lib_putblock1(win, x, y, sx, sy, skip, p) \\r
+       lib_execcmd0(0x004c, 1, (void *) (win), (int) (x), (int) (y), (int) (sx), \\r
+       (int) (sy), (int) (skip), (void *) (p), 0x000c, 0x0000)\r
+\r
+#define        lib_opengraphbox(opt, graphbox, mode, mode_opt, x_size, y_size, x_pos, y_pos, window) \\r
+       (struct LIB_GRAPHBOX *) lib_execcmd2(2 * 4 + 4, 0x0030, (int) (opt), \\r
+       (graphbox) ? (void *) (graphbox) : malloc(sizeof (struct LIB_GRAPHBOX) + (x_size) * (y_size) * ((mode) & 0xf)), \\r
+       (int) (mode), (int) (mode_opt), (int) (x_size), (int) (y_size), \\r
+       (int) (x_pos), (int) (y_pos), (void *) (window), 0x0000)\r
+\r
+#define        lib_opengraphbox_nm(opt, graphbox, mode, mode_opt, x_size, y_size, x_pos, y_pos, window) \\r
+       lib_execcmd0(0x0030, (int) (opt), (void *) (graphbox), \\r
+       (int) (mode), (int) (mode_opt), (int) (x_size), (int) (y_size), \\r
+       (int) (x_pos), (int) (y_pos), (void *) (window), 0x0000)\r
+\r
+#define        lib_opengraphbox_am(opt, graphbox, mode, mode_opt, x_size, y_size, x_pos, y_pos, window) \\r
+       (struct LIB_GRAPHBOX *) lib_execcmd2(2 * 4 + 4, 0x0030, (int) (opt), \\r
+       malloc(sizeof (struct LIB_GRAPHBOX) + (x_size) * (y_size) * ((mode) & 0xf)), \\r
+       (int) (mode), (int) (mode_opt), (int) (x_size), (int) (y_size), \\r
+       (int) (x_pos), (int) (y_pos), (void *) (window), 0x0000)\r
+\r
+#define        lib_flushgraphbox(opt, win, x, y, sx, sy, skip, p) \\r
+       lib_execcmd0(0x004c, opt, (void *) (win), (int) (x), (int) (y), (int) (sx), \\r
+       (int) (sy), (int) (skip), (void *) (p), 0x000c, 0x0000)\r
+\r
+#define        lib_drawline0(opt, gbox, color, x0, y0, x1, y1) \\r
+       lib_execcmd0(0x0054, (int) (opt), (void *) (gbox), (int) (color), \\r
+       (int) (x0), (int) (y0), (int) (x1), (int) (y1), 0x0000)\r
+\r
+#define lib_drawlines0(opt, gbox, x0, y0, xsize, ysize, lines, ofs) \\r
+       lib_execcmd0(0x0108, (int) (opt), (void *) (gbox), (int) (x0), \\r
+       (int) (y0), (int) (xsize), (int) (ysize), (int) (lines), (void *) (ofs), \\r
+       0x000c, 0x0000)\r
+\r
+#define        lib_convlines(opt, lines, src, dest) \\r
+       lib_execcmd0(0x010c, (int) (opt), (int) (lines), \\r
+       (struct LIB_LINES0 *) (src), 0x000c, (struct LIB_LINES1 *) (dest), \\r
+       0x000c, 0x0000)\r
+\r
+#define        lib_initmodulehandle0(opt, slot) \\r
+       lib_execcmd0(0x00a0, (int) (opt), (int) (slot), 0x0000)\r
+\r
+#define lib_putblock02001(gbox, buf, vx0, vy0) \\r
+       lib_execcmd0(0x0058, 0x2001, (void *) (gbox), (void *) (buf), \\r
+       (int) (vx0), (int) (vy0), 0x0000)\r
+\r
+#define        lib_opengraphbox2(opt, graphbox, mode, mode_opt, x_bsize, y_bsize, \\r
+       x_vsize, y_vsize, x_pos, y_pos, window) \\r
+       (struct LIB_GRAPHBOX *) lib_execcmd2(2 * 4 + 4, 0x0030, (int) (opt), \\r
+       (graphbox) ? (void *) (graphbox) : malloc(sizeof (struct LIB_GRAPHBOX) + (x_bsize) * (y_bsize) * ((mode) & 0xf)), \\r
+       (int) (mode), (int) (mode_opt), (int) (x_bsize), (int) (y_bsize), \\r
+       (int) (x_vsize), (int) (y_vsize), (int) (x_pos), (int) (y_pos), \\r
+       (void *) (window), 0x0000)\r
+\r
+#define        lib_opengraphbox2_nm(opt, graphbox, mode, mode_opt, x_bsize, y_bsize, \\r
+       x_vsize, y_vsize, x_pos, y_pos, window) \\r
+       lib_execcmd0(0x0030, (int) (opt), (void *) (graphbox), \\r
+       (int) (mode), (int) (mode_opt), (int) (x_bsize), (int) (y_bsize), \\r
+       (int) (x_vsize), (int) (y_vsize), (int) (x_pos), (int) (y_pos), \\r
+       (void *) (window), 0x0000)\r
+\r
+#define        lib_opengraphbox2_am(opt, graphbox, mode, mode_opt, x_bsize, y_bsize, \\r
+       x_vsize, y_vsize, x_pos, y_pos, window) \\r
+       (struct LIB_GRAPHBOX *) lib_execcmd2(2 * 4 + 4, 0x0030, (int) (opt), \\r
+       malloc(sizeof (struct LIB_GRAPHBOX) + (x_bsize) * (y_bsize) * ((mode) & 0xf)), \\r
+       (int) (mode), (int) (mode_opt), (int) (x_bsize), (int) (y_bsize), \\r
+       (int) (x_vsize), (int) (y_vsize), (int) (x_pos), (int) (y_pos), \\r
+       (void *) (window), 0x0000)\r
+\r
+#define lib_putblock03001(gbox, buf, vx0, vy0, tbuf, tbuf_skip, tcol0) \\r
+       lib_execcmd0(0x0058, 0x3001, (void *) (gbox), (void *) (buf), \\r
+       (int) (vx0), (int) (vy0), (void *) (tbuf), (int) (tbuf_skip), \\r
+       (int) (tcol0), 0x0000)\r
+\r
+#define lib_drawpoints0(opt, gbox, x0, y0, xsize, ysize, points, ofs) \\r
+       lib_execcmd0(0x005c, (int) (opt), (void *) (gbox), (int) (x0), \\r
+       (int) (y0), (int) (xsize), (int) (ysize), (int) (points), (void *) (ofs), \\r
+       0x000c, 0x0000)\r
+\r
+#define        lib_wsjis2gg00jpn0(len, sjis, gg00jpn, ankbase, jpnbase) \\r
+       lib_execcmd0(0x00ec, 0x0001, (int) (len), (void *) (sjis), 0x000c, \\r
+       (int *) (gg00jpn), 0x000c, (int) (ankbase), (int) (jpnbase), 0x0000)\r
+\r
+#define lib_drawlines1(opt, win, x0, y0, xsize, ysize, lines, ofs) \\r
+       lib_execcmd0(0x0110, (int) (opt), (void *) (win), (int) (x0), \\r
+       (int) (y0), (int) (xsize), (int) (ysize), (int) (lines), (void *) (ofs), \\r
+       0x000c, 0x0000)\r
+\r
+#define lib_drawpoints1(opt, win, x0, y0, xsize, ysize, points, ofs) \\r
+       lib_execcmd0(0x0050, (int) (opt), (void *) (win), (int) (x0), \\r
+       (int) (y0), (int) (xsize), (int) (ysize), (int) (points), (void *) (ofs), \\r
+       0x000c, 0x0000)\r
+\r
+#define        lib_seuc2gg00(len, seuc, gg00, ankbase, rightbase) \\r
+       lib_execcmd0(0x00ec, 0x0002, (int) (len), (void *) (seuc), 0x000c, \\r
+       (int *) (gg00), 0x000c, (int) (ankbase), (int) (rightbase), 0x0000)\r
+\r
+#define        lib_resizemodule(opt, slot, newsize, sig) \\r
+       lib_execcmd0(0x0120, 0x0000, (int) (slot), (int) (newsize), 1, \\r
+       (int) (sig), 0x0000)\r
+\r
+#define        lib_drawpoint0(opt, gbox, color, x, y) \\r
+       lib_execcmd0(0x0054, (int) (opt), (void *) (gbox), (int) (color), \\r
+       (int) (x), (int) (y), (int) (x), (int) (y), 0x0000)\r
+\r
+#define        lib_getrandseed() \\r
+       lib_execcmd2(2 * 4 + 4, 0x0118, (int) 0, (int) 0, (int) 0x0000)\r
+\r
+#define        lib_putstring0(opt, x_pos, y_pos, textbox, color, bcolor, len, str) \\r
+       lib_execcmd0(0x0040, (int) (opt) | 0x4000, (int) (x_pos),  (int) (y_pos), \\r
+       (void *) (textbox), (int) (color), (int) (bcolor), (int) (len), \\r
+       (void *) (str), (int) 0x000c, 0x0000)\r
+\r
+#define        lib_putstring1(opt, x_pos, y_pos, tbox, col, bcol, base, len, str) \\r
+       lib_execcmd0(0x0040, (int) (opt) | 0x4000, (int) (x_pos),  (int) (y_pos), \\r
+       (void *) (tbox), (int) (col), (int) (bcol), (int) (base), (int) (len), \\r
+       (void *) (str), (int) 0x000c, 0x0000)\r
+\r
+/* <guigui00.h>\89ü\97Ç\8cv\89æ\82Ì\82½\82ß\82Ì\92Ç\8bL */\r
+\r
+//void lib_initsignalbox0_256(int rewind);\r
+//void lib_initsignalbox0_4k(int rewind);\r
+//void lib_initsignalbox0_64k(int rewind);\r
+extern int lib_work256[256 / 4];\r
+extern int lib_sigrwd_256, *lib_sigptr_256, lib_sigbox_256[256 / 4];\r
+extern int lib_sigrwd_4k,  *lib_sigptr_4k,  lib_sigbox_4k[4096 / 4];\r
+extern int lib_sigrwd_64k, *lib_sigptr_64k, lib_sigbox_64k[65536 / 4];\r
+int lib_getsig0w(int *sigbox);\r
+int lib_getsig0(int *sigbox);\r
+int lib_getsig1w(int *sigbox);\r
+int lib_getsig1(int *sigbox);\r
+\r
+extern int lib_initsignalbox0_256d[1];\r
+extern __inline__ void lib_initsignalbox0_256(int rewind)\r
+{\r
+       __asm__ (" movl $_lib_initsignalbox0_256d,%%ebx\n\t"    \\r
+                        " movl %0,24(%%ebx)                   \n\t"    \\r
+                        " .byte 154                           \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 199                           \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        : : "r" (rewind) : "%ebx" );\r
+}\r
+\r
+extern int lib_initsignalbox0_4kd[1];\r
+extern __inline__ void lib_initsignalbox0_4k(int rewind)\r
+{\r
+       __asm__ (" movl $_lib_initsignalbox0_4kd,%%ebx \n\t"    \\r
+                        " movl %0,24(%%ebx)                   \n\t"    \\r
+                        " .byte 154                           \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 199                           \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        : : "r" (rewind) : "%ebx" );\r
+}\r
+\r
+extern int lib_initsignalbox0_64kd[1];\r
+extern __inline__ void lib_initsignalbox0_64k(int rewind)\r
+{\r
+       __asm__ (" movl $_lib_initsignalbox0_64kd,%%ebx\n\t"    \\r
+                        " movl %0,24(%%ebx)                   \n\t"    \\r
+                        " .byte 154                           \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        " .byte 199                           \n\t"    \\r
+                        " .byte 0                             \n\t"    \\r
+                        : : "r" (rewind) : "%ebx" );\r
+}\r
+\r
+#if (!defined(LIB_FN_INIT))\r
+/* function-number */\r
+#define LIB_FN_INIT                            0x0004  /* non-malloc\8c^ */\r
+#define LIB_FN_CLOSE                   0x0008\r
+#define LIB_FN_WAITSIGNAL              0x0018\r
+#define LIB_FN_WAITSIGNALTIME  0x0018\r
+#define LIB_FN_OPENWINDOW              0x0020  /* non-malloc\8c^ */\r
+#define LIB_FN_OPENWINDOW1             0x0020  /* non-malloc\8c^ */\r
+       /* \81ªslot\82Ì\82Æ\82±\82ë\82É1\82ð\91«\82·\81Aflags\82Ì\82Æ\82±\82ë\82Í256\94{\82µ\82Ä\82³\82ç\82É1\82ð\91«\82· */\r
+#define LIB_FN_CLOSEWINDOW             0x0024\r
+#define LIB_FN_OPENTEXTBOX             0x0028  /* non-malloc\8c^ */\r
+#define LIB_FN_CLOSETEXTBOX            0x002c\r
+#define LIB_FN_OPENGRAPHBOX            0x0030  /* non-malloc\8c^ */\r
+#define LIB_FN_OPENGRAPHBOX2   0x0030  /* non-malloc\8c^ */\r
+#define LIB_FN_CONTROLWINDOW   0x003c\r
+#define LIB_FN_PUTSTRING               0x0040\r
+       /* \81ª\95\81\92Ê\82É\8eg\82¤\82È\82çopt\82É0x4000\82ð\91«\82· */\r
+       /* \81ª\83e\83L\83X\83g\96\84\82ß\8d\9e\82Ý\82ð\82â\82é\82È\82ç0x4000\82Í\91«\82³\82È\82¢ */\r
+#define LIB_FN_DRAWLINE                        0x0044\r
+#define LIB_FN_FLUSHGRAPHBOX   0x004c  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_PUTBLOCK1               0x004c  /* \90æ\93ª\82Éopt\82Æ\82µ\82Ä1\82ð\92Ç\89Á\81A\82³\82ç\82É\82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_DRAWPOINTS1             0x0050  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_DRAWLINE0               0x0054\r
+#define LIB_FN_DRAWPOINT0              0x0054\r
+       /* \81ªx\82Æy\82Ì\82 \82Æ\82É\81A\82Ü\82½x\82Æy\82ð\92Ç\89Á\81F\8eÀ\82ÍDRAWLINE0\82Å\82²\82Ü\82©\82µ\82Ä\82¢\82é\82½\82ß */\r
+#define LIB_FN_PUTBLOCK02001   0x0058  /* \90æ\93ª\82Éopt\82Æ\82µ\82Ä0x2001\82ð\92Ç\89Á */\r
+#define LIB_FN_PUTBLOCK03001   0x0058  /* \90æ\93ª\82Éopt\82Æ\82µ\82Ä0x3001\82ð\92Ç\89Á */\r
+#define LIB_FN_DRAWPOINTS0             0x005c  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_OPENSIGNALBOX   0x0060  /* non-malloc\8c^ */\r
+#define LIB_FN_DEFINESIGNAL            0x0068\r
+       /* \81ª0p0\82Ì\8fê\8d\87\82Í\81A\82¨\82µ\82è\82É0\82ð2\82Â\92Ç\89Á */\r
+       /* \81ª1p0\82Ì\8fê\8d\87\82Í\81Asignal\82Ì\91O\82É1\82ð\92Ç\89Á\81Asignal\82Ì\8cã\82ë\82É0\82ð\92Ç\89Á */\r
+#define LIB_FN_OPENTIMER               0x0070\r
+#define LIB_FN_CLOSETIMER              0x0074\r
+#define LIB_FN_SETTIMER                        0x0078\r
+#define LIB_FN_SETTIMERTIME            0x0078\r
+#define LIB_FN_OPENSOUNDTRAK   0x0080\r
+#define LIB_FN_CONTROLFREQ             0x008c\r
+#define LIB_FN_MAPMODULE               0x00c0  /* addr\82Ì\8cã\82ë\82É0x000c\82ð\92Ç\89Á\81Aofs\82Æattr\82Í\91«\82µ\8eZ\82µ\82Ä\88ê\82Â\82É */\r
+#define LIB_FN_UNMAPMODULE             0x00c4  /* addr\82Ì\8cã\82ë\82É0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_LOADFONTSET             0x00e0  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_LOADFONTSET0            0x00e0\r
+#define LIB_FN_MAKECHARSET             0x00e8\r
+#define LIB_FN_WSJIS2GG00JPN0  0x00ec\r
+       /* \81ª\90æ\93ª\82Éopt\82Æ\82µ\82Ä1\82ð\92Ç\89Á\81Asjis\82Ægg00jpn\82Ì\82¤\82µ\82ë\82É\82»\82ê\82¼\82ê0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_SEUC2GG00               0x00ec\r
+       /* \81ª\90æ\93ª\82Éopt\82Æ\82µ\82Ä2\82ð\92Ç\89Á\81Aseuc\82Ægg00\82Ì\82¤\82µ\82ë\82É\82»\82ê\82¼\82ê0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_DRAWLINES0              0x0108  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_CONVLINES               0x010c  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_DRAWLINES1              0x0110  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
+#define LIB_FN_RESIZEMODULE            0x0120  /* sig\82Ì\91O\82É1\82ð\92Ç\89Á */\r
+#endif\r
+\r
+#define lib_openwintitle(size, window) \\r
+    lib_opentextbox(0x1000, 0, 0, size, 1, 0, 0, window, 0x00c0, 0)\r
+\r
+#define lib_settimertime_interval(slot, time0, time1) \\r
+    lib_settimertime(0x12, slot, time0, time1, 0)\r
+\r
+#define lib_settimertime_fromnow(slot, time0, time1) \\r
+    lib_settimertime(0x32, slot, time0, time1, 0)\r
+\r
+#define lib_wait_interval(time0, time1) \\r
+    lib_waitsignaltime(0x0007, 0, 0, time0, time1, 0)\r
+\r
+#define lib_wait_fromnow(time0, time1) \\r
+    lib_waitsignaltime(0x000f, 0, 0, time0, time1, 0)\r
+\r
+int lib_imul(signed int a, signed int b, int *h);\r
+int lib_idiv(signed int a, signed int b, int *r);\r
+int lib_imuldiv(signed int a, signed int b, signed int c, int *r);\r
+int lib_imod(signed int a, signed int b, int *q);\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/guigui00.rul b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/guigui00.rul
new file mode 100644 (file)
index 0000000..c9b3f02
--- /dev/null
@@ -0,0 +1,20 @@
+format:\r
+       /* \82±\82Ì\83Z\83N\83V\83\87\83\93\82Å\83\8a\83\93\83N\82Ì\95û\90j\82ð\8bL\8fq */\r
+       code(align:1, logic:0x48,      file:0x48);\r
+       data(align:4, logic:stack_end, file:code_end);\r
+\r
+file:\r
+       /* \82±\82Ì\83Z\83N\83V\83\87\83\93\82Å\83R\83}\83\93\83h\83\89\83C\83\93\82É\8f\91\82«\82«\82ê\82È\82©\82Á\82½\r
+               .ojb\83t\83@\83C\83\8b\81A.lib\83t\83@\83C\83\8b\82ð\8bL\8dÚ */\r
+       /* \82È\82¨\81A\82±\82Ì\83Z\83N\83V\83\87\83\93\82Í\83t\83\8b\83p\83X\82Å\8f\91\82¢\82Ä\82à\82æ\82¢\81B */\r
+       /* \97á\81F  c:/osask/gg00libc.lib;  */\r
+       ../z_tools/guigui00/gg00libc.lib;\r
+       ../z_tools/guigui00/golibc.lib;\r
+\r
+label:\r
+       /* \95K\82¸\83\8a\83\93\83N\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\83\89\83x\83\8b\82ð\8ew\92è */\r
+       /* \83G\83\93\83g\83\8a\83|\83C\83\93\83g\82ð\8ew\92è\82·\82ê\82Î\82¢\82¢\82Æ\8ev\82Á\82Ä\82­\82¾\82³\82¢ */\r
+       _OsaskMain;\r
+\r
+\r
+       /* \8fã\8bL3\83Z\83N\83V\83\87\83\93\82Ì\8f\87\8f\98\82Í\93ü\82ê\91Ö\82¦\82Ä\82Í\82¢\82¯\82Ü\82¹\82ñ! */\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/limits.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/limits.h
new file mode 100644 (file)
index 0000000..f4d9f73
--- /dev/null
@@ -0,0 +1,23 @@
+/* copyright(C) 2002 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(LIMITS_H))\r
+\r
+#define LIMITS_H       1\r
+\r
+#define CHAR_BIT       8\r
+#define        CHAR_MAX        (+127)\r
+#define CHAR_MIN       0\r
+#define INT_MAX                (+0x7fffffff)\r
+#define INT_MIN                (-0x7fffffff)\r
+#define LONG_MAX    INT_MAX\r
+#define        LONG_MIN        INT_MIN\r
+#define SCHAR_MAX      (+127)\r
+#define        SCHAR_MIN       (-127)\r
+#define        SHRT_MAX        (+0x7fff)\r
+#define SHRT_MIN       (-0x7fff)\r
+#define UCHAR_MAX      (+0xff)\r
+#define UINT_MAX       (+0xffffffff)\r
+#define ULONG_MAX      UINT_MAX\r
+#define USHRT_MAX      (+0xffff)\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/math.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/math.h
new file mode 100644 (file)
index 0000000..9df151a
--- /dev/null
@@ -0,0 +1,42 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(MATH_H))\r
+\r
+#define MATH_H 1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+double sin(double);\r
+double cos(double);\r
+double sqrt(double);\r
+double ldexp(double x, int n);\r
+double frexp(double x, int *exp);\r
+\r
+extern __inline__ double sin(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fsin" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+extern __inline__ double cos(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fcos" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+extern __inline__ double sqrt(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fsqrt" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/setjmp.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/setjmp.h
new file mode 100644 (file)
index 0000000..5512f36
--- /dev/null
@@ -0,0 +1,20 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(SETJMP_H))\r
+\r
+#define SETJMP_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+typedef int jmp_buf[3]; /* EBP, EIP, ESP */\r
+\r
+#define setjmp(env)                    __builtin_setjmp(env)\r
+#define longjmp(env, val)      __builtin_longjmp(env, val)\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stdarg.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stdarg.h
new file mode 100644 (file)
index 0000000..ab6b2a9
--- /dev/null
@@ -0,0 +1,21 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDARG_H))\r
+\r
+#define STDARG_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#define va_start(v,l)  __builtin_stdarg_start((v),l)\r
+#define va_end                 __builtin_va_end\r
+#define va_arg                 __builtin_va_arg\r
+#define va_copy(d,s)   __builtin_va_copy((d),(s))\r
+#define        va_list                 __builtin_va_list\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stddef.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stddef.h
new file mode 100644 (file)
index 0000000..95727bc
--- /dev/null
@@ -0,0 +1,17 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDDEF_H))\r
+\r
+#define STDDEF_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+typedef unsigned int size_t;\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stdio.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stdio.h
new file mode 100644 (file)
index 0000000..9999635
--- /dev/null
@@ -0,0 +1,24 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDIO_H))\r
+\r
+#define STDIO_H        1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#if (!defined(NULL))\r
+       #define NULL    ((void *) 0)\r
+#endif\r
+\r
+#include <stdarg.h>\r
+\r
+int sprintf(char *s, const char *format, ...);\r
+int vsprintf(char *s, const char *format, va_list arg);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stdlib.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/stdlib.h
new file mode 100644 (file)
index 0000000..c361077
--- /dev/null
@@ -0,0 +1,34 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDLIB_H))\r
+\r
+#define STDLIB_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#include <stddef.h>            /* size_t */\r
+\r
+#define        RAND_MAX        0x7fff\r
+#define srand(seed)                    (void) (rand_seed = (seed))\r
+\r
+int abs(int n);\r
+double atof(const char *s);\r
+int atoi(const char *s);\r
+void qsort(void *base, size_t n, size_t size,\r
+       int (*cmp)(const void *, const void *));\r
+int rand(void);\r
+extern unsigned int rand_seed;\r
+double strtod(const char *s, const char **endp);\r
+long strtol(const char *s, const char **endp, int base);\r
+unsigned long strtoul(const char *s, const char **endp, int base);\r
+\r
+void *malloc(unsigned int nbytes);\r
+void free(void *ap);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/string.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/guigui00/string.h
new file mode 100644 (file)
index 0000000..62bd804
--- /dev/null
@@ -0,0 +1,38 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STRING_H))\r
+\r
+#define STRING_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#include <stddef.h>            /* size_t */\r
+\r
+char *strcpy(char *s, const char *ct);\r
+char *strncpy(char *s, const char *ct, size_t n);\r
+char *strcat(char *s, const char *ct);\r
+char *strncat(char *s, const char *ct, size_t n);\r
+int strcmp(const char *cs, const char *ct);\r
+int strncmp(const char *cs, const char *ct, size_t n);\r
+char *strchr(const char *cs, int c);\r
+char *strrchr(const char *cs, int c);\r
+size_t strspn(const char *s, const char *accept);\r
+size_t strcspn(const char *s, const char *reject);\r
+char *strpbrk(const char *s, const char *accept);\r
+char *strstr(const char *cs, const char *ct);\r
+size_t strlen(const char *cs);\r
+\r
+void *memcpy(void *s, const void *ct, size_t n);\r
+void *memmove(void *s, const void *ct, size_t n);\r
+int memcmp(const void *cs, const void *ct, size_t n);\r
+void *memchr(const void *cs, int c, size_t n);\r
+void *memset(void *s, int c, size_t n);\r
+char *strdup(const char *s);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/apilib.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/apilib.h
new file mode 100644 (file)
index 0000000..6c7aced
--- /dev/null
@@ -0,0 +1,27 @@
+void api_putchar(int c);\r
+void api_putstr0(char *s);\r
+void api_putstr1(char *s, int l);\r
+void api_end(void);\r
+int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title);\r
+void api_putstrwin(int win, int x, int y, int col, int len, char *str);\r
+void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col);\r
+void api_initmalloc(void);\r
+char *api_malloc(int size);\r
+void api_free(char *addr, int size);\r
+void api_point(int win, int x, int y, int col);\r
+void api_refreshwin(int win, int x0, int y0, int x1, int y1);\r
+void api_linewin(int win, int x0, int y0, int x1, int y1, int col);\r
+void api_closewin(int win);\r
+int api_getkey(int mode);\r
+int api_alloctimer(void);\r
+void api_inittimer(int timer, int data);\r
+void api_settimer(int timer, int time);\r
+void api_freetimer(int timer);\r
+void api_beep(int tone);\r
+int api_fopen(char *fname);\r
+void api_fclose(int fhandle);\r
+void api_fseek(int fhandle, int offset, int mode);\r
+int api_fsize(int fhandle, int mode);\r
+int api_fread(char *buf, int maxsize, int fhandle);\r
+int api_cmdline(char *buf, int maxsize);\r
+int api_getlang(void);\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/apilib.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/apilib.lib
new file mode 100644 (file)
index 0000000..c755010
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/apilib.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/errno.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/errno.h
new file mode 100644 (file)
index 0000000..c1ffd85
--- /dev/null
@@ -0,0 +1,20 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(ERRNO_H))\r
+\r
+#define ERRNO_H        1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+extern int errno;\r
+\r
+#define        ENOENT          2       /* No such file or directory */\r
+#define        ERANGE          34      /* Result too large (or too small) */\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/float.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/float.h
new file mode 100644 (file)
index 0000000..943ba62
--- /dev/null
@@ -0,0 +1,26 @@
+/* copyright(C) 2002 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(FLOAT_H))\r
+\r
+#define FLOAT_H                        1\r
+\r
+#define FLT_RADIX              2\r
+#define FLT_ROUNDS             1 /* nearest */\r
+#define FLT_DIG                        6\r
+#define FLT_EPSILON            1.19209290e-07F\r
+#define FLT_MANT_DIG   24\r
+#define FLT_MAX                        3.40282347e+38F\r
+#define FLT_MAX_EXP            (+128)\r
+#define FLT_MIN                        1.17549435e-38F\r
+#define FLT_MIN_EXP            (-125)\r
+\r
+#define DBL_DIG                        15\r
+#define DBL_EPSILON            2.2204460492503131e-16\r
+#define DBL_MANT_DIG   53\r
+#define DBL_MAX                        1.7976931348623157e+308\r
+#define DBL_MAX_EXP            1024\r
+#define DBL_MIN                        2.2250738585072014e-308\r
+#define DBL_MIN_EXP            (-1021)\r
+\r
+#endif\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/golibc.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/golibc.lib
new file mode 100644 (file)
index 0000000..9651ab1
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/golibc.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/haribote.rul b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/haribote.rul
new file mode 100644 (file)
index 0000000..281c2a8
--- /dev/null
@@ -0,0 +1,19 @@
+format:\r
+       /* \82±\82Ì\83Z\83N\83V\83\87\83\93\82Å\83\8a\83\93\83N\82Ì\95û\90j\82ð\8bL\8fq */\r
+       code(align:1, logic:0x24,      file:0x24);\r
+       data(align:4, logic:stack_end, file:code_end);\r
+\r
+file:\r
+       /* \82±\82Ì\83Z\83N\83V\83\87\83\93\82Å\83R\83}\83\93\83h\83\89\83C\83\93\82É\8f\91\82«\82«\82ê\82È\82©\82Á\82½\r
+               .ojb\83t\83@\83C\83\8b\81A.lib\83t\83@\83C\83\8b\82ð\8bL\8dÚ */\r
+       /* \82È\82¨\81A\82±\82Ì\83Z\83N\83V\83\87\83\93\82Í\83t\83\8b\83p\83X\82Å\8f\91\82¢\82Ä\82à\82æ\82¢\81B */\r
+       /* \97á\81F  c:/osask/gg00libc.lib;  */\r
+       ../z_tools/haribote/harilibc.lib;\r
+       ../z_tools/haribote/golibc.lib;\r
+\r
+label:\r
+       /* \95K\82¸\83\8a\83\93\83N\82µ\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\83\89\83x\83\8b\82ð\8ew\92è */\r
+       /* \83G\83\93\83g\83\8a\83|\83C\83\93\83g\82ð\8ew\92è\82·\82ê\82Î\82¢\82¢\82Æ\8ev\82Á\82Ä\82­\82¾\82³\82¢ */\r
+       _HariStartup;\r
+\r
+       /* \8fã\8bL3\83Z\83N\83V\83\87\83\93\82Ì\8f\87\8f\98\82Í\93ü\82ê\91Ö\82¦\82Ä\82Í\82¢\82¯\82Ü\82¹\82ñ! */\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/harilibc.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/harilibc.lib
new file mode 100644 (file)
index 0000000..545fd31
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/harilibc.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/limits.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/limits.h
new file mode 100644 (file)
index 0000000..f4d9f73
--- /dev/null
@@ -0,0 +1,23 @@
+/* copyright(C) 2002 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(LIMITS_H))\r
+\r
+#define LIMITS_H       1\r
+\r
+#define CHAR_BIT       8\r
+#define        CHAR_MAX        (+127)\r
+#define CHAR_MIN       0\r
+#define INT_MAX                (+0x7fffffff)\r
+#define INT_MIN                (-0x7fffffff)\r
+#define LONG_MAX    INT_MAX\r
+#define        LONG_MIN        INT_MIN\r
+#define SCHAR_MAX      (+127)\r
+#define        SCHAR_MIN       (-127)\r
+#define        SHRT_MAX        (+0x7fff)\r
+#define SHRT_MIN       (-0x7fff)\r
+#define UCHAR_MAX      (+0xff)\r
+#define UINT_MAX       (+0xffffffff)\r
+#define ULONG_MAX      UINT_MAX\r
+#define USHRT_MAX      (+0xffff)\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/math.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/math.h
new file mode 100644 (file)
index 0000000..9df151a
--- /dev/null
@@ -0,0 +1,42 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(MATH_H))\r
+\r
+#define MATH_H 1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+double sin(double);\r
+double cos(double);\r
+double sqrt(double);\r
+double ldexp(double x, int n);\r
+double frexp(double x, int *exp);\r
+\r
+extern __inline__ double sin(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fsin" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+extern __inline__ double cos(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fcos" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+extern __inline__ double sqrt(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fsqrt" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/setjmp.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/setjmp.h
new file mode 100644 (file)
index 0000000..5512f36
--- /dev/null
@@ -0,0 +1,20 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(SETJMP_H))\r
+\r
+#define SETJMP_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+typedef int jmp_buf[3]; /* EBP, EIP, ESP */\r
+\r
+#define setjmp(env)                    __builtin_setjmp(env)\r
+#define longjmp(env, val)      __builtin_longjmp(env, val)\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/stdarg.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/stdarg.h
new file mode 100644 (file)
index 0000000..ab6b2a9
--- /dev/null
@@ -0,0 +1,21 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDARG_H))\r
+\r
+#define STDARG_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#define va_start(v,l)  __builtin_stdarg_start((v),l)\r
+#define va_end                 __builtin_va_end\r
+#define va_arg                 __builtin_va_arg\r
+#define va_copy(d,s)   __builtin_va_copy((d),(s))\r
+#define        va_list                 __builtin_va_list\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/stddef.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/stddef.h
new file mode 100644 (file)
index 0000000..95727bc
--- /dev/null
@@ -0,0 +1,17 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDDEF_H))\r
+\r
+#define STDDEF_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+typedef unsigned int size_t;\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/stdio.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/stdio.h
new file mode 100644 (file)
index 0000000..9999635
--- /dev/null
@@ -0,0 +1,24 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDIO_H))\r
+\r
+#define STDIO_H        1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#if (!defined(NULL))\r
+       #define NULL    ((void *) 0)\r
+#endif\r
+\r
+#include <stdarg.h>\r
+\r
+int sprintf(char *s, const char *format, ...);\r
+int vsprintf(char *s, const char *format, va_list arg);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/string.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/haribote/string.h
new file mode 100644 (file)
index 0000000..62bd804
--- /dev/null
@@ -0,0 +1,38 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STRING_H))\r
+\r
+#define STRING_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#include <stddef.h>            /* size_t */\r
+\r
+char *strcpy(char *s, const char *ct);\r
+char *strncpy(char *s, const char *ct, size_t n);\r
+char *strcat(char *s, const char *ct);\r
+char *strncat(char *s, const char *ct, size_t n);\r
+int strcmp(const char *cs, const char *ct);\r
+int strncmp(const char *cs, const char *ct, size_t n);\r
+char *strchr(const char *cs, int c);\r
+char *strrchr(const char *cs, int c);\r
+size_t strspn(const char *s, const char *accept);\r
+size_t strcspn(const char *s, const char *reject);\r
+char *strpbrk(const char *s, const char *accept);\r
+char *strstr(const char *cs, const char *ct);\r
+size_t strlen(const char *cs);\r
+\r
+void *memcpy(void *s, const void *ct, size_t n);\r
+void *memmove(void *s, const void *ct, size_t n);\r
+int memcmp(const void *cs, const void *ct, size_t n);\r
+void *memchr(const void *cs, int c, size_t n);\r
+void *memset(void *s, int c, size_t n);\r
+char *strdup(const char *s);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/hrb_mak.txt b/CHNOSProject/chnos/tolset_chn_000/z_tools/hrb_mak.txt
new file mode 100644 (file)
index 0000000..2cfa4cd
--- /dev/null
@@ -0,0 +1,89 @@
+TOOLPATH = ../z_tools/\r
+RULEFILE = ../z_tools/haribote/haribote.rul\r
+MAKE     = $(TOOLPATH)make.exe -r\r
+SJISCONV = $(TOOLPATH)sjisconv.exe -s\r
+CC1      = $(TOOLPATH)cc1.exe -I$(INCPATH) $(CC1OPT) -Os -Wall -quiet\r
+GAS2NASK = $(TOOLPATH)gas2nask.exe -a\r
+NASK     = $(TOOLPATH)nask.exe\r
+OBJ2BIM  = $(TOOLPATH)obj2bim.exe\r
+BIM2HRB  = $(TOOLPATH)bim2hrb.exe\r
+BIM2BIN  = $(TOOLPATH)bim2bin.exe\r
+CPP0     = $(TOOLPATH)cpp0.exe -P -I$(INCPATH)\r
+ASKA     = $(TOOLPATH)aska.exe\r
+NASKCNV  = $(TOOLPATH)naskcnv0.exe -l -s -w\r
+GOLIB    = $(TOOLPATH)golib00.exe\r
+LINK     = $(TOOLPATH)ld.exe -s -Bdynamic --stack $(STACKSIZE)\r
+EDIMG    = $(TOOLPATH)edimg.exe\r
+SARTOL   = $(TOOLPATH)sartol.exe\r
+DELE     = del\r
+COPY     = copy\r
+\r
+LIBPATH  = $(INCPATH)\r
+LIBS     = $(LIBPATH)w32clibc.lib $(LIBPATH)golibc.lib $(LIBPATH)libmingw.lib\r
+\r
+# \88È\8fã\82Ì\8d\80\96Ú\82Í\82 \82È\82½\82Ì\83f\83B\83\8c\83N\83g\83\8a\8d\\90¬\82É\82 \82í\82¹\82Ä\8f\91\82«\8a·\82¦\82é\r
+\r
+# \83f\83t\83H\83\8b\83g\93®\8dì\r
+\r
+default :\r
+       $(MAKE) $(TARGET).$(MODE)\r
+\r
+# \88ê\94Ê\8bK\91¥\r
+\r
+%.ca : %.c Makefile\r
+       $(SJISCONV) $*.c $*.ca\r
+\r
+%.gas : %.ca Makefile\r
+       $(CC1) -o $*.gas $*.ca\r
+\r
+%.nas : %.gas Makefile\r
+       $(GAS2NASK) $*.gas $*.nas\r
+\r
+%.obj : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj $*.lst\r
+\r
+%.ias : %.ask Makefile\r
+       $(CPP0) -o $*.ias $*.ask\r
+\r
+%.3as : %.ias Makefile\r
+       $(ASKA) $*.ias $*.3as\r
+\r
+%.lst : %.nas Makefile\r
+       $(NASK) $*.nas $*.obj $*.lst\r
+\r
+# \83t\83@\83C\83\8b\90\90¬\8bK\91¥\r
+\r
+$(TARGET).bim : $(OBJS) Makefile\r
+       $(OBJ2BIM) @$(RULEFILE) out:$(TARGET).bim map:$(TARGET).map \\r
+               stack:$(STACKSIZE) $(OBJS) $(INCPATH)apilib.lib\r
+\r
+%.org : %.bim Makefile\r
+       $(BIM2HRB) $*.bim $*.org $(MALLOCSIZE) $(BIMOPT0)\r
+\r
+%.hrb : %.org Makefile\r
+       $(BIM2BIN) -osacmp in:$*.org out:$*.hrb $(BIMOPT1)\r
+\r
+$(TARGET).lib : $(OBJS) Makefile\r
+       $(GOLIB) out:$@ $(OBJS)\r
+\r
+$(TARGET).exe : $(OBJS) Makefile\r
+       $(LINK) -o $(TARGET).exe -Map $(TARGET).map $(OBJS) $(LIBS)\r
+\r
+# \83R\83}\83\93\83h\r
+\r
+run :\r
+       $(MAKE) $(TARGET).$(MODE)\r
+       $(EDIMG) imgin:$(TOOLPATH)hrb_qemu/haribote.img         \\r
+               copy from:$(TARGET).$(MODE) to:@:                               \\r
+               imgout:$(TOOLPATH)qemu/fdimage0.bin\r
+       $(MAKE) -C $(TOOLPATH)qemu\r
+\r
+clean :\r
+       -$(DELE) *.obj\r
+       -$(DELE) $(TARGET).bim\r
+       -$(DELE) $(TARGET).map\r
+       -$(DELE) $(TARGET).org\r
+\r
+src_only :\r
+       $(MAKE) clean\r
+       -$(DELE) $(TARGET).$(MODE)\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/hrb_qemu/haribote.img b/CHNOSProject/chnos/tolset_chn_000/z_tools/hrb_qemu/haribote.img
new file mode 100644 (file)
index 0000000..fbcd8fa
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/hrb_qemu/haribote.img differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/imgtol.com b/CHNOSProject/chnos/tolset_chn_000/z_tools/imgtol.com
new file mode 100644 (file)
index 0000000..5ccf1dc
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/imgtol.com differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/ld.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/ld.exe
new file mode 100644 (file)
index 0000000..cf04958
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/ld.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/license.txt b/CHNOSProject/chnos/tolset_chn_000/z_tools/license.txt
new file mode 100644 (file)
index 0000000..b45e8fb
--- /dev/null
@@ -0,0 +1,117 @@
+\90ì\8d\87\93°\83\89\83C\83Z\83\93\83X-01  ver.1.0\r
+                                                   2000.12.30 H.Kawai (\90ì\8d\87\8fG\8eÀ)\r
+\r
+\82O\81D\8aT\97v\r
+\r
+  \95½\82½\82­\8c¾\82¤\82Æ\81A\81u\83t\83\8a\81[\83\\83t\83g\82Å\82·\81B\8eg\97p\91O\8eg\97p\8cã\82É\91Î\89¿\82ð\8ex\95¥\82¤\82±\82Æ\82È\82­\81A\8e©\97R\82É\8eg\r
+\82¦\82Ü\82·\81B\83R\83s\81[\82µ\82Ä\82à\82¢\82¢\82Å\82·\81B\89ü\95Ï\82µ\82Ä\82à\82¢\82¢\82Å\82·\81B\8f¤\8bÆ\97\98\97p\82µ\82Ä\82à\82¢\82¢\82Å\82·\81B\82Å\82à\83o\r
+\83O\82È\82Ç\82Å\91¹\8aQ\82ª\8fo\82Ä\82à\90Ó\94C\82Í\82Æ\82ê\82Ü\82¹\82ñ\81B\81v\82Á\82Ä\82±\82Æ\82Å\82·\81B\r
+\r
+  \97\98\97p\8eÒ\82â\89ü\95Ï\82µ\82½\82è\8eQ\8dl\82É\82µ\82½\82è\82·\82é\90l\82Ì\97\98\89v\82Ì\82½\82ß\82É\81A\83v\83\8d\83O\83\89\83\80\92\86\82Å\8eg\82Á\82Ä\82¢\82é\83A\r
+\83\8b\83S\83\8a\83Y\83\80\82Å\92\98\8dì\8eÒ\82ª\8f«\97\88\93Á\8b\96\82ð\82Æ\82é\82±\82Æ\82ª\82 \82Á\82Ä\82à\81A\93Á\8b\96\97¿\82ð\97v\8b\81\82µ\82½\82è\82Í\82µ\82È\82¢\82Æ\82¢\r
+\82¤\95Û\8fØ\82à\82 \82è\82Ü\82·\81B\r
+\r
+\82P\81D\96Ú\93I\r
+\r
+  \82±\82Ì\83\89\83C\83Z\83\93\83X\82Å\92ñ\8b\9f\82³\82ê\82é\83\\83t\83g\83E\83F\83A\82Í\81A\8f­\82µ\82Å\82à\91½\82­\82Ì\90l\82É\97\98\89v\82ð\82à\82½\82ç\82µ\81A\83\\r
+\83t\83g\83E\83F\83A\8bZ\8fp\82Ì\90i\95à\82É\8f­\82µ\82Å\82à\8dv\8c£\82Å\82«\82ê\82Î\82Æ\82¢\82¤\96Ú\93I\82Å\8cö\8aJ\82·\82é\81B\r
+\r
+\82Q\81D\8eï\8e|\r
+\r
+  \82±\82Ì\83\89\83C\83Z\83\93\83X\82Í\81A\92\98\8dì\8c \82ð\95ú\8aü\82·\82é\82à\82Ì\82Å\82Í\82È\82¢\81i\93Æ\90è\93I\82É\83R\83s\81[\82·\82é\8c \97\98\82Í\95ú\8aü\82µ\r
+\82Ä\82¢\82é\81j\81B\97\98\97p\8eÒ\82Í\82±\82Ì\83\\83t\83g\83E\83F\83A\82Ì\88ê\95\94\82Ü\82½\82Í\91S\95\94\82ð\8e©\97R\82É\83R\83s\81[\82µ\81A\8dÄ\94z\95z\82·\82é\82±\r
+\82Æ\82ª\82Å\82«\82é\81B\97\98\97p\82É\8dÛ\82µ\82Ä\91Î\89¿\82ð\97v\8b\81\82µ\82È\82¢\81B\89ð\90Í\81A\89ü\95Ï\82à\91Î\89¿\82È\82µ\82É\94F\82ß\82é\81B\r
+\r
+  \82±\82Ì\83\89\83C\83Z\83\93\83X\82ª\93K\97p\82³\82ê\82é\83\\83t\83g\83E\83F\83A\82Ì\97\98\97p\82É\82Â\82¢\82Ä\81A\8f¤\8bÆ\93I\82È\97\98\97p\82à\96³\8fð\8c\8f\82Å\94F\r
+\82ß\82é\81B\82»\82Ì\82Ü\82Ü\97L\8f\9e\82Å\94Ì\94\84\82µ\82Ä\82à\8d\\82í\82È\82¢\81B\r
+\r
+  \82±\82Ì\83\89\83C\83Z\83\93\83X\82ª\93K\97p\82³\82ê\82é\83\\83t\83g\83E\83F\83A\82Ì\88ê\95\94\82Ü\82½\82Í\91S\95\94\82ð\8c³\82É\82µ\82Ä\8dì\90¬\82³\82ê\82½\83\\83t\r
+\83g\83E\83F\83A\81i\88È\8d~\81A\94h\90\95¨\82Æ\8fÌ\82·\82é\81j\82É\91Î\82µ\81A\82Ç\82ñ\82È\83\89\83C\83Z\83\93\83X\82ð\95t\97^\82µ\82Ä\82à\82æ\82¢\81B\82·\82È\82í\r
+\82¿\81A\94h\90\95¨\82ª\83R\83s\81[\8bÖ\8e~\82Å\82 \82Á\82Ä\82à\82æ\82¢\82µ\81A\94h\90\95¨\82ª\97L\8f\9e\82Å\82µ\82©\94z\95z\82³\82ê\82È\82­\82Ä\82à\8d\\82í\82È\r
+\82¢\81B\82à\82¿\82ë\82ñ\96³\8f\9e\82Å\82 \82Á\82Ä\82à\82æ\82¢\81B\94h\90\95¨\82É\91Î\82·\82é\92\98\8dì\8c \82Í\81A\94h\90\95¨\82ð\90\90¬\82µ\82½\8eÒ\82É\8bA\82µ\r
+\81A\82±\82Ì\83\89\83C\83Z\83\93\83X\82ª\93K\97p\82³\82ê\82é\83\\83t\83g\83E\83F\83A\82Ì\92\98\8dì\8eÒ\82ª\94h\90\95¨\82É\91Î\82µ\82Ä\92\98\8dì\8c \82ð\8eå\92£\82·\82é\r
+\82±\82Æ\82Í\82È\82¢\81B\r
+\r
+  \94h\90\95¨\82Ì\83h\83L\83\85\83\81\83\93\83g\92\86\82É\81A\8c³\82É\82µ\82½\83\\83t\83g\83E\83F\83A\82Ì\92\98\8dì\8eÒ\82ð\8fÐ\89î\82·\82é\8b`\96±\82Í\82È\82¢\81B\82±\r
+\82Ì\95\82Í\81A\82à\82¿\82ë\82ñ\81A\8fÐ\89î\82·\82é\82±\82Æ\82ð\8bÖ\8e~\82·\82é\82à\82Ì\82Å\82à\82È\82¢\81B\r
+\r
+  \94h\90\95¨\82Ì\8cö\8aJ\82É\8dÛ\82µ\82Ä\81A\8c³\82É\82µ\82½\83\\83t\83g\83E\83F\83A\82Ì\92\98\8dì\8eÒ\82É\8am\94F\82ð\8eæ\82é\8b`\96±\82Í\82È\82¢\81B\82±\82Ì\r
+\95\82Í\81A\82à\82¿\82ë\82ñ\81A\8am\94F\82ð\8bÖ\8e~\82·\82é\82à\82Ì\82Å\82Í\82È\82¢\81B\r
+\r
+  \92\98\8dì\8eÒ\82Í\81A\83\\83t\83g\83E\83F\83A\82Ì\8e¿\82ð\95Û\8fØ\82µ\82È\82¢\81B\82µ\82½\82ª\82Á\82Ä\81A\82±\82Ì\83\\83t\83g\83E\83F\83A\82Å\94í\8aQ\82ð\94í\r
+\82Á\82½\82è\81A\8aú\91Ò\82µ\82½\8c\8b\89Ê\82ª\93¾\82ç\82ê\82È\82­\82Ä\82à\81A\92\98\8dì\8eÒ\82Í\90Ó\94C\82ð\95\89\82í\82È\82¢\81B\r
+\r
+  \82±\82Ì\83\89\83C\83Z\83\93\83X\82ª\93K\97p\82³\82ê\82é\83\\83t\83g\83E\83F\83A\82Å\8eg\82í\82ê\82Ä\82¢\82é\8bZ\8fp\82É\82Â\82¢\82Ä\82Í\81A\8e\96\91O\82É\92\98\8dì\r
+\8eÒ\82É\8b\96\82³\82ê\82½\8eÒ\88È\8aO\82ª\93Á\8b\96\82ð\8eæ\93¾\82·\82é\82±\82Æ\82Í\8bÖ\8e~\82·\82é\81B\90V\82½\82È\8bZ\8fp\82ð\89Á\82¦\82½\94h\90\95¨\82ð\90\90¬\r
+\82µ\81A\82»\82Ì\92Ç\89Á\82³\82ê\82½\95\94\95ª\82Ì\93Á\8b\96\82ð\82Æ\82é\82±\82Æ\82Í\94F\82ß\82é\81B\92\98\8dì\8eÒ\82ª\83\\83t\83g\83E\83F\83A\92\86\82Ì\8bZ\8fp\82É\91Î\r
+\82µ\82Ä\8cã\82©\82ç\93Á\8b\96\82ð\82Æ\82é\82±\82Æ\82Í\82 \82è\82¤\82é\82ª\81A\94h\90\95¨\82â\82±\82Ì\83\\83t\83g\83E\83F\83A\82Ì\97\98\97p\82É\91Î\82µ\82Ä\93Á\8b\96\r
+\97¿\82â\82»\82Ì\91¼\82Ì\91Î\89¿\82ð\8b\81\82ß\82é\82±\82Æ\82Í\82È\82¢\82±\82Æ\82ð\95Û\8fØ\82·\82é\81B\82±\82Ì\95Û\8fØ\82Í\81A\93Á\8b\96\8eæ\93¾\91O\82É\90\90¬\82³\r
+\82ê\82½\94h\90\95¨\82¾\82¯\82Å\82È\82­\81A\93Á\8b\96\8eæ\93¾\8cã\82É\90\90¬\82³\82ê\82½\94h\90\95¨\82É\82à\93K\97p\82³\82ê\82é\81B\r
+\r
+  \89ð\90Í\8c\8b\89Ê\82ð\82Ü\82Æ\82ß\82Ä\93Á\8b\96\82ð\82Æ\82é\82±\82Æ\82É\82Í\8e\96\91O\82Ì\92\98\8dì\8eÒ\82Ì\8b\96\89Â\82ª\95K\97v\82¾\82©\81A\93Á\8b\96\82ð\82Æ\82é\82±\r
+\82Æ\88È\8aO\82É\82Â\82¢\82Ä\82Í\89½\82ç\90§\8cÀ\82Í\82È\82¢\81B\r
+\r
+\82R\81D\95â\91«\r
+\r
+  \8aî\96{\93I\82É\81A\83R\83s\81[\82Í\91å\8a½\8c}\82Å\82·\81B\82à\82µ\81A\92\98\8dì\8eÒ\82É\89½\82©\89\82ð\8a´\82\82½\82ç\81A\88ê\90l\82Å\82à\91½\82­\82Ì\90l\r
+\82É\82±\82Ì\83\\83t\83g\83E\83F\83A\82ð\82·\82·\82ß\82Ä\81A\83R\83s\81[\82µ\82Ä\82 \82°\82Ä\89º\82³\82¢\81B\92\98\8dì\8eÒ\82Í\91½\82­\82Ì\90l\82É\8eg\82Á\82Ä\82à\r
+\82ç\82¢\82½\82¢\82Æ\8ev\82Á\82Ä\82¢\82é\82Ì\82Å\81A\83R\83s\81[\82·\82ê\82Î\92\98\8dì\8eÒ\82Í\8aì\82Ñ\82Ü\82·\81B\82»\82ê\82Å\82à\91«\82è\82È\82¢\82Æ\8a´\82\82½\r
+\82ç\81A\90¥\94ñ\81A\8a´\91z\82ð\92\98\8dì\8eÒ\82É\91\97\82Á\82Ä\82 \82°\82Ä\89º\82³\82¢\81B\82»\82¤\82·\82ê\82Î\81A\82à\82Á\82Æ\8aì\82Ô\82Å\82µ\82å\82¤\81B\r
+\r
+  \82±\82ê\82Å\83\89\83C\83Z\83\93\83X\82³\82ê\82½\83\\83t\83g\83E\83F\83A\82Ì\92\98\8dì\8c \8fî\95ñ\82¾\82¯\82ð\89ü\95Ï\82µ\81A\82»\82ê\82ð\8dÄ\94z\95z\82·\82é\82±\r
+\82Æ\82Í\82±\82Ì\83\89\83C\83Z\83\93\83X\82É\82æ\82Á\82Ä\8bÖ\8e~\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B\94h\90\95¨\88µ\82¢\82Å\82·\81B\82±\82ê\82Í\94²\82¯\8c\8a\82Å\82Í\82È\r
+\82¢\82Å\82·\81B\82µ\82½\82ª\82Á\82Ä\81A\92\98\8dì\8c \8fî\95ñ\82¾\82¯\82ð\8f\91\82«\8a·\82¦\82Ä\8dÄ\94z\95z\82·\82é\82±\82Æ\82ª\95K\97v\82È\82ç\81A\82µ\82Ä\82¢\82½\r
+\82¾\82¢\82Ä\82©\82Ü\82¢\82Ü\82¹\82ñ\81B\r
+\r
+  \83o\83O\82ð\8eæ\82Á\82½\82è\81A\8b@\94\\82ð\92Ç\89Á\82µ\82Ä\82¢\82½\82¾\82­\82Ì\82Í\82à\82¿\82ë\82ñ\82Å\82·\82ª\81A\83v\83\8d\83O\83\89\83\80\82É\92\90\8eß\82ð\95t\r
+\82¯\82Ä\93Ç\82Ý\82â\82·\82­\82µ\82½\82è\81A\83h\83L\83\85\83\81\83\93\83g\82ð\95â\91«\82·\82é\82È\82Ç\81A\82»\82¤\82¢\82¤\83o\83C\83i\83\8a\81[\82â\8eÀ\8ds\8c\8b\89Ê\82É\r
+\94½\89f\82³\82ê\82È\82¢\82æ\82¤\82È\89ü\95Ï\82à\91å\8a½\8c}\82Å\82·\81B\82»\82¤\82¢\82¤\94h\90\95¨\82ª\82Å\82«\82½\82ç\81A\98A\97\8d\82µ\82Ä\82à\82ç\82¦\82é\82Æ\r
+\82¤\82ê\82µ\82¢\82Å\82·\81i\8b`\96±\82Å\82Í\82 \82è\82Ü\82¹\82ñ\81j\81B\r
+\r
+  \89½\82©\8b^\96â\93_\82ª\82 \82Á\82½\82è\81A\94h\90\95¨\82ð\8dì\90¬\82·\82é\8fã\82Å\8fî\95ñ\82ª\95s\91«\82µ\82Ä\82¢\82é\82Æ\8a´\82\82½\82ç\81A\92\98\8dì\8eÒ\r
+\82É\98A\97\8d\82ð\82Æ\82Á\82Ä\8e¿\96â\82·\82é\82±\82Æ\82ª\82Å\82«\82Ü\82·\81B\82½\82¾\81A\92\98\8dì\8eÒ\82Ì\93s\8d\87\82Å\82·\82®\82É\82Í\95Ô\8e\96\82ª\82Å\82«\82È\82¢\r
+\82©\82à\82µ\82ê\82Ü\82¹\82ñ\81B\82»\82ê\82Í\82²\97e\8eÍ\82­\82¾\82³\82¢\81B\82±\82Ì\83\89\83C\83Z\83\93\83X\82»\82Ì\82à\82Ì\82Ì\95s\94õ\82È\82Ç\82ð\8ew\93E\82·\82é\r
+\8fê\8d\87\82Í\81A\92\98\8dì\8eÒ\82©\90ì\8d\87\93°\82É\82²\98A\97\8d\82­\82¾\82³\82¢\81B\r
+\r
+  \82à\82µ\82©\82·\82é\82Æ\81A\82±\82ê\82Å\83\89\83C\83Z\83\93\83X\82³\82ê\82½\83\\83t\83g\83E\83F\83A\82Å\97\98\97p\82³\82ê\82Ä\82¢\82é\8bZ\8fp\82É\82Â\82¢\82Ä\81A\r
+\92\98\8dì\8eÒ\82Ì\8b\96\89Â\82Ì\96³\82¢\8eÒ\82ª\93Á\8b\96\82ð\8eæ\93¾\82·\82é\82±\82Æ\82ð\8bÖ\82\82Ä\82¢\82é\82±\82Æ\82ª\81A\93ú\96{\82Ì\93Á\8b\96\96@\82É\92ï\90G\82µ\r
+\82Ä\82¢\82é\82©\82à\82µ\82ê\82Ü\82¹\82ñ\81i\82²\88Ó\8c©\82ð\91Ò\82Á\82Ä\82¢\82Ü\82·\81j\81B\82±\82ê\82É\82Â\82¢\82Ä\81A\83\89\83C\83Z\83\93\83X\82ð\8dÅ\8f\89\82É\92ñ\r
+\8f¥\82µ\82½\90ì\8d\87\8fG\8eÀ\82Ì\8c©\89ð\82ð\88È\89º\82É\8f\91\82¢\82Ä\82¨\82«\82Ü\82·\81B\r
+\r
+  \93Á\8b\96\96@\82ª\90§\92è\82³\82ê\82½\94w\8ci\82É\82Í\81A\94­\96¾\8eÒ\82ª\8e©\95ª\82Ì\94­\96¾\82É\82æ\82é\97\98\89v\82ð\8eç\82é\82½\82ß\82É\94­\96¾\82Ì\8fÚ\8d×\r
+\82ð\8cö\95\\82µ\82È\82¢\82±\82Æ\82ª\89È\8aw\8bZ\8fp\82Ì\90i\95à\82ð\92x\82ç\82¹\82é\82©\82ç\81A\8cö\95\\82µ\82Ä\82à\82ç\82¤\91ã\82í\82è\82É\88ê\92è\8aú\8aÔ\82Ì\r
+\93Æ\90è\97\98\97p\82ð\96@\93I\82É\95Û\8cì\82·\82é\81A\82Æ\82¢\82¤\90¸\90_\82ª\82 \82è\82Ü\82·\81B\82±\82Ì\83\89\83C\83Z\83\93\83X\82Å\82Í\81A\94­\96¾\82Ì\8fÚ\8d×\82ð\r
+\88Ó\90}\93I\82É\89B\82·\82Â\82à\82è\82Í\82È\82­\81A\82µ\82½\82ª\82Á\82Ä\93Á\8b\96\82ð\8eæ\82é\82±\82Æ\82ð\8bÖ\8e~\82µ\82Ä\82à\93Á\8b\96\96@\82Ì\90¸\90_\82É\82Í\94½\r
+\82µ\82Ä\82¢\82È\82¢\82Æ\8dl\82¦\82Ä\82¢\82Ü\82·\81B\82Þ\82µ\82ë\81A\82±\82Ì\83\89\83C\83Z\83\93\83X\82Ì\90¸\90_\82ð\8b\82\82Ü\82È\82¢\8eÒ\82ª\93Á\8b\96\82ð\8eæ\93¾\82µ\r
+\83I\83\8a\83W\83i\83\8b\82Ì\83\\83t\83g\83E\83F\83A\82â\94h\90\95¨\82É\91Î\82µ\82Ä\93Á\8b\96\97¿\82ð\90¿\8b\81\82·\82é\82©\82à\82µ\82ê\82È\82¢\95s\88À\82Ì\95û\82ª\81A\r
+\89È\8aw\8bZ\8fp\82Ì\90i\95à\82ð\92x\82ç\82¹\82é\82Æ\8dl\82¦\82Ü\82·\81B\82µ\82½\82ª\82Á\82Ä\81A\82»\82Ì\95s\88À\82ð\8e\96\91O\82É\95¥\90@\82µ\82½\82±\82Ì\83\89\83C\r
+\83Z\83\93\83X\82Í\93Á\8b\96\96@\82É\93K\82Á\82½\82à\82Ì\82¾\82Æ\8dl\82¦\82Ä\82¢\82Ü\82·\81B\r
+\r
+  \82à\82¿\82ë\82ñ\81A\88ê\94Ô\88À\90S\82È\82Ì\82Í\81A\83I\83\8a\83W\83i\83\8b\82Ì\83\\83t\83g\83E\83F\83A\82Å\94­\96¾\82Æ\94F\82ß\82ç\82ê\82é\82·\82×\82Ä\82Ì\82à\r
+\82Ì\82É\82Â\82¢\82Ä\92\98\8dì\8eÒ\82ª\93Á\8b\96\82ð\8eæ\93¾\82µ\82Ä\81A\91¼\8eÒ\82Ì\93Á\8b\96\8eæ\93¾\82ð\8e\96\91O\82É\96W\82°\82ê\82Î\82¢\82¢\82Ì\82Å\82·\82ª\81A\82»\r
+\82ê\82Í\92\98\8dì\8eÒ\82É\82Í\95\89\92S\82É\82È\82é\8fê\8d\87\82ª\82 \82è\82Ü\82·\81B\82»\82Ì\95\89\92S\82Æ\83\\83t\83g\83E\83F\83A\82ð\8cö\8aJ\82·\82é\82©\82Ç\82¤\82©\r
+\82ð\93V\94\89\82É\82©\82¯\82È\82¯\82ê\82Î\82¢\82¯\82È\82¢\82Æ\82µ\82½\82ç\81A\8cö\8aJ\82ð\82 \82«\82ç\82ß\82Ä\82µ\82Ü\82¤\8fê\8d\87\82à\82 \82é\82©\82à\82µ\82ê\82Ü\r
+\82¹\82ñ\81B\82»\82ê\82Í\93Á\8b\96\96@\82Ì\90¸\90_\82Ì\8aú\91Ò\82·\82é\82à\82Ì\82Å\82Í\82 \82è\82Ü\82¹\82ñ\82µ\81A\89ä\81X\82Ì\96Ú\93I\81i\81u\82P\81D\96Ú\93I\81v\r
+\82ð\8eQ\8fÆ\81j\82É\82à\89\88\82¢\82Ü\82¹\82ñ\81B\r
+\r
+  \82Ü\82½\81A\94­\96¾\82Ì\8fÚ\8d×\82ª\93Á\8b\96\96@\82Ì\8c`\8e®\82É\82æ\82Á\82Ä\8bL\8fq\82³\82ê\82Ä\82¢\82È\82¢\82½\82ß\82É\96¾\82ç\82©\82Å\82È\82¢\8fê\8d\87\81A\r
+\92\98\8dì\8eÒ\88È\8aO\82Ì\82à\82Ì\82ª\8b\96\89Â\82È\82­\82»\82ê\82ð\89ð\90Í\82µ\82Ä\96¾\82ç\82©\82É\82·\82é\82±\82Æ\82Í\81A\82±\82Ì\83\89\83C\83Z\83\93\83X\82Å\94F\82ß\r
+\82ç\82ê\82Ä\82¢\82Ä\82¢\82Ü\82·\81B\82»\82ê\82ð\96³\8f\9e\82Å\8cö\8aJ\82µ\82Ä\82à\82¢\82¢\82Å\82·\82µ\81A\97L\8f\9e\82Å\94Ì\94\84\82·\82é\82±\82Æ\82à\82Å\82«\82Ü\82·\r
+\81B\r
+\r
+  \82È\82¨\81A\82±\82ê\82Å\83\89\83C\83Z\83\93\83X\82³\82ê\82½\83\\83t\83g\83E\83F\83A\92\86\82Ì\82·\82×\82Ä\82Ì\8bZ\8fp\82É\91Î\82µ\82Ä\81A\97\98\97p\82É\8dÛ\82µ\82Ä\r
+\93Á\8b\96\97¿\82ð\8ex\95¥\82¤\90S\94z\82ª\91S\82­\96³\82¢\82í\82¯\82Å\82Í\82 \82è\82Ü\82¹\82ñ\81B\8cö\8aJ\82Ì\8e\9e\93_\82Å\97L\8cø\82È\93Á\8b\96\82É\82æ\82é\8bZ\8fp\r
+\82ª\83\\83t\83g\83E\83F\83A\93à\82Å\8eg\82í\82ê\82Ä\82¢\82ê\82Î\81A\82»\82ê\82É\82Â\82¢\82Ä\82Í\93Á\8b\96\95Û\8e\9d\8eÒ\82©\82ç\82Ì\93Á\8b\96\97¿\97v\8b\81\82ª\82 \82è\r
+\82¦\82Ü\82·\81B\82±\82Ì\83\89\83C\83Z\83\93\83X\82ª\93Á\8b\96\97¿\82Ì\90S\94z\96³\82µ\82Æ\95Û\8fØ\82µ\82Ä\82¢\82é\82Ì\82Í\81A\82±\82Ì\83\\83t\83g\83E\83F\83A\93à\82Å\r
+\90V\82½\82É\94­\96¾\82Æ\94F\82ß\82ç\82ê\82é\8bZ\8fp\82É\91Î\82µ\82Ä\82Ì\82Ý\82Å\82·\81B\r
+\r
+  \82±\82Ì\83\89\83C\83Z\83\93\83X\82ð\8e©\95ª\82Ì\83\\83t\83g\83E\83F\83A\82É\93K\97p\82µ\82½\82¢\82Æ\8ev\82¤\95û\82ª\82¨\82ç\82ê\82Ü\82µ\82½\82ç\81A\8e\96\91O\81E\r
+\8e\96\8cã\82É\8b\96\89Â\82ð\8b\81\82ß\82é\82±\82Æ\82È\82­\8eg\82Á\82Ä\82¢\82½\82¾\82¢\82Ä\82©\82Ü\82¢\82Ü\82¹\82ñ\81B\82à\82µ\95s\93s\8d\87\82ª\82 \82ê\82Î\81A\83\89\83C\r
+\83Z\83\93\83X\95\82ð\89ü\95Ï\82µ\82Ä\8eg\82Á\82Ä\82¢\82½\82¾\82¢\82Ä\82à\82¢\82¢\82Å\82·\81B\89ü\95Ï\82Ì\8dÛ\82É\82Í\81A\8d¬\97\90\82ð\96h\82®\82½\82ß\82É\83\89\83C\r
+\83Z\83\93\83X\96¼\82ð\95Ï\8dX\82·\82é\82Ì\82ð\96Y\82ê\82È\82¢\82æ\82¤\82É\82µ\82Ä\82­\82¾\82³\82¢\81B\r
+\r
+\82S\81D\83\8a\83\93\83N\r
+\r
+  \90ì\8d\87\93°URL       http://www.imasy.org/~mone/kawaido/\r
+  \90ì\8d\87\8fG\8eÀURL     http://www.imasy.org/~kawai/\r
+          e-mail  kawai@imasy.org\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/make.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/make.exe
new file mode 100644 (file)
index 0000000..80d6b82
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/make.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/makefont.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/makefont.exe
new file mode 100644 (file)
index 0000000..b525aa0
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/makefont.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/mkisofs.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/mkisofs.exe
new file mode 100644 (file)
index 0000000..5df1818
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/mkisofs.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/nask.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/nask.exe
new file mode 100644 (file)
index 0000000..3a319b1
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/nask.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/naskcnv0.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/naskcnv0.exe
new file mode 100644 (file)
index 0000000..1e1d0f1
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/naskcnv0.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/nothing.com b/CHNOSProject/chnos/tolset_chn_000/z_tools/nothing.com
new file mode 100644 (file)
index 0000000..1178bd3
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/nothing.com differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/obj2bim.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/obj2bim.exe
new file mode 100644 (file)
index 0000000..15aa7df
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/obj2bim.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/osalink1.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/osalink1.exe
new file mode 100644 (file)
index 0000000..13fdb90
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/osalink1.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/Makefile b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/Makefile
new file mode 100644 (file)
index 0000000..80e94c8
--- /dev/null
@@ -0,0 +1,2 @@
+default :\r
+       qemu-win.bat\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/SDL.dll b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/SDL.dll
new file mode 100644 (file)
index 0000000..abf9686
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/SDL.dll differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/bios.bin b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/bios.bin
new file mode 100644 (file)
index 0000000..fe9816e
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/bios.bin differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/qemu-win.bat b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/qemu-win.bat
new file mode 100644 (file)
index 0000000..a393b18
--- /dev/null
@@ -0,0 +1,4 @@
+@set SDL_VIDEODRIVER=windib\r
+@set QEMU_AUDIO_DRV=none\r
+@set QEMU_AUDIO_LOG_TO_MONITOR=0\r
+qemu.exe -L . -m 32 -localtime -std-vga -fda fdimage0.bin
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/qemu.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/qemu.exe
new file mode 100644 (file)
index 0000000..ea966e3
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/qemu.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/vgabios.bin b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/vgabios.bin
new file mode 100644 (file)
index 0000000..78e9c9c
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu/vgabios.bin differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/Makefile b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/Makefile
new file mode 100644 (file)
index 0000000..24e9533
--- /dev/null
@@ -0,0 +1,2 @@
+default :\r
+       qemu.exe -L . --fda fdimage0.bin\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/SDL.dll b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/SDL.dll
new file mode 100644 (file)
index 0000000..414b449
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/SDL.dll differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/bios.bin b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/bios.bin
new file mode 100644 (file)
index 0000000..ae2240b
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/bios.bin differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/qemu.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/qemu.exe
new file mode 100644 (file)
index 0000000..77ce330
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/qemu.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/vgabios.bin b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/vgabios.bin
new file mode 100644 (file)
index 0000000..78e9c9c
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_9x/vgabios.bin differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/Makefile b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/Makefile
new file mode 100644 (file)
index 0000000..4c82253
--- /dev/null
@@ -0,0 +1,2 @@
+default :\r
+       qemu-x86_64.bat\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/SDL.dll b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/SDL.dll
new file mode 100644 (file)
index 0000000..b2236fc
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/SDL.dll differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/bios.bin b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/bios.bin
new file mode 100644 (file)
index 0000000..14ea6a6
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/bios.bin differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/fmod.dll b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/fmod.dll
new file mode 100644 (file)
index 0000000..6b0e379
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/fmod.dll differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/qemu-system-x86_64.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/qemu-system-x86_64.exe
new file mode 100644 (file)
index 0000000..111606e
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/qemu-system-x86_64.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/qemu-x86_64.bat b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/qemu-x86_64.bat
new file mode 100644 (file)
index 0000000..720a6c0
--- /dev/null
@@ -0,0 +1 @@
+qemu-system-x86_64.exe -L . -m 128 -cdrom chnos.iso -soundhw all -localtime -std-vga\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/vgabios.bin b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/vgabios.bin
new file mode 100644 (file)
index 0000000..78e9c9c
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/qemu_iso/vgabios.bin differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/sartol.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/sartol.exe
new file mode 100644 (file)
index 0000000..c3074af
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/sartol.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/sjisconv.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/sjisconv.exe
new file mode 100644 (file)
index 0000000..bc3fb2d
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/sjisconv.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/t5lzma.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/t5lzma.exe
new file mode 100644 (file)
index 0000000..d069510
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/t5lzma.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/!cons_9x.bat b/CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/!cons_9x.bat
new file mode 100644 (file)
index 0000000..e42252a
--- /dev/null
@@ -0,0 +1 @@
+command
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/!cons_nt.bat b/CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/!cons_nt.bat
new file mode 100644 (file)
index 0000000..6e07473
--- /dev/null
@@ -0,0 +1 @@
+cmd.exe
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/Makefile b/CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/Makefile
new file mode 100644 (file)
index 0000000..a4d0353
--- /dev/null
@@ -0,0 +1,10 @@
+TARGET     = bim2chn\r
+MODE       = exe\r
+OBJS       = $(TARGET).obj\r
+STACKSIZE  = 0x1000000 # 16MB (default)\r
+\r
+INCPATH    = ../z_tools/win32/\r
+CC1OPT     = -Dmain=main0\r
+include ../z_tools/com_mak.txt\r
+\r
+# tolset08\91Î\89\9eMakefile\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/bim2chn.c b/CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/bim2chn.c
new file mode 100644 (file)
index 0000000..e4c65ad
--- /dev/null
@@ -0,0 +1,180 @@
+#include <stdio.h>\r
+#include <stdlib.h>\r
+\r
+typedef unsigned char UCHAR;\r
+int getnum(const UCHAR *p);\r
+int get32(const UCHAR *p);\r
+void put32(UCHAR *p, int i);\r
+\r
+#define MAXSIZ 4 * 1024 * 1024\r
+\r
+int main(int argc, UCHAR **argv)\r
+{\r
+       UCHAR *fbuf = malloc(MAXSIZ);\r
+       int heap_siz, mmarea, fsiz, dsize, dofs, stksiz, wrksiz, entry, bsssiz;\r
+       int heap_adr, i;\r
+       FILE *fp;\r
+       static UCHAR sign[4] = "CHNP";\r
+\r
+       /* \83p\83\89\83\81\81[\83^\82Ì\8eæ\93¾ */\r
+       if (argc < 4) {\r
+               puts("usage>bim2chn appname.bim appname.chn heap-size [mmarea-size]");\r
+               return 1;\r
+       }\r
+       heap_siz = getnum(argv[3]);\r
+       mmarea = 0;\r
+       if (argc >= 5)\r
+               mmarea = getnum(argv[4]);\r
+\r
+       /* \83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý */\r
+       fp = fopen(argv[1], "rb");\r
+       if (fp == NULL) {\r
+err_bim:\r
+               puts("bim file read error");\r
+               return 1;\r
+       }\r
+       fsiz = fread(fbuf, 1, MAXSIZ, fp);\r
+       fclose(fp);\r
+       if (fsiz >= MAXSIZ || fsiz < 0)\r
+               goto err_bim;\r
+\r
+       /* \83w\83b\83_\8am\94F */\r
+       if (get32(&fbuf[4]) != 0x24) {  /* \83t\83@\83C\83\8b\92\86\82Ì.text\83X\83^\81[\83g\83A\83h\83\8c\83X */\r
+err_form:\r
+               puts("bim file format error");\r
+               return 1;\r
+       }\r
+       if (get32(&fbuf[8]) != 0x24)    /* \83\81\83\82\83\8a\83\8d\81[\83h\8e\9e\82Ì.text\83X\83^\81[\83g\83A\83h\83\8c\83X */\r
+               goto err_form;\r
+       dsize  = get32(&fbuf[12]);      /* .data\83Z\83N\83V\83\87\83\93\83T\83C\83Y */\r
+       dofs   = get32(&fbuf[16]);      /* \83t\83@\83C\83\8b\82Ì\82Ç\82±\82É.data\83Z\83N\83V\83\87\83\93\82ª\82 \82é\82© */\r
+       stksiz = get32(&fbuf[20]);      /* \83X\83^\83b\83N\83T\83C\83Y */\r
+       entry  = get32(&fbuf[24]);      /* \83G\83\93\83g\83\8a\83|\83C\83\93\83g */\r
+       bsssiz = get32(&fbuf[28]);      /* bss\83T\83C\83Y */\r
+\r
+       /* \83w\83b\83_\90\90¬ */\r
+       heap_adr = stksiz + dsize + bsssiz;\r
+       heap_adr = (heap_adr + 0xf) & 0xfffffff0; /* 16\83o\83C\83g\92P\88Ê\82É\90Ø\82è\8fã\82° */\r
+       wrksiz = heap_adr + heap_siz;\r
+       wrksiz = (wrksiz + 0xfff) & 0xfffff000; /* 4KB\92P\88Ê\82É\90Ø\82è\8fã\82° */\r
+       put32(&fbuf[ 0], wrksiz);\r
+       for (i = 0; i < 4; i++)\r
+               fbuf[4 + i] = sign[i];\r
+       put32(&fbuf[ 8], mmarea);\r
+       put32(&fbuf[12], stksiz);\r
+       put32(&fbuf[16], dsize);\r
+       put32(&fbuf[20], dofs);\r
+       put32(&fbuf[24], 0xe9000000);\r
+       put32(&fbuf[28], entry - 0x20);\r
+       put32(&fbuf[32], heap_adr);\r
+\r
+       /* \83t\83@\83C\83\8b\8f\91\82«\8d\9e\82Ý */\r
+       fp = fopen(argv[2], "wb");\r
+       if (fp == NULL) {\r
+err_chn:\r
+               puts("chn file write error");\r
+               return 1;\r
+       }\r
+       i = fwrite(fbuf, 1, fsiz, fp);\r
+       fclose(fp);\r
+       if (fsiz != i)\r
+               goto err_chn;\r
+\r
+       return 0;\r
+}\r
+\r
+int getnum(const UCHAR *p)\r
+{\r
+       int i = 0, base = 10, sign = 1;\r
+       UCHAR c;\r
+       if (*p == '-') {\r
+               p++;\r
+               sign = -1;\r
+       }\r
+       if (*p == '0') {\r
+               p++;\r
+               base = 8;\r
+               c = *p;\r
+               if (c >= 'a')\r
+                       c -= 'a' - 'A';\r
+               if (c == 'X') {\r
+                       p++;\r
+                       base = 16;\r
+               }\r
+               if (c == 'O') {\r
+                       p++;\r
+                       base = 8;\r
+               }\r
+               if (c == 'B') {\r
+                       p++;\r
+                       base = 2;\r
+               }\r
+       }\r
+       for (;;) {\r
+               c = *p++;\r
+               if ('0' <= c && c <= '9')\r
+                       c -= '0'; \r
+               else if ('A' <= c && c <= 'F')\r
+                       c -= 'A' - 10;\r
+               else if ('a' <= c && c <= 'f')\r
+                       c -= 'a' - 10;\r
+               else\r
+                       break;\r
+               if (c >= base)\r
+                       break;\r
+               i = i * base + c;\r
+       }\r
+       if (c >= 'a')\r
+               c -= 'a' - 'A';\r
+       if (c == 'K')\r
+               i <<= 10;\r
+       if (c == 'M')\r
+               i <<= 20;\r
+       if (c == 'G')\r
+               i <<= 30;\r
+       return i * sign;\r
+}\r
+\r
+int get32(const UCHAR *p)\r
+{\r
+       return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;\r
+}\r
+\r
+void put32(UCHAR *p, int i)\r
+{\r
+       p[0] =  i        & 0xff;\r
+       p[1] = (i >>  8) & 0xff;\r
+       p[2] = (i >> 16) & 0xff;\r
+       p[3] = (i >> 24) & 0xff;\r
+       return;\r
+}\r
+\r
+/*\r
+\r
+memo\r
+\r
+[ .bim\83t\83@\83C\83\8b\82Ì\8d\\91¢ ]\r
+\r
++ 0 : .text\83T\83C\83Y\r
++ 4 : \83t\83@\83C\83\8b\92\86\82Ì.text\83X\83^\81[\83g\83A\83h\83\8c\83X\81i0x24\81j\r
++ 8 : \83\81\83\82\83\8a\83\8d\81[\83h\8e\9e\82Ì.text\83X\83^\81[\83g\83A\83h\83\8c\83X\81i0x24\81j\r
++12 : .data\83T\83C\83Y\r
++16 : \83t\83@\83C\83\8b\92\86\82Ì.data\83X\83^\81[\83g\83A\83h\83\8c\83X\r
++20 : \83\81\83\82\83\8a\83\8d\81[\83h\8e\9e\82Ì.data\83X\83^\81[\83g\83A\83h\83\8c\83X\r
++24 : \83G\83\93\83g\83\8a\83|\83C\83\93\83g\r
++28 : bss\97Ì\88æ\82Ì\83o\83C\83g\90\94\r
++36 : \83R\81[\83h\r
+\r
+[ .chn\83t\83@\83C\83\8b\82Ì\8d\\91¢ (.hrb\82Æ\83V\83O\83l\83`\83\83\88È\8aO\93¯\93\99)]\r
+\r
++ 0 : stack+.data+heap \82Ì\91å\82«\82³\81i4KB\82Ì\94{\90\94\81j\r
++ 4 : \83V\83O\83l\83`\83\83 "CHNP"\r
++ 8 : mmarea \82Ì\91å\82«\82³\81i4KB\82Ì\94{\90\94\81j\r
++12 : \83X\83^\83b\83N\8f\89\8aú\92l\81\95.data\93]\91\97\90æ\r
++16 : .data\82Ì\83T\83C\83Y\r
++20 : .data\82Ì\8f\89\8aú\92l\97ñ\82ª\83t\83@\83C\83\8b\82Ì\82Ç\82±\82É\82 \82é\82©\r
++24 : 0xe9000000\r
++28 : \83G\83\93\83g\83\8a\83A\83h\83\8c\83X-0x20\r
++32 : heap\97Ì\88æ\81imalloc\97Ì\88æ\81j\8aJ\8en\83A\83h\83\8c\83X\r
+\r
+*/\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/make.bat b/CHNOSProject/chnos/tolset_chn_000/z_tools/tolsrc_chn/bim2chn/make.bat
new file mode 100644 (file)
index 0000000..e489766
--- /dev/null
@@ -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/CHNOSProject/chnos/tolset_chn_000/z_tools/tset_chn.txt b/CHNOSProject/chnos/tolset_chn_000/z_tools/tset_chn.txt
new file mode 100644 (file)
index 0000000..a833b1b
--- /dev/null
@@ -0,0 +1,42 @@
+tolset_chn\82Ì\90à\96¾\8f\91\81i11:23 2011/07/02\81j\r
+  \82±\82ê\82Í\81u30\93ú\82Å\82Å\82«\82é\81I OS\8e©\8dì\93ü\96å\81v\82É\82Â\82¢\82Ä\82¢\82étolset\82ð\83p\83\8f\81[\83A\83b\83v\82µ\82½\82à\82Ì\82Å\82·\81B\r
+\82Æ\8b¤\82É\81ACHNOSProject\82ð\8aJ\94­\82µ\82½\82è\81A\83e\83X\83g\82·\82é\82½\82ß\82Ì\92Ç\89Á\82à\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82·\81B\r
+\r
+\82±\82Ì\83p\83b\83P\81[\83W\82É\82Í\81AOS\82Í\8aÜ\82Ü\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B\r
+OS\82Ì\83\\81[\83X\82ð\83_\83E\83\93\83\8d\81[\83h\82µ\81A\89ð\93\80\82µ\82½\82ç\81Achnos_xxx\83t\83H\83\8b\83_\82ð\81Az_tools\83t\83H\83\8b\83_\82Æ\93¯\82\8aK\91w\82É\83R\83s\81[\82µ\82Ä\82­\82¾\82³\82¢\81B\r
+\82»\82ê\88È\8d~\82Í\81A\82»\82Ì\83\\81[\83X\82É\95\8d\91®\82µ\82Ä\82¢\82é\83h\83L\83\85\83\81\83\93\83g\82ð\8eQ\8fÆ\82µ\82Ä\82­\82¾\82³\82¢\81B\r
+\r
+\8aî\96{\93I\82É\81A\82±\82Ì\83p\83b\83P\81[\83W\82Ì\92\86\82É\8aÜ\82Ü\82ê\82Ä\82¢\82é\82à\82Ì\82Í\82Ù\82Æ\82ñ\82Ç\82ª\81A\82±\82Ì\83t\83@\83C\83\8b\82Æ\93¯\82\8aK\91w\82É\82 \82é\81ulicense.txt\81v\82É\82 \82é\81A\r
+KL-01\82Æ\82È\82Á\82Ä\82¢\82Ü\82·\81B\r
+\r
+KL-01\82Å\82È\82¢\82à\82Ì\82Í\81A\8e\9f\82Ì\92Ê\82è\82Å\82·\81B\r
+       cc1.exe\r
+       cpp0.exe\r
+       ld.exe\r
+       make.exe\r
+       upx.exe\r
+       \8fã\8bL\82Ì\82à\82Ì\82Í\81AGPL\83\89\83C\83Z\83\93\83X\82ª\93K\97p\82³\82ê\82Ü\82·\81B\r
+       t5lzma.exe\r
+       qemu/qemu.exe\r
+       qemu/bios.bin\r
+       qemu/SDL.bin\r
+       qemu_9x/qemu.exe\r
+       qemu_9x/bios.bin\r
+       qemu_9x/SDL.bin\r
+       qemu_iso/bios.bin\r
+       qemu_iso/qemu-system-x86_64.exe\r
+       qemu_iso/qemu-x86_64.bat\r
+       qemu_iso/SDL.exe\r
+       bochs/bochs-smp.exe\r
+       bochs/bios.bin\r
+       \8fã\8bL\82Ì\82à\82Ì\82Í\81ALGPL\83\89\83C\83Z\83\93\83X\82ª\93K\97p\82³\82ê\82Ü\82·\81B\r
+\r
+       RWFD.EXE\r
+       RWFD.TXT\82ð\8eQ\8fÆ\82µ\82Ä\82­\82¾\82³\82¢\81B\r
+\r
+       \83\89\83C\83Z\83\93\83X\82É\82Â\82¢\82Ä\82Í\81A\8fÚ\82µ\82­\8am\94F\82µ\82Ä\82¢\82È\82¢\82Ì\82Å\81A\8aÔ\88á\82¢\82ª\82 \82é\82©\82à\82µ\82ê\82Ü\82¹\82ñ\81B\r
+       \8aÔ\88á\82¢\82Ì\8ew\93E\81A\91å\8a½\8c}\82Å\82·\81B\r
+\r
+hikarupsp:\r
+       hikarupsp@users.sourceforge.jp\r
+       http://sourceforge.jp/projects/chnosproject/
\ No newline at end of file
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/upx.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/upx.exe
new file mode 100644 (file)
index 0000000..d478568
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/upx.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/wce.exe b/CHNOSProject/chnos/tolset_chn_000/z_tools/wce.exe
new file mode 100644 (file)
index 0000000..58df3f4
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/wce.exe differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/errno.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/errno.h
new file mode 100644 (file)
index 0000000..c1ffd85
--- /dev/null
@@ -0,0 +1,20 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(ERRNO_H))\r
+\r
+#define ERRNO_H        1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+extern int errno;\r
+\r
+#define        ENOENT          2       /* No such file or directory */\r
+#define        ERANGE          34      /* Result too large (or too small) */\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/float.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/float.h
new file mode 100644 (file)
index 0000000..943ba62
--- /dev/null
@@ -0,0 +1,26 @@
+/* copyright(C) 2002 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(FLOAT_H))\r
+\r
+#define FLOAT_H                        1\r
+\r
+#define FLT_RADIX              2\r
+#define FLT_ROUNDS             1 /* nearest */\r
+#define FLT_DIG                        6\r
+#define FLT_EPSILON            1.19209290e-07F\r
+#define FLT_MANT_DIG   24\r
+#define FLT_MAX                        3.40282347e+38F\r
+#define FLT_MAX_EXP            (+128)\r
+#define FLT_MIN                        1.17549435e-38F\r
+#define FLT_MIN_EXP            (-125)\r
+\r
+#define DBL_DIG                        15\r
+#define DBL_EPSILON            2.2204460492503131e-16\r
+#define DBL_MANT_DIG   53\r
+#define DBL_MAX                        1.7976931348623157e+308\r
+#define DBL_MAX_EXP            1024\r
+#define DBL_MIN                        2.2250738585072014e-308\r
+#define DBL_MIN_EXP            (-1021)\r
+\r
+#endif\r
+\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/golibc.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/golibc.lib
new file mode 100644 (file)
index 0000000..f2a29f3
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/golibc.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/libmingw.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/libmingw.lib
new file mode 100644 (file)
index 0000000..b3d2ae7
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/libmingw.lib differ
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/limits.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/limits.h
new file mode 100644 (file)
index 0000000..f4d9f73
--- /dev/null
@@ -0,0 +1,23 @@
+/* copyright(C) 2002 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(LIMITS_H))\r
+\r
+#define LIMITS_H       1\r
+\r
+#define CHAR_BIT       8\r
+#define        CHAR_MAX        (+127)\r
+#define CHAR_MIN       0\r
+#define INT_MAX                (+0x7fffffff)\r
+#define INT_MIN                (-0x7fffffff)\r
+#define LONG_MAX    INT_MAX\r
+#define        LONG_MIN        INT_MIN\r
+#define SCHAR_MAX      (+127)\r
+#define        SCHAR_MIN       (-127)\r
+#define        SHRT_MAX        (+0x7fff)\r
+#define SHRT_MIN       (-0x7fff)\r
+#define UCHAR_MAX      (+0xff)\r
+#define UINT_MAX       (+0xffffffff)\r
+#define ULONG_MAX      UINT_MAX\r
+#define USHRT_MAX      (+0xffff)\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/math.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/math.h
new file mode 100644 (file)
index 0000000..9df151a
--- /dev/null
@@ -0,0 +1,42 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(MATH_H))\r
+\r
+#define MATH_H 1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+double sin(double);\r
+double cos(double);\r
+double sqrt(double);\r
+double ldexp(double x, int n);\r
+double frexp(double x, int *exp);\r
+\r
+extern __inline__ double sin(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fsin" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+extern __inline__ double cos(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fcos" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+extern __inline__ double sqrt(double x)\r
+{\r
+       double res;\r
+       __asm__ ("fsqrt" : "=t" (res) : "0" (x));\r
+       return res;\r
+}\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/setjmp.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/setjmp.h
new file mode 100644 (file)
index 0000000..5512f36
--- /dev/null
@@ -0,0 +1,20 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(SETJMP_H))\r
+\r
+#define SETJMP_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+typedef int jmp_buf[3]; /* EBP, EIP, ESP */\r
+\r
+#define setjmp(env)                    __builtin_setjmp(env)\r
+#define longjmp(env, val)      __builtin_longjmp(env, val)\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stdarg.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stdarg.h
new file mode 100644 (file)
index 0000000..ab6b2a9
--- /dev/null
@@ -0,0 +1,21 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDARG_H))\r
+\r
+#define STDARG_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#define va_start(v,l)  __builtin_stdarg_start((v),l)\r
+#define va_end                 __builtin_va_end\r
+#define va_arg                 __builtin_va_arg\r
+#define va_copy(d,s)   __builtin_va_copy((d),(s))\r
+#define        va_list                 __builtin_va_list\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stddef.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stddef.h
new file mode 100644 (file)
index 0000000..95727bc
--- /dev/null
@@ -0,0 +1,17 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDDEF_H))\r
+\r
+#define STDDEF_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+typedef unsigned int size_t;\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stdio.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stdio.h
new file mode 100644 (file)
index 0000000..27f483c
--- /dev/null
@@ -0,0 +1,67 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDIO_H))\r
+\r
+#define STDIO_H        1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#if (!defined(NULL))\r
+       #define NULL    ((void *) 0)\r
+#endif\r
+\r
+#include <stdarg.h>\r
+\r
+/* golibc */\r
+int sprintf(char *s, const char *format, ...);\r
+int vsprintf(char *s, const char *format, va_list arg);\r
+\r
+/* w32clibc */\r
+typedef struct {\r
+       unsigned int handle;\r
+       int flags; /* bit0:text/bin, bit1:input-enabe, bit2:output-enable */\r
+               /* bit3:EOF, bit4:ungetc-enable */\r
+       int ungetc;\r
+} FILE;\r
+extern FILE __stdin, __stdout, __stderr;\r
+#define        stdin   (&__stdin)\r
+#define        stdout  (&__stdout)\r
+#define        stderr  (&__stderr)\r
+#define EOF            -1\r
+#define SEEK_SET       0\r
+#define SEEK_CUR       1\r
+#define SEEK_END       2\r
+\r
+unsigned int fwrite(const void *ptr, unsigned int size, unsigned int nmemb, FILE *stream);\r
+int fputs(const char *s, FILE *stream);\r
+int fprintf(FILE *stream, const char *format, ...);\r
+int vfprintf(FILE *stream, const char *format, va_list arg);\r
+int puts(const char *s);\r
+int printf(const char *format, ...);\r
+int vprintf(const char *format, va_list arg);\r
+int fclose(FILE *stream);\r
+int fflush(FILE *stream);\r
+FILE *fopen(const char *filename, const char *mode);\r
+unsigned int fread(void *ptr, unsigned int size, unsigned int nobj, FILE *stream);\r
+int fseek(FILE *stream, int offset, int origin);\r
+int ftell(FILE *stream);\r
+int remove(const char *filename);\r
+int fputc(int c, FILE *stream);\r
+void clearerr(FILE *stream);\r
+void rewind(FILE *stream);\r
+int fgetc(FILE *stream);\r
+int feof(FILE *stream);\r
+#define getc           fgetc\r
+#define getchar()      getc(stdin)\r
+#define putchar(c)     fputc(c, stdout)\r
+char *fgets(char *s, int n, FILE *stream);\r
+char *gets(char *s);\r
+int ungetc(int c, FILE *stream);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stdlib.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/stdlib.h
new file mode 100644 (file)
index 0000000..0bc8e25
--- /dev/null
@@ -0,0 +1,40 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STDLIB_H))\r
+\r
+#define STDLIB_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#include <stddef.h>            /* size_t */\r
+\r
+#define        RAND_MAX        0x7fff\r
+#define srand(seed)                    (void) (rand_seed = (seed))\r
+\r
+#define EXIT_SUCCESS           0\r
+#define EXIT_FAILURE           1\r
+\r
+int abs(int n);\r
+double atof(const char *s);\r
+int atoi(const char *s);\r
+void qsort(void *base, size_t n, size_t size,\r
+       int (*cmp)(const void *, const void *));\r
+int rand(void);\r
+extern unsigned int rand_seed;\r
+double strtod(const char *s, const char **endp);\r
+long strtol(const char *s, const char **endp, int base);\r
+unsigned long strtoul(const char *s, const char **endp, int base);\r
+\r
+void *malloc(unsigned int nbytes);\r
+void free(void *ap);\r
+void exit(int status);\r
+#define abort()                exit(EXIT_FAILURE)\r
+int system(const char *s);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/string.h b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/string.h
new file mode 100644 (file)
index 0000000..62bd804
--- /dev/null
@@ -0,0 +1,38 @@
+/* copyright(C) 2003 H.Kawai (under KL-01). */\r
+\r
+#if (!defined(STRING_H))\r
+\r
+#define STRING_H       1\r
+\r
+#if (defined(__cplusplus))\r
+       extern "C" {\r
+#endif\r
+\r
+#include <stddef.h>            /* size_t */\r
+\r
+char *strcpy(char *s, const char *ct);\r
+char *strncpy(char *s, const char *ct, size_t n);\r
+char *strcat(char *s, const char *ct);\r
+char *strncat(char *s, const char *ct, size_t n);\r
+int strcmp(const char *cs, const char *ct);\r
+int strncmp(const char *cs, const char *ct, size_t n);\r
+char *strchr(const char *cs, int c);\r
+char *strrchr(const char *cs, int c);\r
+size_t strspn(const char *s, const char *accept);\r
+size_t strcspn(const char *s, const char *reject);\r
+char *strpbrk(const char *s, const char *accept);\r
+char *strstr(const char *cs, const char *ct);\r
+size_t strlen(const char *cs);\r
+\r
+void *memcpy(void *s, const void *ct, size_t n);\r
+void *memmove(void *s, const void *ct, size_t n);\r
+int memcmp(const void *cs, const void *ct, size_t n);\r
+void *memchr(const void *cs, int c, size_t n);\r
+void *memset(void *s, int c, size_t n);\r
+char *strdup(const char *s);\r
+\r
+#if (defined(__cplusplus))\r
+       }\r
+#endif\r
+\r
+#endif\r
diff --git a/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/w32clibc.lib b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/w32clibc.lib
new file mode 100644 (file)
index 0000000..fa24f53
Binary files /dev/null and b/CHNOSProject/chnos/tolset_chn_000/z_tools/win32/w32clibc.lib differ