You are a coding agent on macOS. Your job is to set up an environment where you can build NES (Nintendo Entertainment System) ROMs in C, run them in an emulator, and drive that emulator from the command line so you can iterate without a human pressing buttons. Aim for the state described below; report back at each milestone with what you did and what is verified.
By the end you should have:
- An emulator running. FCEUX 2.6+ installed and able to load
.nesROMs. It exposes a Lua scripting API; that API is how you will control it programmatically. - A C toolchain for the 6502.
cc65(which providescc65,ca65,ld65,cl65) and a copy of Shiru/clbr's NESLib, a small C-callable helper library that wraps the bits of the NES hardware most games need (palettes, sprites, controllers, PPU, frame waits, optional famitone2 audio).