alcedo/kernel/arch/i386/io.nim

19 lines
321 B
Nim

type
IOPacket* = tuple
port: uint16
value: uint8
{.push stackTrace:off.}
proc outb*(data: IOPacket) =
let x = data.value
let y = data.port
asm """
"outb %%al, %%dx" : :"a"(`x`), "d"(`y`)
"""
proc inb*(port: uint16): uint =
asm """
"inb %%dx, %%al" :"=a"(`result`) :"d"(`port`)
"""
{.pop.}