You can try using a look up table, place the value of each key in an array or map in memory in numerical order starting at row 0 column 0. You have four rows by four columns. For any key press two bits on the 8-bit latch will go high (row & col).
Split the 8-bit latch into two nibbles representing the row and column values. (I Assume the row is in the high nibble) The column is the value of the low nibble which will also have a single bit set and can only be one of the following values
1000 = 8
0100 = 4
0010 = 2
0001 = 1
(The row and col nibbles can only be these 4 values for a proper key press)
You want to convert these nibble values in to a sequental value of 3,2,1,0 to indicate which col or row has been pressed.
Using a counter and the ZERO flag in the status register perform a series of right shifts incrementing a count for each shift. When the zero flag gets set stop shifting/counting as you will have just removed the only set bit in the col nibble.
Place the increment after the zero test to give you a zero based count (3 to 0) (If you code so you get 4 to1 just subtract 1)
Do the same thing for the ROW (High nibble)
This will give you row and col values of following in two seperate bytes
00000011 = 3
00000010 = 2
00000001 = 1
00000000 = 0
Depending on you array layout left shift ROW by two and AND with COL
00000011 = 3 << 2 = 00001100 = 12
00000010 = 2 << 2 = 00001000 = 8
00000001 = 1 << 2 = 00000100 = 4
00000000 = 0 << 2 = 00000000 = 0
Let assume that a third row button was pressed this results in the value of 8 which will be AND'ed (ADD) with the COL value (0 to 3) Lets assume COL 2
_00001000(8)
&00000010(2)
=00001010(10 or 0xA)
If you map out a truth table for this method for each key you will find that you will get a sequential binary count from 0000 to 1111.
The above example value of 10 is then used in a look up table or Array to return the mapped value of the key pad.
You can use this sequential value as a pointer to read a value from memory off set from a base address where key press value bytes are stored (mapped)