mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Implement IN, OUT.
This commit is contained in:
parent
bf6fd8e5e4
commit
aade91f043
@ -1460,6 +1460,16 @@ void stos(const InstructionT &instruction, AddressT &eCX, AddressT &eDI, IntT &e
|
||||
repeat<AddressT>(instruction, eCX, flow_controller);
|
||||
}
|
||||
|
||||
template <typename IntT, typename IOT>
|
||||
void out(uint16_t port, IntT value, IOT &io) {
|
||||
io.template out<IntT>(port, value);
|
||||
}
|
||||
|
||||
template <typename IntT, typename IOT>
|
||||
void in(uint16_t port, IntT &value, IOT &io) {
|
||||
value = io.template in<IntT>(port);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <
|
||||
@ -1476,7 +1486,7 @@ template <
|
||||
FlowControllerT &flow_controller,
|
||||
RegistersT ®isters,
|
||||
MemoryT &memory,
|
||||
[[maybe_unused]] IOT &io
|
||||
IOT &io
|
||||
) {
|
||||
using IntT = typename DataSizeType<data_size>::type;
|
||||
using AddressT = uint16_t; // TODO.
|
||||
@ -1693,6 +1703,23 @@ template <
|
||||
}
|
||||
return;
|
||||
|
||||
case Operation::OUT: {
|
||||
uint16_t port;
|
||||
switch(instruction.destination().source()) {
|
||||
case Source::DirectAddress: port = instruction.operand(); break;
|
||||
default: port = registers.dx(); break;
|
||||
}
|
||||
Primitive::out(port, pair_low(), io);
|
||||
} return;
|
||||
case Operation::IN: {
|
||||
uint16_t port;
|
||||
switch(instruction.source().source()) {
|
||||
case Source::DirectAddress: port = instruction.operand(); break;
|
||||
default: port = registers.dx(); break;
|
||||
}
|
||||
Primitive::in(port, pair_low(), io);
|
||||
} return;
|
||||
|
||||
case Operation::XLAT: Primitive::xlat<AddressT>(instruction, memory, registers); return;
|
||||
|
||||
case Operation::POP: source() = Primitive::pop<IntT>(memory, registers); break;
|
||||
|
@ -179,6 +179,8 @@ struct Memory {
|
||||
uint16_t write_back_value_;
|
||||
};
|
||||
struct IO {
|
||||
template <typename IntT> void out([[maybe_unused]] uint16_t port, [[maybe_unused]] IntT value) {}
|
||||
template <typename IntT> IntT in([[maybe_unused]] uint16_t port) { return IntT(~0); }
|
||||
};
|
||||
class FlowController {
|
||||
public:
|
||||
@ -352,9 +354,15 @@ struct FailedExecution {
|
||||
@"4C.json.gz", @"4D.json.gz", @"4E.json.gz", @"4F.json.gz",
|
||||
@"FE.1.json.gz",
|
||||
@"FF.1.json.gz",
|
||||
*/
|
||||
// OUT
|
||||
@"E6.json.gz", @"E7.json.gz",
|
||||
@"EE.json.gz", @"EF.json.gz",
|
||||
|
||||
// TODO: IN, OUT
|
||||
|
||||
// IN
|
||||
@"E4.json.gz", @"E5.json.gz",
|
||||
@"EC.json.gz", @"ED.json.gz",
|
||||
/*
|
||||
@"70.json.gz", // JO
|
||||
@"71.json.gz", // JNO
|
||||
@"72.json.gz", // JB
|
||||
@ -413,11 +421,11 @@ struct FailedExecution {
|
||||
// STOS
|
||||
@"AA.json.gz", @"AB.json.gz",
|
||||
|
||||
// TODO: INS, OUTS
|
||||
*/
|
||||
// SCAS
|
||||
@"AE.json.gz", @"AF.json.gz",
|
||||
/*
|
||||
|
||||
// TODO: INS, OUTS
|
||||
|
||||
@"E0.json.gz", // LOOPNE
|
||||
@"E1.json.gz", // LOOPE
|
||||
@"E2.json.gz", // LOOP
|
||||
|
Loading…
Reference in New Issue
Block a user