Run arduino as ps/2 keyboard encoder

Hi, I am trying to make a custom keyboard using the atmega 2560 that can run the ps/2 protocol. (I hope to get other protocols working on it, but for now, ps/2 is the most important.) Does anybody how to would be possible to get an Arduino Mega to act as a ps/2 encoder with full support for nkro as well as control, shift, caplock, numlock, scrolllock, and all that. I assume the key matrix could be plugged into the digital io pins then defined as different rows and colums in the code. However, how could I make code that could convert key presses into ps/2 scancodes?

If possible, I would also like it if the keyboard could also have 10 programmable macro keys that could be programmable using a max232, once the basic encoder is set up, how could I do that?

Lastly, would a custom circuit be needed between the 2560 and the ps/2 port (like a clock or something)?

Hello
take a look here.