comments, formatting
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 24 Dec 2017 00:47:34 +0100
changeset 30f049c3d3244d
parent 29 10d6964e7b4a
child 31 b997cbf9e30b
comments, formatting
c++/rgb-assembler/rgb-assembler.cpp
     1.1 --- a/c++/rgb-assembler/rgb-assembler.cpp	Sun Dec 24 00:30:54 2017 +0100
     1.2 +++ b/c++/rgb-assembler/rgb-assembler.cpp	Sun Dec 24 00:47:34 2017 +0100
     1.3 @@ -40,6 +40,7 @@
     1.4  
     1.5  	setlocale(LC_ALL, "");
     1.6  
     1.7 +	// TODO: wrap in a class with read(), write() and setAddress() methods
     1.8  	octet_t * memory = (octet_t*) malloc(MEMORY_SIZE);
     1.9  
    1.10  	// Sample program / data:
    1.11 @@ -76,17 +77,20 @@
    1.12  		write<command_t>(memory, a, CMD_END);
    1.13  	}
    1.14  
    1.15 +	// Supported commands
    1.16 +	// TODO: dynamic reconfiguration
    1.17  	unordered_map<command_t, shared_ptr < Command>> commands = {
    1.18  		{CMD_GOTO, make_shared<commands::Goto>()},
    1.19  		{CMD_GOTO_COMPARE, make_shared<commands::GotoCompare>()},
    1.20  		{CMD_SLEEP, make_shared<commands::Sleep>()},
    1.21  		{CMD_END, make_shared<commands::End>()},
    1.22  		{CMD_COLOR, make_shared<commands::Color>()},
    1.23 -		{CMD_INCREMENT, make_shared < commands::IncrementDecrement>(true, 1)},
    1.24 -		{CMD_DECREMENT, make_shared < commands::IncrementDecrement>(false, 1)},
    1.25 +		{CMD_INCREMENT, make_shared <commands::IncrementDecrement>(true, 1)},
    1.26 +		{CMD_DECREMENT, make_shared <commands::IncrementDecrement>(false, 1)},
    1.27  	};
    1.28  
    1.29  
    1.30 +	// Main loop / interpreter:
    1.31  	for (address_t i = 0; i < MEMORY_SIZE;) {
    1.32  		wprintf(L"command %*d = ", 4, i);
    1.33  		command_t commandCode = read<command_t>(memory, i);