mirror of
https://github.com/pskupinski/65816.js.git
synced 2024-09-28 22:56:03 +00:00
added PEA and PEI
This commit is contained in:
parent
98a058058f
commit
b956d2254f
30
cpu.js
30
cpu.js
@ -124,7 +124,8 @@ function CPU_65816() {
|
|||||||
0x7e : ROR_absolute_indexed_x,
|
0x7e : ROR_absolute_indexed_x,
|
||||||
0x76 : ROR_direct_page_indexed_x,
|
0x76 : ROR_direct_page_indexed_x,
|
||||||
0x48 : PHA , 0x68 : PLA, 0x5a : PHY, 0x7a : PLY,
|
0x48 : PHA , 0x68 : PLA, 0x5a : PHY, 0x7a : PLY,
|
||||||
0xda : PHX, 0xfa : PLX, 0x08 : PHP, 0x28 : PLP };
|
0xda : PHX, 0xfa : PLX, 0x08 : PHP, 0x28 : PLP,
|
||||||
|
0xf4 : PEA, 0xd4 : PEI };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take a raw hex string representing the program and execute it.
|
* Take a raw hex string representing the program and execute it.
|
||||||
@ -203,6 +204,29 @@ var MMU = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var PEA = {
|
||||||
|
bytes_required:function() {
|
||||||
|
return 3;
|
||||||
|
},
|
||||||
|
execute:function(cpu, bytes) {
|
||||||
|
cpu.mmu.store_byte(cpu.r.s--, bytes[0]);
|
||||||
|
cpu.mmu.store_byte(cpu.r.s--, bytes[1]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var PEI = {
|
||||||
|
bytes_required:function() {
|
||||||
|
return 2;
|
||||||
|
},
|
||||||
|
execute:function(cpu, bytes) {
|
||||||
|
var location = bytes[0]+cpu.r.d;
|
||||||
|
var low_byte = cpu.mmu.read_byte(location);
|
||||||
|
var high_byte = cpu.mmu.read_byte(location+1);
|
||||||
|
cpu.mmu.store_byte(cpu.r.s--, high_byte);
|
||||||
|
cpu.mmu.store_byte(cpu.r.s--, low_byte);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var PHP = {
|
var PHP = {
|
||||||
bytes_required:function() {
|
bytes_required:function() {
|
||||||
return 1;
|
return 1;
|
||||||
@ -244,7 +268,7 @@ var PHX = {
|
|||||||
var low_byte = cpu.r.x & 0x00ff;
|
var low_byte = cpu.r.x & 0x00ff;
|
||||||
var high_byte = cpu.r.x >> 8;
|
var high_byte = cpu.r.x >> 8;
|
||||||
cpu.mmu.store_byte(cpu.r.s--, high_byte);
|
cpu.mmu.store_byte(cpu.r.s--, high_byte);
|
||||||
cpu.mmu.store_byte(cpu.r.s--, high_byte);
|
cpu.mmu.store_byte(cpu.r.s--, low_byte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -283,7 +307,7 @@ var PHY = {
|
|||||||
var low_byte = cpu.r.y & 0x00ff;
|
var low_byte = cpu.r.y & 0x00ff;
|
||||||
var high_byte = cpu.r.y >> 8;
|
var high_byte = cpu.r.y >> 8;
|
||||||
cpu.mmu.store_byte(cpu.r.s--, high_byte);
|
cpu.mmu.store_byte(cpu.r.s--, high_byte);
|
||||||
cpu.mmu.store_byte(cpu.r.s--, high_byte);
|
cpu.mmu.store_byte(cpu.r.s--, low_byte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user