It's called a computer - but building your own, and then writing all your own games for the system you built, seems a bit pointless?.
Far easier to just buy one, there's even been a very cheap system you could buy that contained internally all the old favourite games, like Pacman and Frogger.