Some notes before I abandoned the initial implementation to get it working quickly.
// if file > rank, above the diagonal
// if above diagonal: 8 - (file - rank) = row #
// if below diagonal: rank - file = row #
// if file == rank => row = 0
//
// if above the diagonal, indicies are from
// 8 - row # to 8
// if below the diagonal, indicies are from
// 0 to 8 - row #
Some notes before I abandoned the initial implementation to get it working quickly.