Index: kbd/xtk/circuit.txt
===================================================================
--- kbd/xtk/circuit.txt	(revision 9e3cc0481d2a895c87645ba7df063fc0386ef2f4)
+++ kbd/xtk/circuit.txt	(revision 9e3cc0481d2a895c87645ba7df063fc0386ef2f4)
@@ -0,0 +1,1 @@
+The circuit used for ps2toserial is the same as the one for ak2serial, so see you there !
Index: kbd/xtk/code/Makefile
===================================================================
--- kbd/xtk/code/Makefile	(revision 9e3cc0481d2a895c87645ba7df063fc0386ef2f4)
+++ kbd/xtk/code/Makefile	(revision 9e3cc0481d2a895c87645ba7df063fc0386ef2f4)
@@ -0,0 +1,14 @@
+CC := $(shell { which avr-gcc || which avr-gcc-x86; } 2>/dev/null)
+OBJCOPY := $(shell { which avr-objcopy || which avr-objcopy-x86; } 2>/dev/null)
+
+keyboard.hex: keyboard.bin
+	$(OBJCOPY) -j .text -j .data -O ihex keyboard.bin keyboard.hex
+
+keyboard.bin: keyboard.o main.o
+	$(CC) keyboard.o main.o -o keyboard.bin -mmcu=atmega8 -Os
+
+main.o: main.c ../../libs/usart/usart.h ../../libs/ps2_keyboard/ps2_keyboard.h
+	$(CC) -std=c99 -c main.c -mmcu=atmega8 -Os -o main.o -mmcu=atmega8 -Os
+
+keyboard.o: ../../libs/ps2_keyboard/ps2_keyboard.c ../../libs/ps2_keyboard/ps2_keyboard.h ../../libs/ps2_keyboard/keymap.h
+	$(CC) -DCALLBACK="callback();" -c ../../libs/ps2_keyboard/ps2_keyboard.c -mmcu=atmega8 -Os -o keyboard.o
Index: kbd/xtk/code/keyboard.hex
===================================================================
--- kbd/xtk/code/keyboard.hex	(revision 9e3cc0481d2a895c87645ba7df063fc0386ef2f4)
+++ kbd/xtk/code/keyboard.hex	(revision 9e3cc0481d2a895c87645ba7df063fc0386ef2f4)
@@ -0,0 +1,59 @@
+:1000000092C0A1C0A1C09FC09EC09DC09CC09BC00B
+:100010009AC099C098C097C096C095C094C093C02C
+:1000200092C091C090C03F3F3F3F3F3F3F3F3F3F67
+:100030003F3F3F3F3F3F3F3F3F3F3F71313F3F3FAC
+:100040007A736177323F3F6378646534333F3F2092
+:1000500076667472353F3F6E62686779363F3F3F20
+:100060006D6A7537383F3F3F6B696F30393F3F3FAF
+:100070003F6C3F703F3F3F3F3F3F3F3F3F3F3F3F32
+:100080003F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F80
+:100090003F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F70
+:1000A0003F3F3F3F3F3F3F203FA000023F123F0303
+:1000B000A43F3F84263F3FA7263FA183803F3F3F89
+:1000C00087748573813F3F7677757270713F3F57B4
+:1000D00067656362613F3F5666546453603F3F3FCC
+:1000E00046555251503F3F2C45434240413F3F37D8
+:1000F00023443533313F3F3F3F1132303F3F862568
+:10010000222136343F3F3F3F3F3F3F3F973F3F171E
+:100110003F15243F3F3F01A60716051482A513276C
+:1001200006A3A204103F11241FBECFE5D4E0DEBF1A
+:10013000CDBF10E0A0E6B0E001C01D92A637B10728
+:10014000E1F7BFD024C15CCF1F920F920FB60F9280
+:1001500011242F933F934F935F936F937F938F93CC
+:100160009F93AF93BF93EF93FF9382B390E489275C
+:1001700082BB83994EC080916200811108C084992E
+:1001800026C081E0809362001092610027C0209118
+:100190006100283090F4849B0CC03091640081E0B1
+:1001A00090E0022E01C0880F0A94EAF7382B3093B2
+:1001B00064002F5F209361002CC0283021F489E077
+:1001C0008093610026C010926200109261008091BD
+:1001D0006400803F31F481E08093650010926400F8
+:1001E00018C09091640080916500923149F48111AA
+:1001F00004C081E0809360000CC01092600002C0D7
+:10020000882319F01092650004C081E08093630098
+:1002100037D0FF91EF91BF91AF919F918F917F91D7
+:100220006F915F914F913F912F910F900FBE0F9063
+:100230001F901895E82FF0E0EA5DFF4F84919091B0
+:100240006000911180520895809163008823E1F34A
+:1002500010926300809164000895109262001092E1
+:100260006400109261008B98839A85B7886085BF7F
+:1002700085B78B7F85BF8BB780688BBF78940895D7
+:10028000E3DFE82FF0E0EA55FF4FE491809165004D
+:10029000AE2FA295AF70EF70B0E0AA59BF4F21E02A
+:1002A00030E00E2E01C0220F0A94EAF7882329F0CD
+:1002B00020958C9128232C9308958C91822B8C93DC
+:1002C0000895CBDF18BA86E087BB8E9A8FEF9FEF39
+:1002D00064E068BB20E22A95F1F718BA40E24A953B
+:1002E000F1F768BBE0E2EA95F1F718BAF0E2FA95A7
+:1002F000F1F724E030E021503109C0F0AC01022ECA
+:1003000002C0559547950A94E2F740FF02C068BBCA
+:1003100001C018BA40E24A95F1F7C19AE0E4EA95C3
+:10032000F1F718BAF0E7FA95F1F7E5CFE7EDF0E06D
+:100330003197F1F700C0000028E030E0FC01EF70D9
+:10034000FF27EA59FF4F21503109C8F0408150E0A2
+:10035000022E02C0559547950A94E2F740FF02C06D
+:1003600068BB01C018BA40E24A95F1F7C19A40E46F
+:100370004A95F1F718BA40E74A95F1F7E4CF0196AC
+:10038000803191050CF4A5CF8FEF9FEFA2CFF894A9
+:02039000FFCF9D
+:00000001FF
Index: kbd/xtk/code/main.c
===================================================================
--- kbd/xtk/code/main.c	(revision 9e3cc0481d2a895c87645ba7df063fc0386ef2f4)
+++ kbd/xtk/code/main.c	(revision 9e3cc0481d2a895c87645ba7df063fc0386ef2f4)
@@ -0,0 +1,102 @@
+#define F_CPU 16000000UL
+
+#include <avr/io.h>
+#include <avr/pgmspace.h>
+#include <util/delay.h>
+
+#include "../../libs/ps2_keyboard/ps2_keyboard.h"
+
+uint8_t keys[16];
+
+const uint8_t pcw[128] PROGMEM = {
+// 0   1   2   3    4    5    6    7    8    9    A    B    C    D    E    F
+'?' ,0x20,'?' ,0xA0,0x00,0x02,'?' ,0x12,'?' ,0x03,0xA4,'?' ,'?' ,0x84,0x26,'?', // 0
+'?' ,0xA7,0x26,'?' ,0xA1,0x83,0x80,'?' ,'?' ,'?' ,0x87,0x74,0x85,0x73,0x81,'?', // 1
+'?' ,0x76,0x77,0x75,0x72,0x70,0x71,'?' ,'?' ,0x57,0x67,0x65,0x63,0x62,0x61,'?', // 2
+'?' ,0x56,0x66,0x54,0x64,0x53,0x60,'?' ,'?' ,'?' ,0x46,0x55,0x52,0x51,0x50,'?', // 3
+'?' ,',' ,0x45,0x43,0x42,0x40,0x41,'?' ,'?' ,0x37,0x23,0x44,0x35,0x33,0x31,'?', // 4
+'?' ,'?' ,'?' ,0x11,0x32,0x30,'?' ,'?' ,0x86,0x25,0x22,0x21,0x36,0x34,'?' ,'?', // 5
+'?' ,'?' ,'?' ,'?' ,'?' ,'?' ,0x97,'?' ,'?' ,0x17,'?' ,0x15,0x24,'?' ,'?' ,'?', // 6
+0x01,0xA6,0x07,0x16,0x05,0x14,0x82,0xA5,0x13,0x27,0x06,0xA3,0xA2,0x04,0x10,'?'  // 7
+};
+
+
+void callback()
+{
+	uint8_t key_code = 0;
+	key_code = read_char(); // TODO this is blocking function
+
+	uint8_t decode = pgm_read_byte(&(pcw[key_code]));
+	if(release)
+		keys[decode >> 4] &= ~(1 << (decode & 0xF));
+	else
+		keys[decode >> 4] |= 1 << (decode & 0xF);
+}
+
+
+int main() {
+  init_keyboard(); 
+
+  // PCW init - configure pins directions
+  PORTB = 0;
+  DDRB = 0x6; // PB1 and PB2 as outputs
+
+  //debug LED - output
+  DDRD |= (1<<PD6);
+
+
+  while(1) {
+	for(int idx = -1; idx < 16; idx++)
+	{
+		// send data to PCW
+		
+		// Start pulse
+		PORTB = 4;
+		_delay_us(6);
+		PORTB = 0;
+		_delay_us(6);
+		PORTB = 4;
+		_delay_us(6);
+		PORTB = 0;
+		_delay_us(6);
+
+		// Address
+		for(int j = 4; --j >= 0;)
+		{
+			if(idx & (1<<j))
+				PORTB = 4;
+			else
+				PORTB = 0;
+
+			// Clock
+			_delay_us(6);
+			PORTB |= 2;
+			_delay_us(12);
+			PORTB = 0;
+			_delay_us(21);
+		}
+
+		// One "empty" clock cycle
+		_delay_us(21 + 33);
+
+		// Data
+		for(int j = 8; --j >= 0;)
+		{
+			if (keys[idx & 0xF] & (1 << j)) 
+				PORTB = 4;
+			else
+				PORTB = 0;
+
+			// Clock
+			_delay_us(6);
+			PORTB |= 2;
+			_delay_us(12);
+			PORTB = 0;
+			_delay_us(21);
+		}
+	}
+  }
+  
+  return 0;
+}
+
Index: kbd/xtk/doc/signalling.txt
===================================================================
--- kbd/xtk/doc/signalling.txt	(revision 9e3cc0481d2a895c87645ba7df063fc0386ef2f4)
+++ kbd/xtk/doc/signalling.txt	(revision 9e3cc0481d2a895c87645ba7df063fc0386ef2f4)
@@ -0,0 +1,30 @@
+XT keyboard protocol and signalling
+===================================
+
+The keyboard comnmunicates with the PC/XT through a mostly single-direction
+serial link.
+
+When the link is idle, the CLK line is high (floating), and the DATA line is
+low (pulled by the keyboard).
+
+When the keyboard wants to send a byte:
+- It checks that the CLK line is not pulled low (the PC/XT does this when the
+receiving buffer is full).
+- It sends the byte for the keycode. There is a start bit (DATA=1), followed by
+the 7-bit keycode (LSb first), and the make/break bit (set for release, clear
+for key press).
+
+As the 9th bit is pushed, the PC will force the clock line low until the CPU has
+read the received byte and cleared the receiving register.
+
+The PC stores the data on the falling edge of the clock. It can also reset the
+keyboard by pulling the clock line low for too long (unsure what the exact
+timing is).
+
+It is up to the keyboard to manage the states of the LEDs. At power on, the LEDs
+are off. They are switched by pressing CAPS and NUM locks. It's possible that
+they get out of sync with the caps/num state the computer has. It is also up to
+the keyboard to handle typematic (key repeat) and a keyboard buffer, if needed.
+
+At boot, the keyboard is supposed to send 0xAA when it is ready to work.
+However, I'm not sure my XT clone BIOS actually checks for that.
