{"id":471226,"date":"2025-08-19T09:01:25","date_gmt":"2025-08-19T09:01:25","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=471226"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=471226","title":{"rendered":"<span>\u041d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0410\u0414: \u043f\u0448\u0438\u0435\u043c \u041e\u0421. \u0427\u0430\u0441\u0442\u044c 2 \u2014 \u043c\u043e\u0434\u0443\u043b\u0438 \u0438 \u0432\u0432\u043e\u0434<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u0437\u0434\u0440\u0430\u0441\u0442\u0435, \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0432\u0441\u0435 \u0440\u0430\u0437\u043e\u0431\u044c\u0435\u043c \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u0438, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0432\u0432\u043e\u0434, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443!<\/p>\n<h3>\u0428\u0430\u0433 1. \u041c\u043e\u0434\u0443\u043b\u0438<\/h3>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0430\u043f\u043e\u0447\u043a\u0443 <code>kernel\/lib<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0438 \u0444\u0430\u0439\u043b\u0430: <code>stdio.h<\/code>, <code>types.h<\/code>, <code>string.h<\/code>. \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e &#8212; \u0432\u0432\u043e\u0434-\u0432\u044b\u0432\u043e\u0434, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0442\u0438\u043f\u044b, \u0432 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/p>\n<p>\u0412 <code>stdio.h<\/code> \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 2 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#8212; <code>printc()<\/code> \u0438 <code>printl()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u0438 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e<\/p>\n<pre><code class=\"cpp\">void printc(char* video_memory, char symb, char* color, int charpos) {     video_memory[charpos * 2] = symb;     video_memory[charpos * 2 + 1] = color; } int printl(char* video_memory, const char* text, int startpos) {     int nextpos;     for (int i = 0;; i++) {         if (text[i] == '\\0') {break;}         printc(video_memory, text[i], (char *)0x07, startpos);         startpos++;         nextpos = startpos;     }     return nextpos; }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f &#8212; \u044d\u0442\u043e \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0441 \u044f\u0434\u0440\u0435 &#8212; \u0432 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u044c (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432\u0435\u0434\u044c \u0430\u0434\u0440\u0435\u0441 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f) \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u043d\u043e\u043c\u0435\u0440 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 (\u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439) <em> 2 \u0441\u0430\u043c \u0441\u0438\u043c\u0432\u043e\u043b, \u0430 \u0432 \u043d\u043e\u043c\u0435\u0440<\/em>2+1 &#8212; \u0446\u0432\u0435\u0442. \u0412 <code>printl()<\/code> \u0436\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0440\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 &#8212; \u0430\u0434\u0440\u0435\u0441 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u0438, \u0442\u0435\u043a\u0441\u0442 \u0438&#8230;. \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b. \u0412\u0435\u0434\u044c \u0442\u0435\u043a\u0441\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430. \u041a\u0441\u0442\u0430\u0442\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0441\u043b\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u0438\u043c\u0432\u043e\u043b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f. \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u0432 \u0446\u0438\u043a\u043b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c <code>printc()<\/code>.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 &#8212; \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0439. \u041f\u0438\u0448\u0435\u043c \u0432\u0432\u043e\u0434<\/p>\n<pre><code class=\"cpp\">static inline unsigned char inb(unsigned short port) {     unsigned char data;     __asm__ volatile (\"inb %1, %0\" : \"=a\" (data) : \"Nd\" (port));     return data; }  unsigned char getchar(void) {     unsigned char scancode;     do {         scancode = inb(0x64);         scancode &amp;= 1;     } while (!scancode);      return inb(0x60); }<\/code><\/pre>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u0440\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 ASM \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u0445. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 &#8212; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u0440\u0442\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f PS\/2 (\u0434\u0430-\u0434\u0430, \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 \u0440\u0430\u0437\u044a\u0435\u043c, \u043d\u0435 USB, \u0442\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0433\u043e-\u0433\u043e!), \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u0431\u0438\u0442 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438, \u0438 \u0442\u0430\u043a \u043f\u043e \u0446\u0438\u043a\u043b\u0443 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u0438\u0442 \u0440\u0430\u0432\u0435\u043d 1; \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430.<\/p>\n<blockquote>\n<p>\u041d\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0443: \u043a\u043e\u0434 \u043d\u0430\u0436\u0430\u0442\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u044b (\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0438\u043c\u0432\u043e\u043b) <strong>\u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f<\/strong> \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043d \u043d\u0430 \u0441\u0430\u043c\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0435<\/p>\n<\/blockquote>\n<p>\u0412 <code>types.h<\/code> \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442 &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0438\u0448\u0435\u043c \u043e\u0434\u0438\u043d <code>typedef<\/code><\/p>\n<pre><code class=\"cpp\">typedef unsinged int u32<\/code><\/pre>\n<p>\u0412 <code>string.h<\/code> \u0442\u043e\u0436 \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435<\/p>\n<pre><code class=\"cpp\">int strlen(constchar* text) {     returnsizeof(text) \/ sizeof(char); }<\/code><\/pre>\n<h3>\u0428\u0430\u0433 2. \u041f\u0438\u0448\u0435\u043c \u0432\u0432\u043e\u0434 \u0432 \u044f\u0434\u0440\u0435<\/h3>\n<p>\u0410 \u0441\u0435\u0439\u0447\u0430\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0432\u044b\u0432\u043e\u0434 \u0438 \u0432\u0432\u043e\u0434, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u043e \u0432 \u043d\u0430\u0448\u0435 \u044f\u0434\u0440\u043e. \u041d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u043a\u0430\u043a\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0431\u0443\u0434\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443:<\/p>\n<ul>\n<li>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u0434 \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u044d\u0442\u043e\u0442 (\u0442\u0443\u0442 \u0432\u044b\u0432\u043e\u0434 \u0438 \u0432\u0432\u043e\u0434 \u0441\u043c\u0438\u0432\u043e\u043b\u0430) (\u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 (<code>#include \"stdio.h\"<\/code>)<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">const char* message = \"HabrOS 0.0.2                                                                    &gt;&gt;&gt; \"; int nextpos = printl(video_memory, message, 0); unsigned char ch = getchar(); printc(video_memory, ch, (char *)0x07, nextpos+1);<\/code><\/pre>\n<p>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0437\u044f\u0442\u044c \u043c\u043e\u0435, \u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0432\u043e\u0435<\/p>\n<ul>\n<li>\n<p>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0438\u0436\u0435 \u043a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043a\u0430\u043d\u043a\u043e\u0434\u0430:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">char hex_chars[] = \"0123456789ABCDEF\"; printc(video_memory, hex_chars[(ch &gt;&gt; 4) &amp; 0xF], (char*)0x07, nextpos++); printc(video_memory, hex_chars[ch &amp; 0xF], (char*)0x07, nextpos++);<\/code><\/pre>\n<ul>\n<li>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c (\u0441\u043a\u0440\u0438\u043f\u0442 \u0435\u0441\u0442\u044c, \u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043a <code>i686-elf-gcc -o ...<\/code> \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c <code>-I kernel\/lib<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u044c \u043a\u043b\u0430\u0432\u0438\u0448\u0443<\/p>\n<\/li>\n<li>\n<p>\u0418\u0434\u0435\u043c \u043d\u0430 <a href=\"https:\/\/api.vc.ru\/v2.8\/redirect?to=https%3A%2F%2Fwiki.osdev.org%2FPS%2F2%5C_Keyboard%23Scan%5C_Code%5C_Sets&amp;postId=2157525\" rel=\"noopener noreferrer nofollow\">OSDev Wiki<\/a> \u0438 \u0438\u0449\u0435\u043c \u0442\u0430\u043c \u043d\u0430\u0448 \u043a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u043d\u0430\u0436\u0430\u043b\u0438 \u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043a\u043b\u0430\u0432\u0438\u0448\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 &#8212; \u0437\u043d\u0430\u0447\u0438\u0442 \u0443 \u0432\u0430\u0441 \u044d\u0442\u043e\u0442 code scan set (\u0443 \u043c\u0435\u043d\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440)<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0434\u0442\u0438 \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a.<\/p>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e (\u0432 <code>stdio.h<\/code>) \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0438\u0437 \u0441\u043a\u0430\u043d\u043a\u043e\u0434\u043e\u0432 \u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435<\/p>\n<pre><code class=\"cpp\">unsigned char transform(unsigned char ch) {     unsigned char codes[] = {     (unsigned char)0x01, (unsigned char)0x02, (unsigned char)0x03,     (unsigned char)0x04, (unsigned char)0x05, (unsigned char)0x06,      (unsigned char)0x07, (unsigned char)0x08, (unsigned char)0x09,     (unsigned char)0x0A, (unsigned char)0x0B, (unsigned char)0x0C,     (unsigned char)0x0D, (unsigned char)0x0E, (unsigned char)0x0F,     (unsigned char)0x10, (unsigned char)0x11, (unsigned char)0x12,     (unsigned char)0x13, (unsigned char)0x14, (unsigned char)0x15,     (unsigned char)0x16, (unsigned char)0x17, (unsigned char)0x18,     (unsigned char)0x19, (unsigned char)0x1A, (unsigned char)0x1B,     (unsigned char)0x1C, (unsigned char)0x1D, (unsigned char)0x1E,     (unsigned char)0x1F, (unsigned char)0x20, (unsigned char)0x21,     (unsigned char)0x22, (unsigned char)0x23, (unsigned char)0x24,     (unsigned char)0x25, (unsigned char)0x26, (unsigned char)0x27,     (unsigned char)0x28, (unsigned char)0x29, (unsigned char)0x2A,     (unsigned char)0x2B, (unsigned char)0x2C, (unsigned char)0x2D,     (unsigned char)0x2E, (unsigned char)0x2F, (unsigned char)0x30,     (unsigned char)0x31, (unsigned char)0x32, (unsigned char)0x33,     (unsigned char)0x34, (unsigned char)0x35, (unsigned char)0x36,     (unsigned char)0x37, (unsigned char)0x38, (unsigned char)0x39,     (unsigned char)0x3A, (unsigned char)0x3B, (unsigned char)0x3C,     (unsigned char)0x3D, (unsigned char)0x3E, (unsigned char)0x3F,     (unsigned char)0x40, (unsigned char)0x41, (unsigned char)0x42,     (unsigned char)0x43, (unsigned char)0x44, (unsigned char)0x45,     (unsigned char)0x46, (unsigned char)0x47, (unsigned char)0x48,     (unsigned char)0x49, (unsigned char)0x4A, (unsigned char)0x4B,     (unsigned char)0x4C, (unsigned char)0x4D, (unsigned char)0x4E,     (unsigned char)0x4F, (unsigned char)0x50, (unsigned char)0x51,     (unsigned char)0x52, (unsigned char)0x53, (unsigned char)0x57,     (unsigned char)0x58     };          unsigned char symbols_standart[] = {     (unsigned char)0x00, '1', '2', \/\/ 0x00 - null (not bind)     '3', '4', '5',     '6', '7', '8',     '9', '0', '-',     '=', (unsigned char)0x08, (unsigned char)0x09,     'q', 'w', 'e',     'r', 't', 'y',     'u', 'i', 'o',     'p', '[', ']',     (unsigned char)0x0A, (unsigned char)0x01, 'a', \/\/0x01 - l ctrl     's', 'd', 'f',     'g', 'h', 'j',     'k', 'l', ';',     '\\'', '`', (unsigned char)0x02, \/\/0x02 - l shift     '\\\\', 'z', 'x',     'c', 'v', 'b',     'n', 'm', ',',     '.', '\/', (unsigned char)0x00,     '*', (unsigned char)0x00, ' ',     (unsigned char)0x03, (unsigned char)0x00, (unsigned char)0x00, \/\/0x03 - caps     (unsigned char)0x00, (unsigned char)0x00, (unsigned char)0x00,     (unsigned char)0x00, (unsigned char)0x00, (unsigned char)0x00,     (unsigned char)0x00, (unsigned char)0x00, (unsigned char)0x00,     (unsigned char)0x00, '7', '8',     '9', '-', '4',     '5', '6', '+',     '1', '2', '3',     '0', '.', (unsigned char)0x00,     (unsigned char)0x00     };     int status = 0;     for (int i = 0; i != (sizeof(codes) \/ sizeof(char)); i++) {         if (ch == codes[i]) {             status = 1;             return symbols_standart[i];         }     }     if (status == 0) {         return ch;     } }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u0430\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442, \u0442\u0430\u043a \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437 \u0441\u043a\u0430\u043d\u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f), \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u043a\u0440\u0443\u0433\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 \u0438\u0437 1-\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0435\u0441\u043b\u0438 \u0440\u0430\u0432\u0435\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441\u0438\u043c\u0432\u043e\u043b \u0438\u0437 2-\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 (\u043d\u0430\u0436\u0430\u0442\u0430\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0430). \u0410 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0448\u043b\u043e \u0432 1-\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043d\u0430\u0448 \u0441\u0438\u043c\u0432\u043e\u043b, \u0442\u043e \u043c\u044b \u0435\u0433\u043e \u0436\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u0430\u043c-\u0442\u043e \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438, \u0430 \u044d\u0442\u043e \u0435\u0449\u0435 \u043c\u044b \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u0441 CapsLock \u0438 Shift, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u0438\u0432\u0435\u043b \u0431\u043e\u043b\u0435\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u0432 \u044f\u0434\u0440\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0438 \u043f\u0443\u0441\u0442\u043e\u0439 \u0446\u0438\u043a\u043b \u043d\u0430<\/p>\n<pre><code class=\"cpp\">while(1) {     unsigned char ch = getchar();     unsigned char ch_descaned = transform(ch);     printc(video_memory, ch_descaned, (char *)0x07, nextpos+1);      nextpos++; }<\/code><\/pre>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c, \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/591\/6fe\/3b2\/5916fe3b2a22c6bfd3cc7f18dc8b6aac.jpg\" alt=\"\u042d\u043c...... \u041c\u044b \u0436\u0435 \u043d\u0435 \u044d\u0442\u043e\u0433\u043e \u0445\u043e\u0442\u0435\u043b\u0438?\" title=\"\u042d\u043c...... \u041c\u044b \u0436\u0435 \u043d\u0435 \u044d\u0442\u043e\u0433\u043e \u0445\u043e\u0442\u0435\u043b\u0438?\" width=\"auto\" height=\"auto\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/591\/6fe\/3b2\/5916fe3b2a22c6bfd3cc7f18dc8b6aac.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/591\/6fe\/3b2\/5916fe3b2a22c6bfd3cc7f18dc8b6aac.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u042d\u043c&#8230;&#8230; \u041c\u044b \u0436\u0435 \u043d\u0435 \u044d\u0442\u043e\u0433\u043e \u0445\u043e\u0442\u0435\u043b\u0438?<\/figcaption><\/div>\n<\/figure>\n<p>\u0421\u0442\u0440\u0430\u043d\u043d\u043e \u043a\u0430\u043a-\u0442\u043e. \u0412\u0440\u043e\u0434\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u043d\u043e \u0437\u0430 \u043d\u0438\u043c\u0438 \u043f\u043e\u0442\u043e\u043c \u0438\u0434\u0435\u0442 \u0435\u0449\u0435 \u0441\u0438\u043c\u0432\u043e\u043b. \u0421\u0442\u0440\u0430\u043d\u043d\u043e, \u0434\u0430? \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u0436\u0430\u0442\u044c. \u041d\u0435\u0442\u0443 \u0442\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u0434\u0430? \u0422\u0430\u043a \u0432\u043e\u0442 \u0432 \u0447\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u043c\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u0442\u043f\u0443\u0441\u043a\u0430\u043d\u0438\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0448\u044b, \u0438 \u043e\u043d\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u043b\u043e \u0441\u043a\u0430\u043d\u043a\u043e\u0434 0x80 + \u0441\u043a\u0430\u043d\u043a\u043e\u0434 \u043a\u043b\u0430\u0432\u0438\u0448\u044b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u0432 <code>stdio.h<\/code> \u0438 \u0432\u043c\u0435\u0441\u0442\u043e <code>return inb(0x60);<\/code><strong><em> <\/em><\/strong>\u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cpp\">unsigned char scan = inb(0x60); if (scan &amp; 0x80) {     return 0; } return scan;<\/code><\/pre>\n<p>\u041e\u043d \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u043f\u0443\u0441\u043a\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u044b. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0432 kernel.c \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b:<\/p>\n<pre><code class=\"cpp\">if (ch == 0) continue;<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0431\u0435\u043b \u043d\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 (\u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0441\u043a\u0430\u043d\u043a\u043e\u0434\u0430 0x00 \u043d\u0435\u0442\u0443)<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043e\u0442\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0432 ISO \u0444\u0430\u0439\u043b &#8212; \u0438 \u0432\u0443\u0430\u043b\u044f<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/77c\/da7\/04a\/77cda704a702a665053b2743bbf1c3d2.jpg\" alt=\"\u0423\u0440\u0430, \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e\" title=\"\u0423\u0440\u0430, \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e\" width=\"auto\" height=\"auto\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/\/post_images\/77c\/da7\/04a\/77cda704a702a665053b2743bbf1c3d2.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/77c\/da7\/04a\/77cda704a702a665053b2743bbf1c3d2.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0423\u0440\u0430, \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0443 \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432\u0441\u0435\u0445 \u043a\u043b\u0430\u0432\u0438\u0448. \u0410 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043a\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043f\u043b\u0430\u043d \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>echo<\/code>, <code>shutdown<\/code> \u0438 <code>version<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 Github: <a href=\"https:\/\/github.com\/KirillMos2\/HabrOS\/\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/KirillMos2\/HabrOS\/<\/a> <\/p>\n<hr\/>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0447\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438! \u0411\u0443\u0434\u0443 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u041e\u0421.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/938544\/\"> https:\/\/habr.com\/ru\/articles\/938544\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u0437\u0434\u0440\u0430\u0441\u0442\u0435, \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0432\u0441\u0435 \u0440\u0430\u0437\u043e\u0431\u044c\u0435\u043c \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u0438, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0432\u0432\u043e\u0434, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443!<\/p>\n<h3>\u0428\u0430\u0433 1. \u041c\u043e\u0434\u0443\u043b\u0438<\/h3>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0430\u043f\u043e\u0447\u043a\u0443 <code>kernel\/lib<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0438 \u0444\u0430\u0439\u043b\u0430: <code>stdio.h<\/code>, <code>types.h<\/code>, <code>string.h<\/code>. \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e &#8212; \u0432\u0432\u043e\u0434-\u0432\u044b\u0432\u043e\u0434, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0442\u0438\u043f\u044b, \u0432 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/p>\n<p>\u0412 <code>stdio.h<\/code> \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 2 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#8212; <code>printc()<\/code> \u0438 <code>printl()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u0438 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e<\/p>\n<pre><code class=\"cpp\">void printc(char* video_memory, char symb, char* color, int charpos) {     video_memory[charpos * 2] = symb;     video_memory[charpos * 2 + 1] = color; } int printl(char* video_memory, const char* text, int startpos) {     int nextpos;     for (int i = 0;; i++) {         if (text[i] == '\\0') {break;}         printc(video_memory, text[i], (char *)0x07, startpos);         startpos++;         nextpos = startpos;     }     return nextpos; }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f &#8212; \u044d\u0442\u043e \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0441 \u044f\u0434\u0440\u0435 &#8212; \u0432 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u044c (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432\u0435\u0434\u044c \u0430\u0434\u0440\u0435\u0441 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f) \u043c\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u043d\u043e\u043c\u0435\u0440 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 (\u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439) <em> 2 \u0441\u0430\u043c \u0441\u0438\u043c\u0432\u043e\u043b, \u0430 \u0432 \u043d\u043e\u043c\u0435\u0440<\/em>2+1 &#8212; \u0446\u0432\u0435\u0442. \u0412 <code>printl()<\/code> \u0436\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0440\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 &#8212; \u0430\u0434\u0440\u0435\u0441 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u0438, \u0442\u0435\u043a\u0441\u0442 \u0438&#8230;. \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b. \u0412\u0435\u0434\u044c \u0442\u0435\u043a\u0441\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430. \u041a\u0441\u0442\u0430\u0442\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0441\u043b\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u0438\u043c\u0432\u043e\u043b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f. \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u0432 \u0446\u0438\u043a\u043b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c <code>printc()<\/code>.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 &#8212; \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0439. \u041f\u0438\u0448\u0435\u043c \u0432\u0432\u043e\u0434<\/p>\n<pre><code class=\"cpp\">static inline unsigned char inb(unsigned short port) {     unsigned char data;     __asm__ volatile (\"inb %1, %0\" : \"=a\" (data) : \"Nd\" (port));     return data; }  unsigned char getchar(void) {     unsigned char scancode;     do {         scancode = inb(0x64);         scancode &amp;= 1;     } while (!scancode);      return inb(0x60); }<\/code><\/pre>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u0440\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 ASM \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u0445. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 &#8212; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u0440\u0442\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f PS\/2 (\u0434\u0430-\u0434\u0430, \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 \u0440\u0430\u0437\u044a\u0435\u043c, \u043d\u0435 USB, \u0442\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0433\u043e-\u0433\u043e!), \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u0431\u0438\u0442 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438, \u0438 \u0442\u0430\u043a \u043f\u043e \u0446\u0438\u043a\u043b\u0443 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0431\u0438\u0442 \u0440\u0430\u0432\u0435\u043d 1; \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430.<\/p>\n<blockquote>\n<p>\u041d\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0443: \u043a\u043e\u0434 \u043d\u0430\u0436\u0430\u0442\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u044b (\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0438\u043c\u0432\u043e\u043b) <strong>\u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f<\/strong> \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043d \u043d\u0430 \u0441\u0430\u043c\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0435<\/p>\n<\/blockquote>\n<p>\u0412 <code>types.h<\/code> \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442 &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0438\u0448\u0435\u043c \u043e\u0434\u0438\u043d <code>typedef<\/code><\/p>\n<pre><code class=\"cpp\">typedef unsinged int u32<\/code><\/pre>\n<p>\u0412 <code>string.h<\/code> \u0442\u043e\u0436 \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435<\/p>\n<pre><code class=\"cpp\">int strlen(constchar* text) {     returnsizeof(text) \/ sizeof(char); }<\/code><\/pre>\n<h3>\u0428\u0430\u0433 2. \u041f\u0438\u0448\u0435\u043c \u0432\u0432\u043e\u0434 \u0432 \u044f\u0434\u0440\u0435<\/h3>\n<p>\u0410 \u0441\u0435\u0439\u0447\u0430\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0432\u044b\u0432\u043e\u0434 \u0438 \u0432\u0432\u043e\u0434, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u043e \u0432 \u043d\u0430\u0448\u0435 \u044f\u0434\u0440\u043e. \u041d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u043a\u0430\u043a\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0431\u0443\u0434\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443:<\/p>\n<ul>\n<li>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u043a\u043e\u0434 \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430 \u044d\u0442\u043e\u0442 (\u0442\u0443\u0442 \u0432\u044b\u0432\u043e\u0434 \u0438 \u0432\u0432\u043e\u0434 \u0441\u043c\u0438\u0432\u043e\u043b\u0430) (\u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 (<code>#include \"stdio.h\"<\/code>)<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">const char* message = \"HabrOS 0.0.2                                                                    &gt;&gt;&gt; \"; int nextpos = printl(video_memory, message, 0); unsigned char ch = getchar(); printc(video_memory, ch, (char *)0x07, nextpos+1);<\/code><\/pre>\n<p>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0437\u044f\u0442\u044c \u043c\u043e\u0435, \u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0432\u043e\u0435<\/p>\n<ul>\n<li>\n<p>\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0438\u0436\u0435 \u043a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043a\u0430\u043d\u043a\u043e\u0434\u0430:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">char hex_chars[] = \"0123456789ABCDEF\"; printc(video_memory, hex_chars[(ch &gt;&gt; 4) &amp; 0xF], (char*)0x07, nextpos++); printc(video_memory, hex_chars[ch &amp; 0xF], (char*)0x07, nextpos++);<\/code><\/pre>\n<ul>\n<li>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c (\u0441\u043a\u0440\u0438\u043f\u0442 \u0435\u0441\u0442\u044c, \u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043a <code>i686-elf-gcc -o ...<\/code> \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c <code>-I kernel\/lib<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u044c \u043a\u043b\u0430\u0432\u0438\u0448\u0443<\/p>\n<\/li>\n<li>\n<p>\u0418\u0434\u0435\u043c \u043d\u0430 <a href=\"https:\/\/api.vc.ru\/v2.8\/redirect?to=https%3A%2F%2Fwiki.osdev.org%2FPS%2F2%5C_Keyboard%23Scan%5C_Code%5C_Sets&amp;postId=2157525\" rel=\"noopener noreferrer nofollow\">OSDev Wiki<\/a> \u0438 \u0438\u0449\u0435\u043c \u0442\u0430\u043c \u043d\u0430\u0448 \u043a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b \u043d\u0430\u0436\u0430\u043b\u0438 \u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043a\u043b\u0430\u0432\u0438\u0448\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 &#8212; \u0437\u043d\u0430\u0447\u0438\u0442 \u0443 \u0432\u0430\u0441 \u044d\u0442\u043e\u0442 code scan set (\u0443 \u043c\u0435\u043d\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440)<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0434\u0442\u0438 \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a.<\/p>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e (\u0432 <code>stdio.h<\/code>) \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0438\u0437 \u0441\u043a\u0430\u043d\u043a\u043e\u0434\u043e\u0432 \u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435<\/p>\n<pre><code class=\"cpp\">unsigned char transform(unsigned char ch) {     unsigned char codes[] = {     (unsigned char)0x01, (unsigned char)0x02, (unsigned char)0x03,     (unsigned char)0x04, (unsigned char)0x05, (unsigned char)0x06,      (unsigned char)0x07, (unsigned char)0x08, (unsigned char)0x09,     (unsigned char)0x0A, (unsigned char)0x0B, (unsigned char)0x0C,     (unsigned char)0x0D, (unsigned char)0x0E, (unsigned char)0x0F,     (unsigned char)0x10, (unsigned char)0x11, (unsigned char)0x12,     (unsigned char)0x13, (unsigned char)0x14, (unsigned char)0x15,     (unsigned char)0x16, (unsigned char)0x17, (unsigned char)0x18,     (unsigned char)0x19, (unsigned char)0x1A, (unsigned char)0x1B,     (unsigned char)0x1C, (unsigned char)0x1D, (unsigned char)0x1E,     (unsigned char)0x1F, (unsigned char)0x20, (unsigned char)0x21,     (unsigned char)0x22, (unsigned char)0x23, (unsigned char)0x24,     (unsigned char)0x25, (unsigned char)0x26, (unsigned char)0x27,     (unsigned char)0x28, (unsigned char)0x29, (unsigned char)0x2A,     (unsigned char)0x2B, (unsigned char)0x2C, (unsigned char)0x2D,     (unsigned char)0x2E, (unsigned char)0x2F, (unsigned char)0x30,     (unsigned char)0x31, (unsigned char)0x32, (unsigned char)0x33,     (unsigned char)0x34, (unsigned char)0x35, (unsigned char)0x36,     (unsigned char)0x37, (unsigned char)0x38, (unsigned char)0x39,     (unsigned char)0x3A, (unsigned char)0x3B, (unsigned char)0x3C,     (unsigned char)0x3D, (unsigned char)0x3E, (unsigned char)0x3F,     (unsigned char)0x40, (unsigned char)0x41, (unsigned char)0x42,     (unsigned char)0x43, (unsigned char)0x44, (unsigned char)0x45,     (unsigned char)0x46, (unsigned char)0x47, (unsigned char)0x48,     (unsigned char)0x49, (unsigned char)0x4A, (unsigned char)0x4B,     (unsigned char)0x4C, (unsigned char)0x4D, (unsigned char)0x4E,     (unsigned char)0x4F, (unsigned char)0x50, (unsigned char)0x51,     (unsigned char)0x52, (unsigned char)0x53, (unsigned char)0x57,     (unsigned char)0x58     };          unsigned char symbols_standart[] = {     (unsigned char)0x00, '1', '2', \/\/ 0x00 - null (not bind)     '3', '4', '5',     '6', '7', '8',     '9', '0', '-',     '=', (unsigned char)0x08, (unsigned char)0x09,     'q', 'w', 'e',     'r', 't', 'y',     'u', 'i', 'o',     'p', '[', ']',     (unsigned char)0x0A, (unsigned char)0x01, 'a', \/\/0x01 - l ctrl     's', 'd', 'f',     'g', 'h', 'j',     'k', 'l', ';',     '\\'', '`', (unsigned char)0x02, \/\/0x02 - l shift     '\\\\', 'z', 'x',     'c', 'v', 'b',     'n', 'm', ',',     '.', '\/', (unsigned char)0x00,     '*', (unsigned char)0x00, ' ',     (unsigned char)0x03, (unsigned char)0x00, (unsigned char)0x00, \/\/0x03 - caps     (unsigned char)0x00, (unsigned char)0x00, (unsigned char)0x00,     (unsigned char)0x00, (unsigned char)0x00, (unsigned char)0x00,     (unsigned char)0x00, (unsigned char)0x00, (unsigned char)0x00,     (unsigned char)0x00, '7', '8',     '9', '-', '4',     '5', '6', '+',     '1', '2', '3',     '0', '.', (unsigned char)0x00,     (unsigned char)0x00     };     int status = 0;     for (int i = 0; i != (sizeof(codes) \/ sizeof(char)); i++) {         if (ch == codes[i]) {             status = 1;             return symbols_standart[i];         }     }     if (status == 0) {         return ch;     } }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u0430\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442, \u0442\u0430\u043a \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437 \u0441\u043a\u0430\u043d\u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f), \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u043a\u0440\u0443\u0433\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 \u0438\u0437 1-\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0435\u0441\u043b\u0438 \u0440\u0430\u0432\u0435\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441\u0438\u043c\u0432\u043e\u043b \u0438\u0437 2-\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 (\u043d\u0430\u0436\u0430\u0442\u0430\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0430). \u0410 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0448\u043b\u043e \u0432 1-\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043d\u0430\u0448 \u0441\u0438\u043c\u0432\u043e\u043b, \u0442\u043e \u043c\u044b \u0435\u0433\u043e \u0436\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u0430\u043c-\u0442\u043e \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438, \u0430 \u044d\u0442\u043e \u0435\u0449\u0435 \u043c\u044b \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u0441 CapsLock \u0438 Shift, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u0438\u0432\u0435\u043b \u0431\u043e\u043b\u0435\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u0432 \u044f\u0434\u0440\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0438 \u043f\u0443\u0441\u0442\u043e\u0439 \u0446\u0438\u043a\u043b \u043d\u0430<\/p>\n<pre><code class=\"cpp\">while(1) {     unsigned char ch = getchar();     unsigned char ch_descaned = transform(ch);     printc(video_memory, ch_descaned, (char *)0x07, nextpos+1);      nextpos++; }<\/code><\/pre>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c, \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f<\/p>\n<figure class=\"\">\n<div><figcaption>\u042d\u043c&#8230;&#8230; \u041c\u044b \u0436\u0435 \u043d\u0435 \u044d\u0442\u043e\u0433\u043e \u0445\u043e\u0442\u0435\u043b\u0438?<\/figcaption><\/div>\n<\/figure>\n<p>\u0421\u0442\u0440\u0430\u043d\u043d\u043e \u043a\u0430\u043a-\u0442\u043e. \u0412\u0440\u043e\u0434\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u043d\u043e \u0437\u0430 \u043d\u0438\u043c\u0438 \u043f\u043e\u0442\u043e\u043c \u0438\u0434\u0435\u0442 \u0435\u0449\u0435 \u0441\u0438\u043c\u0432\u043e\u043b. \u0421\u0442\u0440\u0430\u043d\u043d\u043e, \u0434\u0430? \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0437\u0430\u0436\u0430\u0442\u044c. \u041d\u0435\u0442\u0443 \u0442\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430, \u0434\u0430? \u0422\u0430\u043a \u0432\u043e\u0442 \u0432 \u0447\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u043c\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0441 \u043e\u0442\u043f\u0443\u0441\u043a\u0430\u043d\u0438\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0448\u044b, \u0438 \u043e\u043d\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u043b\u043e \u0441\u043a\u0430\u043d\u043a\u043e\u0434 0x80 + \u0441\u043a\u0430\u043d\u043a\u043e\u0434 \u043a\u043b\u0430\u0432\u0438\u0448\u044b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u0432 <code>stdio.h<\/code> \u0438 \u0432\u043c\u0435\u0441\u0442\u043e <code>return inb(0x60);<\/code><strong><em> <\/em><\/strong>\u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cpp\">unsigned char scan = inb(0x60); if (scan &amp; 0x80) {     return 0; } return scan;<\/code><\/pre>\n<p>\u041e\u043d \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u043f\u0443\u0441\u043a\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u044b. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0432 kernel.c \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b:<\/p>\n<pre><code class=\"cpp\">if (ch == 0) continue;<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0431\u0435\u043b \u043d\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 (\u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0441\u043a\u0430\u043d\u043a\u043e\u0434\u0430 0x00 \u043d\u0435\u0442\u0443)<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043e\u0442\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0432 ISO \u0444\u0430\u0439\u043b &#8212; \u0438 \u0432\u0443\u0430\u043b\u044f<\/p>\n<figure class=\"\">\n<div><figcaption>\u0423\u0440\u0430, \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e<\/figcaption><\/div>\n<\/figure>\n<p>\u041d\u0443 \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432\u0441\u0435\u0445 \u043a\u043b\u0430\u0432\u0438\u0448. \u0410 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043a\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043f\u043b\u0430\u043d \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>echo<\/code>, <code>shutdown<\/code> \u0438 <code>version<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 Github: <a href=\"https:\/\/github.com\/KirillMos2\/HabrOS\/\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/KirillMos2\/HabrOS\/<\/a> <\/p>\n<hr\/>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0447\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438! \u0411\u0443\u0434\u0443 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u041e\u0421.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/938544\/\"> https:\/\/habr.com\/ru\/articles\/938544\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-471226","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/471226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=471226"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/471226\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=471226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=471226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=471226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}