diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2017-12-02 16:35:43 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2017-12-02 16:35:43 -0500 |
commit | c9d2819d72bece6470bb3a7cf0edf669699a7ab4 (patch) | |
tree | 6382ef3e19f388a7e6d805ce62893c16d37f2acc | |
parent | 11adba68c348ca81961943940e6b64d7e8f3e2ac (diff) | |
download | minos-c9d2819d72bece6470bb3a7cf0edf669699a7ab4.tar.gz |
Fixup possible register clobbering
-rw-r--r-- | console.asm | 5 | ||||
-rw-r--r-- | stdio.asm | 9 |
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 @@ -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 |