Update the timing for the delays and also create the Write method on the HAL to choreograph the writing process in the YMF262 and create the Set_OPL_Mode , and also created the YMF262-Types.hpp to hold types used by the YMF262
This commit is contained in:
parent
17b754c864
commit
ec589d929a
|
|
@ -3,12 +3,13 @@
|
|||
|
||||
#include <cstdint>
|
||||
#include "GPIO.hpp"
|
||||
#include "YMF262-Types.hpp"
|
||||
|
||||
template <class GPIOPolicy>
|
||||
class YMF262_HAL{
|
||||
private:
|
||||
|
||||
GPIOPolicy _gpio;
|
||||
GPIOPolicy& _gpio;
|
||||
uint32_t _t_icw_ticks;
|
||||
uint32_t _t_as_ticks;
|
||||
uint32_t _t_ah_ticks;
|
||||
|
|
@ -40,9 +41,9 @@ class YMF262_HAL{
|
|||
public:
|
||||
|
||||
|
||||
YMF262_HAL(GPIOPolicy policy, uint32_t opl_clock, uint32_t cpu_clock){
|
||||
_t_icw_ticks = (400 * cpu_clock) / opl_clock;
|
||||
_t_recovery_ticks = (32 * cpu_clock) / opl_clock;
|
||||
YMF262_HAL(GPIOPolicy& policy, uint32_t opl_clock, uint32_t cpu_clock):_gpio(policy){
|
||||
_t_icw_ticks = 400 * (cpu_clock/ opl_clock);
|
||||
_t_recovery_ticks = 32 * (cpu_clock / opl_clock);
|
||||
double ticks_per_ns = (double)cpu_clock / 1.0e9;
|
||||
_t_as_ticks = (uint32_t)(10 * ticks_per_ns);
|
||||
_t_ah_ticks = (uint32_t)(10 * ticks_per_ns);
|
||||
|
|
@ -61,6 +62,10 @@ class YMF262_HAL{
|
|||
write_bus(bank,Port::DATA,data);
|
||||
};
|
||||
|
||||
void set_OPL_Mode(OPLMode mode){
|
||||
write(Bank::BANK_1, 0x105, (mode == OPLMode::OPL3) ? 0x01 : 0x00);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef YMF262_MODES_HPP
|
||||
#define YMF262_MODES_HPP
|
||||
|
||||
enum class OPLMode{
|
||||
OPL3,
|
||||
OPL2
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue