summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--console.asm5
-rw-r--r--stdio.asm9
2 files changed, 11 insertions, 3 deletions
diff --git a/console.asm b/console.asm
index 8c880f3..de4fdb7 100644
--- a/console.asm
+++ b/console.asm
@@ -32,6 +32,7 @@ putc:
console_scroll_up:
+ pusha
cmp dh, MAX_ROWS - 1
jne .no_action
@@ -50,12 +51,14 @@ console_scroll_up:
mov dh, MAX_ROWS ; lower row.
int 10h
.no_action:
+ popa
ret
console_driver:
push bp
mov bp, sp
+ pusha
call console_cursor_getpos
mov dh, [cursor_row]
@@ -143,9 +146,9 @@ console_driver:
call setcursor
add sp, 2
-
.return_noupdate:
call console_scroll_up
+ popa
mov sp, bp
pop bp
ret
diff --git a/stdio.asm b/stdio.asm
index b4b54a4..35f4cd6 100644
--- a/stdio.asm
+++ b/stdio.asm
@@ -29,9 +29,11 @@ puts:
printi:
push bp
mov bp, sp
+ push ax
mov ax, [bp + 4]
call putint
.return:
+ pop ax
mov sp, bp
pop bp
ret
@@ -55,8 +57,8 @@ printh:
puthex:
push ax
push bx
- push dx
push cx
+ push dx
; ax is integer to print
ror ah, 4 ; reverse hex value
@@ -91,8 +93,8 @@ puthex:
jne .divide
.return:
- pop cx
pop dx
+ pop cx
pop bx
pop ax
ret
@@ -141,6 +143,8 @@ printf:
mov bp, sp
mov di, bp ; save base pointer address
+ push di
+
mov bx, [bp + 4] ; format string address
add bp, 6 ; set base pointer to beginning of '...' args
@@ -234,6 +238,7 @@ printf:
; a procedure modifies DI without restoring
; it, we're doomed; we'll roll right off the
; edge into oblivion.
+ pop di
mov sp, bp
pop bp
ret