Added an I/O port driver and made it callable from C.
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
#ifndef IO_H
|
||||||
|
#define IO_H
|
||||||
|
void outb(unsigned short port, unsigned char data);
|
||||||
|
#endif
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
global outb
|
||||||
|
|
||||||
|
; outb - Send a byte to an I/O port.
|
||||||
|
; stack: [esp + 8] The data byte
|
||||||
|
; [esp + 4] The I/O port
|
||||||
|
; [esp ] Return address
|
||||||
|
outb:
|
||||||
|
mov al, [esp + 8] ; Move the data to send into the AL register
|
||||||
|
mov dx, [esp + 4] ; Move the address of the I/O port into the DX register
|
||||||
|
out dx, al ; Send the data to the I/O port
|
||||||
|
ret ; Return
|
||||||
Reference in New Issue
Block a user