mirror of
https://github.com/Alvin-Zilverstand/bob16.git
synced 2026-12-02 06:21:19 +01:00
correct bit mask for and/add + fix not to be bitwise instead of logical
This commit is contained in:
1 parent
adeee84c77
commit
121b632fb0
1 file changed
+5
-5
@@ -199,7 +199,7 @@ void execute() {
|
|||||||
case NOP:
|
case NOP:
|
||||||
break;
|
break;
|
||||||
case ADD:
|
case ADD:
|
||||||
switch ((cpu.ir >> 7) & 0x7) {
|
switch ((cpu.ir >> 7) & 0x3) {
|
||||||
case 0:
|
case 0:
|
||||||
if (cpu.ir & 0b1) {
|
if (cpu.ir & 0b1) {
|
||||||
printf("bad instruction: %X\n at memory address %X\n", cpu.ir, ram.memory[cpu.pc - 1]);
|
printf("bad instruction: %X\n at memory address %X\n", cpu.ir, ram.memory[cpu.pc - 1]);
|
||||||
@@ -226,7 +226,7 @@ void execute() {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case AND:
|
case AND:
|
||||||
switch ((cpu.ir >> 7) & 0x7) {
|
switch ((cpu.ir >> 7) & 0x3) {
|
||||||
case 0:
|
case 0:
|
||||||
if (cpu.ir & 0x1) {
|
if (cpu.ir & 0x1) {
|
||||||
printf("bad instruction: %X\n at memory address %X\n", cpu.ir, ram.memory[cpu.pc - 1]);
|
printf("bad instruction: %X\n at memory address %X\n", cpu.ir, ram.memory[cpu.pc - 1]);
|
||||||
@@ -258,10 +258,10 @@ void execute() {
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cpu.ir & 0x100)) {
|
if (cpu.ir & 0x100) {
|
||||||
cpu.alu.accumulator = !cpu.regFile[(cpu.ir >> 5) & 0x7];
|
cpu.alu.accumulator = ~cpu.regFile[(cpu.ir >> 9) & 0x7];
|
||||||
} else {
|
} else {
|
||||||
cpu.alu.accumulator = !cpu.regFile[(cpu.ir >> 9) & 0x7];
|
cpu.alu.accumulator = ~cpu.regFile[(cpu.ir >> 5) & 0x7];
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in new issue
Block a user