# HG changeset patch # User František Kučera # Date 1514069127 -3600 # Node ID e85d2bfaff73b9effe3f150e323b1c12a91fb275 # Parent cb2055cdc2f09ac38b4af0d3f8da50375f6db7f8 END in class diff -r cb2055cdc2f0 -r e85d2bfaff73 c++/rgb-assembler/commands/End.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/c++/rgb-assembler/commands/End.h Sat Dec 23 23:45:27 2017 +0100 @@ -0,0 +1,25 @@ +#pragma once + +#include +#include +#include + +#include "../Command.h" +#include "../memory.h" + +using namespace std; + +namespace commands { + +class End : public Command { +public: + + void process(octet_t* memory, address_t& index) override { + wprintf(L"END\n"); + index = MEMORY_SIZE; + } +private: + +}; + +} diff -r cb2055cdc2f0 -r e85d2bfaff73 c++/rgb-assembler/nbproject/configurations.xml --- a/c++/rgb-assembler/nbproject/configurations.xml Sat Dec 23 23:42:46 2017 +0100 +++ b/c++/rgb-assembler/nbproject/configurations.xml Sat Dec 23 23:45:27 2017 +0100 @@ -5,6 +5,7 @@ displayName="Header Files" projectFiles="true"> Command.h + commands/End.h commands/Goto.h commands/Sleep.h memory.h @@ -47,6 +48,8 @@ + + @@ -81,6 +84,8 @@ + + diff -r cb2055cdc2f0 -r e85d2bfaff73 c++/rgb-assembler/rgb-assembler.cpp --- a/c++/rgb-assembler/rgb-assembler.cpp Sat Dec 23 23:42:46 2017 +0100 +++ b/c++/rgb-assembler/rgb-assembler.cpp Sat Dec 23 23:45:27 2017 +0100 @@ -10,6 +10,7 @@ #include "Command.h" #include "commands/Goto.h" #include "commands/Sleep.h" +#include "commands/End.h" using namespace std; @@ -114,6 +115,7 @@ unordered_map> commands = { {CMD_GOTO, make_shared()}, {CMD_SLEEP, make_shared()}, + {CMD_END, make_shared()}, }; for (address_t i = 0; i < MEMORY_SIZE;) { @@ -170,12 +172,6 @@ wprintf(L"GOTO COMPARE a = %02X, b = %02X, eq = %d, gt = %d, lt = %d → %d\n", a, b, eq, gt, lt, i); break; } - case CMD_END: - { - wprintf(L"END\n"); - i = MEMORY_SIZE; - break; - } default: { wprintf(L"invalid command\n");