From 5d335c2de289020b93358918fa4972b1fc7d2840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BD=A4=E5=88=9A?= <2585649532@qq.com> Date: Thu, 27 Oct 2022 20:14:49 +0800 Subject: [PATCH] Update mappers.js add mapper241 --- src/mappers.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/mappers.js b/src/mappers.js index 866f87a7..a2ce34c7 100644 --- a/src/mappers.js +++ b/src/mappers.js @@ -1515,4 +1515,26 @@ Mappers[180].prototype.loadROM = function () { this.nes.cpu.requestIrq(this.nes.cpu.IRQ_RESET); }; +/** +* Mapper 241 (BNROM, NINA-01) +* +* @description http://wiki.nesdev.com/w/index.php/INES_Mapper_241 +* @example +* @constructor https://blog.heheda.top +*/ +Mappers[241] = function(nes) { + this.nes = nes; + }; + +Mappers[241].prototype = new Mappers[0](); + +Mappers[241].prototype.write = function(address, value) { + if (address < 0x8000) { + Mappers[0].prototype.write.apply(this, arguments); + return; + } else { + this.load32kRomBank(value, 0x8000); + } +}; + module.exports = Mappers;