summaryrefslogtreecommitdiff
path: root/src/io/io.asm
blob: 37ad7ebc8b010aa43226f94200fe3c2b5cebf9cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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