{"id":161,"date":"2017-08-11T14:12:15","date_gmt":"2017-08-11T06:12:15","guid":{"rendered":"http:\/\/www.sinkland.cn\/?p=161"},"modified":"2019-08-17T15:04:32","modified_gmt":"2019-08-17T07:04:32","slug":"smlos%e4%b8%89-%e5%9b%be%e5%bd%a2%e5%a4%84%e7%90%86%e7%9b%b8%e5%85%b3%e5%8a%9f%e8%83%bd%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"http:\/\/www.sinkland.cn\/?p=161","title":{"rendered":"SmlOS\u4e09-\u56fe\u5f62\u5904\u7406\u76f8\u5173\u529f\u80fd\u5b9e\u73b0"},"content":{"rendered":"<h3>\u663e\u5b58\u64cd\u4f5c<\/h3>\n<p>\u5728\u524d\u9762\u663e\u5361\u76f8\u5173\u529f\u80fd\u8fdb\u884c\u4e86\u4ecb\u7ecd\u3002\u4e3b\u8981\u539f\u7406\u662f\u627e\u5230\u663e\u5b58\u5730\u5740\uff0c\u7136\u540e\u5199\u5165\u5bf9\u5e94\u7684\u989c\u8272\u6570\u503c\u3002<\/p>\n<p>\u663e\u5b58\u5730\u5740\u5728\u65e9\u671f\u5904\u7406\u7684\u65f6\u5019\uff0c\u5df2\u7ecf\u5b58\u5728\u76f8\u5e94\u7684\u5185\u5b58\u5730\u5740\u91cc\u9762\u5e76\u4fdd\u5b58\u5728BOOTINFO\u7ed3\u6784\u4f53vram\u6210\u5458\u53d8\u91cf\u91cc\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u3002<\/p>\n<p>\u5728\u8c03\u8bd5\u7684\u65f6\u5019\u53ef\u4ee5\u628a\u663e\u5b58\u5168\u90e8\u586b\u5145\u6210\u4e00\u79cd\u989c\u8272\uff0c\u5927\u6982\u4f1a\u662f\u8fd9\u6837:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/pic.sinkland.cn\/1%E6%98%BE%E7%A4%BA%E8%83%8C%E6%99%AF.jpg\" alt=\"image\" \/><\/p>\n<hr \/>\n<h3>\u6587\u5b57\u663e\u793a<\/h3>\n<p>\u6587\u5b57\u5462\uff0c\u5176\u5b9e\u5c31\u662f\u4e00\u4e2a\u4e2a\u5c0f\u77e9\u5f62\u91cc\u753b\u51fa\u5b57\u4f53\u7684\u6837\u5b50\u3002<\/p>\n<p>\u8fd9\u91cc\u6587\u5b57\u663e\u793a\u91c7\u7528\u6587\u5b57\u77e9\u9635\u4e3a8*16\u7684\u683c\u5f0f\uff0c\u5e76\u6709\u4e13\u7528\u6587\u4ef6\u8f6c\u6362\u6210\u76f8\u5e94\u7684\u4e2d\u95f4\u4ef6\u6587\u4ef6\u4e0e\u5185\u6838\u6587\u4ef6\u76f8\u8fde\u63a5\u8c03\u7528\u3002<\/p>\n<p>\u5b57\u4f53\u77e9\u9635\u4e2d\u5305\u542b\u7684\u53ea\u662f\u76f8\u5e94\u7684\u70b9\u96c6\u3002<\/p>\n<p>\u6307\u51fa\u4e86\u57288*16\u7684\u77e9\u5f62\u533a\u57df\u4e2d\u6587\u5b57\u9700\u8981\u663e\u793a\u7684\u70b9\u3002\u7cfb\u7edf\u4f1a\u7531\u6b64\u5224\u65ad\u5e76\u8fdb\u884c\u7ed8\u56fe\u3002<\/p>\n<p>\u800c\u663e\u793a\u53ea\u662f\u9700\u8981\u5411\u663e\u5b58\u5199\u5165\u76f8\u5e94\u70b9\uff0c\u4fbf\u53ef\u4ee5\u5728\u5c4f\u5e55\u8fdb\u884c\u663e\u793a\u3002<\/p>\n<p>\u8fd9\u91cc\u663e\u793a\u4e86\u51e0\u4e2a\u6570\u5b57\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/pic.sinkland.cn\/2%E8%BE%93%E5%87%BA%E6%96%87%E5%AD%97.jpg\" alt=\"image\" \/><\/p>\n<p>\u8fd9\u91cc\u63d0\u4f9b\u5355\u4e2a\u5b57\u7b26\u4e32\u7ed8\u5236\u51fd\u6570\uff1a<\/p>\n<pre><code class=\"language-c \">extern char Font[4096];\n\n\/*\u8f93\u51fa\u5b57\u7b26\u4e32*\/\nvoid PutFont_Asc(unsigned char *vram, int nXSize, int x, int y, char c,unsigned char *s)\n{\n for (; *s != 0x00; s++)\n {\n  PutFont8(vram, nXSize, x, y, c, Font + *s * 16);\n  x += 8;\n }\n return;\n}\n<\/code><\/pre>\n<hr \/>\n<h3>\u8c03\u8272\u677f\u8bbe\u7f6e<\/h3>\n<p>\u8fd9\u91cc\u7684\u663e\u793a\u6a21\u5f0f\u662f8\u4f4d\u8272\u6a21\u5f0f\uff0c\u8c03\u8272\u677f\u529f\u80fd\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6307\u5b9a\u989c\u8272\u503c\u7684\u5bf9\u5e94\u5173\u7cfb\u3002<\/p>\n<p>\u800c\u5728\u4f7f\u7528\u8c03\u8272\u677f\u529f\u80fd\u4e4b\u524d\uff0c\u9996\u5148\u8981\u4fdd\u5b58EFLAGS\u5bc4\u5b58\u5668\u7684\u5185\u5bb9\uff0cEFLAGS\u5bc4\u5b58\u5668\u4e3b\u8981\u7528\u4e8e\u63d0\u4f9b\u7a0b\u5e8f\u72b6\u6001\uff0c\u5e76\u8fdb\u884c\u76f8\u5e94\u63a7\u5236\uff0c\u5728\u8bbe\u5b9a\u7ed3\u675f\u540e\u6062\u590d\u8be5\u5bc4\u5b58\u5668\u5185\u5bb9\u3002<\/p>\n<p>\u800c\u5355\u4e2a\u989c\u8272\u53f7\u7684\u8bbe\u5b9a\uff0c\u6709\u6c47\u7f16\u6307\u4ee4out\u8fdb\u884c\uff0c\u56e0\u4e3aC\u8bed\u8a00\u5e76\u6ca1\u6709\u76f8\u5e94\u6307\u4ee4\uff0c\u6240\u4ee5\u662f\u7528\u6c47\u7f16\u5b9e\u73b0\uff0c\u5e76\u7531C\u8bed\u8a00\u8fdb\u884c\u8c03\u7528\u3002<\/p>\n<pre><code class=\"language-erlang \">_io_cli:    ; void io_cli(void);    ; \u5173\u95ed\u6240\u6709\u53ef\u5c4f\u853d\u4e2d\u65ad\n    CLI\n    RET\n\n_io_out8:   ; void io_out8(int port, int data);     ; \u5c068\u4f4d\u7684data\u8f93\u51fa\u5230port\u7aef\u53e3\n    MOV     EDX,[ESP+4]     ; port\n    MOV     AL,[ESP+8]      ; data\n    OUT     DX,AL\n    RET\n\n<\/code><\/pre>\n<pre><code class=\"language-c \">\/* \u8bbe\u7f6e\u8c03\u8272\u677f\u51fd\u6570 *\/\nvoid set_palette(int start, int end, unsigned char *rgb)\n{\n int i, eflags;\n eflags = io_load_eflags(); \/* \u4fdd\u5b58eflags\u7684\u503c *\/\n io_cli(); \/* \u5173\u95ed\u6240\u6709\u53ef\u5c4f\u853d\u4e2d\u65ad *\/\n io_out8(0x03c8, start);\n for (i = start; i &lt;= end; i++)\n {\n  io_out8(0x03c9, rgb[0] \/ 4);\n  io_out8(0x03c9, rgb[1] \/ 4);\n  io_out8(0x03c9, rgb[2] \/ 4);\n  rgb += 3;\n }\n io_store_eflags(eflags); \/* \u6062\u590deflags\u7684\u503c *\/\n return;\n}\n<\/code><\/pre>\n<p>\u5728\u8fd9\u91cc\u7531CPU\u5411\u5916\u90e8\u8bbe\u5907\u53d1\u9001\u6307\u5b9a\u547d\u4ee4\u8bbe\u5b9a\u8c03\u8272\u677f\u529f\u80fd\u3002<\/p>\n<p>\u800c\u5728\u8fd9\u91cc\u8bbe\u5b9a\u4e8616\u53f7\u989c\u8272\uff0c\u5206\u522b\u5982\u4e0b\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5e8f\u53f7<\/th>\n<th>\u989c\u8272<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>0<\/td>\n<td>\u9ed1<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>\u4eae\u7ea2<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>\u4eae\u7eff<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>\u4eae\u9ec4<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u4eae\u84dd<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u4eae\u7d2b<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>\u6d45\u4eae\u84dd<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>\u767d<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>\u4eae\u7070<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>\u6697\u7ea2<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>\u6697\u7eff<\/td>\n<\/tr>\n<tr>\n<td>11<\/td>\n<td>\u6697\u9ec4<\/td>\n<\/tr>\n<tr>\n<td>12<\/td>\n<td>\u6697\u9752<\/td>\n<\/tr>\n<tr>\n<td>13<\/td>\n<td>\u6697\u7d2b<\/td>\n<\/tr>\n<tr>\n<td>14<\/td>\n<td>\u6d45\u6697\u84dd<\/td>\n<\/tr>\n<tr>\n<td>15<\/td>\n<td>\u6697\u7070<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8bbe\u7f6e\u8c03\u8272\u677f\u4e4b\u540e\u5c31\u80fd\u663e\u793a\u5404\u79cd\u4e0d\u540c\u7684\u989c\u8272\u4e86\u3002<\/p>\n<hr \/>\n<h3>\u9f20\u6807\u53ca\u7a97\u53e3\u663e\u793a<\/h3>\n<p>\u56fe\u5f62\u663e\u793a\u529f\u80fd\u8fd8\u5305\u62ec\u9f20\u6807\u7684\u56fe\u50cf\u7684\u521d\u59cb\u5316\uff0c\u9f20\u6807\u56fe\u50cf\u7684\u521d\u59cb\u5316\u8bbe\u7f6e\u4e0e\u77e9\u5f62\u7684\u7ed8\u5236\u7c7b\u4f3c.<\/p>\n<p>\u51c6\u5907\u4e00\u4e2a\u9f20\u6807\u56fe\u50cf\u7684\u4e8c\u7ef4\u6570\u7ec4\uff0c\u91c7\u752816*16\u7684\u5927\u5c0f,\u8fd9\u5c31\u662f\u9f20\u6807\u7684\u5f62\u72b6\u4e86\u3002<\/p>\n<pre><code class=\"language-c \"> static char cursor[16][16] =\n {\n  \"**..............\",\n  \"*O*.............\",\n  \"*OO*............\",\n  \"*OOO*...........\",\n  \"*OOOO*..........\",\n  \"*OOOOO*.........\",\n  \"*OOOOOO*........\",\n  \"*OOOOOOO*.......\",\n  \"*OOOOOOOO*......\",\n  \"*OOOOOOOOO*.....\",\n  \"*OOOO******.....\",\n  \"*OOO*...........\",\n  \"*OO*............\",\n  \"*O*.............\",\n  \"**..............\",\n  \"................\"\n };\n<\/code><\/pre>\n<p>\u5e76\u6839\u636e\u5bf9\u5e94\u70b9\u7ed8\u5236\u51fa\u76f8\u5e94\u7684\u9f20\u6807\u7684\u56fe\u50cf\uff0c\u652f\u6301\u900f\u660e\u8272\u8bbe\u5b9a\u529f\u80fd\uff0c\u56fe\u5c42\u7ba1\u7406\u7684\u76f8\u5173\u51fd\u6570\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528\u3002<\/p>\n<p>\u800c\u7a97\u53e3\u9ed8\u8ba4\u56fe\u5f62\u7684\u7ed8\u5236\uff0c\u548c\u4e00\u822c\u56fe\u5f62\u7684\u7ed8\u5236\u7c7b\u4f3c\u3002\u4e3b\u8981\u5206\u6210\u56db\u6b65\uff1a\u7b2c\u4e00\u7ed8\u5236\u51fa\u7a97\u4f53\u77e9\u5f62\uff0c\u7b2c\u4e8c\u7ed8\u5236\u51fa\u5de5\u4f5c\u533a\u77e9\u5f62\uff0c\u7b2c\u4e09\u7ed8\u5236\u51fa\u7a97\u53e3\u6807\u9898\uff0c\u6700\u540e\u7ed8\u5236\u51fa\u5173\u95ed\u6309\u94ae\u3002<\/p>\n<p>\u524d\u4e24\u6b65\u8c03\u7528\u77e9\u5f62\u7684\u7ed8\u5236\u51fd\u6570\uff0c\u7b2c\u4e09\u6b65\u8c03\u7528\u5b57\u7b26\u4e32\u7684\u663e\u793a\u51fd\u6570\u3002<br \/>\n\u5173\u95ed\u6309\u94ae\u7684\u7ed8\u5236\u4e0e\u9f20\u6807\u7684\u7ed8\u5236\u7c7b\u4f3c\u3002<\/p>\n<pre><code class=\"language-c \">  \/\/ \u8fd9\u4e2a\u6570\u7ec4\u5b9a\u4e49\u7684\u662f\u7a97\u53e3\u53f3\u4e0a\u89d2\u90a3\u4e2a\u53c9\u53c9\u56fe\u5f62\n static char closebtn[13][20] =\n {\n  \"QQQQQQQQQQQQQQQQQQQQ\",\n  \"QQQQQQQQQQQQQQQQQQQQ\",\n  \"QQQQQQQQQQQQQQQQQQQQ\",\n  \"QQQQQQ@@QQQQ@@QQQQQQ\",\n  \"QQQQQQQ@@QQ@@QQQQQQQ\",\n  \"QQQQQQQQ@@@@QQQQQQQQ\",\n  \"QQQQQQQQQ@@QQQQQQQQQ\",\n  \"QQQQQQQQ@@@@QQQQQQQQ\",\n  \"QQQQQQQ@@QQ@@QQQQQQQ\",\n  \"QQQQQQ@@QQQQ@@QQQQQQ\",\n  \"QQQQQQQQQQQQQQQQQQQQ\",\n  \"QQQQQQQQQQQQQQQQQQQQ\",\n  \"QQQQQQQQQQQQQQQQQQQQ\"\n };\n<\/code><\/pre>\n<p>\u662f\u4e00\u4e2a13*20\u7684\u7ea2\u8272\u53c9\u53c9\u3002<\/p>\n<p>\u5bf9\u4e8e\u56fe\u5c42\u7ed8\u5236\u5b57\u7b26\u4e32\u529f\u80fd\uff0c\u4ee5\u4e0a\u53ea\u662f\u5355\u7eaf\u7684\u5728\u5bf9\u5e94\u663e\u793a\u6570\u7ec4\u91cc\u9762\u8fdb\u884c\u7ed8\u5236\u64cd\u4f5c\u3002<\/p>\n<p>\u4f46\u662f\u5728\u52a0\u5165\u56fe\u5c42\u7ba1\u7406\u7ed3\u6784\u4e4b\u540e\uff0c\u8fd9\u4e9b\u64cd\u4f5c\u5e76\u6ca1\u6709\u76f4\u63a5\u7684\u5199\u5165\u5230\u663e\u5b58\u91cc\uff0c\u64cd\u4f5c\u7684\u7ba1\u7406\u7531\u56fe\u5c42\u7ba1\u7406\u76f8\u5173\u51fd\u6570\u51b3\u5b9a\u3002<\/p>\n<p>\u6bcf\u4e00\u4e2a\u7a97\u53e3\uff0c\u5c31\u76f8\u5f53\u4e0ephotoshop\u91cc\u7684\u5404\u79cd\u56fe\u5c42\u76f8\u4e92\u91cd\u53e0\uff0c\u6709\u56fe\u5c42\u7ba1\u7406\u51fd\u6570\u8ba1\u7b97\u51fa\u6765\u6700\u7ec8\u7684\u663e\u793a\u7684\u6837\u5b50\uff0c\u5199\u5230\u663e\u5b58\u4e2d\u3002<\/p>\n<p>\u663e\u793a\u7684\u6837\u5b50\u5927\u6982\u662f:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/pic.sinkland.cn\/window_show.jpg\" alt=\"image\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u663e\u5b58\u64cd\u4f5c \u5728\u524d\u9762\u663e\u5361\u76f8\u5173\u529f\u80fd\u8fdb\u884c\u4e86\u4ecb\u7ecd\u3002\u4e3b\u8981\u539f\u7406\u662f\u627e\u5230\u663e\u5b58\u5730\u5740\uff0c\u7136\u540e\u5199\u5165\u5bf9\u5e94\u7684\u989c\u8272\u6570\u503c\u3002 \u663e\u5b58\u5730\u5740\u5728\u65e9\u671f\u5904\u7406\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/www.sinkland.cn\/index.php?rest_route=\/wp\/v2\/posts\/161"}],"collection":[{"href":"http:\/\/www.sinkland.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sinkland.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sinkland.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sinkland.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=161"}],"version-history":[{"count":4,"href":"http:\/\/www.sinkland.cn\/index.php?rest_route=\/wp\/v2\/posts\/161\/revisions"}],"predecessor-version":[{"id":192,"href":"http:\/\/www.sinkland.cn\/index.php?rest_route=\/wp\/v2\/posts\/161\/revisions\/192"}],"wp:attachment":[{"href":"http:\/\/www.sinkland.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sinkland.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sinkland.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}