/* namcot163 #19 FLASH MEMORY WRITE 8000h-87FFh Select 1K VROM at PPU 0000h-03FFh (with E800h/Bit6) 8800h-8FFFh Select 1K VROM at PPU 0400h-07FFh ("") 9000h-97FFh Select 1K VROM at PPU 0800h-0BFFh ("") 9800h-9FFFh Select 1K VROM at PPU 0C00h-0FFFh ("") A000h-A7FFh Select 1K VROM at PPU 1000h-13FFh (with E800h/Bit7) A800h-AFFFh Select 1K VROM at PPU 1400h-17FFh ("") B000h-B7FFh Select 1K VROM at PPU 1800h-1BFFh ("") B800h-BFFFh Select 1K VROM at PPU 1C00h-1FFFh ("") E000h-E7FFh Select 8K ROM at 8000h-9FFFh (initially 1st half of 1st 16K) Bit5-0 Page_number E800h-EFFFh Select 8K ROM at A000h-BFFFh (initially 2nd half of 1st 16K) Bit5-0 Page_number Bit6 Select at CHR_address $0000-$0FFF 0:ROM&RAM 1:ROM Bit7 Select at CHR_address $1000-$1FFF 0:ROM&RAM 1:ROM F000h-F7FFh Select 8K ROM at C000h-DFFFh (initially 1st half of last 16K) Bit5-0 Page_number N/A Fixed 8K ROM at E000h-FFFFh (always 2nd half of last 16K) CPU Memmory Bank cpu address|rom address |page|task $8000-$9fff|0x02000-0x03fff|1 |write 0x2aaa $a000-$bfff|0x04000-0x05fff|2 |write 0x5555 $c000-$dfff|0x02000*n |n |write area $e000-$ffff|末尾 |fix |boot area PPU Memmory Bank ppu address|rom address |page|task $0000-$03ff|0x02800-0x02bff|0x0a|write 0x2aaa $0400-$07ff|0x05400-0x057ff|0x15|write 0x5555 $0800-$0bff|未使用 $0c00-$0fff|未使用 $1000-$1FFF|0x1000*n |n |write area */ board <- { mappernum = 19, vram_mirrorfind = false, cpu = {banksize = 0x2000, maxsize = 4 * mega}, ppu = {banksize = 0x0400, maxsize = 4 * mega}, }; function initalize(d, cpu_banksize, ppu_banksize) { cpu_command(d, 0x2aaa, 0x8000, cpu_banksize); cpu_command(d, 0x5555, 0xa000, cpu_banksize); cpu_write(d, 0xe000, 1); cpu_write(d, 0xe800, 2); ppu_command(d, 0x2aaa, 0x0000, ppu_banksize); ppu_command(d, 0x5555, 0x0400, ppu_banksize); cpu_write(d, 0x8000, 0x0a); cpu_write(d, 0x8800, 0x15); } function cpu_transfer(d, start, end, cpu_banksize) { for(local i = start; i < end - 1; i += 1){ cpu_write(d, 0xf000, i); cpu_program(d, 0xc000, cpu_banksize); } cpu_program(d, 0xe000, cpu_banksize) } function ppu_transfer(d, start, end, ppu_banksize) { for(local i = start; i < end; i += 4){ cpu_write(d, 0xa000, i); cpu_write(d, 0xa800, i | 1); cpu_write(d, 0xb000, i | 2); cpu_write(d, 0xb800, i | 3); ppu_program(d, 0x1000, ppu_banksize * 4); } }