Have a look here
http://www.piclist.com/techref/micro...ard/ps2-jc.htm

assembler but the comments should give you information as to how to do what you want