Mario's Time Machine (NES)/Door 1

Run to the right and head into the first door (jump on the star statue to reach it).

Take out the three koopas, and walk on top of the torch that appears. Press down to take it.

Stand on top of the time machine and press down like you would any other pipe, press right once to change the time to 776 B.C., then press.

Run to the far right of the area, stand on top of the big white object (the torch), press to view the torch in the item selection square, then press  to use it.

The password you get is RGNC4L.