#include "../../bootpack.h"

void Keyboard::wait_sendready() {
	IO8 key_status(Keyboard::PORT_KEYSTA);
	while(1)
	{
		if ( (key_status.in() &
			Keyboard::KEYSTA_SEND_NOTREADY) == 0) {
			break;
		}
	}
}

void Keyboard::init() {
	IO8 key_command(Keyboard::PORT_KEYCMD);
	IO8 key_data(Keyboard::PORT_KEYDAT);
	wait_sendready();
	key_command << Keyboard::KEYCMD_WRITE_MODE;
	wait_sendready();
	key_data << Keyboard::KBC_MODE;
}
