added BRA

This commit is contained in:
Preston Skupinski 2011-05-02 20:20:20 -04:00
parent 3c4e7264cf
commit ddbf51d8ef
1 changed files with 15 additions and 1 deletions

16
cpu.js
View File

@ -76,7 +76,7 @@ function CPU_65816() {
0x74 : STZ_direct_page_indexed_x, 0x9b : TXY,
0xbb : TYX, 0xaa : TAX, 0xa8 : TAY, 0x8a : TXA,
0x98 : TYA, 0x4c : JMP_absolute,
0x6c : JMP_absolute_indirect };
0x6c : JMP_absolute_indirect, 0x80 : BRA };
}
var MMU = {
@ -116,6 +116,20 @@ var MMU = {
}
};
var BRA = {
bytes_required:function() {
return 2;
},
execute:function(cpu, bytes) {
// Handle single byte two's complement numbers as the branch argument.
if(bytes[0]<=127) {
cpu.r.pc+=bytes[0];
} else {
cpu.r.pc-=256-bytes[0];
}
}
};
var JMP_absolute_indirect = {
bytes_required:function() {
return 3;