{"id":6066,"date":"2026-06-25T14:06:34","date_gmt":"2026-06-25T05:06:34","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=6066"},"modified":"2026-06-25T14:19:45","modified_gmt":"2026-06-25T05:19:45","slug":"os-minios-4-1","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/06\/25\/os-minios-4-1\/","title":{"rendered":"[OS] miniOS-4(1)"},"content":{"rendered":"\n<p>\ud83d\udc49\ufe0f \uc774\ubc88\uc5d0\ub294 \uac04\ub2e8\ud55c \uba85\ub839\uc5b4\ub97c \uc785\ub825\ubc1b\uace0 \uc2e4\ud589\ud560 \uc218 \uc788\ub294 \uc258\uc744 \ub9cc\ub4e4\uc5b4\ubd05\uc2dc\ub2e4.<br>Now, let&#8217;s create a shell that can accept and execute simple commands.<\/p>\n\n\n\n<p>\ud83d\udc49\ufe0f boot.asm\uc740 \uae30\uc874 \ucf54\ub4dc\uc640 \uac19\uc2b5\ub2c8\ub2e4.<br>boot.asm is the same as the existing code.<\/p>\n\n\n\n<p>\ud83d\udc49\ufe0f \uc804\uccb4\ud30c\uc77c\uc740 boot.asm\uacfc sector2.asm\uc785\ub2c8\ub2e4.<br>The complete files are boot.asm and sector2.asm.<\/p>\n\n\n\n<p>\ud83d\udc49\ufe0f \uc804\uccb4\ucf54\ub4dc \/ Full Code(secotor2.asm)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;org 0x8000]\nbits 16\n\nstart:\n    ; \uc6f0\ucef4 \uba54\uc2dc\uc9c0 \ucd9c\ub825\n    ; Print welcome message\n    mov si, msg_welcome\n    call print_string\n\n; \ud504\ub86c\ud504\ud2b8(miniOS&gt; )\ub97c \ucd9c\ub825\ud558\uace0 \uc785\ub825\uc744 \uc900\ube44\ud558\ub294 \uacf3\n; The place to print the prompt (miniOS&gt; ) and prepare for input\nprompt:\n    mov si, msg_prompt\n    call print_string\n\n    ; \uc785\ub825 \ubc84\ud37c\ub97c \uac00\ub9ac\ud0ac \ud3ec\uc778\ud130(DI)\ub97c \ubc84\ud37c\uc758 \uc2dc\uc791 \uc8fc\uc18c\ub85c \ucd08\uae30\ud654\n    ; Initialize the pointer (DI) pointing to the input buffer with the starting address of the buffer\n    mov di, cmd_buffer\n    mov cx, 0           ; \uc785\ub825\ub41c \uae00\uc790 \uc218\ub97c \uc138\uae30 \uc704\ud55c \uce74\uc6b4\ud130\n                        ; Counter to count the number of entered characters\n\n; \ud0a4\ubcf4\ub4dc \uc785\ub825\uc744 \ud55c \uae00\uc790\uc529 \ubc1b\ub294 \ub8e8\ud504\n; A loop that receives keyboard input character by character\nkey_loop:\n    mov ah, 0x00\n    int 0x16            ; \ud0a4\ubcf4\ub4dc \uc785\ub825 \ubc1b\uae30 (AL\uc5d0 ASCII \ucf54\ub4dc \uc800\uc7a5)\n                        ; Get keyboard input (Store ASCII code in AL)\n\n    ; \uc5d4\ud130 \ud0a4(13)\ub97c \ub20c\ub800\ub294\uc9c0 \ud655\uc778\n    ; Check if the Enter key (13) was pressed\n    cmp al, 13\n    je check_command\n\n    ; \ubc31\uc2a4\ud398\uc774\uc2a4 \ud0a4(8) \ucc98\ub9ac (\uae00\uc790 \uc9c0\uc6b0\uae30)\n    ; Process Backspace key (8) (Erase character)\n    cmp al, 8\n    je backspace\n\n    ; \ubc84\ud37c \ub118\uce68 \ubc29\uc9c0 (\ucd5c\ub300 15\uae00\uc790\ub9cc \uc785\ub825 \uac00\ub2a5)\n    ; Prevent buffer overflow (Max 15 characters allowed)\n    cmp cx, 15\n    je key_loop\n\n    ; \ud654\uba74\uc5d0 \uae00\uc790 \ucd9c\ub825 (\uc5d0\ucf54)\n    ; Output character to screen (Echo)\n    mov ah, 0x0e\n    int 0x10\n\n    ; \uc785\ub825\ubc1b\uc740 \ubb38\uc790\ub97c \ubc84\ud37c\uc5d0 \uc800\uc7a5\ud558\uace0 \ud3ec\uc778\ud130(DI) \uc774\ub3d9\n    ; Save the received character to the buffer and move the pointer (DI)\n    mov &#91;di], al\n    inc di\n    inc cx              ; \uae00\uc790 \uc218 \uc99d\uac00\n                        ; Increment character count\n    jmp key_loop\n\n; \ubc31\uc2a4\ud398\uc774\uc2a4 \ucc98\ub9ac \ub8e8\ud2f4\n; Backspace processing routine\nbackspace:\n    cmp cx, 0           ; \uc785\ub825\ub41c \uae00\uc790\uac00 \uc5c6\uc73c\uba74 \ubb34\uc2dc\n                        ; Ignore if no characters are entered\n    je key_loop\n    \n    ; \ud654\uba74\uc5d0\uc11c \uae00\uc790 \uc9c0\uc6b0\uae30 (\uc67c\ucabd \uc774\ub3d9 -&gt; \uacf5\ubc31 \ucd9c\ub825 -&gt; \ub2e4\uc2dc \uc67c\ucabd \uc774\ub3d9)\n    ; Erase character from screen (Move left -&gt; Output space -&gt; Move left again)\n    mov ah, 0x0e\n    mov al, 8\n    int 0x10\n    mov al, ' '\n    int 0x10\n    mov al, 8\n    int 0x10\n\n    dec di              ; \ubc84\ud37c \ud3ec\uc778\ud130 1 \uac10\uc18c\n                        ; Decrement buffer pointer by 1\n    dec cx              ; \uae00\uc790 \uc218 1 \uac10\uc18c\n                        ; Decrement character count by 1\n    jmp key_loop\n\n; \uc5d4\ud130\ub97c \ucce4\uc744 \ub54c \uc785\ub825\ub41c \uba85\ub839\uc5b4\ub97c \ube44\uad50\ud558\ub294 \uacf3\n; The place to compare the entered command when Enter is pressed\ncheck_command:\n    ; \ubb38\uc790\uc5f4\uc758 \ub05d\uc744 \ud45c\uc2dc\ud558\uae30 \uc704\ud574 \ubc84\ud37c\uc758 \ud604\uc7ac \uc704\uce58\uc5d0 0(Null) \uc0bd\uc785\n    ; Insert 0 (Null) at the current location of the buffer to mark the end of the string\n    mov byte &#91;di], 0\n\n    ; \uc904\ubc14\uafc8 \ucd9c\ub825\n    ; Output newline\n    call print_newline\n\n    ; \uc785\ub825\ub41c \uae00\uc790\uac00 \uc544\uc608 \uc5c6\uc73c\uba74 \uadf8\ub0e5 \ub2e4\uc74c \ud504\ub86c\ud504\ud2b8\ub85c\n    ; If no characters are entered at all, just go to the next prompt\n    cmp cx, 0\n    je prompt\n\n    ; 1. 'help' \uba85\ub839\uc5b4 \ube44\uad50\n    ; 1. Compare 'help' command\n    mov si, cmd_buffer\n    mov di, cmd_help\n    call compare_string\n    je do_help          ; \uac19\uc73c\uba74 do_help\ub85c \uc810\ud504\n                        ; If equal, jump to do_help\n\n    ; 2. 'clear' \uba85\ub839\uc5b4 \ube44\uad50\n    ; 2. Compare 'clear' command\n    mov si, cmd_buffer\n    mov di, cmd_clear\n    call compare_string\n    je do_clear         ; \uac19\uc73c\uba74 do_clear\ub85c \uc810\ud504\n                        ; If equal, jump to do_clear\n\n    ; \uc77c\uce58\ud558\ub294 \uba85\ub839\uc5b4\uac00 \uc5c6\uc73c\uba74 \uc5d0\ub7ec \uba54\uc2dc\uc9c0 \ucd9c\ub825\n    ; If no matching command is found, print error message\n    mov si, msg_unknown\n    call print_string\n    jmp prompt\n\n; &#91;\uba85\ub839\uc5b4 \ucc98\ub9ac] help \uad6c\ud604\n; &#91;Command Processing] Implement help\ndo_help:\n    mov si, msg_help_text\n    call print_string\n    jmp prompt\n\n; &#91;\uba85\ub839\uc5b4 \ucc98\ub9ac] clear \uad6c\ud604\n; &#91;Command Processing] Implement clear\ndo_clear:\n    ; BIOS \ud654\uba74 \uc2a4\ud06c\ub864 \uae30\ub2a5\uc744 \uc774\uc6a9\ud574 \ud654\uba74 \uc9c0\uc6b0\uae30\n    ; Clear screen using BIOS screen scroll function\n    mov ah, 0x06        ; \uc2a4\ud06c\ub864 \uc5c5 \uae30\ub2a5\n                        ; Scroll up function\n    mov al, 0           ; 0 = \ud654\uba74 \uc804\uccb4 \uc9c0\uc6b0\uae30\n                        ; 0 = Clear entire screen\n    mov bh, 0x07        ; \ubc14\ud0d5\uc0c9 \uac80\uc815, \uae00\uc790\uc0c9 \ud770\uc0c9\n                        ; Background black, Foreground white\n    mov ch, 0           ; \uc88c\uc0c1\ub2e8 \ud589\n                        ; Upper left row\n    mov cl, 0           ; \uc88c\uc0c1\ub2e8 \uc5f4\n                        ; Upper left column\n    mov dh, 24          ; \uc6b0\ud558\ub2e8 \ud589\n                        ; Lower right row\n    mov dl, 79          ; \uc6b0\ud558\ub2e8 \u5217\n                        ; Lower right column\n    int 0x10\n\n    ; \ucee4\uc11c\ub97c \ub9e8 \uc704 \uc88c\uc0c1\ub2e8(0,0)\uc73c\ub85c \uc774\ub3d9\n    ; Move cursor to the top-left corner (0,0)\n    mov ah, 0x02\n    mov bh, 0\n    mov dh, 0\n    mov dl, 0\n    int 0x10\n\n    jmp prompt\n\n; &#91;\ud568\uc218] \ub450 \ubb38\uc790\uc5f4\uc774 \uac19\uc740\uc9c0 \ube44\uad50 (SI\uc640 DI \uc8fc\uc18c\uc758 \ubb38\uc790\uc5f4 \ube44\uad50)\n; &#91;Function] Compare if two strings are equal (Compare strings at SI and DI addresses)\ncompare_string:\n.loop:\n    mov al, &#91;si]\n    mov bl, &#91;di]\n    cmp al, bl          ; \ub450 \uae00\uc790\uac00 \uac19\uc740\uc9c0 \ube44\uad50\n                        ; Compare if two characters are equal\n    jne .not_equal      ; \ub2e4\ub974\uba74 \ud0c8\ucd9c\n                        ; If not equal, escape\n    cmp al, 0           ; \ubb38\uc790\uc5f4\uc774 \ub05d\ub0ac\ub294\uc9c0 \ud655\uc778 (\ub458 \ub2e4 0\uc778 \uc0c1\ud669)\n                        ; Check if the string ended (Both are 0 case)\n    je .equal           ; \ub05d\ub0ac\uc73c\uba74 \uc644\ubcbd\ud788 \uc77c\uce58\n                        ; If ended, perfect match\n    inc si\n    inc di\n    jmp .loop\n.not_equal:\n    clc                 ; Carry Flag \ud074\ub9ac\uc5b4 (\uac19\uc9c0 \uc54a\uc74c \ud45c\uc2dc, \uc5b5\uc9c0 flag \uc138\ud305\uc6a9\uc73c\ub85c cmp \ud65c\uc6a9)\n                        ; Clear Carry Flag (Indicate not equal, use cmp for forced flag setting)\n    mov al, 1\n    cmp al, 0           ; Zero Flag\ub97c 0\uc73c\ub85c \ub9cc\ub4e4\uc5b4 '\ub2e4\ub984'\uc744 \uc54c\ub9bc\n                        ; Set Zero Flag to 0 to notify 'Not Equal'\n    ret\n.equal:\n    cmp al, 0           ; Zero Flag\ub97c 1\ub85c \ub9cc\ub4e4\uc5b4 '\uac19\uc74c'\uc744 \uc54c\ub9bc (AL\uc774 0\uc774\ubbc0\ub85c)\n                        ; Set Zero Flag to 1 to notify 'Equal' (Since AL is 0)\n    ret\n\n; &#91;\ud568\uc218] \ubb38\uc790\uc5f4 \ucd9c\ub825\n; &#91;Function] Print string\nprint_string:\n    lodsb\n    cmp al, 0\n    je .done\n    mov ah, 0x0e\n    int 0x10\n    jmp print_string\n.done:\n    ret\n\n; &#91;\ud568\uc218] \uc904\ubc14\uafc8 \ucd9c\ub825\n; &#91;Function] Print newline\nprint_newline:\n    mov ah, 0x0e\n    mov al, 13\n    int 0x10\n    mov al, 10\n    int 0x10\n    ret\n\n; ----------------------------------------------------\n; \ub370\uc774\ud130 \ubc0f \ubcc0\uc218 \uc120\uc5b8 \uc601\uc5ed (\uc804\uc5ed \ubcc0\uc218)\n; Data and variable declaration area (Global variables)\n; ----------------------------------------------------\nmsg_welcome   db '3. Hello from Sector 2! miniOS Shell Started.', 13, 10, 0\nmsg_prompt    db 'miniOS&gt; ', 0\nmsg_unknown   db 'Unknown command! Type \"help\".', 13, 10, 0\nmsg_help_text db 'Available commands: help, clear', 13, 10, 0\n\n; \ube44\uad50\ud560 \uba85\ub839\uc5b4 \uae30\uc900 \ubb38\uc790\uc5f4 (\uc0c1\uc218)\n; Reference command strings for comparison (Constants)\ncmd_help      db 'help', 0\ncmd_clear     db 'clear', 0\n\n; \uc0ac\uc6a9\uc790\uac00 \uc785\ub825\ud55c \uae00\uc790\ub4e4\uc744 \ub2f4\uc744 '\ube48 \ubcc0\uc218 \uacf5\uac04' (\ubc84\ud37c)\n; 'Empty variable space' to hold characters entered by the user (Buffer)\n; 16\ubc14\uc774\ud2b8 \ud06c\uae30\ub9cc\ud07c \uacf5\uac04\uc744 \ubbf8\ub9ac \ud655\ubcf4\ud574 \ub461\ub2c8\ub2e4.\n; Pre-allocate space of 16 bytes.\ncmd_buffer    times 16 db 0\n\n; 512\ubc14\uc774\ud2b8 \ud06c\uae30 \ub9de\ucd94\uae30\n; Fill up to 512 bytes\ntimes 512 - ($ - $$) db 0\n<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49\ufe0f \ucf54\ub4dc\uc124\uba85(sector2.asm)<\/p>\n\n\n\n<p>\u2714\ufe0f boot.asm \ucf54\ub4dc\uc124\uba85\uc740 \uc774\uc804\uacfc \uac19\uc544\uc11c \uc0dd\ub7b5\ud569\ub2c8\ub2e4.<br>I will skip the explanation of the boot.asm code, as it is the same as before.<\/p>\n\n\n\n<p>\u2714\ufe0f \uba54\uc138\uc9c0 \ucd9c\ub825\ub4f1 \uc774\uc804\uacfc \uad6c\uc870\uac19\uc740 \ubd80\ubd84\uc758 \uc124\uba85\uc740 \uc0dd\ub7b5\ud569\ub2c8\ub2e4.<br>Explanations regarding aspects where the structure remains the same as before\u2014such as message output\u2014are omitted.<\/p>\n\n\n\n<p>\u2714\ufe0f \uc800\uc7a5\ud560 \ubaa9\uc801\uc9c0 \uc8fc\uc18c \uc9c0\uc815(prompt:)<br>Specify destination address to save (prompt:)<\/p>\n\n\n\n<p>&#8212; DI (Destination Index) \ub808\uc9c0\uc2a4\ud130\ub294 CPU\uac00 \uba54\ubaa8\ub9ac\uc5d0 \ub370\uc774\ud130\ub97c &#8216;\uc800\uc7a5(\uae30\ub85d)&#8217;\ud560 \ub54c \uc8fc\ub85c \uc0ac\uc6a9\ud558\ub294 \ub300\ud45c\uc801\uc778 \ud3ec\uc778\ud130(\ud654\uc0b4\ud45c) \ub808\uc9c0\uc2a4\ud130\uc785\ub2c8\ub2e4.<br>The DI (Destination Index) register is a representative pointer register primarily used by the CPU when storing (writing) data to memory.<\/p>\n\n\n\n<p>&#8212; cmd_buffer: <br>\ucd9c\ubc1c\uc810(0x8000)\uc5d0\uc11c \ucf54\ub4dc \uae38\uc774\ub9cc\ud07c \ub4a4\ub85c \ub5a8\uc5b4\uc9c4 \ubc84\ud37c \uc804\uc6a9 \ubc29 \ubc88\ud638(\uc2e4\uc81c \uba54\ubaa8\ub9ac \uc8fc\uc18c)\uc785\ub2c8\ub2e4.<br>This is the buffer-specific room number (actual memory address) located a distance equal to the code length behind the starting point (0x8000).<\/p>\n\n\n\n<p>&#8212; \uc544\ub798\uc5d0\uc11c mov [di], al \uc774\ub807\uac8c \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<br>Below, it is used like this: <code>mov [di], al<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mov di, cmd_buffer<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \uc785\ub825\ud55c \uae00\uc790 \uc218 \uc138\ub294 \uce74\uc6b4\ud130<br>Counter that counts the number of characters entered<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mov cx, 0 <\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \ud0a4\ubcf4\ub4dc \uc785\ub825\uc744 \ud55c \uae00\uc790\uc529 \ubc1b\ub294 \ub8e8\ud504(key_loop:)<br>A loop that accepts keyboard input one character at a time (key_loop:)<\/p>\n\n\n\n<p>&#8212; \ud0a4\ubcf4\ub4dc \uc785\ub825 \uc77d\uae30 \uae30\ub2a5 \uc120\ud0dd (\ubc14\uc774\uc624\uc2a4 \uc11c\ube44\uc2a4 \uc778\ud130\ub7fd\ud2b8)<br>Select Keyboard Input Read Function (BIOS Service Interrupt)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> mov ah, 0x00<\/code><\/pre>\n\n\n\n<p>&#8212; \uc778\ud130\ub7fd\ud2b8 \uc2e4\ud589<br>Interrupt execution<\/p>\n\n\n\n<p>&#8212; AH = 0x00 \uc815\ubcf4\ub97c \uac00\uc9c0\uace0 BIOS \ud0a4\ubcf4\ub4dc \uc778\ud130\ub7fd\ud2b8\ub97c \ucd5c\uc885 \ud638\ucd9c\ud569\ub2c8\ub2e4.<br>Finally, the BIOS keyboard interrupt is called with AH = 0x00.<\/p>\n\n\n\n<p>&#8212; \ud654\uba74 \ucd9c\ub825(int 0x10), \ub514\uc2a4\ud06c \uc77d\uae30(int 0x13), \ud0a4\ubcf4\ub4dc \uc785\ub825(int 0x16)<br>Screen output (int 0x10), disk read (int 0x13), keyboard input (int 0x16)<\/p>\n\n\n\n<p>&#8212; \uc0ac\uc6a9\uc790\uc785\ub825\uc744 \ubc1b\uae30 \uc704\ud574 \ube14\ub85c\ud0b9 \uc0c1\ud0dc\uac00 \ub429\ub2c8\ub2e4.<br>It enters a blocking state to receive user input.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int 0x16<\/code><\/pre>\n\n\n\n<p>&#8212; \uc5d4\ud130\ud0a4\uac00 \uc785\ub825\ub418\uba74 check_command\ub77c\ubca8\uc744 \uc2e4\ud589 \ud569\ub2c8\ub2e4.<br>When the Enter key is pressed, the check_command label is executed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    cmp al, 13\n    je check_command<\/code><\/pre>\n\n\n\n<p>&#8212; \ubc31\uc2a4\ud398\uc774\uc2a4 \ud0a4\ub97c \uc785\ub825\uc2dc backspace\ub77c\ubca8\uc744 \uc2e4\ud589\ud569\ub2c8\ub2e4.<br>Pressing the Backspace key executes the &#8216;backspace&#8217; label.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    cmp al, 8\n    je backspace<\/code><\/pre>\n\n\n\n<p>&#8212; \ubc84\ud37c \uc624\ubc84\ud50c\ub85c\uc6b0 \ubc29\uc9c0 \uae30\ub2a5 \uc785\ub2c8\ub2e4.<br>This is a buffer overflow prevention feature.<\/p>\n\n\n\n<p>&#8212; \uc0ac\uc6a9\uc790\uac00 \ud0a4\ubcf4\ub4dc\ub97c \ud55c \uae00\uc790\uc529 \uce60 \ub54c\ub9c8\ub2e4 inc cx \uba85\ub839\uc5b4\ub97c \ud1b5\ud574 \ud604\uc7ac \ubc84\ud37c\uc5d0 \uc313\uc778 \uae00\uc790 \uc218\ub97c \uae30\uc5b5\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4.<br>Each time the user types a character, the <code>inc cx<\/code> instruction tracks the number of characters accumulated in the current buffer.<\/p>\n\n\n\n<p>&#8212; cmp (Compare) \uba85\ub839\uc5b4\ub97c \ud1b5\ud574 &#8220;\ud604\uc7ac \uae00\uc790 \uc218(CX)\uac00 15\uc640 \uac19\uc740\uc9c0&#8221; \ube44\uad50\ud569\ub2c8\ub2e4.<br>The <code>cmp<\/code> (Compare) instruction is used to compare whether the current character count (CX) is equal to 15.<\/p>\n\n\n\n<p>&#8212; cmd_buffer\uc758 \ud06c\uae30\ub294 16\ubc14\uc774\ud2b8\uc774\uba70 \ub9c8\uc9c0\ub9c9\uc5d0 \uc885\ub8cc\ud45c\uc2dc \uc2e0\ud638 0\uc774\ub4e4\uc5b4\uac00\ubbc0\ub85c \uae00\uc790\uc218\ub97c 15\ubc14\uc774\ud2b8\uae4c\uc9c0\ub85c \uc81c\ud55c\ud569\ub2c8\ub2e4. <br>The size of cmd_buffer is 16 bytes; since a null terminator (0) is placed at the end, the character count is limited to 15 bytes.<\/p>\n\n\n\n<p>&#8212; 15\uc790\ub97c \ucd08\uacfc\ud558\uba74 key_loop\ub77c\ubca8\ub85c \uc810\ud504\ud569\ub2c8\ub2e4.<br>If it exceeds 15 characters, it jumps to the key_loop label.<\/p>\n\n\n\n<p>&#8212; \ucd94\uac00 \uc785\ub825\ud558\uba74 \ud654\uba74\uc0c1\uc5d0\ub294 \uacc4\uc18d \uac19\uc740\uc790\ub9ac\uc5d0 \ucee4\uc11c\uac00 \uc788\uace0 \ubcc0\ud654\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.<br>If you enter more input, the cursor remains in the same position on the screen, and there is no change.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    cmp cx, 15\n    je key_loop<\/code><\/pre>\n\n\n\n<p>&#8212; \ud654\uba74\uc5d0 \uae00\uc790\ub97c \ucd9c\ub825\ud569\ub2c8\ub2e4.<br>It outputs text to the screen.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    mov ah, 0x0e\n    int 0x10<\/code><\/pre>\n\n\n\n<p>&#8212; \uc0ac\uc6a9\uc790\uac00 \ub204\ub978 \uae00\uc790\uac00 \uc800\uc7a5\ub41c al\ub808\uc9c0\uc2a4\ud130\uc758 \ub0b4\uc6a9\uc744 cmd_buffer\uc5d0 \uc800\uc7a5\ud569\ub2c8\ub2e4.<br>The contents of the AL register, which holds the character pressed by the user, are stored in cmd_buffer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mov &#91;di], al<\/code><\/pre>\n\n\n\n<p>&#8212; \ub2e4\uc74c \uc800\uc7a5 \uc704\uce58\ub85c \uc774\ub3d9\ud569\ub2c8\ub2e4.<br>Navigate to the following save location.<\/p>\n\n\n\n<p>&#8212; inc (Increment): \uac12\uc744 1 \uc99d\uac00\uc2dc\ud0a4\ub294 \uba85\ub839\uc5b4\uc785\ub2c8\ub2e4.<br>inc (Increment): An instruction that increments a value by 1.<\/p>\n\n\n\n<p>&#8212; DI \ub808\uc9c0\uc2a4\ud130\uc5d0 \ub4e4\uc5b4\uc788\ub294 \uba54\ubaa8\ub9ac \uc8fc\uc18c \uc22b\uc790\ub97c 1 \ub298\ub824\uc90d\ub2c8\ub2e4. (\uc608: 0x8064 \u2794 0x8065)<br>Increments the memory address value stored in the DI register by 1. (e.g., 0x8064 \u2794 0x8065)<\/p>\n\n\n\n<p>&#8212; \uc8fc\uc18c\ub97c 1 \ub298\ub824\uc8fc\uc5b4\uc57c \ub2e4\uc74c\ubc88\uc5d0 \uc0ac\uc6a9\uc790\uac00 \uc0c8\ub85c\uc6b4 \ud0a4\ub97c \ub204\ub97c \ub54c, \ubc29\uae08 \uc4f4 \uae00\uc790 \uc704\uc5d0 \uacb9\uccd0 \uc4f0\uc9c0 \uc54a\uace0 \uadf8 \ubc14\ub85c \uc606 \uce78(\ub2e4\uc74c \ubc14\uc774\ud2b8)\uc5d0 \uc0c8 \uae00\uc790\ub97c \uc800\uc7a5\ud560 \uc218 \uc788\uae30 \ub54c\ubb38\uc785\ub2c8\ub2e4.<br>This is because the address must be incremented by 1 so that the next time the user presses a key, the new character can be stored in the adjacent cell (the next byte) instead of overwriting the character just written.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>inc di <\/code><\/pre>\n\n\n\n<p>&#8212; \uae00\uc790 \uc218\ub97c \uc138\ub294 \uce74\uc6b4\ud130\ub97c \uc99d\uac00\uc2dc\ud0b5\ub2c8\ub2e4.<br>Increments the character count.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>inc cx<\/code><\/pre>\n\n\n\n<p>&#8212; \uc5ec\uae30\uae4c\uc9c0\uac00 \uc2e4\uc81c \uba54\uc778 \ub85c\uc9c1\uc785\ub2c8\ub2e4.<br>This covers the actual main logic.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u2714\ufe0f \ubc31\uc2a4\ud398\uc774\uc2a4 \ucc98\ub9ac\ub8e8\ud2f4(backspace:)<br>Backspace handling routine (backspace:)<\/p>\n\n\n\n<p>&#8212; \uc785\ub825\ub41c \uae00\uc790\uac00 0\uc778\uc9c0 \ud655\uc778\ud569\ub2c8\ub2e4. \uc785\ub825\ub41c \uae00\uc790\uac00 \uc5c6\ub294\ub370 \ubc31\uc2a4\ud398\uc774\uc2a4 \ud0a4\ub97c \ub204\ub978\uacbd\uc6b0 key_loop\ub77c\ubca8(\ud0a4\ubcf4\ub4dc \uc785\ub825\ubc1b\uae30)\ub85c \uc810\ud504\ud569\ub2c8\ub2e4.<br>It checks whether the input string is empty. If the Backspace key is pressed when there is no input, it jumps to the <code>key_loop<\/code> label (to receive keyboard input).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cmp cx, 0 \nje key_loop<\/code><\/pre>\n\n\n\n<p>&#8212; \ud654\uba74\uc5d0\uc11c \uae00\uc790\ub97c \uc9c0\uc6b0\ub294 \ubd80\ubd84\uc785\ub2c8\ub2e4.<br>This is the part where text is erased from the screen.<\/p>\n\n\n\n<p>&#8212; \ucef4\ud4e8\ud130 \ub0b4\ubd80\uc758 \ud654\uba74 \uc81c\uc5b4 \uc2dc\uc2a4\ud15c(BIOS)\uc5d0\ub294 &#8216;\ubc29\uae08 \uc4f4 \uae00\uc790\ub97c \uc9c0\uc6b0\ub294 \ud3b8\ub9ac\ud55c \uc0ad\uc81c \uae30\ub2a5&#8217;\uc774 \ub530\ub85c \uc5c6\uc2b5\ub2c8\ub2e4. \uc624\uc9c1 \uc0c8\ub85c\uc6b4 \uae00\uc790\ub97c \uc704\uc5d0 \ub36e\uc5b4\uc4f0\ub294 \uae30\ub2a5\ub9cc \uc788\uc2b5\ub2c8\ub2e4.<br>The screen control system (BIOS) inside the computer does not have a dedicated, convenient delete function for erasing the characters just written; it only has a function to overwrite them with new characters.<\/p>\n\n\n\n<p>&#8212; \ub530\ub77c\uc11c \uae00\uc790\ub97c \uc9c0\uc6b0\ub824\uba74 &#8220;\uc9c0\uc6b0\uace0 \uc2f6\uc740 \uc704\uce58\ub85c \ucee4\uc11c\ub97c \uc62e\uae34 \ub4a4, &#8216;\uacf5\ubc31(\uc2a4\ud398\uc774\uc2a4\ubc14)&#8217; \ubb38\uc790\ub97c \uac15\uc81c\ub85c \ub36e\uc5b4\uc368\uc11c \uae00\uc790\ub97c \uc548 \ubcf4\uc774\uac8c \uac00\ub9bd\ub2c8\ub2e4.<br>Therefore, to erase a character, move the cursor to the desired position and overwrite the character with a space (using the spacebar) to hide it from view.<\/p>\n\n\n\n<p>&#8212; \ubc14\uc774\uc624\uc2a4 \ud154\ub808\uadf8\ub798\ud504 \uae30\ub2a5\uc744 \uc120\ud0dd\ud569\ub2c8\ub2e4.<br>Select the BIOS Telegraph function.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mov ah, 0x0e<\/code><\/pre>\n\n\n\n<p>&#8212; al\ub808\uc9c0\uc2a4\ud130\uc5d0 8\uc744 \ub300\uc785\ud569\ub2c8\ub2e4.ASCII \ucf54\ub4dc 8\ubc88\uc740 &#8216;\ubc31\uc2a4\ud398\uc774\uc2a4(Backspace)&#8217; \ubb38\uc790\uc785\ub2c8\ub2e4.<br>Assign 8 to the AL register. ASCII code 8 represents the &#8216;Backspace&#8217; character.<\/p>\n\n\n\n<p>&#8212; int 0x10\ub85c BIOS \ube44\ub514\uc624 \uc778\ud130\ub7fd\ud2b8\ub97c \uc2e4\ud589\ud569\ub2c8\ub2e4.(\uae30\ub2a5 \uc2e4\ud589)<br>Executes the BIOS video interrupt using <code>int 0x10<\/code> (executes the function).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mov al, 8\nint 0x10<\/code><\/pre>\n\n\n\n<p>&#8212; \ud604\uc7ac\uc704\uce58\ub97c \uacf5\ubc31\uc73c\ub85c \ubc14\uafc9\ub2c8\ub2e4.<br>Changes the current location to a blank space.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> mov al, ' '\n int 0x10<\/code><\/pre>\n\n\n\n<p>&#8212; \uc67c\ucabd\uc73c\ub85c \ucee4\uc11c\ub97c \ud55c\uce78 \uc62e\uae41\ub2c8\ub2e4.<br>Moves the cursor one space to the left.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mov al, 8\nint 0x10<\/code><\/pre>\n\n\n\n<p>&#8212; \ubc84\ud37c\uba54\ubaa8\ub9ac(di)\ub97c 1 \uac10\uc18c\ud558\uace0, \uae00\uc790\uc218 \uce74\uc6b4\ud130\ub97c 1\uac10\uc18c\ud569\ub2c8\ub2e4.<br>Decrement the buffer memory (di) by 1 and decrement the character count counter by 1.<\/p>\n\n\n\n<p>&#8212; key_loop\ub77c\ubca8\ub85c \uc810\ud504\ud569\ub2c8\ub2e4.<br>Jump to the key_loop label.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> dec di              \n dec cx  \n jmp key_loop           <\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \uc5d4\ud130\ub97c \ucce4\uc744 \ub54c \uc785\ub825\ub41c \uba85\ub839\uc5b4\ub97c \ube44\uad50\ud558\ub294 \uacf3<br>The place where the entered command is compared when the Enter key is pressed.<\/p>\n\n\n\n<p>&#8212; \ud604\uc7ac \uc704\uce58\uc5d0 0\uc744 \uc785\ub825\ud574\uc11c \uba85\ub839\uc5b4\uc758 \ub05d\uc784\uc744 \ud45c\uc2dc\ud569\ub2c8\ub2e4.<br>Enter 0 at the current position to indicate the end of the command.<\/p>\n\n\n\n<p>&#8212; DI \uc8fc\uc18c\uac00 \uac00\ub9ac\ud0a4\ub294 \uacf3\uc5d0 \ub531 1\ubc14\uc774\ud2b8 \ud06c\uae30\ub9cc\ud07c\ub9cc 0\uc744 \ub300\uc785\ud558\ub77c\ub294 \ud06c\uae30 \uc9c0\uc815 \ud0a4\uc6cc\ub4dc \uc785\ub2c8\ub2e4.<br>This is a size-specifying keyword that instructs to assign a zero value of exactly one byte in size to the location pointed to by the DI register.<\/p>\n\n\n\n<p>byte: 1\ubc14\uc774\ud2b8 \ud06c\uae30 (8\ube44\ud2b8) \/ 1-byte size (8 bits) \u2794 mov byte [di],<\/p>\n\n\n\n<p>word: 2\ubc14\uc774\ud2b8 \ud06c\uae30 (16\ube44\ud2b8) \/ 2-byte size (16-bit) \u2794 mov word [di], 0<\/p>\n\n\n\n<p>dword: 4\ubc14\uc774\ud2b8 \ud06c\uae30 \/ 4-byte size (32\ube44\ud2b8\/32 bit, Double Word) \u2794 mov dword [di], 0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mov byte &#91;di], 0<\/code><\/pre>\n\n\n\n<p>&#8212; \uc904 \ubc14\uafc8\uc744 \uc2e4\ud589\ud569\ub2c8\ub2e4.<br>Performs a line break.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>call print_newline<\/code><\/pre>\n\n\n\n<p>&#8212; \uc544\ub798\uc5d0 print_newline:\ub77c\ubca8\uc774 \uc788\uc2b5\ub2c8\ub2e4.<br>There is a <code>print_newline:<\/code> label below.<\/p>\n\n\n\n<p>&#8212; mov ah, 0x0e : <br>\ud154\ub808\ud0c0\uc774\ud504 \ubc29\uc2dd \ucd9c\ub825\uc744 \uc124\uc815\ud569\ub2c8\ub2e4.<br>Configures teletype-style output.<\/p>\n\n\n\n<p>&#8212; mov al, 13 &amp; int 0x10<br> \ud604\uc7ac \uc704\uce58\ud55c \uc904\uc758 \ub9e8 \uc67c\ucabd(\uccab \ubc88\uc9f8 \uce78)\uc73c\ub85c  \uc774\ub3d9 \ud569\ub2c8\ub2e4.(\ucf00\ub9ac\uc9c0\ub9ac\ud134,\\r)<br>Moves to the leftmost position (the first cell) of the current line (Carriage Return, \\r).<\/p>\n\n\n\n<p>&#8211;mov al, 10 &amp; int 0x10 : <br>\ucee4\uc11c\ub97c \ud55c \uc904 \uc544\ub798\ub85c \uc774\ub3d9\uc2dc\ud0b5\ub2c8\ub2e4.(\ub77c\uc778\ud53c\ub4dc,\\n)<br>Moves the cursor down one line (Line Feed, \\n).<\/p>\n\n\n\n<p>&#8212; ref<br>\uc774 \ud568\uc218\ub97c \ud638\ucd9c\ud588\ub358 \uba54\uc778 \ub85c\uc9c1\uc758 \uc790\ub9ac\ub85c \uc774\ub3d9\ud569\ub2c8\ub2e4.<br>Navigate to the location in the main logic where this function was called.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print_newline:\n    mov ah, 0x0e\n    mov al, 13\n    int 0x10\n    mov al, 10\n    int 0x10\n    ret<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \uc2a4\ud06c\ub9b0 \uc0f7 \/  ScreenShot<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"749\" height=\"485\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-4-1.jpg\" alt=\"\" class=\"wp-image-6068\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-4-1.jpg 749w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-4-1-300x194.jpg 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-4-1-400x259.jpg 400w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"756\" height=\"482\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-4-2.jpg\" alt=\"\" class=\"wp-image-6069\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-4-2.jpg 756w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-4-2-300x191.jpg 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/06\/minios-4-2-400x255.jpg 400w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/figure>\n\n\n\n<p>\u2705 \ub098\uba38\uc9c0 \uc124\uba85\uc740 \ub2e4\uc74c \ud3ec\uc2a4\ud2b8\uc5d0\uc11c\uc774\uc5b4\uac00\uaca0\uc2b5\ub2c8\ub2e4.<br>I will continue with the rest of the explanation in the next post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc49\ufe0f \uc774\ubc88\uc5d0\ub294 \uac04\ub2e8\ud55c \uba85\ub839\uc5b4\ub97c \uc785\ub825\ubc1b\uace0 \uc2e4\ud589\ud560 \uc218 \uc788\ub294 \uc258\uc744 \ub9cc\ub4e4\uc5b4\ubd05\uc2dc\ub2e4.Now, let&#8217;s create a shell that can accept and execute simple commands. \ud83d\udc49\ufe0f boot.asm\uc740 \uae30\uc874 \ucf54\ub4dc\uc640 \uac19\uc2b5\ub2c8\ub2e4.boot.asm is the same as the existing code. \ud83d\udc49\ufe0f \uc804\uccb4\ud30c\uc77c\uc740 boot.asm\uacfc sector2.asm\uc785\ub2c8\ub2e4.The complete files are boot.asm and sector2.asm. \ud83d\udc49\ufe0f \uc804\uccb4\ucf54\ub4dc \/ Full Code(secotor2.asm) \ud83d\udc49\ufe0f \ucf54\ub4dc\uc124\uba85(sector2.asm) \u2714\ufe0f boot.asm \ucf54\ub4dc\uc124\uba85\uc740 \uc774\uc804\uacfc \uac19\uc544\uc11c [&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-6066","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\/6066","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=6066"}],"version-history":[{"count":2,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6066\/revisions"}],"predecessor-version":[{"id":6070,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/6066\/revisions\/6070"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=6066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=6066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=6066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}