From dc6b746faa656729de3ffc5b3ec5b087328dbd27 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Thu, 26 Dec 2019 16:24:32 -0500 Subject: just learned you can index with ecx, updated assembly accordingly --- src/kernel/serial.asm | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'src/kernel/serial.asm') diff --git a/src/kernel/serial.asm b/src/kernel/serial.asm index 9077d99..6318bc5 100644 --- a/src/kernel/serial.asm +++ b/src/kernel/serial.asm @@ -22,18 +22,14 @@ send_byte:;void send_byte(uint8_t value, uint8_t port) push ebp mov ebp, esp - mov cl, byte [ebp + 8] ;value - xor edx, edx - mov dl, byte [ebp + 12];port + xor ecx, ecx + mov cl, byte [ebp + 12];port - test dl, 0xfc + test cl, 0xfc jnz .leave - xchg ebx, edx - shl bl, 1 - mov ax, word [ebx + com_ports] - mov ebx, edx - mov dx, ax + shl cl, 1 + mov dx, word [ecx + com_ports] or dx, 5 @@ -44,7 +40,7 @@ send_byte:;void send_byte(uint8_t value, uint8_t port) and dx, 0xfff8 - mov al, cl + mov al, byte [ebp + 8];value out dx, al .leave: @@ -57,17 +53,14 @@ read_byte:;uint8_t read_byte(uint8_t port) xor eax, eax - xor edx, edx - mov dl, byte [ebp + 8];port + xor ecx, ecx + mov cl, byte [ebp + 8];port - test dl, 0xfc + test cl, 0xfc jnz .leave - xchg ebx, edx - shl bl, 1 - mov cx, word [ebx + com_ports] - mov ebx, edx - mov dx, cx + shl cl, 1 + mov dx, word [ecx + com_ports] or dx, 5 -- cgit v1.2.3