mirror of
https://github.com/Alvin-Zilverstand/bob16.git
synced 2026-12-01 06:21:19 +01:00
fix some minor assembler bugs
This commit is contained in:
1 parent
ab1999c3a4
commit
d87e7acb1f
1 file changed
+6
-6
@@ -246,7 +246,7 @@ void execute() {
|
|||||||
cpu.alu.accumulator = cpu.regFile[(cpu.ir >> 4) & 0x7] & cpu.regFile[(cpu.ir >> 1) & 0x7];
|
cpu.alu.accumulator = cpu.regFile[(cpu.ir >> 4) & 0x7] & cpu.regFile[(cpu.ir >> 1) & 0x7];
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
cpu.alu.accumulator = cpu.regFile[(cpu.ir >> 4) & 0x7] & sext(cpu.ir & 0x1, 4);
|
cpu.alu.accumulator = cpu.regFile[(cpu.ir >> 4) & 0x7] & sext(cpu.ir & 0xF, 4);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (cpu.ir & 0x1F) {
|
if (cpu.ir & 0x1F) {
|
||||||
@@ -788,11 +788,11 @@ int assemble() {
|
|||||||
|
|
||||||
int conditionCodes = 0;
|
int conditionCodes = 0;
|
||||||
for (int i = 0; i < l; i++) {
|
for (int i = 0; i < l; i++) {
|
||||||
if (tokens[2][i] == 'n') {
|
if (tokens[1][i] == 'n') {
|
||||||
conditionCodes |= 0b100;
|
conditionCodes |= 0b100;
|
||||||
} else if (tokens[2][i] == 'z') {
|
} else if (tokens[1][i] == 'z') {
|
||||||
conditionCodes |= 0b010;
|
conditionCodes |= 0b010;
|
||||||
} else if (tokens[2][i] == 'p') {
|
} else if (tokens[1][i] == 'p') {
|
||||||
conditionCodes |= 0b001;
|
conditionCodes |= 0b001;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -854,7 +854,7 @@ int assemble() {
|
|||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
int r0 = parseReg(tokens[2]);
|
int r0 = parseReg(tokens[1]);
|
||||||
if (r0 == -1) {
|
if (r0 == -1) {
|
||||||
printf("Wrong tokens on line %d!\n", lineCount);
|
printf("Wrong tokens on line %d!\n", lineCount);
|
||||||
return -3;
|
return -3;
|
||||||
@@ -942,4 +942,4 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user