9 typedef uint16_t address_t;
10 typedef uint8_t command_t;
12 const address_t MEMORY_SIZE = 1024;
14 const command_t CMD_GOTO = 100;
15 const command_t CMD_SLEEP = 101;
16 const command_t CMD_END = 102;
18 command_t readCommand(command_t (&memory)[MEMORY_SIZE], const address_t index) {
19 // TODO: map higher memory to static hardcoded areas or peripherals
23 void writeMemoryChar(command_t (&memory)[MEMORY_SIZE], const address_t index, const int value) {
24 memory[index] = value;
27 void writeMemoryChar(command_t* memory[], const address_t index, const command_t value) {
28 *memory[index] = value;
31 int main(int argc, char* argv[]) {
33 setlocale(LC_ALL, "");
36 command_t memory[MEMORY_SIZE] = {
42 address_t memorySize = sizeof (memory) / sizeof (*memory);
45 for (address_t i = 0; i < memorySize; i++) {
46 command_t ch = readCommand(memory, i);
47 wprintf(L"command %d = %d\n", i, ch);
53 command.append("GOTO");
56 command.append("SLEEP");
59 command.append("END");
65 if (!command.empty()) {
66 wprintf(L"\t%s\n", command.c_str());
72 wprintf(L"all done\n");