{"id":6122,"date":"2026-07-02T07:26:04","date_gmt":"2026-07-01T22:26:04","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=6122"},"modified":"2026-07-02T10:42:01","modified_gmt":"2026-07-02T01:42:01","slug":"os-minios-9","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/07\/02\/os-minios-9\/","title":{"rendered":"[OS]miniOS-9"},"content":{"rendered":"\n<p>\ud83d\udc49\ufe0f 32\ube44\ud2b8 \ubcf4\ud638\ubaa8\ub4dc\uc5d0\uc11c \ud654\uba74\uc5d0 \uae00\uc790\uc4f0\ub294 \ucf54\ub4dc\uc785\ub2c8\ub2e4.(\uadf8\ub798\ud53d \ubaa8\ub4dc \uc720\uc9c0\uc0c1\ud0dc)<br>This is code for writing text to the screen in 32-bit protected mode (while maintaining graphics mode).<\/p>\n\n\n\n<p>\ud83d\udc49\ufe0f \ud30c\uc77c \/ files<\/p>\n\n\n\n<p>&#8212; kernel.c\ud30c\uc77c\uc744 \uc81c\uc678\ud558\uace4 \uae30\uc874\uc758 \ub0b4\uc6a9\uacfc \ub3d9\uc77c\ud569\ub2c8\ub2e4.<br>Except for the kernel.c file, the contents are identical to the original.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>boot.asm  kernel.c  sector2.asm<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49\ufe0f \ucf54\ub4dc \/ Code<\/p>\n\n\n\n<p>\u2714\ufe0f kernel.c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>typedef unsigned char byte;\n\n\/\/ ------------------------------------------------------------------------\n\/\/ 1. \uae30\ubcf8 \uadf8\ub798\ud53d \ud568\uc218 (volatile \uc801\uc6a9\uc73c\ub85c \uba54\ubaa8\ub9ac \uac15\uc81c \uc4f0\uae30)\n\/\/ Basic graphics functions (forced memory write via volatile)\n\/\/ ------------------------------------------------------------------------\nvoid draw_pixel(int x, int y, byte color) {\n    volatile byte *vram = (volatile byte *)0xA0000;\n    vram&#91;(y * 320) + x] = color;\n}\n\nvoid clear_screen(byte color) {\n    for (int y = 0; y &lt; 200; y++) {\n        for (int x = 0; x &lt; 320; x++) {\n            draw_pixel(x, y, color);\n        }\n    }\n}\n\n\/\/ ------------------------------------------------------------------------\n\/\/ 2. \uae00\uc790 \ucd9c\ub825 \ud568\uc218 (\ud3f0\ud2b8 \ub370\uc774\ud130\ub97c \ud568\uc218 \ub0b4\ubd80\ub85c \uc774\ub3d9\ud558\uc5ec \ub9c1\ud0b9 \uc624\ub958 \ud574\uacb0)\n\/\/ Character output function (resolved linking errors by moving font data inside the function)\n\/\/ ------------------------------------------------------------------------\nvoid draw_char(int start_x, int start_y, int font_index, byte color) {\n    \/\/ \ub9c1\ucee4 \uc624\ub958\ub97c \ubc29\uc9c0\ud558\uae30 \uc704\ud574 \ud3f0\ud2b8 \ub370\uc774\ud130\ub97c \ud568\uc218 \ub0b4\ubd80 \uc9c0\uc5ed \ubcc0\uc218\ub85c \uc120\uc5b8\ud569\ub2c8\ub2e4.\n    \/\/ To prevent linker errors, declare the font data as a local variable within the function.\n    byte font_8x8&#91;6]&#91;8] = {\n        {0x18, 0x24, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x00}, \/\/ A (index 0)\n        {0x7C, 0x42, 0x42, 0x7C, 0x42, 0x42, 0x7C, 0x00}, \/\/ B (index 1)\n        {0x3C, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3C, 0x00}, \/\/ C (index 2)\n        {0x78, 0x44, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00}, \/\/ D (index 3)\n        {0x7E, 0x40, 0x40, 0x78, 0x40, 0x40, 0x7E, 0x00}, \/\/ E (index 4)\n        {0x7E, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x00}  \/\/ F (index 5)\n    };\n\n    for (int y = 0; y &lt; 8; y++) {\n        byte row_data = font_8x8&#91;font_index]&#91;y];\n        \n        for (int x = 0; x &lt; 8; x++) {\n            \/\/ \ube44\ud2b8 \ub9c8\uc2a4\ud0b9 \uc5f0\uc0b0\uc73c\ub85c 1\uc778 \ubd80\ubd84\ub9cc \uc810\uc744 \ucc0d\uc74c\n            \/\/ Plot points only at positions corresponding to 1s using bitmasking operations.\n            if ((row_data &amp; (0x80 &gt;&gt; x)) != 0) {\n                draw_pixel(start_x + x, start_y + y, color);\n            }\n        }\n    }\n}\n\n\/\/ ------------------------------------------------------------------------\n\/\/ 3. \ucee4\ub110 \uba54\uc778 \ud568\uc218\n\/\/ Kernel main function\n\/\/ ------------------------------------------------------------------------\nvoid kernel_main(void) {\n    \/\/ \ubc30\uacbd\uc744 \ud30c\ub780\uc0c9(1)\uc73c\ub85c \ucd08\uae30\ud654\n    \/\/ Reset the background to blue (1).\n    clear_screen(1);\n\n    \/\/ \ud654\uba74 \uc911\uc559(X=100, Y=80) \uadfc\ucc98\uc5d0 \ub2e4\ub978 \uc0c9\uc0c1\uc73c\ub85c A, B, C, D, E, F \ucd9c\ub825\n    \/\/ Display A, B, C, D, E, and F in different colors near the center of the screen (X=100, Y=80)\n    draw_char(100, 80,  0, 15); \/\/ \ud770\uc0c9\/white 'A'\n    draw_char(112, 80,  1, 14); \/\/ \ub178\ub780\uc0c9\/yellow 'B'\n    draw_char(124, 80,  2, 10); \/\/ \ucd08\ub85d\uc0c9\/green 'C'\n    draw_char(136, 80,  3, 12); \/\/ \ube68\uac04\uc0c9\/red 'D'\n    draw_char(148, 80,  4, 13); \/\/ \uc790\uc0c9\/Purple 'E'\n    draw_char(160, 80,  5, 11); \/\/ \uccad\ub85d\uc0c9\/blue-green 'F'\n\n    while (1) {\n        __asm__ __volatile__(\"hlt\");\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49\ufe0f \ucf54\ub4dc\uc124\uba85 \/ Code Explanation<\/p>\n\n\n\n<p>\u2714\ufe0f  byte \ud0c0\uc785\uc120\uc5b8 \/ byte type declaration<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>typedef unsigned char byte;<\/code><\/pre>\n\n\n\n<p>&#8212; <strong>typedef<\/strong><\/p>\n\n\n\n<p>1)&#8221;Type Definition&#8221;\uc758 \uc904\uc784\ub9d0\ub85c, \uae30\uc874\uc5d0 \uc874\uc7ac\ud558\ub294 \ub370\uc774\ud130 \ud0c0\uc785\uc5d0 \uc0c8\ub85c\uc6b4 \ubcc4\uba85(\ubcc4\uce6d)\uc744 \ubd99\uc5ec\uc8fc\ub294 \ud0a4\uc6cc\ub4dc\uc785\ub2c8\ub2e4.<br>Short for &#8220;Type Definition,&#8221; this is a keyword used to assign a new alias to an existing data type.<\/p>\n\n\n\n<p>2)\uae34 \uc774\ub984\uc744 \uc9e7\uac8c \uc904\uc5ec\uc11c \uc0ac\uc6a9 \ud560 \uc218 \uc788\uac8c \ud574\uc90d\ub2c8\ub2e4.<br>It allows you to shorten long names for use.<\/p>\n\n\n\n<p>3)typeof\ubb38\ubc95\uc740 \uc544\ub798\ucc98\ub984 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<br>The <code>typeof<\/code> syntax is used as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>typedef &#91;\uae30\uc874 \uc790\ub8cc\ud615\/Existing data type] &#91;\uc0c8\ub85c\uc6b4 \ubcc4\uba85 \/New alias];<\/code><\/pre>\n\n\n\n<p>4)typeof\ub97c \uc0ac\uc6a9\ud558\uba74 \uc544\ub798\ucc98\ub7fc \ub370\uc774\ud130 \ud0c0\uc785\uc744 \uc904\uc5ec\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>By using <code>typeof<\/code>, you can use a shortened form for the data type, as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \ubcc4\uce6d\uc744 \uc0ac\uc6a9\ud558\uc9c0 \uc54a\uc740 \uacbd\uc6b0\n# When no alias is used\nvolatile unsigned char *vram = (volatile unsigned char *)0xA0000;\n\n# \ubcc4\uce6d\uc744 \uc0ac\uc6a9\ud558\ub294 \uacbd\uc6b0\n# When using aliases\nvolatile byte *vram = (volatile byte *)0xA0000;<\/code><\/pre>\n\n\n\n<p>&#8212; <strong>unsigned char<\/strong><\/p>\n\n\n\n<p>1)C\uc5b8\uc5b4\uc5d0\uc11c \uae30\ubcf8\uc73c\ub85c \uc81c\uacf5\ud558\ub294 \uac00\uc7a5 \uc791\uc740 \ub2e8\uc704\uc758 \ub370\uc774\ud130 \uc790\ub8cc\ud615\uc785\ub2c8\ub2e4.<br>It is the smallest unit of data type provided by default in the C language.<\/p>\n\n\n\n<p>2)char\ub294 \uae30\ubcf8\uc801\uc73c\ub85c 1\ubc14\uc774\ud2b8(8\ube44\ud2b8) \ud06c\uae30\uc758 \uba54\ubaa8\ub9ac\ub97c \uac00\uc9d1\ub2c8\ub2e4.<br>A <code>char<\/code> typically occupies 1 byte (8 bits) of memory.<\/p>\n\n\n\n<p>3)unsigned\ub294 &#8216;\ubd80\ud638\uac00 \uc5c6\ub2e4&#8217;\ub294 \ub73b\uc785\ub2c8\ub2e4. \ub9c8\uc774\ub108\uc2a4((-)) \uc74c\uc218\ub97c \ud45c\ud604\ud558\uc9c0 \uc54a\uaca0\ub2e4\ub294 \uc758\ubbf8\uc785\ub2c8\ub2e4.<br>&#8216;Unsigned&#8217; means &#8216;without a sign.&#8217; It signifies that negative numbers (indicated by a minus sign) are not represented.<\/p>\n\n\n\n<p>4)\uc77c\ubc18\uc801\uc778 char\ub294 (-128 ~ +127)\uae4c\uc9c0 \ud45c\ud604\ud558\uc9c0\ub9cc, \ubd80\ud638\ub97c \uc5c6\uc564 unsigned char\ub294 8\ube44\ud2b8 \uc804\uccb4\ub97c \uc591\uc218\ub85c\ub9cc \uc0ac\uc6a9\ud558\uc5ec (0 ~ 255)\uae4c\uc9c0 \ud45c\ud604\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>While a standard <code>char<\/code> represents values \u200b\u200bfrom -128 to +127, an <code>unsigned char<\/code>\u2014which removes the sign bit\u2014uses all 8 bits for positive values, allowing it to represent a range of 0 to 255.<\/p>\n\n\n\n<p>\u2714\ufe0f draw_pixel\ud568\uc218<br>draw_pixel function<\/p>\n\n\n\n<p>&#8212; \ud2b9\uc815 \uc88c\ud45c ((x, y))\uc5d0 \uc6d0\ud558\ub294 \uc0c9\uc0c1\uc758 \uc810(\ud53d\uc140) \ud558\ub098\ub97c \ucc0d\ub294 \ud568\uc218\uc785\ub2c8\ub2e4.<br>This is a function that plots a single point (pixel) of a desired color at specific coordinates (x, y).<\/p>\n\n\n\n<p>&#8212; <strong>unsigned char<\/strong><\/p>\n\n\n\n<p>1)C\uc5b8\uc5b4\uc5d0\uc11c \uae30\ubcf8\uc73c\ub85c \uc81c\uacf5\ud558\ub294 \uac00\uc7a5 \uc791\uc740 \ub2e8\uc704\uc758 \ub370\uc774\ud130 \uc790\ub8cc\ud615\uc785\ub2c8\ub2e4.<br>It is the smallest unit of data type provided by default in the C language.<\/p>\n\n\n\n<p>2)char\ub294 \uae30\ubcf8\uc801\uc73c\ub85c 1\ubc14\uc774\ud2b8(8\ube44\ud2b8) \ud06c\uae30\uc758 \uba54\ubaa8\ub9ac\ub97c \uac00\uc9d1\ub2c8\ub2e4.<br>A <code>char<\/code> typically occupies 1 byte (8 bits) of memory.<\/p>\n\n\n\n<p>3)unsigned\ub294 &#8216;\ubd80\ud638\uac00 \uc5c6\ub2e4&#8217;\ub294 \ub73b\uc785\ub2c8\ub2e4. \ub9c8\uc774\ub108\uc2a4((-)) \uc74c\uc218\ub97c \ud45c\ud604\ud558\uc9c0 \uc54a\uaca0\ub2e4\ub294 \uc758\ubbf8\uc785\ub2c8\ub2e4.<br>&#8216;Unsigned&#8217; means &#8216;without a sign.&#8217; It signifies that negative numbers (indicated by a minus sign) are not represented.<\/p>\n\n\n\n<p>4)\uc77c\ubc18\uc801\uc778 char\ub294 (-128 ~ +127)\uae4c\uc9c0 \ud45c\ud604\ud558\uc9c0\ub9cc, \ubd80\ud638\ub97c \uc5c6\uc564 unsigned char\ub294 8\ube44\ud2b8 \uc804\uccb4\ub97c \uc591\uc218\ub85c\ub9cc \uc0ac\uc6a9\ud558\uc5ec (0 ~ 255)\uae4c\uc9c0 \ud45c\ud604\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br>While a standard <code>char<\/code> represents values \u200b\u200bfrom -128 to +127, an <code>unsigned char<\/code>\u2014which removes the sign bit\u2014uses all 8 bits for positive values, allowing it to represent a range of 0 to 255.<\/p>\n\n\n\n<p>\u2714\ufe0f draw_pixel\ud568\uc218<br>draw_pixel function<\/p>\n\n\n\n<p>&#8212; \ud2b9\uc815 \uc88c\ud45c ((x, y))\uc5d0 \uc6d0\ud558\ub294 \uc0c9\uc0c1\uc758 \uc810(\ud53d\uc140) \ud558\ub098\ub97c \ucc0d\ub294 \ud568\uc218\uc785\ub2c8\ub2e4.<br>This is a function that plots a single point (pixel) of a desired color at specific coordinates (x, y).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void draw_pixel(int x, int y, byte color) {\n    volatile byte *vram = (volatile byte *)0xA0000;\n    vram&#91;(y * 320) + x] = color;\n}<\/code><\/pre>\n\n\n\n<p>&#8211;draw_pixel\ud568\uc218 \ud30c\ub77c\uba54\ud130<br>draw_pixel function parameters<\/p>\n\n\n\n<p>1)x \ub294 \uac00\ub85c\uc88c\ud45c,y\ub294 \uc138\ub85c\uc88c\ud45c\uc774\uba70 \uac00\ub85c\ub294 319\ubc88,\uc138\ub85c 199\ubc88\uae4c\uc9c0 \uac00\ub2a5\ud569\ub2c8\ub2e4.(\ud574\uc0c1\ub3c4 300 x 200)<br>x represents the horizontal coordinate and y the vertical coordinate; the horizontal range is 0 to 319, and the vertical range is 0 to 199 (resolution: 300 x 200).<\/p>\n\n\n\n<p>2)color\ub294 256\uc0c9\uc744 \uc0ac\uc6a9\ud558\ubbc0\ub85c 256\ubc88\uae4c\uc9c0 \uc0ac\uc6a9\uac00\ub2a5\ud569\ub2c8\ub2e4.<br>Since the color setting uses a 256-color palette, values \u200b\u200bup to 256 can be used.<\/p>\n\n\n\n<p>&#8211;0xA0000<\/p>\n\n\n\n<p>1)IBM PC \ud638\ud658 \ucef4\ud4e8\ud130\uc5d0\uc11c VGA \uadf8\ub798\ud53d \uce74\ub4dc\uc758 \ud654\uba74 \uba54\ubaa8\ub9ac\uac00 \uc2dc\uc791\ub418\ub294 \ubb3c\ub9ac\uc801 \uc8fc\uc18c\uc785\ub2c8\ub2e4. \uc774 \uc8fc\uc18c\uc5d0 \ub370\uc774\ud130\ub97c \uc4f0\uba74 \ubaa8\ub2c8\ud130 \ud654\uba74\uc5d0 \uadf8\ub300\ub85c \ub098\ud0c0\ub0a9\ub2c8\ub2e4.<br>This is the physical address where the screen memory of a VGA graphics card begins on an IBM PC-compatible computer. Writing data to this address causes it to appear directly on the monitor screen.<\/p>\n\n\n\n<p>&#8211;volatile<\/p>\n\n\n\n<p>1)\ucef4\ud30c\uc77c\ub7ec\ub294 \uc18d\ub3c4\ub97c \ub192\uc774\uae30 \uc704\ud574\uc11c \ud55c\ubc88 \uc77d\uc5b4 \uc628 \uac12\uc744 cpu\ub808\uc9c0\uc2a4\ud130\uc5d0 \uc800\uc7a5\ud574\ub450\uace0 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<br>To increase speed, the compiler stores a value it has read into a CPU register and uses it from there.<\/p>\n\n\n\n<p>2)volatile\ud0a4\uc6cc\ub4dc\ub97c \uc0ac\uc6a9\ud558\uba74 \ub808\uc9c0\uc2a4\ud130\uc758 \uac12\uc744 \ucc38\uc870\ud558\uc9c0 \uc54a\uace0 \ubc14\ub85c \uba54\ubaa8\ub9ac\uc5d0\uc11c \uac12\uc744 \uac00\uc838\uc635\ub2c8\ub2e4.<br>When the <code>volatile<\/code> keyword is used, the value is retrieved directly from memory instead of referencing the value in a register.<\/p>\n\n\n\n<p>&#8212; \ubb38\uc790\uc758 \uc704\uce58 \uc124\uc815<br>Setting the text position<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vram&#91;(y * 320) + x] = color;<\/code><\/pre>\n\n\n\n<p>1)vram\ubc30\uc5f4\uc740 \ub2e8\uc21c \uac12\uc758 \ub098\uc5f4\uc774\uace0 \ub098\uc911\uc5d0 \uc2e4\uc81c\ub85c X,Y\uc704\uce58\ub97c \uc7a1\uae30\uc704\ud574 \ub370\uc774\ud130 \uc14b\ud305\ud569\ub2c8\ub2e4.<br>The VRAM array is simply a sequence of values; the data is configured later to actually determine the X and Y positions.<\/p>\n\n\n\n<p>&#8212; \ud654\uba74\uc758 \ubc30\uacbd\uc0c9\uc744 \uc9c0\uc815\ud569\ub2c8\ub2e4.<br>Specifies the background color of the screen.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void clear_screen(byte color) {\n    for (int y = 0; y &lt; 200; y++) {\n        for (int x = 0; x &lt; 320; x++) {\n            draw_pixel(x, y, color);\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>1)kernel_main\ud568\uc218\uc5d0\uc11c clear_screen(1)\uc744 \uc9c0\uc815\ud574\uc11c \ud654\uba74\uc744 \ud30c\ub791\uc0c9\uc73c\ub85c \uc14b\ud305\ud569\ub2c8\ub2e4.<br>In the <code>kernel_main<\/code> function, specify <code>clear_screen(1)<\/code> to set the screen color to blue.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void kernel_main(void) {\n    \/\/ \ubc30\uacbd\uc744 \ud30c\ub780\uc0c9(1)\uc73c\ub85c \ucd08\uae30\ud654\n    \/\/ Reset the background to blue (1).\n    clear_screen(1);\n\n    ...\n}\n<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f draw_char\ud568\uc218<br>draw_char function<\/p>\n\n\n\n<p>&#8212; &#8216;A&#8217;\uc758 \ub370\uc774\ud130 \uc2dc\uac01\ud654<br>Data visualization of &#8216;A&#8217;<\/p>\n\n\n\n<p>1){0x18, 0x24, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x00}\uc744 2\uc9c4\uc218\ub85c \ubc14\uafb8\uc5b4 8&#215;8 \ubaa8\ub208\uc885\uc774\uc5d0 \ucc44\uc6b0\uba74 \ub2e4\uc74c\uacfc \uac19\uc740 \ubaa8\uc591\uc774 \ub098\uc635\ub2c8\ub2e4.<br>If you convert {0x18, 0x24, 0x42, 0x7E, 0x42, 0x42, 0x42, 0x00} into binary and fill in an 8&#215;8 grid, the following shape is formed.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>\ud589\/Col (Y)<\/td><td>16\uc9c4\uc218\/Hexadecimal<\/td><td>2\uc9c4\uc218 \ubcc0\ud658 (8\ube44\ud2b8)<br>Binary Conversion (8-bit)<\/td><td>\uc2e4\uc81c \uae00\uc790 \ubaa8\uc591<br>Actual character shape<\/td><\/tr><tr><td>0\ubc88\uc9f8\/0th<\/td><td>0x18<\/td><td>00011000<\/td><td>\u2591\u2591\u2591<strong>\u2588\u2588<\/strong>\u2591\u2591\u2591 <\/td><\/tr><tr><td>1\ubc88\uc9f8\/1st<\/td><td>0x24<\/td><td>00100100<\/td><td>\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2591<\/td><\/tr><tr><td>2\ubc88\uc9f8\/2nd<\/td><td>0x42<\/td><td>01000010<\/td><td>\u2591\u2588\u2591\u2591\u2591\u2591\u2588\u2591<\/td><\/tr><tr><td>3\ubc88\uc9f8\/3rd<\/td><td>0x7E<\/td><td>01111110<\/td><td>\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2591<\/td><\/tr><tr><td>4\ubc88\uc9f8\/4th<\/td><td>0x42<\/td><td>01000010<\/td><td>\u2591\u2588\u2591\u2591\u2591\u2591\u2588\u2591<\/td><\/tr><tr><td>5\ubc88\uc9f8\/5th<\/td><td>0x42<\/td><td>01000010<\/td><td>\u2591\u2588\u2591\u2591\u2591\u2591\u2588\u2591<\/td><\/tr><tr><td>6\ubc88\uc9f8\/6th<\/td><td>0x42<\/td><td>01000010<\/td><td>\u2591\u2588\u2591\u2591\u2591\u2591\u2588\u2591<\/td><\/tr><tr><td>7\ubc88\uc9f8\/7th<\/td><td><code>0x00<\/code><\/td><td>00000000<\/td><td>\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591<br><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>&#8212; \ud654\uba74\uc5d0 \uae00\uc790 \uadf8\ub9ac\uae30 \/ Drawing text on the screen<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    for (int y = 0; y &lt; 8; y++) {\n        byte row_data = font_8x8&#91;font_index]&#91;y];\n        \n        for (int x = 0; x &lt; 8; x++) {\n            \/\/ \ube44\ud2b8 \ub9c8\uc2a4\ud0b9 \uc5f0\uc0b0\uc73c\ub85c 1\uc778 \ubd80\ubd84\ub9cc \uc810\uc744 \ucc0d\uc74c\n            \/\/ Plot points only at positions corresponding to 1s using bitmasking operations.\n            if ((row_data &amp; (0x80 &gt;&gt; x)) != 0) {\n                draw_pixel(start_x + x, start_y + y, color);\n            }\n        }\n    }<\/code><\/pre>\n\n\n\n<p>1)\ubc18\ubcf5\ubb38\uc774 \uc2e4\ud589\ub418\uba74\uc11c font_8x8 \ubc30\uc5f4\uc5d0\uc11c \ud574\ub2f9\ud558\ub294 \ubb38\uc790\uc758 \uac12\uc744 \ud558\ub098\uc529 \uaebc\ub0c5\ub2c8\ub2e4.<br>As the loop executes, it retrieves the values \u200b\u200bfor the corresponding characters from the <code>font_8x8<\/code> array one by one.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>byte row_data = font_8x8&#91;font_index]&#91;y];<\/code><\/pre>\n\n\n\n<p>2)0x80 &gt;&gt; x<\/p>\n\n\n\n<p>2-1) 16\uc9c4\uc218 0x80\uc740 \uc774\uc9c4\uc218\ub85c 10000000\uac12\uc774 \ub429\ub2c8\ub2e4.<br>The hexadecimal value 0x80 corresponds to the binary value 10000000.<\/p>\n\n\n\n<p>2-2) \ubc18\ubcf5\ubb38\uc774 \uc2e4\ud589\ub418\uba74 x = 0 \uc77c \ub54c: 10000000,x = 1 \uc77c \ub54c: 01000000,x = 2 \uc77c \ub54c: 00100000 \uc774\ub807\uac8c \ube44\ud2b8\uac00 \uc774\ub3d9\ud569\ub2c8\ub2e4.<br>When the loop executes, the bits shift as follows: 10000000 when x = 0, 01000000 when x = 1, and 00100000 when x = 2.<\/p>\n\n\n\n<p>3) row_data &amp; (\u2026)<\/p>\n\n\n\n<p>3-1) \uc564\ub4dc \uc5f0\uc0b0\uc73c\ub85c row_data\uc640 0x80 &gt;&gt; x\uac12\uc744 \ud655\uc778\ud569\ub2c8\ub2e4.<br>Check <code>row_data<\/code> and the value of <code>0x80 &gt;&gt; x<\/code> using an AND operation.<\/p>\n\n\n\n<p>3-2)row_data\uac00 A\ubb38\uc790\ub97c \uadf8\ub9ac\uace0 0x80 &gt;&gt; 0 \uc778\uacbd\uc6b0\ub85c \uc564\ub4dc \uc5f0\uc0b0\uc758 \uacb0\uacfc\uac00 00000000 \uc774\ubbc0\ub85c \uc810\uc744 \ucc0d\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<br>If <code>row_data<\/code> represents the character &#8216;A&#8217; and the operation is <code>0x80 &gt;&gt; 0<\/code>, the result of the AND operation is <code>00000000<\/code>, so no dot is drawn.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  00011000  (row_data: 'A'\uc758 \uccab \uc904 \/ row_data: First line of 'A')\n&amp; 10000000  (0x80 &gt;&gt; 0)\n------------\n  00000000  \n<\/code><\/pre>\n\n\n\n<p>3-3) x=3\uc77c\ub54c 4\ubc88\uc9f8 \ube44\ud2b8\uac00 1\uc774 \ub429\ub2c8\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  00011000  (row_data: 'A'\uc758 \uccab \uc904 \/ row_data: First line of 'A')\n&amp; 00010000  (0x80 &gt;&gt; 3)\n------------\n  00010000  \n<\/code><\/pre>\n\n\n\n<p>3-4)\ube44\ud2b8\uac00 1\uc778 \ubd80\ubd84\uc740 draw_pixel\ud568\uc218\ub97c \uc0ac\uc6a9\ud574\uc11c \uc810\uc744 \ucc0d\uc2b5\ub2c8\ub2e4.<br>For parts where the bit is 1, a dot is drawn using the <code>draw_pixel<\/code> function.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>draw_pixel(start_x + x, start_y + y, color);<\/code><\/pre>\n\n\n\n<p>3-5) \uc815\ub9ac\ud558\uba74 \uccab\ubc88\uc9f8\uc904\ubd80\ud130 8\ubc88\uc9f8 \uc904\uae4c\uc9c0 \uc88c\uce21\uc5d0\uc11c \uc6b0\uce21\uc73c\ub85c 8\ube44\ud2b8\ub97c \uc21c\uc11c\ub300\ub85c \ud655\uc778\ud574\uc11c \uc810\uc744 \ucc0d\uc5b4\uc11c \ubb38\uc790\ub97c \ucd9c\ub825\ud569\ub2c8\ub2e4.<br>To summarize, the process involves checking 8 bits in order from left to right across the first eight lines and outputting characters by plotting points.<\/p>\n\n\n\n<p>\u2714\ufe0f \uc808\uc804 \ubc0f \ub300\uae30\uc0c1\ud0dc \/ Power Saving and Standby Modes<\/p>\n\n\n\n<p>1)__asm_ \uc5b4\uc148\ube14\ub7ec \ucf54\ub4dc\ub97c \uc0ac\uc6a9\ud558\ub294 \ud0a4\uc6cc\ub4dc\uc785\ub2c8\ub2e4.<br><code>__asm<\/code> is a keyword used for assembler code.<\/p>\n\n\n\n<p>2)__volatile__ hlt\uba85\ub839\uc5b4\ub97c \ucef4\ud30c\uc77c\ub7ec\uac00 \uc0ad\uc81c\ud558\uc9c0 \ubabb\ud558\uac8c \ub9c9\ub294 \uae30\ub2a5\uc785\ub2c8\ub2e4.<br><code>__volatile__<\/code> prevents the compiler from removing the <code>hlt<\/code> instruction.<\/p>\n\n\n\n<p>3)hlt\ub294 \ub2e4\uc74c \uc2e0\ud638 (\uc778\ud130\ub7fd\ud2b8) \uc62c\ub54c \uae4c\uc9c0 \ub300\uae30\uc0c1\ud0dc\ub85c \uc124\uc815\ud569\ub2c8\ub2e4.<br>The HLT instruction sets the processor to a waiting state until the next signal (interrupt) arrives.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    while (1) {\n        __asm__ __volatile__(\"hlt\");\n    }<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83d\udc49\ufe0f \ucef4\ud30c\uc77c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># 1. \ubd80\ud2b8\uc139\ud130 \ubc0f \ubcf4\ud638\ubaa8\ub4dc \uc9c4\uc785\ubd80 \ucef4\ud30c\uc77c\nnasm -f bin boot.asm -o boot.bin\nnasm -f elf32 sector2.asm -o sector2.o\n\n# 2. \uc0c8\ub85c \uc218\uc815\ud55c kernel.c \ucef4\ud30c\uc77c\ngcc -m32 -c kernel.c -o kernel.o -nostdlib -fno-builtin -fno-stack-protector -fno-pic -fno-PIE\n\n# 3. \ud558\ub098\uc758 \ubc14\uc774\ub108\ub9ac\ub85c \uacb0\ud569\nld -m elf_i386 -Ttext 0x8000 -e start -o sector2.bin sector2.o kernel.o --oformat binary\n\n# 4. \uc774\ubbf8\uc9c0 \uc0dd\uc131 \ubc0f \uc2e4\ud589\ncat boot.bin sector2.bin &gt; temp.bin\ndd if=temp.bin of=os.img bs=512 count=2880 conv=sync\nqemu-system-x86_64 -drive file=os.img,format=raw,if=floppy -boot a\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"674\" height=\"482\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/07\/miniOS-9.jpg\" alt=\"\" class=\"wp-image-6135\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/07\/miniOS-9.jpg 674w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/07\/miniOS-9-300x215.jpg 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/07\/miniOS-9-400x286.jpg 400w\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc49\ufe0f 32\ube44\ud2b8 \ubcf4\ud638\ubaa8\ub4dc\uc5d0\uc11c \ud654\uba74\uc5d0 \uae00\uc790\uc4f0\ub294 \ucf54\ub4dc\uc785\ub2c8\ub2e4.(\uadf8\ub798\ud53d \ubaa8\ub4dc \uc720\uc9c0\uc0c1\ud0dc)This is code for writing text to the screen in 32-bit protected mode (while maintaining graphics mode). \ud83d\udc49\ufe0f \ud30c\uc77c \/ files &#8212; kernel.c\ud30c\uc77c\uc744 \uc81c\uc678\ud558\uace4 \uae30\uc874\uc758 \ub0b4\uc6a9\uacfc \ub3d9\uc77c\ud569\ub2c8\ub2e4.Except for the kernel.c file, the contents are identical to the original. \ud83d\udc49\ufe0f \ucf54\ub4dc \/ Code \u2714\ufe0f kernel.c \ud83d\udc49\ufe0f \ucf54\ub4dc\uc124\uba85 \/ Code [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6122","post","type-post","status-publish","format-standard","hentry","category-uncategorized","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=6122"}],"version-history":[{"count":12,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6122\/revisions"}],"predecessor-version":[{"id":6136,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6122\/revisions\/6136"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=6122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=6122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=6122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}