{"id":6054,"date":"2026-06-23T11:20:40","date_gmt":"2026-06-23T02:20:40","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=6054"},"modified":"2026-06-23T11:38:35","modified_gmt":"2026-06-23T02:38:35","slug":"os-minios-2","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/06\/23\/os-minios-2\/","title":{"rendered":"[OS]miniOS-2"},"content":{"rendered":"\n<p>\ud83d\udc49\ud83c\udffb \uc544\ub798\uc758 \ucf54\ub4dc\ub294 \ud654\uba74\uc5d0 &#8216;X&#8217;\ub300\uc2e0\uc5d0 Hello miniOS!\ub97c \ud654\uba74\uc5d0 \ucd9c\ub825\ud569\ub2c8\ub2e4.<br>The code below outputs &#8220;Hello miniOS!&#8221; to the screen instead of &#8220;X&#8221;.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb  boot.asm \uc804\uccb4 \ucf54\ub4dc \/ full code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>; BIOS\uac00 \uc774 \ucf54\ub4dc\ub97c \uba54\ubaa8\ub9ac 0x7C00\uc5d0 \ub85c\ub4dc\ud569\ub2c8\ub2e4.\n; The BIOS loads this code into memory at 0x7C00.\n&#91;org 0x7c00]\n\n; 16\ube44\ud2b8 \ub9ac\uc5bc \ubaa8\ub4dc\ub85c \uc2e4\ud589\ud569\ub2c8\ub2e4.\n; Executes in 16-bit real mode.\nbits 16\n\nstart:\n    ; \ub370\uc774\ud130 \uc138\uadf8\uba3c\ud2b8 \ub808\uc9c0\uc2a4\ud130 \ucd08\uae30\ud654\n    ; Initialize data segment register\n    mov ax, 0\n    mov ds, ax\n\n    ; \ubb38\uc790\uc5f4\uc758 \uc2dc\uc791 \uc8fc\uc18c\ub97c SI \ub808\uc9c0\uc2a4\ud130\uc5d0 \uc800\uc7a5\n    ; Store the starting address of the string in the SI register\n    mov si, msg\n\n; \ubb38\uc790\uc5f4\uc744 \ud55c \uae00\uc790\uc529 \uc77d\uc5b4\uc640 \ucd9c\ub825\ud558\ub294 \ub8e8\ud504\n; A loop that reads and prints a string character by character\nprint_loop:\n    ; SI\uac00 \uac00\ub9ac\ud0a4\ub294 \uc8fc\uc18c\uc5d0\uc11c 1\ubc14\uc774\ud2b8\ub97c AL\uc5d0 \ub85c\ub4dc\ud558\uace0 SI\ub97c 1 \uc99d\uac00\uc2dc\ud0b4\n    ; Load 1 byte from the address pointed to by SI into AL and increment SI by 1\n    lodsb           \n\n    ; \uac00\uc838\uc628 \ubb38\uc790\uac00 0(\ubb38\uc790\uc5f4\uc758 \ub05d)\uc778\uc9c0 \ud655\uc778\n    ; Check if the retrieved character is 0 (end of string)\n    cmp al, 0     \n\n    ; 0\uc774\uba74 \ubb34\ud55c \ub8e8\ud504\ub85c \uc774\ub3d9\ud558\uc5ec \uc885\ub8cc\n    ; If 0, jump to the infinite loop and terminate.\n    je hang         \n\n    ; BIOS \ud154\ub808\ud0c0\uc774\ud504 \ucd9c\ub825 \uae30\ub2a5 \uc120\ud0dd\n    ; Select BIOS teletype output function\n    mov ah, 0x0e    \n\n    ; BIOS \ube44\ub514\uc624 \uc778\ud130\ub7fd\ud2b8 \ud638\ucd9c\ud558\uc5ec AL\uc758 \ubb38\uc790 \ucd9c\ub825\n    ; Call BIOS video interrupt to output the character in AL\n    int 0x10       \n\n    ; \ub2e4\uc74c \uae00\uc790 \ucd9c\ub825\uc744 \uc704\ud574 \ub8e8\ud504 \ubc18\ubcf5\n    ; Loop to print the next character\n    jmp print_loop  \n\n; \ud604\uc7ac \uc704\uce58($)\uc5d0\uc11c \ubb34\ud55c \ub8e8\ud504\ub97c \ub3cc\uba70 \ub300\uae30\ud569\ub2c8\ub2e4.\n; Waits in an infinite loop at the current location ($).\nhang:\n    jmp $\n\n; \ucd9c\ub825\ud560 \ubb38\uc790\uc5f4 \uc815\uc758 (\ub05d\uc5d0 0\uc744 \ubd99\uc5ec \ubb38\uc790\uc5f4\uc758 \ub05d\uc744 \ud45c\uc2dc)\n; Define the string to output (append 0 to mark the end of the string)\nmsg db 'Hello miniOS!', 0\n\n; 512\ubc14\uc774\ud2b8 \uc911 \ube48 \uacf5\uac04\uc744 \ubaa8\ub450 0\uc73c\ub85c \ucc44\uc6c1\ub2c8\ub2e4.\n; Fill all remaining space within the 512 bytes with zeros.\ntimes 510 - ($ - $$) db 0\n\n; \uc774 \ub514\uc2a4\ud06c\uac00 \ubd80\ud305 \uac00\ub2a5\ud558\ub2e4\ub294 \uac83\uc744 \uc54c\ub9ac\ub294 \ubd80\ud2b8 \uc2dc\uadf8\ub2c8\ucc98 \uc800\uc7a5\n; Store the boot signature indicating that this disk is bootable.\ndw 0xaa55\n\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># 1. \uc5b4\uc148\ube14\ub9ac\uc5b4 \ucf54\ub4dc\ub97c \uc21c\uc218\ud55c \ubc14\uc774\ub108\ub9ac \ud30c\uc77c(.bin)\ub85c \ucef4\ud30c\uc77c\n# Compile assembly code into a pure binary file (.bin)\nnasm -f bin boot.asm -o boot.bin\n\n# 2. QEMU \uc5d0\ubbac\ub808\uc774\ud130\uc5d0 \uc774 \ubc14\uc774\ub108\ub9ac\ub97c \ub514\uc2a4\ud06c\ub85c \ub123\uc5b4 \uac00\uc0c1 \ucef4\ud4e8\ud130 \ubd80\ud305\n# Put this binary on a disk and boot the virtual machine in the QEMU emulator\nqemu-system-x86_64 -drive format=raw,file=boot.bin<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"490\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-2-jpg.jpg\" alt=\"\" class=\"wp-image-6055\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-2-jpg.jpg 748w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-2-jpg-300x197.jpg 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-2-jpg-400x262.jpg 400w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \ucf54\ub4dc\uc124\uba85 \/ Code description<\/p>\n\n\n\n<p>\u2714\ufe0f \ub808\uc9c0\uc2a4\ud130 ax,ds\ub97c  0 \uc73c\ub85c \ucd08\uae30\ud654\ud558\uae30<br>Initialize registers ax and ds to 0.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    mov ax, 0\n    mov ds, ax<\/code><\/pre>\n\n\n\n<p>&#8212; <strong>\ub808\uc9c0\uc2a4\ud130(Register)<\/strong>\ub294 \ubcc0\uc218\uc640 \ube44\uc2b7\ud558\uc9c0\ub9cc, <strong>CPU(\ucef4\ud4e8\ud130\uc758 \ub450\ub1cc) \ub0b4\ubd80\uc5d0 \uc874\uc7ac\ud558\ub294 &#8216;\ucd08\uace0\uc18d \ubbf8\ub2c8 \uc800\uc7a5 \uacf5\uac04&#8217;<\/strong>\uc785\ub2c8\ub2e4.(RAM\uc774 \uc544\ub2d8)<br>A register is similar to a variable, but it is a &#8220;high-speed mini-storage space&#8221; located inside the CPU (the brain of the computer)\u2014not in RAM.<\/p>\n\n\n\n<p>&#8212; ax\uc640 ds\ub97c 0\uc73c\ub85c \ucd08\uae30\ud654\ud558\ub294 \uc774\uc720\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<br>The reasons for initializing ax and ds to zero are as follows.<\/p>\n\n\n\n<p>1) ds\uc5d0 \uc4f0\ub808\uae30 \uac12\uc774 \ub4e4\uc5b4 \uc788\uc744 \uc218 \uc788\uc5b4\uc11c 0\uc73c\ub85c \ucd08\uae30\ud654 \ud569\ub2c8\ub2e4. \uc4f0\ub808\uae30 \uac12\uc774 \uc788\uc73c\uba74 \uc798\ubabb\ub41c \uc8fc\uc18c\ub97c \uac00\ub9ac\ud0b5\ub2c8\ub2e4.<br><code>ds<\/code> may contain garbage values, so it is initialized to zero; if garbage values \u200b\u200bare present, it would point to an invalid address.<\/p>\n\n\n\n<p>2)\uc8fc\uc18c \uacc4\uc0b0\uacf5\uc2dd<br>Address calculation formula<\/p>\n\n\n\n<p>\uc138\uadf8\uba3c\ud2b8 \ub808\uc9c0\uc2a4\ud130(ds)\uac00 0\uc774\uae30 \ub54c\ubb38\uc5d0 \ubcc0\uc218\uc758 \ub370\uc774\ud130\ud06c\uae30\uac00 \uc8fc\uc18c\uc704\uce58\uac00 \ub429\ub2c8\ub2e4.<br>Since the segment register (ds) is 0, the data size of the variable becomes the address location.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\uc9c4\uc9dc \uc8fc\uc18c = (\uc138\uadf8\uba3c\ud2b8 \ub808\uc9c0\uc2a4\ud130 \u00d7 16) + \ubcc0\uc218\uc758 \uc704\uce58(\uc624\ud504\uc14b)\nActual address = (segment register \u00d7 16) + variable location (offset)<\/code><\/pre>\n\n\n\n<p>&#8212;  \uc544\ub798\uc758 \ud83d\udcd3\ubd80\ubd84\uc740 \ubcc0\uc218,\ub808\uc9c0\uc2a4\ud130\uc5d0 \ub300\ud55c \uac1c\ub150 \ubc0f \uc6a9\ub3c4 \uc124\uba85\uc785\ub2c8\ub2e4.<br>The section marked \ud83d\udcd3 below explains the concepts and purposes of variables and registers.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83d\udcd3  \ubcc0\uc218\uc640 \ub808\uc9c0\uc2a4\ud130\uc758 \ud575\uc2ec \ucc28\uc774\uc810<br>Key differences between variables and registers<\/p>\n\n\n\n<p>1)\uc5b4\uc148\ube14\ub7ec\uc5d0\uc11c \ub808\uc9c0\uc2a4\ud130\uc5d0 \ub4f1\ub85d\ud558\ub294\uac74 \ubcc0\uc218\ub4f1\ub85d\uacfc \uc720\uc0ac\ud558\uc9c0\ub9cc \ub2e4\uc74c\uacfc \uac19\uc740 \ucc28\uc774\uc810\uc774 \uc788\uc2b5\ub2c8\ub2e4.<br>Registering a register in an assembler is similar to declaring a variable, but there are the following differences.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th>\uad6c\ubd84 (Category)<\/th><th>\ubcc0\uc218 (Variable)<\/th><th>\ub808\uc9c0\uc2a4\ud130 (Register)<\/th><\/tr><tr><td><strong>\uc704\uce58<\/strong> \/ Location<\/td><td>\ucef4\ud4e8\ud130\uc758 <strong>\uba54\ubaa8\ub9ac(RAM)<\/strong><br>Computer memory (RAM)<\/td><td><strong>CPU \ub0b4\ubd80<\/strong> \ud558\ub4dc\uc6e8\uc5b4<br>Internal CPU hardware<\/td><\/tr><tr><td><strong>\uac1c\uc218<\/strong> \/ Quantity<\/td><td>\uba54\ubaa8\ub9ac \uc6a9\ub7c9\uc774 \ud5c8\uc6a9\ud558\ub294 \ud55c <strong>\ubb34\ud55c\ub300<\/strong><br>Infinite as long as memory capacity allows<\/td><td>CPU \uc124\uacc4 \uc2dc \uace0\uc815\ub428 (<strong>\uc218\uc2ed \uac1c \ub0b4\uc678<\/strong>)<br>Fixed during CPU design (around a few dozen)<\/td><\/tr><tr><td><strong>\uc774\ub984<\/strong> \/ Name<\/td><td><code>age<\/code>, <code>name<\/code> \ub4f1 \uac1c\ubc1c\uc790\uac00 \ub9c8\uc74c\ub300\ub85c \uc9c0\uc74c<br>Age, name, etc. are named arbitrarily by the developer<\/td><td><code>ax<\/code>, <code>bx<\/code>, <code>cx<\/code>, <code>ds<\/code> \ub4f1 <strong>\uc774\ubbf8 \uc815\ud574\uc838 \uc788\uc74c<\/strong><br>ax, bx, cx, ds, etc., are already defined.<\/td><\/tr><tr><td><strong>\uc18d\ub3c4<\/strong> \/ Speed<\/td><td>\ube60\ub984 \/ fast<\/td><td><strong>\ucef4\ud4e8\ud130\uc5d0\uc11c \uac00\uc7a5 \ube60\ub984<\/strong> (\uba54\ubaa8\ub9ac\ubcf4\ub2e4 \uc218\uc2ed \ubc30)<br>Fastest in the computer (dozens of times faster than memory)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\ud83d\udcd3 \ub808\uc9c0\uc2a4\ud130\uc758 \uc885\ub958 \ubc0f \uc6a9\ub3c4<br>Types and Uses of Registers<\/p>\n\n\n\n<p>1-1) \uc77c\ubc18 \uacc4\uc0b0\uc6a9 \uacf5\uac04(\ubc94\uc6a9 \ub808\uc9c0\uc2a4\ud130)<br>General-purpose calculation space (general-purpose registers)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>AX (Accumulator - \ub204\uc0b0\uae30\/\uc5f0\uc0b0\uc6a9)\nAX (Accumulator - for accumulation\/calculation)\n\n-- \uc218\ud559 \uc5f0\uc0b0(\ub354\ud558\uae30, \uacf1\ud558\uae30)\uc758 \uc911\uc2ec\uc774\uc790, \uc785\ucd9c\ub825\uc758 \ub300\ub9ac\uc778\uc785\ub2c8\ub2e4.\nIt is the hub of mathematical operations (addition, multiplication) and the agent for input and output.\n\n-- \uc704 \ucf54\ub4dc\uc5d0\uc11c mov ah, 0x0e\ub97c \ud560 \ub54c \uc0ac\uc6a9\ud55c ah, al\uc774 \ubc14\ub85c \uc774 ax\ub97c \ubc18\uc529 \ucabc\uac1c\uc11c \uc4f0\ub294 \uc774\ub984\uc785\ub2c8\ub2e4. BIOS \uae30\ub2a5\uc744 \ud638\ucd9c\ud560 \ub54c \ubc88\ud638\ud45c \uc5ed\ud560\uc744 \ud569\ub2c8\ub2e4.\nIn the code above, the `ah` and `al` used with `mov ah, 0x0e` are the names for the two halves of the `ax` register; they serve as function identifiers when calling BIOS services.\n\nBX (Base - \uae30\uc900 \uc8fc\uc18c\uc6a9)\nBX (Base - for base address)\n\n-- \uba54\ubaa8\ub9ac\uc758 \ud2b9\uc815 \uc8fc\uc18c(\uc704\uce58)\ub97c \uac00\ub9ac\ud0a4\ub294 \ub098\uce68\ubc18 \uc5ed\ud560\uc744 \uc790\uc8fc \ud569\ub2c8\ub2e4.\nIt often acts as a compass pointing to a specific memory address (or location).\n\nCX (Counter - \ubc18\ubcf5 \ud69f\uc218\uc6a9)\nCX (Counter - for repetition count)\n\n-- or\ubb38 \uac19\uc740 \ubc18\ubcf5\ubb38(Loop)\uc774 \uba87 \ubc88 \ub3cc\uc558\ub294\uc9c0 \uc138\ub294 \uacc4\uc218\uae30\uc785\ub2c8\ub2e4. \ub8e8\ud504 \uba85\ub839\uc5b4\ub97c \uc4f0\uba74 CPU\uac00 \uc790\ub3d9\uc73c\ub85c cx \uac12\uc744 1\uc529 \uae4e\uc73c\uba74\uc11c 0\uc774 \ub420 \ub54c\uae4c\uc9c0 \ubc18\ubcf5\ud569\ub2c8\ub2e4.\nIt is a counter that tracks the number of iterations for loops, such as the `loop` instruction. When the `loop` instruction is used, the CPU automatically decrements the `CX` register by 1 in each iteration until it reaches zero.\n\nDX (Data - \ub370\uc774\ud130 \ud655\uc7a5\uc6a9)\nDX (Data - for data expansion)\n\n-- ax\ub9cc\uc73c\ub85c \ub2f4\uae30 \ud798\ub4e0 \ub108\ubb34 \ud070 \uc22b\uc790\ub97c \uacf1\ud558\uac70\ub098 \ub098\ub20c \ub54c \uc11c\ube0c \uc8fc\uba38\ub2c8\ub85c \ub3d5\uac70\ub098, \ud558\ub4dc\uc6e8\uc5b4 \uc7a5\uce58\uc640 \uc18c\ud1b5\ud560 \ub54c \uc501\ub2c8\ub2e4.\nIt is used to assist with multiplication or division involving numbers too large to fit into the `ax` register alone\u2014acting as a secondary storage\u2014or when communicating with hardware devices.<\/code><\/pre>\n\n\n\n<p>1-2) \uba54\ubaa8\ub9ac \uad6c\uc5ed \uad00\ub9ac\uc6a9 \uacf5\uac04 (\uc138\uadf8\uba3c\ud2b8 \ub808\uc9c0\uc2a4\ud130)<br>Space for memory area management (segment registers)<\/p>\n\n\n\n<p><code>DS<\/code>\ub294 \uc704 \uad6c\uc5ed\ub4e4\uacfc \uc885\ub958\uac00 \uc544\uc608 \ub2e4\ub978 <strong>\uc138\uadf8\uba3c\ud2b8(Segment) \ub808\uc9c0\uc2a4\ud130<\/strong>\uc785\ub2c8\ub2e4. 16\ube44\ud2b8 \ucef4\ud4e8\ud130\ub294 \uba54\ubaa8\ub9ac\uac00 \ub108\ubb34 \ub113\uc5b4\uc11c, \uba54\ubaa8\ub9ac\ub97c \uc5ec\ub7ec \uad6c\uc5ed\uc73c\ub85c \ub098\ub204\uc5b4 \uad00\ub9ac\ud569\ub2c8\ub2e4.<br>The DS is a segment register that belongs to a completely different category than the aforementioned areas. Because the memory space in 16-bit computers is so vast, memory is managed by dividing it into multiple sections.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DS (Data Segment) - \ub370\uc774\ud130\ub97c \ucc3e\uae30\uc704\ud55c \uc778\ub371\uc2a4\uc2a4\ud2f0\ucee4 \/ Index stickers for locating data\n\n-- \"\uc9c0\uae08\ubd80\ud130 \uc0ac\uc6a9\ud558\ub294 \ubcc0\uc218\ub098 \ubb38\uc790\uc5f4 \uac19\uc740 \ub370\uc774\ud130\ub294 \ubaa8\ub450 \uc774 \uc5ec\uae30\uc5d0\uc11c \ucc3e\uc73c\ub77c\"\uace0 \uae30\uc900\uc810\uc744 \uc7a1\ub294 \uc5ed\ud560\uc744 \ud569\ub2c8\ub2e4.\nIt serves as a reference point, indicating, \"Look here for any data\u2014such as variables or strings\u2014that will be used from this point forward.\"\n\n-- mov ds, ax\ub85c \ub370\uc774\ud130 \ub3d9\ub124 \uae30\uc900\uc810\uc744 0\uc73c\ub85c \uc7a1\uc558\uae30 \ub54c\ubb38\uc5d0, CPU\uac00 msg \ubb38\uc790\uc5f4\uc758 \uc815\ud655\ud55c \uc704\uce58\ub97c \ucc3e\uc544\ub0bc \uc218 \uc788\uc5c8\ub358 \uac83\uc785\ub2c8\ub2e4.\nBy setting the data segment base address to 0 with the instruction `mov ds, ax`, the CPU was able to locate the exact position of the `msg` string.\n\nCS (Code Segment): \n\ub0b4\uac00 \uc2e4\ud589\ud560 \uc9c4\uc9dc \uba85\ub839\uc5b4(\ucf54\ub4dc)\ub4e4\uc774 \ubaa8\uc5ec \uc788\ub294 \uc8fc\uc18c\uc785\ub2c8\ub2e4.\nThis is the address where the actual commands (code) I am to execute are located.\n\nSS (Stack Segment): \n\ud568\uc218\ub97c \ud638\ucd9c\ud558\uac70\ub098 \uc784\uc2dc \ub370\uc774\ud130\ub97c \uc7a0\uc2dc \uc313\uc544\ub450\ub294 '\uc2a4\ud0dd'\uc774\ub77c\ub294 \uc784\uc2dc \uc800\uc7a5 \uacf5\uac04\uc758 \uc8fc\uc18c\uc785\ub2c8\ub2e4.\nIt is the address of a temporary storage space called the \"stack,\" used for calling functions or briefly storing temporary data.<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u2714\ufe0f \ucd9c\ub825\ud560 \ubb38\uc790\uc5f4 <code>'Hello miniOS!', 0<\/code>\uc774 \uc800\uc7a5\ub41c \uba54\ubaa8\ub9ac\uc758 \uc2dc\uc791 \uc8fc\uc18c\ub97c <code>SI<\/code> \ub808\uc9c0\uc2a4\ud130\uc5d0 \ub123\uc2b5\ub2c8\ub2e4.<br>Load the starting address of the memory containing the string &#8216;Hello miniOS!&#8217; and the value 0 into the SI register.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mov si, msg<\/code><\/pre>\n\n\n\n<p>&#8212; msg\ub294 \ucf54\ub4dc \uc717\ubd80\ubd84\uc5d0\uc11c \ucd08\uae30\ud654 \ud55c\ubd80\ubd84\uc774 \uc5c6\uc9c0\ub9cc \uc544\ub798\uc5d0 &#8216;msg db &#8216;Hello miniOS!&#8217;, 0&#8217;\uc774 \ucf54\ub4dc\ub97c \ubcf4\uace0 si \ub808\uc9c0\uc2a4\ud130\uc5d0 \uc790\ub3d9\uc73c\ub85c \uc8fc\uc18c\ub97c \ub4f1\ub85d\ud569\ub2c8\ub2e4.<br>Although <code>msg<\/code> is not explicitly initialized in the upper section of the code, the address is automatically registered in the <code>SI<\/code> register based on the line <code>msg db 'Hello miniOS!', 0<\/code> found further down.<\/p>\n\n\n\n<p>&#8212; si \ub808\uc9c0\uc2a4\ud130\ub97c \uc0ac\uc6a9\ud558\ub294 \uc774\uc720\ub294 \ubc14\ub85c \uc544\ub798\uc5d0 <code>lodsb<\/code>(Load String Byte)  \ucf54\ub4dc \ub54c\ubb38\uc785\ub2c8\ub2e4.<br>The reason the SI register is used is because of the <code>lodsb<\/code> (Load String Byte) instruction immediately following it.<\/p>\n\n\n\n<p>&#8212; <code>lodsb<\/code>(Load String Byte) \uba85\ub839\uc5b4\ub294 CPU \ub0b4\ubd80\uc5d0 \ub2e4\uc74c\uacfc \uac19\uc774 <strong>\uac15\uc81c\ub85c \uc57d\uc18d<\/strong>\uc774 \ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4.<br>The <code>lodsb<\/code> (Load String Byte) instruction is hard-wired within the CPU to operate according to the following conventions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"lodsb \uba85\ub839\uc5b4\uac00 \uc2e4\ud589\ub418\uba74, CPU\ub294 \ubb34\uc870\uac74 si \ub808\uc9c0\uc2a4\ud130\uac00 \uac00\ub9ac\ud0a4\uace0 \uc788\ub294 \uba54\ubaa8\ub9ac \uc8fc\uc18c\ub85c \ucc3e\uc544\uac00\uc11c 1\ubc14\uc774\ud2b8\ub97c \uc77d\uc5b4 AL \ub808\uc9c0\uc2a4\ud130\uc5d0 \ub123\ub294\ub2e4.\"\n\nWhen the `lodsb` instruction is executed, the CPU unconditionally accesses the memory address pointed to by the `SI` register, reads one byte, and loads it into the `AL` register.<\/code><\/pre>\n\n\n\n<p>&#8212; \uadf8\ub798\uc11c lodsb\uc640 si\ub808\uc9c0\uc2a4\ud130\ub294 \uac19\uc774 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<br>Therefore, the <code>lodsb<\/code> instruction and the <code>si<\/code> register are used together.<\/p>\n\n\n\n<p>&#8212; \uc5b4\uc148\ube14\ub7ec\uc5d0\uc11c\ub294 \ucef4\ud30c\uc77c\ub418\uae30\uc804 \ucef4\ud30c\uc77c\ub7ec\uac00 \uc804\uccb4 \ucf54\ub4dc\ub97c \ubaa8\ub450 \uc0b4\ud3b4\ubcf4\uace0 \uacc4\uc0b0\ud55c \ud6c4 \ucef4\ud30c\uc77c\ub429\ub2c8\ub2e4.<br>In the case of an assembler, the compiler examines and calculates the entire code before the actual compilation takes place.<\/p>\n\n\n\n<p>\u2714\ufe0f \ud154\ub808\ud0c0\uc774\ud504 \ubaa8\ub4dc(\ud55c\uae00\uc790 \ucd9c\ub825 \uae30\ub2a5)<br>Teletype mode (character-by-character output function)<\/p>\n\n\n\n<p>&#8212; \ud654\uba74\uc5d0 \ud0c0\uc790\uae30\ucc98\ub7fc \ucd9c\ub825\ud558\ub77c\ub294 \uba85\ub839\uc785\ub2c8\ub2e4.<br>This is a command to output text to the screen like a typewriter.<\/p>\n\n\n\n<p>&#8212; \ud154\ub808\ud0c0\uc774\ud504 \ubaa8\ub4dc\ub97c \uc120\ud0dd\ud558\uba74 \ucee4\uc11c \uc790\ub3d9\uc774\ub3d9 \uc790\ub3d9\uc904\ubc14\uafc8 \uae30\ub2a5\uc744 \uc9c0\uc6d0\ud569\ub2c8\ub2e4.<br>Selecting Teletype mode enables automatic cursor movement and automatic line wrapping.<\/p>\n\n\n\n<p>&#8212; al \ub808\uc9c0\uc2a4\ud130 \ub0b4\uc758 \ubb38\uc790 \ucd9c\ub825 \uae30\ub2a5\uc778 int 0x10\uc640 \uac19\uc774 \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<br>It is used in conjunction with <code>int 0x10<\/code>, a function for outputting characters via the <code>al<\/code> register.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mov ah, 0x0e  <\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \ubb34\ud55c\ub8e8\ud504 \uc774\uc804 \ubc18\ubcf5\ubb38\uc5d0\uc11c msg db &#8216;Hello miniOS!&#8217;, 0\uc774 \ub370\uc774\ud130 \ubd80\ubd84\uc744 \ubaa8\ub450 \ucc38\uc870\ud558\uace0 \ubb34\ud55c\ub8e8\ud504\ub85c \ub300\uae30 \ud569\ub2c8\ub2e4.<br>In the loop preceding the infinite loop, <code>msg db 'Hello miniOS!', 0<\/code> references the entire data section, and the program then waits within the infinite loop.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>jmp $<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \uba54\ubaa8\ub9ac msg\uc5d0 Hello miniOS!0 \uac12\uc744 \uc785\ub825\ud569\ub2c8\ub2e4.<br>Enter the value &#8220;Hello miniOS!0&#8221; into the memory location <code>msg<\/code>.<\/p>\n\n\n\n<p>&#8212; 0\uc740 \ubb38\uc790\uc5f4\uc758 \ub05d\uc784\uc744 \ud655\uc778\ud558\uae30 \uc704\ud574\uc11c \uc785\ub2c8\ub2e4.<br>It is to verify that 0 marks the end of the string.<\/p>\n\n\n\n<p>&#8212; \ubcc0\uc218\uc5d0 \ud0c0\uc785\uc774 \uc5c6\ub294 \uc774\uc720\ub294 \ubaa8\ub450 ascii\uac12\uc73c\ub85c \uc800\uc7a5\ub418\uae30 \ub54c\ubb38\uc785\ub2c8\ub2e4.<br>The reason variables do not have types is that they are all stored as ASCII values.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>msg db 'Hello miniOS!', 0<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \uc0ac\uc6a9\ud558\uc9c0 \uc54a\ub294 \ub098\uba38\uc9c0 \uacf5\uac04\uc744 \ubaa8\ub450 0\uc73c\ub85c \ucc44\uc6c1\ub2c8\ub2e4.<br>Fill all remaining unused space with zeros.<\/p>\n\n\n\n<p>&#8212; times\ub294 \ubcc0\uc218\uac00 \uc544\ub2c8\ub77c \ubc18\ubcf5\uba85\ub839\uc9c0\uc2dc\uc5b4 \uc785\ub2c8\ub2e4.<br>&#8216;times&#8217; is not a variable; it is a command for repetition.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>times 510 - ($ - $$) db 0<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \ubd80\ud305\uac00\ub2a5\ud568\uc744 \uc9c0\uc2dc\ud558\ub294 \ucf54\ub4dc\uc785\ub2c8\ub2e4.<br>This is the code that indicates bootability.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dw 0xaa55<\/code><\/pre>\n\n\n\n<p>\ud83d\udc4b \uacb0\ub860 \/ conclusion<\/p>\n\n\n\n<p>\u2714\ufe0f16\ube44\ud2b8 \ucef4\ud4e8\ud130\uc5d0\uc11c \ud654\uba74\uc5d0 \uae00\uc790\ub97c \ud45c\uc2dc\ud558\uae30 \uc704\ud574\uc11c\ub294 msg\ubcc0\uc218\uc5d0 \ubb38\uc790\ub97c \uc785\ub825\ud574\ub193\uace0 \ud55c\uae00\uc790\uc529 al\ub808\uc9c0\uc2a4\ud130\uc5d0\uc11c \uac00\uc838\uc640\uc11c \ud654\uba74\uc5d0 \ucd9c\ub825\ud569\ub2c8\ub2e4.<br>To display characters on the screen of a 16-bit computer, the characters are stored in the <code>msg<\/code> variable, then retrieved one by one from the <code>AL<\/code> register and output to the screen.<\/p>\n\n\n\n<p>\u2714\ufe0f al\ub808\uc9c0\uc2a4\ud130\uc5d0\uc11c \ud55c\uae00\uc790\uc529 \ubb38\uc790\ub97c \uac00\uc838\uc624\ub294 \uae30\ub2a5\uc744 \ubc18\ubcf5\ud558\uae30 \uc704\ud574\uc11c  si \ub808\uc9c0\uc2a4\ud130\uc640 lodsb\ub97c \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<br>To repeatedly fetch characters one by one from the register, the SI register and the <code>lodsb<\/code> instruction are used.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc49\ud83c\udffb \uc544\ub798\uc758 \ucf54\ub4dc\ub294 \ud654\uba74\uc5d0 &#8216;X&#8217;\ub300\uc2e0\uc5d0 Hello miniOS!\ub97c \ud654\uba74\uc5d0 \ucd9c\ub825\ud569\ub2c8\ub2e4.The code below outputs &#8220;Hello miniOS!&#8221; to the screen instead of &#8220;X&#8221;. \ud83d\udc49\ud83c\udffb boot.asm \uc804\uccb4 \ucf54\ub4dc \/ full code \ud83d\udc49\ud83c\udffb \ucf54\ub4dc\uc124\uba85 \/ Code description \u2714\ufe0f \ub808\uc9c0\uc2a4\ud130 ax,ds\ub97c 0 \uc73c\ub85c \ucd08\uae30\ud654\ud558\uae30Initialize registers ax and ds to 0. &#8212; \ub808\uc9c0\uc2a4\ud130(Register)\ub294 \ubcc0\uc218\uc640 \ube44\uc2b7\ud558\uc9c0\ub9cc, CPU(\ucef4\ud4e8\ud130\uc758 \ub450\ub1cc) \ub0b4\ubd80\uc5d0 \uc874\uc7ac\ud558\ub294 &#8216;\ucd08\uace0\uc18d \ubbf8\ub2c8 \uc800\uc7a5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,1],"tags":[],"class_list":["post-6054","post","type-post","status-publish","format-standard","hentry","category-os","category-uncategorized","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6054","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=6054"}],"version-history":[{"count":4,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6054\/revisions"}],"predecessor-version":[{"id":6059,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6054\/revisions\/6059"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=6054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=6054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=6054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}