Add STDIN interrupt and error handling for all interrupts

This commit is contained in:
2020-05-17 13:28:59 +02:00
parent f8eaabfc55
commit 06de5290da
5 changed files with 32 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ namespace Execute
{
return std::vector<InterruptFn>
{
/* STDOUT INTERRUPTS */
// 0 print char
[](Execute::Registers & registers, std::vector<std::uint8_t> & memory) { std::putc(registers.A, stdout); },
// 1 print decimal integer
@@ -21,6 +22,13 @@ namespace Execute
{
std::putc(memory[i], stdout);
}
},
/* STDIN INTERRUPTS */
// 10 get char from STDIN
[](Execute::Registers & registers, std::vector<std::uint8_t> & memory)
{
registers.A = std::getchar();
}
};
}