# HG changeset patch # User František Kučera # Date 1513872399 -3600 # Node ID 1dd99de3b1784250adb01b7af3d4813c63ea3c16 # Parent b5cf9c841efc24095a5dd0472133e2bbcf8e0725 GOTO diff -r b5cf9c841efc -r 1dd99de3b178 c++/rgb-assembler/rgb-assembler.cpp --- a/c++/rgb-assembler/rgb-assembler.cpp Thu Dec 21 16:18:23 2017 +0100 +++ b/c++/rgb-assembler/rgb-assembler.cpp Thu Dec 21 17:06:39 2017 +0100 @@ -20,15 +20,15 @@ */ command_t readCommand(command_t * memory, address_t &index) { // TODO: map higher memory to static hardcoded areas or peripherals - command_t value = memory[index]; - index += sizeof (value); - return value; + command_t * value = reinterpret_cast (memory + index); + index += sizeof (*value); + return *value; } address_t readAddress(command_t * memory, address_t &index) { - address_t value = memory[index]; - index += sizeof (value); - return value; + address_t * value = reinterpret_cast (memory + index); + index += sizeof (*value); + return *value; } void writeMemoryChar(command_t(&memory)[MEMORY_SIZE], address_t &index, const int value) { @@ -53,14 +53,21 @@ writeCommand(memory, a, CMD_SLEEP); writeCommand(memory, a, CMD_SLEEP); writeCommand(memory, a, CMD_SLEEP); + writeCommand(memory, a, CMD_GOTO); + writeCommand(memory, a, 8); + writeCommand(memory, a, 0); + writeCommand(memory, a, 1); + writeCommand(memory, a, 1); + writeCommand(memory, a, CMD_SLEEP); writeCommand(memory, a, CMD_END); } for (address_t i = 0; i < MEMORY_SIZE;) { + wprintf(L"command %d = ", i); command_t ch = readCommand(memory, i); - wprintf(L"command %d = %d\n", i, ch); + wprintf(L"%d\n", ch); string command;