inline void register_write(uint8_t reg, uint8_t value) /* Write to register Writes a value to an APU register by feeding the 6502 with instructions for loading the value into A, and then storing the value in $40<reg>. */ { // Put STA_zp on bus before deactivating CPU latch bus_write(STA_zp); // Open latch output bus_select(CPU_ADDRESS); // The code in the register set function has to be cycle exact, so it has to // be run with interrupts disabled: ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { register_set(reg, value); } // Finally, latch the last bus value by deselecting the CPU bus_deselect(); // Reflect change in mirror reg_mirror[reg] = value; }
void op_init(t_context *C) { set_draw_plug=0; // create menus op_menu_init(C); // register register_set(C); set_draw_plug=1; }