Browse files

Fixed the [%nw%+%r%] assembly bit.

  • Loading branch information...
1 parent 668a261 commit e1837c3dfd04a5327c606db7166a0e7833aded50 @RuneTekk committed Apr 14, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/org/sini/Asm.java
  2. +2 −2 src/org/sini/Cpu.java
View
2 src/org/sini/Asm.java
@@ -84,7 +84,7 @@ private static int lookupValue(String str, boolean isLabel) {
Matcher matcher = DECIMAL_PATTERN.matcher(str);
if(matcher.find()) {
int value = Integer.parseInt(matcher.group());
- if(value >= 0x0 && value <= 0x1F && !isLabel)
+ if(str.matches("^" + DECIMAL_PATTERN.pattern() + "$") && value >= 0x0 && value <= 0x1F && !isLabel)
return value + 0x20;
else
str = matcher.replaceAll("%nw%");
View
4 src/org/sini/Cpu.java
@@ -175,7 +175,7 @@ public void execute() {
case OP_SHL:
if(!bothLiteral) {
- int value = ((Cell) a).v >> bValue;
+ int value = ((Cell) a).v << bValue;
r[O].v = value >>> 16;
((Cell) a).v = value & 0xFFFF;
}
@@ -184,7 +184,7 @@ public void execute() {
case OP_SHR:
if(!bothLiteral) {
- ((Cell) a).v = ((Cell) a).v << bValue & 0xFFFF;
+ ((Cell) a).v = ((Cell) a).v >>> bValue;
r[O].v = ((Cell) a).v << 16 >>> bValue & 0xFFFF;
}
r[C].v += 2;

0 comments on commit e1837c3

Please sign in to comment.