rectangles work

This commit is contained in:
2025-06-11 15:50:22 +01:00
parent be7943320d
commit 4d71868ac6
17 changed files with 321 additions and 48 deletions

View File

@@ -1,15 +1,4 @@
; ==================================================================
; MikeOS -- The Mike Operating System kernel
; Copyright (C) 2006 - 2021 MikeOS Developers -- see doc/LICENSE.TXT
;
; SCREEN HANDLING SYSTEM CALLS
; ==================================================================
; ------------------------------------------------------------------
; os_print_string -- Displays text
; IN: SI = message location (zero-terminated string)
; OUT: Nothing (registers preserved)
; SI = pointer to start of string to be printed
os_print_string:
pusha
@@ -29,7 +18,8 @@ os_print_string:
; Exact same as the above procedure, but this adds a newline
; after priting, similar to the difference between Rust's print! and println!
os_print_string_nl: pusha
os_print_string_nl:
pusha
mov ah, 0Eh ; int 10h teletype function, we're telling the BIOS we will print something
@@ -50,35 +40,33 @@ os_print_string_nl: pusha
os_print_newline:
pusha
mov ah, 0Eh
mov al, 13
int 10h
mov al, 10
int 10h
mov ah, 03h
int 10h
mov ah, 02h
add dh, 1
mov dl, 0
int 10h
popa
ret
; -------------------------------------------
os_clear_screen:
pusha
os_set_text_mode:
pusha
; Set mode = 80x25 (text mode)
mov ah, 00h
mov al, 03h ; Set video mode to textmode (80x25). 16 colors, 8 pages
mov al, 03h
int 10h
; Move cursor to the top left
mov ah, 02h
mov dh, 0
mov dl, 0
int 10h
popa
ret
popa
ret
; -------------------------------------------
@@ -98,15 +86,17 @@ os_read_input:
; -------------------------------------------
os_display_input:
os_display_input:
pusha
mov cx, [prompt_length]
.loop:
call .check_key_pressed
jmp os_display_input
jmp .loop
.check_key_pressed:
call os_read_input
call os_read_input
cmp al, 08h
je .backspace
@@ -117,8 +107,12 @@ os_display_input:
cmp al, 1Bh
je .esc_key
cmp cx, 0
jb .check_key_pressed
call .print_current_input
ret
dec cx
jmp .check_key_pressed
.esc_key:
call os_reboot
@@ -126,11 +120,14 @@ os_display_input:
.enter_key:
mov al, 0
stosb
mov di, user_input
popa
call os_read_cli
.backspace:
call .move_cursor_back ; then .move_cursor_back
call .loop ; Else .loop
.move_cursor_back:
mov ah, 0Eh
mov al, 08h