Each potential section of wall is a separately drawn sprite, e.g. directly in front of you, two spaces away, or at a 90 degree angle to the right. The engine just determines which sprites to show depending on map position.