mirror of
https://github.com/pskupinski/65816.js.git
synced 2024-06-24 06:29:28 +00:00
added TAX, TAY, TXA and TYA
This commit is contained in:
parent
08593831b3
commit
b167d4c164
98
cpu.js
98
cpu.js
|
@ -68,7 +68,8 @@ function CPU_65816() {
|
||||||
0x9c : STZ_absolute, 0x64 : STZ_direct_page,
|
0x9c : STZ_absolute, 0x64 : STZ_direct_page,
|
||||||
0x9e : STZ_absolute_indexed_x,
|
0x9e : STZ_absolute_indexed_x,
|
||||||
0x74 : STZ_direct_page_indexed_x, 0x9b : TXY,
|
0x74 : STZ_direct_page_indexed_x, 0x9b : TXY,
|
||||||
0xbb : TYX };
|
0xbb : TYX, 0xaa : TAX, 0xa8 : TAY, 0x8a : TXA,
|
||||||
|
0x98 : TYA };
|
||||||
}
|
}
|
||||||
|
|
||||||
var MMU = {
|
var MMU = {
|
||||||
|
@ -97,6 +98,101 @@ var MMU = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var TYA = {
|
||||||
|
bytes_required:function() {
|
||||||
|
return 1;
|
||||||
|
},
|
||||||
|
execute:function(cpu) {
|
||||||
|
if(cpu.p.m===1) {
|
||||||
|
if(cpu.p.x===1) {
|
||||||
|
// 8-bit index register to 8-bit accumulator.
|
||||||
|
cpu.r.a = cpu.r.y;
|
||||||
|
} else {
|
||||||
|
// 16-bit index register to 8-bit accumulator.
|
||||||
|
cpu.r.a = cpu.r.y & 0x00ff;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 8-bit index register to 16-bit accumulator.
|
||||||
|
// 16-bit index register to 16-bit accumulator.
|
||||||
|
cpu.r.a = cpu.r.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var TAY = {
|
||||||
|
bytes_required:function() {
|
||||||
|
return 1;
|
||||||
|
},
|
||||||
|
execute:function(cpu) {
|
||||||
|
if(cpu.p.m==1) {
|
||||||
|
if(cpu.p.x==1) {
|
||||||
|
// 8-bit accumulator to 8-bit x index register.
|
||||||
|
cpu.r.y = cpu.r.a;
|
||||||
|
} else {
|
||||||
|
// 8-bit accumulator to 16-bit x index register.
|
||||||
|
cpu.r.y = cpu.r.b; // Transfer b as high-byte of x.
|
||||||
|
cpu.r.y |= cpu.r.a; // Use the bitwise or to add a as the low-byte.
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(cpu.p.x==1) {
|
||||||
|
// 16-bit accumulator to 8-bit x index register.
|
||||||
|
cpu.r.y = cpu.r.a & 0x00ff; // Transfer only the low-byte to x.
|
||||||
|
} else {
|
||||||
|
// 16-bit accumulator to 16-bit x index register.
|
||||||
|
cpu.r.y = cpu.r.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var TXA = {
|
||||||
|
bytes_required:function() {
|
||||||
|
return 1;
|
||||||
|
},
|
||||||
|
execute:function(cpu) {
|
||||||
|
if(cpu.p.m===1) {
|
||||||
|
if(cpu.p.x===1) {
|
||||||
|
// 8-bit index register to 8-bit accumulator.
|
||||||
|
cpu.r.a = cpu.r.x;
|
||||||
|
} else {
|
||||||
|
// 16-bit index register to 8-bit accumulator.
|
||||||
|
cpu.r.a = cpu.r.x & 0x00ff;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 8-bit index register to 16-bit accumulator.
|
||||||
|
// 16-bit index register to 16-bit accumulator.
|
||||||
|
cpu.r.a = cpu.r.x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var TAX = {
|
||||||
|
bytes_required:function() {
|
||||||
|
return 1;
|
||||||
|
},
|
||||||
|
execute:function(cpu) {
|
||||||
|
if(cpu.p.m==1) {
|
||||||
|
if(cpu.p.x==1) {
|
||||||
|
// 8-bit accumulator to 8-bit x index register.
|
||||||
|
cpu.r.x = cpu.r.a;
|
||||||
|
} else {
|
||||||
|
// 8-bit accumulator to 16-bit x index register.
|
||||||
|
cpu.r.x = cpu.r.b; // Transfer b as high-byte of x.
|
||||||
|
cpu.r.x |= cpu.r.a; // Use the bitwise or to add a as the low-byte.
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(cpu.p.x==1) {
|
||||||
|
// 16-bit accumulator to 8-bit x index register.
|
||||||
|
cpu.r.x = cpu.r.a & 0x00ff; // Transfer only the low-byte to x.
|
||||||
|
} else {
|
||||||
|
// 16-bit accumulator to 16-bit x index register.
|
||||||
|
cpu.r.x = cpu.r.a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var TXY = {
|
var TXY = {
|
||||||
bytes_required:function() {
|
bytes_required:function() {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user