// (d1 d2 -- d3 d4) private int DSlashModAction() { _interpreter.StackExpect(4); var b = _interpreter.DPop(); var a = _interpreter.DPop(); _interpreter.DPush(a / b); _interpreter.DPush(a % b); return(1); }
// (d n1 -- n2 n3) private int FMSlashModAction() { _interpreter.StackExpect(3); // TODO: Fix to produce floored quotient. var n1 = (long)_interpreter.Pop(); var d = _interpreter.DPop(); _interpreter.Push((int)(d % n1)); // n2 _interpreter.Push((int)(d / n1)); // n3 return(1); }
// (n1 n2 -- ) private int TwoLiteralAction() { if (_interpreter.IsCompiling == false) { throw new Exception("2LITERAL outside a new word definition."); } _interpreter.StackExpect(2); _interpreter.WordBeingDefined.AddWord(new DoubleCellIntegerLiteralWord(_interpreter, _interpreter.DPop())); return(1); }