;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; PlutOS ; ; Copyright (C) 2024 Patrick_Pluto ; ; ; ; This program is free software: you can redistribute it and/or modify ; ; it under the terms of the GNU General Public License as published by ; ; the Free Software Foundation, either version 3 of the License, or ; ; (at your option) any later version. ; ; ; ; This program is distributed in the hope that it will be useful, ; ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; ; GNU General Public License for more details. ; ; ; ; You should have received a copy of the GNU General Public License ; ; along with this program. If not, see .; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; introduction_msg_out: mov si, introduction_msg call print_str ret psh_prompt_out: mov si, psh_prompt call print_str ret term_input: call get_char cmp al, 0x0D je newline cmp al, 0x08 je backspace cmp al, " " jnge term_input call add_to_buffer call print_char jmp term_input ret backspace: call check_cursor_position cmp dl, 7 jl term_input call print_char mov al, 0 call print_char mov al, 0x08 call print_char call rem_from_buffer jmp term_input newline: call print_char mov al, 0x0A call print_char call process_command mov byte [buffer], 0 call psh_prompt_out jmp term_input check_cursor_position: mov ah, 0x03 mov bh, 0x00 int 0x10 ret add_to_buffer: mov si, buffer call loop_through_buffer mov byte [si], al inc si mov byte [si], 0 ret rem_from_buffer: mov si, buffer call loop_through_buffer dec si mov byte [si], 0 ret loop_through_buffer: cmp byte [si], 0 je return inc si jmp loop_through_buffer return: ret introduction_msg: db "Welcome to PlutOS!", 0x0D, 0x0A, 0x0A, "This is an exercise to me to get better at x86 (real mode) assembly", 0x0D, 0x0A, "and learn a bit of low level programming.", 0x0D, 0x0A, "This is not really a serious OS by any means, but who knows what's to come. :)", 0x0D, 0x0A, 0x0A, "To see the list of available commands, type help.", 0x0D, 0x0A, 0x0A, 0 unknown_msg: db "Unknown command: ", 0 psh_prompt: db " ", 0 buffer: times 512 db 0