Read files with temp fix

This commit is contained in:
2023-02-19 18:00:19 +01:00
parent fa8c3ae822
commit db5366f35b
7 changed files with 138 additions and 53 deletions

View File

@@ -0,0 +1,18 @@
#ifndef __JABYENGINE_MATH_HELPER_HPP__
#define __JABYENGINE_MATH_HELPER_HPP__
#include "types.hpp"
namespace JabyEngine {
template<typename T>
static constexpr pair<T, T> div_and_mod(T value, T div) {
const auto result = value/div;
return {static_cast<T>(result), static_cast<T>(value - (result*div))};
}
static constexpr uint8_t to_bcd(uint8_t value) {
const auto [tenth, rest] = div_and_mod(value, static_cast<uint8_t>(10));
return (tenth << 4 | rest);
}
}
#endif //!__JABYENGINE_MATH_HELPER_HPP__

View File

@@ -107,9 +107,11 @@ namespace JabyEngine {
Interrupt::Type complete_irq;
};
static constexpr Info GetStat{0x1, Interrupt::Type::Acknowledge};
static constexpr Info Init{0xA, Interrupt::Type::Complete};
static constexpr Info SetMode{0xE, Interrupt::Type::Acknowledge};
static constexpr Info GetStat{0x01, Interrupt::Type::Acknowledge};
static constexpr Info SetLoc{0x02, Interrupt::Type::Acknowledge};
static constexpr Info ReadN{0x06, Interrupt::Type::DataReady};
static constexpr Info Init{0x0A, Interrupt::Type::Complete};
static constexpr Info SetMode{0x0E, Interrupt::Type::Acknowledge};
};
static constexpr auto IORegister1Adr = 0x1F801801;