Skip to content

Commit

Permalink
Fixed bug with evaluating [SP+n] offsets.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielKeep committed Apr 25, 2012
1 parent 20aa719 commit c0dd7c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dk.Dasm/Codegen/DasmCodegen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,9 @@ public ushort CgStackOp(ParseTreeNode node, ref CgContext ctx, out Code? tail)
case "StackPeek": return 0x19;
case "StackPick":
// Use length-1 since we could have either [sp,+,N] or [pick,N].
tail = EvalLiteralWord(node.ChildNodes[node.ChildNodes.Count - 1], ref ctx);
var pick = node.ChildNodes[0];
var off = pick.ChildNodes[pick.ChildNodes.Count - 1];
tail = EvalLiteralWordAtom(off, ref ctx);
return 0x1a;
default:
throw new UnexpectedGrammarException();
Expand Down

0 comments on commit c0dd7c9

Please sign in to comment.