Top down classic

Im trying to make a classic top down 2d game just like original Zelda for nes. but i cant get the movement to be the same like the old school games.
Were you move up and down, left or right only, no diagonal.
Please help me to figure this out.
Ill even do coding if i have to.
thank you.

move up and down, left or right only,
no diagonal

Probably something like this:

But perhaps you could include more details in case someone who could help did not play that classic.

Thanks, it work great.
I been trying to figure this out for a long time.
thanks.