X-Git-Url: http://git.osdn.net/view?p=unagi%2Fold-svn-converted.git;a=blobdiff_plain;f=client%2Ftrunk%2Fanago%2Fnamcot_19.ai;fp=client%2Ftrunk%2Fanago%2Fnamcot_19.ai;h=07b5c693af7389d830d532351b16f4e51af7613c;hp=21a330a3a776031304952a8ea5c90922d5a552b4;hb=def564246e4b7f5116680a699361faf62547ae6a;hpb=86d28d7a5a4f5b6487a8fccc68cf1e30eea4b392 diff --git a/client/trunk/anago/namcot_19.ai b/client/trunk/anago/namcot_19.ai index 21a330a..07b5c69 100644 --- a/client/trunk/anago/namcot_19.ai +++ b/client/trunk/anago/namcot_19.ai @@ -1,76 +1,76 @@ -/* -iNES mapper #19 - -Many cartridges uses epoxies for ROM, RAM and mapper. Few cartridges -uses discrete parts. Other functions are various though the memory -mapping is common. - -The mistake of an old document is an etymology of 'namcot 106'. I have -seen mapper IC with 163 (well known chip), 129, 175 and 340 for #19. -I have never seen labeled IC with '106'. -'106' is informal virtual name, and the relic of old emulators. -*/ -function cpu_dump(d, pagesize, banksize) -{ - for(local i = 0; i < pagesize - 2; i += 2){ - cpu_write(d, 0xe000, i); - cpu_write(d, 0xe800, i | 1); - cpu_read(d, 0x8000, banksize * 2); - } - cpu_write(d, 0xf000, 0x3e); - cpu_read(d, 0xc000, banksize * 2); -} - -function ppu_dump(d, pagesize, banksize) -{ - cpu_write(d, 0xe800, 0xe0); - for(local i = 0; i < pagesize; i += 8){ - local address = 0x8000; - for(local j = 0; j < 8; j++){ - cpu_write(d, address, i | j); - address += 0x0800; - } - ppu_read(d, 0, banksize * 8); - } -} - -function program_initalize(d, cpu_banksize, ppu_banksize) -{ - cpu_command(d, 0x0000, 0xa000, cpu_banksize); - cpu_command(d, 0x2aaa, 0x8000, cpu_banksize); - cpu_command(d, 0x5555, 0xa000, cpu_banksize); - cpu_write(d, 0xe000, 0x41); - cpu_write(d, 0xe800, 0xe2); - - ppu_command(d, 0x0000, 0x0000, ppu_banksize); - ppu_command(d, 0x2aaa, 0x0400, ppu_banksize); - ppu_command(d, 0x5555, 0x0800, ppu_banksize); - cpu_write(d, 0x8000, 0x00); - cpu_write(d, 0x8800, 0x0a); - cpu_write(d, 0x9000, 0x15); - //map 0x2000-0x2fff is RAM - cpu_write(d, 0xc000, 0xe0); - cpu_write(d, 0xc800, 0xe0); - cpu_write(d, 0xd000, 0xe1); - cpu_write(d, 0xd800, 0xe1); -} - -function cpu_transfer(d, start, end, cpu_banksize) -{ - for(local i = start; i < end - 1; i += 1){ - cpu_write(d, 0xf000, i | 0xe0); - 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); - } -} +/* +iNES mapper #19 + +Many cartridges uses epoxies for ROM, RAM and mapper. Few cartridges +uses discrete parts. Other functions are various though the memory +mapping is common. + +The mistake of an old document is an etymology of 'namcot 106'. I have +seen mapper IC with 163 (well known chip), 129, 175 and 340 for #19. +I have never seen labeled IC with '106'. +'106' is informal virtual name, and the relic of old emulators. +*/ +function cpu_dump(d, pagesize, banksize) +{ + for(local i = 0; i < pagesize - 2; i += 2){ + cpu_write(d, 0xe000, i); + cpu_write(d, 0xe800, i | 1); + cpu_read(d, 0x8000, banksize * 2); + } + cpu_write(d, 0xf000, 0x3e); + cpu_read(d, 0xc000, banksize * 2); +} + +function ppu_dump(d, pagesize, banksize) +{ + cpu_write(d, 0xe800, 0xe0); + for(local i = 0; i < pagesize; i += 8){ + local address = 0x8000; + for(local j = 0; j < 8; j++){ + cpu_write(d, address, i | j); + address += 0x0800; + } + ppu_read(d, 0, banksize * 8); + } +} + +function program_initalize(d, cpu_banksize, ppu_banksize) +{ + cpu_command(d, 0x0000, 0xa000, cpu_banksize); + cpu_command(d, 0x2aaa, 0x8000, cpu_banksize); + cpu_command(d, 0x5555, 0xa000, cpu_banksize); + cpu_write(d, 0xe000, 0x41); + cpu_write(d, 0xe800, 0xe2); + + ppu_command(d, 0x0000, 0x0000, ppu_banksize); + ppu_command(d, 0x2aaa, 0x0400, ppu_banksize); + ppu_command(d, 0x5555, 0x0800, ppu_banksize); + cpu_write(d, 0x8000, 0x00); + cpu_write(d, 0x8800, 0x0a); + cpu_write(d, 0x9000, 0x15); + //map 0x2000-0x2fff is RAM + cpu_write(d, 0xc000, 0xe0); + cpu_write(d, 0xc800, 0xe0); + cpu_write(d, 0xd000, 0xe1); + cpu_write(d, 0xd800, 0xe1); +} + +function cpu_transfer(d, start, end, cpu_banksize) +{ + for(local i = start; i < end - 1; i += 1){ + cpu_write(d, 0xf000, i | 0xe0); + 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); + } +}