To find the lost treasure, you first need to buy the map from the shady character who stands on the same screen as the three pirates and their rat. At first glance, the map looks more like a set of dance steps than directions, but that is exactly what it is: instructions for reaching the treasure.
Once you enter the forest, open the map and follow the steps literally. If it says left, right, up, that means travel all the way to the left edge of the screen into the next area, then all the way to the right into the next, then take the exit at the top, and so on. Follow the sequence faithfully and the treasure is yours.