c++/rgb-assembler/commands/Sleep.h
author František Kučera <franta-hg@frantovo.cz>
Sat, 23 Dec 2017 23:42:46 +0100
changeset 22 cb2055cdc2f0
parent 20 c++/rgb-assembler/commands/Goto.h@b9ceffdcaf14
child 29 10d6964e7b4a
permissions -rw-r--r--
SLEEP in class
franta-hg@20
     1
#pragma once
franta-hg@20
     2
franta-hg@20
     3
#include <wchar.h>
franta-hg@22
     4
#include <chrono>
franta-hg@22
     5
#include <thread>
franta-hg@20
     6
franta-hg@20
     7
#include "../Command.h"
franta-hg@20
     8
franta-hg@22
     9
using namespace std;
franta-hg@22
    10
franta-hg@20
    11
namespace commands {
franta-hg@20
    12
franta-hg@22
    13
class Sleep : public Command {
franta-hg@20
    14
public:
franta-hg@20
    15
franta-hg@20
    16
	void process(octet_t* memory, address_t& index) override {
franta-hg@22
    17
		sleep_t delay = read<sleep_t>(memory, index);
franta-hg@22
    18
		wprintf(L"SLEEP %*d ms\n", 4, delay);
franta-hg@22
    19
		this_thread::sleep_for(chrono::milliseconds(delay));
franta-hg@20
    20
	}
franta-hg@20
    21
private:
franta-hg@20
    22
franta-hg@20
    23
};
franta-hg@20
    24
franta-hg@20
    25
}