Anago loads two script files - flashcore.nut and a spcified .af file. Please leave the flashcore.nut file unchanged.
.af file must define a variable and three functions. The variable is 'board', while the functions are 'initialize()', 'cpu_transfer()' and 'ppu_transfer()'. It's possible to define another function via brief scripting.
Flash memory has a programming waiting period. During this period, the firmware can program another flash memory. Anago executes the following sequence:
The most important function is initialize(), as it will configure an erase state once the initialize() function finishes.
In rare instances, it's possible to change command addresses on xxx_transfer().
The script file must be defined to transfer data sequentially. Anago switches programming threads automatically.
The unit of both banksize and maxsize are in bytes.
function initialize(d, cpu_banksize, ppu_banksize)
This function defines and locates command addresses, which then configures an erase state when the initialize() function finishes.
function cpu_transfer(d, start, end, banksize)
This function is defined in order to transfer the ROM image to the CPU region. This transfers variable bank data by a defined loop, then transfers fixed bank data afterwards.
function ppu_transfer(d, start, end, banksize)
This function is defined to transfer ROM image to PPU region. All bank data is transferred by a defined loop.
function cpu_write(d, address, data) See decsription script_common_en
function cpu_command(d, romoffset, memorymapoffset, banksize)
This function defines command addresses for the connected flash memory on the CPU region. It is defined via initialize(). In addition, it's possible to redefine this function during xxx_transfer().
function ppu_command(d, romoffset, memorymapoffset, banksize)
Similar to the cpu_command(), this function defines command addresses for the connected flash memory on the PPU region.
function cpu_program(d, address, length)
This function programs data into the current CPU memory region. Anago switches threads automatically.
function ppu_program(d, address, length)
This function programs data into the current PPU memory region. Anago switches threads automatically.
This function erases flash memory data on the current memory region. Since this function is already used in flashcore.nut, please do not use this function in an .af file.