you had a backwards ld in there : )
GetXY:
;NOTE: This assumes you stored the map data vertically!
;Input e=y,hl=x
;Output a= tile at (x,y)
ld a,l
and %11111000
ld l,a
;add hl,hl ;only do this if your map is 16 high instead of 8
;ld 0,d BACKWARDS
ld d,0
add hl,de
ld de,map ;or whatever you named the map memory
add hl,de
ld a,(hl)
ret