From 7359f25086e5381d0ab47b34de4fd2959b662c61 Mon Sep 17 00:00:00 2001
From: Pantelis Lekakis
Date: Thu, 16 Feb 2023 11:05:53 +0000
Subject: [PATCH] Added missing rand instruction (0xc family)
---
include/tiny8.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/tiny8.h b/include/tiny8.h
index 44fd724..24af85f 100644
--- a/include/tiny8.h
+++ b/include/tiny8.h
@@ -243,6 +243,7 @@ namespace tiny8
else
m_registers.m_pc = m_state.m_nnn + m_registers.m_v[m_state.m_x];
});
+ add_instruction(0xc0, 0x00, 0x0000, [&]() { m_registers.m_v[m_state.m_x] = (std::rand() % 255) & m_state.m_nn; });
add_instruction(0xd0, 0x00, 0x0000, [&]()
{
auto const coordx = m_registers.m_v[m_state.m_x] & (c_displayWidth - 1);