[bits 32] global port_write8 global port_read8 ; typedef enum port_type_t { ; PORT_TYPE_8BIT = 0, ; PORT_TYPE_8BIT_SLOW = 1, ; PORT_TYPE_16BIT = 2, ; PORT_TYPE_32BIT = 3 ; } port_type_t; PORT_TYPE_8BIT equ 0 PORT_TYPE_8BIT_SLOW equ 1 PORT_TYPE_16BIT equ 2 PORT_TYPE_32BIT equ 3 ; void port_write8( port_t *port, uint8_t data ); port_write8: push ebp mov ebp, esp mov ecx, [ebp+8] mov edx, DWORD [ecx] cmp edx, PORT_TYPE_8BIT je .ok int 10 .ok: mov edx, DWORD [ecx+4] movzx ax, BYTE [ebp+12] out dx, al leave ret ; uint8_t port_read8( port_t *port ) port_read8: push ebp mov ebp, esp mov ecx, DWORD [ebp+8] mov edx, DWORD [ecx] cmp edx, PORT_TYPE_8BIT je .ok int 11 .ok: mov edx, [ecx+4] in al, dx leave ret