WeiWeiXinNet/Games/game3/js/GameBoyCore.js

(开头部分) 296KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/* 
 * JavaScript GameBoy Color Emulator
 * Copyright (C) 2010 Grant Galitz
 * 
 * Ported the video, HDMA, and double speed mode procedure from the STOP opcode from MeBoy 2.2
 * http://arktos.se/meboy/
 * Copyright (C) 2005-2009 Bjorn Carlin
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 * The full license is available at http://www.gnu.org/licenses/gpl.html
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 */
 /**
 *TODO:
	- Working On Right Now:
		- Add a way where the sprite count on a line changes the STAT number adjustment for current clock cycle.
		- Make I/O bit reading and writing more accurate.
	- Started already, but far from merging into here:
		- Serial port link for multiplayer type stuff
		- IR port
		- GBA (ARM7TDMI CPU Core) support will be coming when I feel like working on it more.
			- Could be split off into a separate project, because the CPU is completely different.
	- Afterwards....
		- Fix some boogs.
		- A Bit Later... Byte Later... Which ever comes first :P
			- Add some more MBC support (I haven't seen any game except one so far that uses an unsupported MBC)
				- MBC7, TAMA5, HuC1, etc.
 **/
function GameBoyCore(canvas, canvasAlt, ROMImage) {
	this.canvas = canvas;						//Canvas DOM object for drawing out the graphics to.
	this.canvasAlt = canvasAlt;					//Image DOM object for drawing out the graphics to as an alternate means.
	this.canvasFallbackHappened = false;		//Used for external scripts to tell if we're really using the canvas or not (Helpful with fullscreen switching).
	this.drawContext = null;					// LCD Context
	this.ROMImage = ROMImage;					//The game's ROM. 
	this.ROM = [];								//The full ROM file dumped to an array.
	this.inBootstrap = true;					//Whether we're in the GBC boot ROM.
	this.usedBootROM = false;					//Updated upon ROM loading...
	this.registerA = 0x01; 						// Accumulator (default is GB mode)
	this.FZero = true; 							// bit 7 - Zero
	this.FSubtract = false;						// bit 6 - Sub
	this.FHalfCarry = true;						// bit 5 - Half Carry
	this.FCarry = true;							// bit 4 - Carry
	this.registerB = 0x00;						// Register B
	this.registerC = 0x13;						// Register C
	this.registerD = 0x00;						// Register D
	this.registerE = 0xD8;						// Register E
	this.registersHL = 0x014D;					// Registers H and L
	this.memoryReader = [];						//Array of functions mapped to read back memory
	this.memoryWriter = [];						//Array of functions mapped to write to memory
	this.stackPointer = 0xFFFE;					// Stack Pointer
	this.programCounter = 0x0100;				// Program Counter
	this.halt = false;							//Has the CPU been suspended until the next interrupt?
	this.skipPCIncrement = false;				//Did we trip the DMG Halt bug?
后面还有 6805+ 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。