From 41c83877a71386d39337a0ab788c563df49c1b11 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Wed, 9 Sep 2020 11:52:01 +0200 Subject: [PATCH] fixed label position calculation --- interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interpreter.cpp b/interpreter.cpp index dd37bff..8f3a954 100644 --- a/interpreter.cpp +++ b/interpreter.cpp @@ -34,7 +34,7 @@ std::string interpreter::eval(std::istream& in, bool& done) { // first pass: read program & resolve labels for (std::string line; std::getline(in, line); ++_pc) { if (line[0] == ':') { - _labels.emplace(line.substr(1), _pc); + _labels.emplace(line.substr(1), _pc--); } else { _prog.push_back(line); }