c++/rgb-assembler/rgb-assembler.cpp
changeset 33 ff150572e8c0
parent 32 78c4d6b53499
child 34 d7eed4d972de
     1.1 --- a/c++/rgb-assembler/rgb-assembler.cpp	Mon Dec 25 00:34:27 2017 +0100
     1.2 +++ b/c++/rgb-assembler/rgb-assembler.cpp	Mon Dec 25 01:27:44 2017 +0100
     1.3 @@ -52,7 +52,7 @@
     1.4  		memory.write<command_t>(CMD_SLEEP);
     1.5  		memory.write<sleep_t>(255);
     1.6  		memory.write<command_t>(CMD_GOTO);
     1.7 -		memory.write<address_t>(memory.getIndex() + sizeof (address_t) + 2 * sizeof (command_t));
     1.8 +		memory.write<address_t>(memory.getAddress() + sizeof (address_t) + 2 * sizeof (command_t));
     1.9  		memory.write<command_t>(CMD_INVALID);
    1.10  		memory.write<command_t>(CMD_INVALID);
    1.11  		memory.write<command_t>(CMD_SLEEP);
    1.12 @@ -69,11 +69,11 @@
    1.13  		memory.write<command_t>(CMD_GOTO_COMPARE);
    1.14  		memory.write<address_t>(0);
    1.15  		memory.write<address_t>(0 + sizeof (command_t) + sizeof (sleep_t));
    1.16 -		memory.write<address_t>(memory.getIndex() - 3 * sizeof (address_t) - 2 * sizeof (command_t));
    1.17 +		memory.write<address_t>(memory.getAddress() - 3 * sizeof (address_t) - 2 * sizeof (command_t));
    1.18  		memory.write<address_t>(0);
    1.19 -		memory.write<address_t>(memory.getIndex() + sizeof (address_t));
    1.20 +		memory.write<address_t>(memory.getAddress() + sizeof (address_t));
    1.21  		memory.write<command_t>(CMD_END);
    1.22 -		memory.start();
    1.23 +		memory.setAddressToBeginning();
    1.24  	}
    1.25  
    1.26  	// Supported commands
    1.27 @@ -90,8 +90,8 @@
    1.28  
    1.29  
    1.30  	// Main loop / interpreter:
    1.31 -	while (memory.isInside()) {
    1.32 -		wprintf(L"command %*d = ", 4, memory.getIndex());
    1.33 +	while (memory.isNotOver()) {
    1.34 +		wprintf(L"command %*d = ", 4, memory.getAddress());
    1.35  		command_t commandCode = memory.read<command_t>();
    1.36  		wprintf(L"%02X  ", commandCode);
    1.37