From 7b988e680727beed1d75ff4f0e48158f4465f122 Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Mon, 25 Aug 2025 08:15:02 +0200 Subject: IO: Add in/out declarations/definitions I've forgotten to commit this when working on interrupts. The OS won't build without these helpers. They are used for now mostly to setup PICs. Signed-off-by: Carlos Maiolino --- src/io/io.asm | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/io/io.asm (limited to 'src/io/io.asm') diff --git a/src/io/io.asm b/src/io/io.asm new file mode 100644 index 0000000..37ad7eb --- /dev/null +++ b/src/io/io.asm @@ -0,0 +1,56 @@ +section .asm + +global insb +global insw +global outb +global outw + +insb: + push ebp + mov ebp, esp + + xor eax, eax ; Zero out eax + mov dx, [ebp+8] + in al, dx + + mov esp, ebp + pop ebp + ret + +insw: + push ebp + mov ebp, esp + + xor eax, eax ; Zero out eax + mov dx, [ebp+8] + in ax, dx + + mov esp, ebp + pop ebp + ret + +outb: + push ebp + mov ebp, esp + + xor eax, eax + mov ax, [ebp+12] ; val to write + mov dx, [ebp+8] ; to this port + out dx, al + + mov esp, ebp + pop ebp + ret + +outw: + push ebp + mov ebp, esp + + xor eax, eax + mov ax, [ebp+12] ; val to write + mov dx, [ebp+8] ; to this port + out dx, ax + + mov esp, ebp + pop ebp + ret -- cgit v1.2.3