Delete boot.asm
This commit is contained in:
parent
250d845ad2
commit
22c4591465
86
boot.asm
86
boot.asm
|
@ -1,86 +0,0 @@
|
||||||
[bits 16] ; Set to 16-bit mode
|
|
||||||
[org 0x7C00] ; BIOS loads the bootloader at this address
|
|
||||||
|
|
||||||
start:
|
|
||||||
cli ; Disable interrupts
|
|
||||||
|
|
||||||
; Clear the screen
|
|
||||||
call clear_screen
|
|
||||||
mov si, welcome_message
|
|
||||||
call print_string_real
|
|
||||||
|
|
||||||
command_loop:
|
|
||||||
mov si, prompt_message
|
|
||||||
call print_string_real
|
|
||||||
|
|
||||||
call read_input
|
|
||||||
|
|
||||||
cmp al, 'h' ; Check for 'h' command (help)
|
|
||||||
je print_help
|
|
||||||
cmp al, 'q' ; Check for 'q' command (quit)
|
|
||||||
je quit_terminal
|
|
||||||
cmp al, 'f' ; Check for 'f' command (heckerfetch)
|
|
||||||
je heckerfetch
|
|
||||||
|
|
||||||
mov si, unknown_command_message
|
|
||||||
call print_string_real
|
|
||||||
jmp command_loop ; Repeat the command loop
|
|
||||||
|
|
||||||
print_help:
|
|
||||||
mov si, help_message
|
|
||||||
call print_string_real
|
|
||||||
jmp command_loop ; Return to command loop
|
|
||||||
|
|
||||||
heckerfetch:
|
|
||||||
mov si, heckerfetch_message
|
|
||||||
call print_string_real
|
|
||||||
jmp command_loop ; Return to command loop
|
|
||||||
|
|
||||||
quit_terminal:
|
|
||||||
mov si, goodbye_message
|
|
||||||
call print_string_real
|
|
||||||
jmp hang ; Hang the system
|
|
||||||
|
|
||||||
; Function to read a character from keyboard input
|
|
||||||
read_input:
|
|
||||||
xor eax, eax ; Clear EAX for reading character input
|
|
||||||
int 0x16 ; Call BIOS interrupt to read a character into AL
|
|
||||||
ret ; Return with character in AL
|
|
||||||
|
|
||||||
; Function to print a string in real mode using VGA text buffer
|
|
||||||
print_string_real:
|
|
||||||
mov edi, 0xb8000 ; VGA text buffer address
|
|
||||||
.next_char:
|
|
||||||
lodsb ; Load byte at DS:SI into AL and increment SI
|
|
||||||
cmp al, 0 ; Check for null terminator
|
|
||||||
je .done ; If null, we are done
|
|
||||||
mov [edi], ax ; Write character and attribute (white on black)
|
|
||||||
add edi, 2 ; Move to next character cell
|
|
||||||
jmp .next_char ; Repeat for next character
|
|
||||||
.done:
|
|
||||||
ret ; Return from function
|
|
||||||
|
|
||||||
; Function to clear the screen in real mode
|
|
||||||
clear_screen:
|
|
||||||
xor di, di ; Start from the beginning of the VGA buffer
|
|
||||||
mov cx, 80 * 25 ; Number of characters in a standard text mode screen
|
|
||||||
mov ax, 0x07 ; Attribute for white on black background
|
|
||||||
.fill_screen:
|
|
||||||
stosw ; Store word in [ES:DI] and increment DI by 2
|
|
||||||
loop .fill_screen ; Repeat until CX is zero
|
|
||||||
ret ; Return from function
|
|
||||||
|
|
||||||
; Data section for messages
|
|
||||||
welcome_message db 'Welcome to the HeckerOS!', 0
|
|
||||||
prompt_message db 'Enter command (h for help, q to quit, f for heckerfetch): ', 0
|
|
||||||
help_message db 'Available commands: h (help), q (quit), f (heckerfetch)', 0
|
|
||||||
unknown_command_message db 'Unknown command! Try again.', 0
|
|
||||||
goodbye_message db 'Goodbye!', 0
|
|
||||||
heckerfetch_message db 'OS: HeckerOS Beta, CPU: HeckerSoft Generic CPU 0GHZ', 'Host: HeckerSoft Unknown Host', 0
|
|
||||||
|
|
||||||
; Bootloader signature (must be present)
|
|
||||||
times 510 - ($ - $$) db 0 ; Fill the rest of the sector with zeros
|
|
||||||
dw 0xAA55 ; Boot signature
|
|
||||||
|
|
||||||
hang:
|
|
||||||
jmp hang ; Jump to hang indefinitely
|
|
Loading…
Reference in New Issue