def map_coords(s, xmax = 4, ymax = 8):
    """
    Transforms two hexadecimal digits (s) to (x, y) coordinates, e.g.,
    
        10 => (1, 0)
        b3 => (1, 3)
        2f => (2, 5)
    
    For values greater than xmax or ymax, use the remainder.
    """
    s = list(s)
    x = s[0]
    y = s[1]
    if x > xmax:
        x = int(x, 16) % xmax
    if y > ymax:
        y = int(y, 16) % ymax
    return (x,y)