1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/c++/rgb-assembler/commands/Color.h Sat Dec 23 23:47:37 2017 +0100
1.3 @@ -0,0 +1,23 @@
1.4 +#pragma once
1.5 +
1.6 +#include <wchar.h>
1.7 +
1.8 +#include "../Command.h"
1.9 +
1.10 +namespace commands {
1.11 +
1.12 +class Color : public Command {
1.13 +public:
1.14 +
1.15 + void process(octet_t* memory, address_t& index) override {
1.16 + led_t led = read<led_t>(memory, index);
1.17 + color_t r = read<color_t>(memory, index);
1.18 + color_t g = read<color_t>(memory, index);
1.19 + color_t b = read<color_t>(memory, index);
1.20 + wprintf(L"COLOR %02X %02X %02X → %d\n", r, g, b, led);
1.21 + }
1.22 +private:
1.23 +
1.24 +};
1.25 +
1.26 +}
2.1 --- a/c++/rgb-assembler/nbproject/configurations.xml Sat Dec 23 23:45:27 2017 +0100
2.2 +++ b/c++/rgb-assembler/nbproject/configurations.xml Sat Dec 23 23:47:37 2017 +0100
2.3 @@ -4,6 +4,7 @@
2.4 <logicalFolder name="HeaderFiles"
2.5 displayName="Header Files"
2.6 projectFiles="true">
2.7 + <itemPath>commands/Color.h</itemPath>
2.8 <itemPath>Command.h</itemPath>
2.9 <itemPath>commands/End.h</itemPath>
2.10 <itemPath>commands/Goto.h</itemPath>
2.11 @@ -48,6 +49,8 @@
2.12 </compileType>
2.13 <item path="Command.h" ex="false" tool="3" flavor2="0">
2.14 </item>
2.15 + <item path="commands/Color.h" ex="false" tool="3" flavor2="0">
2.16 + </item>
2.17 <item path="commands/End.h" ex="false" tool="3" flavor2="0">
2.18 </item>
2.19 <item path="commands/Goto.h" ex="false" tool="3" flavor2="0">
2.20 @@ -84,6 +87,8 @@
2.21 </compileType>
2.22 <item path="Command.h" ex="false" tool="3" flavor2="0">
2.23 </item>
2.24 + <item path="commands/Color.h" ex="false" tool="3" flavor2="0">
2.25 + </item>
2.26 <item path="commands/End.h" ex="false" tool="3" flavor2="0">
2.27 </item>
2.28 <item path="commands/Goto.h" ex="false" tool="3" flavor2="0">
3.1 --- a/c++/rgb-assembler/rgb-assembler.cpp Sat Dec 23 23:45:27 2017 +0100
3.2 +++ b/c++/rgb-assembler/rgb-assembler.cpp Sat Dec 23 23:47:37 2017 +0100
3.3 @@ -11,6 +11,7 @@
3.4 #include "commands/Goto.h"
3.5 #include "commands/Sleep.h"
3.6 #include "commands/End.h"
3.7 +#include "commands/Color.h"
3.8
3.9 using namespace std;
3.10
3.11 @@ -116,6 +117,7 @@
3.12 {CMD_GOTO, make_shared<commands::Goto>()},
3.13 {CMD_SLEEP, make_shared<commands::Sleep>()},
3.14 {CMD_END, make_shared<commands::End>()},
3.15 + {CMD_COLOR, make_shared<commands::Color>()},
3.16 };
3.17
3.18 for (address_t i = 0; i < MEMORY_SIZE;) {
3.19 @@ -133,15 +135,6 @@
3.20 }
3.21
3.22 switch (command) {
3.23 - case CMD_COLOR:
3.24 - {
3.25 - led_t led = read<led_t>(memory, i);
3.26 - color_t r = read<color_t>(memory, i);
3.27 - color_t g = read<color_t>(memory, i);
3.28 - color_t b = read<color_t>(memory, i);
3.29 - wprintf(L"COLOR %02X %02X %02X → %d\n", r, g, b, led);
3.30 - break;
3.31 - }
3.32 case CMD_INCREMENT:
3.33 case CMD_DECREMENT:
3.34 {