This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* --- Stack operations --- */ | |
static void pushb(BYTE val) { | |
Memory_WriteByte((STACK_ADDR | cpu.SP--), val); | |
} | |
static void pushw(WORD val) { | |
BYTE tmp = (BYTE)(val & 0xFF); | |
Memory_WriteByte((STACK_ADDR | cpu.SP--), tmp); | |
tmp = (BYTE)((val & 0xFF00) >> 8); | |
Memory_WriteByte((STACK_ADDR | cpu.SP--), tmp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void disassemble2() { | |
printf("$%04X %02X | A:%02X X:%02X Y:%02X SP:%02X | C:%d Z:%d I:%d D:%d V:%d B:%d N:%d | S: %02X %02X\n", | |
cpu.operaddr, cpu.operand, cpu.A, cpu.X, cpu.Y, cpu.SP, | |
GET_FLAG(FLAG_C) != 0, GET_FLAG(FLAG_Z) != 0, GET_FLAG(FLAG_I) != 0, GET_FLAG(FLAG_D) != 0, | |
GET_FLAG(FLAG_V) != 0, GET_FLAG(FLAG_B) != 0, GET_FLAG(FLAG_N) != 0, Memory_ReadByte(STACK_ADDR | (cpu.SP+1)), Memory_ReadByte(STACK_ADDR | (cpu.SP+2))); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test = open("test.log") | |
nestest = open("nestest.log") | |
lineCount = 0 | |
for testLine, nestestLine in zip(test, nestest): | |
if testLine[1:5] != nestestLine[:4]: | |
print(testLine) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Indirect */ | |
static void IND() { | |
cpu.indoperaddr = Memory_ReadWord(cpu.PC); | |
if((cpu.indoperaddr & 0x00FF) == 0x00FF){ | |
cpu.operaddr = (WORD)Memory_ReadByte(cpu.indoperaddr) | ((WORD)Memory_ReadByte(cpu.indoperaddr & 0xFF00) << 8); | |
} | |
else | |
cpu.operaddr = Memory_ReadWord(cpu.indoperaddr); | |
cpu.PC += 2; | |
/* TODO: Implement bug */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Force break */ | |
/* I=1 */ | |
static void BRK() { | |
cpu.PC++; | |
pushw(cpu.PC); | |
pushb(cpu.S); | |
SET_FLAG(FLAG_I); | |
if(NMI){ | |
cpu.PC = Memory_ReadWord(0xFFFA); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Interrupt functions */ | |
/* TODO: Interrupt hijacking */ | |
void interrupt_IRQ() { | |
CLEAR_FLAG(FLAG_B); | |
cpu.PC++; | |
pushw(cpu.PC); | |
pushb(cpu.S); | |
SET_FLAG(FLAG_I); | |
cpu.PC = Memory_ReadWord(0xFFFE); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (cpu.cycles >= 30000) { // "about" 30000 cycles | |
ppu.controller = val; | |
ppu.vram_addr_inc = ((val >> 2) & 0x1) ? 1: 32; | |
ppu.sprite_pattern_addr = ((val >> 3) & 0x1) * 0x1000; | |
ppu.bg_pattern_addr = ((val >> 4) & 0x1) * 0x1000; | |
ppu.sprite_height = ((val >> 5) & 0x1) ? 8 : 16; | |
ppu.nmi_on_vblank = (val >> 7) & 0x1; | |
// Change scroll latch to match base nametable address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.0 | |
Rectangle { | |
id: oauth | |
width: 640 | |
height: 480 | |
color: "#ccd6dd" | |
Text { | |
id: link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n | |
dx = -dist*math.cos(-self.cam.rot) | |
dy = -dist*math.sin(-self.cam.rot) | |
if self.world:isLand(self.player.x+dx, self.player.y+dy) then | |
self.cam:move(dx, dy) | |
self.player:move(dx, dy, "left") | |
end | |
elseif key == "s" then | |
dx = dist*math.sin(self.cam.rot) | |
dy = dist*math.cos(self.cam.rot) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sdkfj lksdfj lskdj fs |
OlderNewer