1.1 --- a/c++/rgb-assembler/rgb-assembler.cpp Sat Dec 23 23:47:37 2017 +0100
1.2 +++ b/c++/rgb-assembler/rgb-assembler.cpp Sat Dec 23 23:50:44 2017 +0100
1.3 @@ -9,6 +9,7 @@
1.4 #include "memory.h"
1.5 #include "Command.h"
1.6 #include "commands/Goto.h"
1.7 +#include "commands/GotoCompare.h"
1.8 #include "commands/Sleep.h"
1.9 #include "commands/End.h"
1.10 #include "commands/Color.h"
1.11 @@ -115,6 +116,7 @@
1.12
1.13 unordered_map<command_t, shared_ptr < Command>> commands = {
1.14 {CMD_GOTO, make_shared<commands::Goto>()},
1.15 + {CMD_GOTO_COMPARE, make_shared<commands::GotoCompare>()},
1.16 {CMD_SLEEP, make_shared<commands::Sleep>()},
1.17 {CMD_END, make_shared<commands::End>()},
1.18 {CMD_COLOR, make_shared<commands::Color>()},
1.19 @@ -147,24 +149,6 @@
1.20 wprintf(L"%sCREMENT %*d → %02X\n", (command == CMD_INCREMENT ? "IN" : "DE"), 5, address, value);
1.21 break;
1.22 }
1.23 - case CMD_GOTO_COMPARE:
1.24 - {
1.25 - address_t aa = read<address_t>(memory, i);
1.26 - address_t ab = read<address_t>(memory, i);
1.27 - address_t eq = read<address_t>(memory, i);
1.28 - address_t gt = read<address_t>(memory, i);
1.29 - address_t lt = read<address_t>(memory, i);
1.30 -
1.31 - octet_t a = read<octet_t>(memory, aa);
1.32 - octet_t b = read<octet_t>(memory, ab);
1.33 -
1.34 - if (a == b) i = eq;
1.35 - else if (a > b) i = gt;
1.36 - else i = lt;
1.37 -
1.38 - wprintf(L"GOTO COMPARE a = %02X, b = %02X, eq = %d, gt = %d, lt = %d → %d\n", a, b, eq, gt, lt, i);
1.39 - break;
1.40 - }
1.41 default:
1.42 {
1.43 wprintf(L"invalid command\n");