summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenji Dial <Benji3.141@gmail.com>2019-12-26 16:24:32 -0500
committerBenji Dial <Benji3.141@gmail.com>2019-12-26 16:24:32 -0500
commitdc6b746faa656729de3ffc5b3ec5b087328dbd27 (patch)
tree9e3c0e221315d2ab14d5446090dfd461ea5d54ea /src
parente0e08a12d4de86b558674fb9f90ad0b0204c26f0 (diff)
downloadportland-os-dc6b746faa656729de3ffc5b3ec5b087328dbd27.tar.gz
just learned you can index with ecx, updated assembly accordingly
Diffstat (limited to 'src')
-rw-r--r--src/kernel/serial.asm29
1 files changed, 11 insertions, 18 deletions
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