mirror of
https://github.com/Alvin-Zilverstand/bob16.git
synced 2026-11-21 12:52:59 +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:
|
||||
break;
|
||||
case ADD:
|
||||
switch ((cpu.ir >> 7) & 0x7) {
|
||||
switch ((cpu.ir >> 7) & 0x3) {
|
||||
case 0:
|
||||
if (cpu.ir & 0b1) {
|
||||
printf("bad instruction: %X\n at memory address %X\n", cpu.ir, ram.memory[cpu.pc - 1]);
|
||||
@@ -226,7 +226,7 @@ void execute() {
|
||||
|
||||
break;
|
||||
case AND:
|
||||
switch ((cpu.ir >> 7) & 0x7) {
|
||||
switch ((cpu.ir >> 7) & 0x3) {
|
||||
case 0:
|
||||
if (cpu.ir & 0x1) {
|
||||
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);
|
||||
}
|
||||
|
||||
if (!(cpu.ir & 0x100)) {
|
||||
cpu.alu.accumulator = !cpu.regFile[(cpu.ir >> 5) & 0x7];
|
||||
if (cpu.ir & 0x100) {
|
||||
cpu.alu.accumulator = ~cpu.regFile[(cpu.ir >> 9) & 0x7];
|
||||
} else {
|
||||
cpu.alu.accumulator = !cpu.regFile[(cpu.ir >> 9) & 0x7];
|
||||
cpu.alu.accumulator = ~cpu.regFile[(cpu.ir >> 5) & 0x7];
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user