Refactor chip8_new and add a test for it