2020-04-17 17:44:23 +02:00

78 lines
1.3 KiB
NASM

; io_port.asm - This file is a part of NutsOS
; NutsOS
; Copyright (C) 2013 Free Software Foundation, Inc.
; NutsOS is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 3 of the License, or
; (at your option) any later version.
; NutsOS is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
; You should have received a copy of the GNU General Public License along
; with NutsOS; If not, see <http://www.gnu.org/licenses/>.
; Valentin Verdier <valentin.verdier03@gmail.com>
[BITS 32]
[SECTION .text]
global _out, _in, _outw, _inw, _outdw, _indw
_out:
push eax
push edx
mov dx, [esp+12]
mov al, [esp+16]
out dx, al
pop edx
pop eax
ret
_in:
push edx
xor eax, eax
mov dx, [esp+8]
in al, dx
pop edx
ret
_outw:
push eax
push edx
mov dx, [esp+12]
mov ax, [esp+16]
out dx, ax
pop edx
pop eax
ret
_inw:
push edx
xor eax, eax
mov dx, [esp+8]
in ax, dx
pop edx
ret
_outdw:
push eax
push edx
mov dx, [esp+12]
mov eax, [esp+16]
out dx, eax
pop edx
pop eax
ret
_indw:
push edx
mov dx, [esp+8]
in eax, dx
pop edx
ret