bits 64 global serial_init global serial_putchar section .text serial_init: xor al, al mov dx, 0x03f9 out dx, al mov al, 0x80 mov dx, 0x03fb out dx, al mov al, 0x03 mov dx, 0x03f8 out dx, al xor al, al mov dx, 0x03f9 out dx, al mov al, 0x03 mov dx, 0x03fb out dx, al mov al, 0xc7 mov dx, 0x03fa out dx, al ret serial_putchar: cmp dil, 0x0a je .do_cr .cr_ret: mov dx, 0x03fd .loop: in al, dx test al, 0x20 jz .loop mov al, dil mov dx, 0x03f8 out dx, al ret .do_cr: mov dil, 0x0d call serial_putchar mov dil, 0x0a jmp .cr_ret