franta-hg@29: /**
franta-hg@29: * RGB assembler
franta-hg@29: * Copyright © 2017 František Kučera (frantovo.cz)
franta-hg@29: *
franta-hg@29: * This program is free software: you can redistribute it and/or modify
franta-hg@29: * it under the terms of the GNU General Public License as published by
franta-hg@29: * the Free Software Foundation, either version 3 of the License, or
franta-hg@29: * (at your option) any later version.
franta-hg@29: *
franta-hg@29: * This program is distributed in the hope that it will be useful,
franta-hg@29: * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@29: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@29: * GNU General Public License for more details.
franta-hg@29: *
franta-hg@29: * You should have received a copy of the GNU General Public License
franta-hg@29: * along with this program. If not, see .
franta-hg@29: */
franta-hg@29:
franta-hg@20: #pragma once
franta-hg@20:
franta-hg@20: #include
franta-hg@20:
franta-hg@20: #include "../Command.h"
franta-hg@20:
franta-hg@20: namespace commands {
franta-hg@20:
franta-hg@25: class GotoCompare : public Command {
franta-hg@20: public:
franta-hg@20:
franta-hg@20: void process(octet_t* memory, address_t& index) override {
franta-hg@25: address_t aa = read(memory, index);
franta-hg@25: address_t ab = read(memory, index);
franta-hg@25: address_t eq = read(memory, index);
franta-hg@25: address_t gt = read(memory, index);
franta-hg@25: address_t lt = read(memory, index);
franta-hg@25:
franta-hg@25: octet_t a = read(memory, aa);
franta-hg@25: octet_t b = read(memory, ab);
franta-hg@25:
franta-hg@25: if (a == b) index = eq;
franta-hg@25: else if (a > b) index = gt;
franta-hg@25: else index = lt;
franta-hg@25:
franta-hg@25: wprintf(L"GOTO COMPARE a = %02X, b = %02X, eq = %d, gt = %d, lt = %d → %d\n", a, b, eq, gt, lt, index);
franta-hg@20: }
franta-hg@20: private:
franta-hg@20:
franta-hg@20: };
franta-hg@20:
franta-hg@20: }