Each letter is mapped based on KSX 5002 keyboard, which is the most common way to type korean. It is modified so that it can distinguish between jongseong(under) letters and choseong(upper) letters. Here is how it is mapped:
( [a,b] [a,b,c] a:original key b:mapped letter c:shifted letter )
1. Everything except for jongseong letters is mapped the same
2. Jongseong letters are mapped in shifted key, except for ㅂ, ㅈ, ㄷ, ㄱ, ㅅ which already has shifted key (double letters). jongseong letters of ㅂ, ㅈ, ㄷ, ㄱ, ㅅ are mapped in 1, 2, 3, 4, 5 and ㄲ, ㅆ's are mapped in $, %.