From 6e5019dcb7e7b40098e2cc44534e6e6ebb0cd79b Mon Sep 17 00:00:00 2001 From: CrazyEttin <> Date: Wed, 2 Jun 2021 18:13:12 +0300 Subject: [PATCH] Trying to set up a stack. --- source/boot.asm | 4 ++-- source/readln.inc | 10 +++------- source/system.asm | 8 ++++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/source/boot.asm b/source/boot.asm index 6e0d743..799f087 100644 --- a/source/boot.asm +++ b/source/boot.asm @@ -37,7 +37,7 @@ mov cl, 0x2 ;Set the destination mov ax, 0x1000 mov es, ax -mov bx, 0 +mov bx, 0x200 ;Set the size mov al, 0x20 ;Load @@ -45,7 +45,7 @@ mov ah, 0x2 int 0x13 ;Boot the system -jmp 0x1000:0 +jmp 0x1000:0x200 ;Padding times 0x1fe-($-$$) db 0 diff --git a/source/readln.inc b/source/readln.inc index 7257be0..957745b 100644 --- a/source/readln.inc +++ b/source/readln.inc @@ -25,10 +25,6 @@ mov byte [.lastln], dh mov ah, 0x0 int 0x16 -;Check for null -cmp al, 0x0 -je .loop - ;Check for return cmp al, 0xd je .return @@ -84,7 +80,7 @@ jmp .char ;Get the cursor position mov ah, 0x3 int 0x10 -;More from the end of a line to the beginning of the next one +;Move from the end of a line to the beginning of the next one cmp dl, [cpl] je .nextln ;Move forward within a line @@ -107,12 +103,12 @@ jmp .checkln .backspace: ;Check for the input beginning -cmp bl, 0x0 +cmp bl, 0x1 je .loop ;Get the cursor position mov ah, 0x3 int 0x10 -;More from the beginning of a line to the end of the previous one +;Move from the beginning of a line to the end of the previous one cmp dl, 0x1 je .prevln ;Move backward within a line diff --git a/source/system.asm b/source/system.asm index bed7819..7fb3132 100644 --- a/source/system.asm +++ b/source/system.asm @@ -1,3 +1,4 @@ +[ORG 0x200] jmp start ;Calls @@ -20,6 +21,13 @@ start: mov ax, 0x1000 mov ds, ax +;Set up the stack +cli +mov ax, 0x1000 +mov ss, ax +mov sp, 0x200 +sti + ;Get the terminal width mov ah, 0xf int 0x10