mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-31 01:25:31 +00:00
Merging master
This commit is contained in:
+8
-2
@@ -54,7 +54,7 @@ namespace ComSquare::CPU
|
|||||||
case 0xA:
|
case 0xA:
|
||||||
return this->_internalRegisters.vtimeh;
|
return this->_internalRegisters.vtimeh;
|
||||||
case 0xB:
|
case 0xB:
|
||||||
return this->_internalRegisters.mdmaen;
|
return this->_internalRegisters.dmaEnableRegister;
|
||||||
case 0xC:
|
case 0xC:
|
||||||
return this->_internalRegisters.hdmaen;
|
return this->_internalRegisters.hdmaen;
|
||||||
case 0xD:
|
case 0xD:
|
||||||
@@ -209,8 +209,14 @@ namespace ComSquare::CPU
|
|||||||
unsigned CPU::update()
|
unsigned CPU::update()
|
||||||
{
|
{
|
||||||
unsigned cycles = 0;
|
unsigned cycles = 0;
|
||||||
|
const unsigned maxCycles = 0x17;
|
||||||
|
|
||||||
for (int i = 0; i < 0x17; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
|
if (!(this->_internalRegisters.dmaEnableRegister & (0xF << i)))
|
||||||
|
continue;
|
||||||
|
cycles += this->_dmaChannels[i].run(maxCycles - cycles);
|
||||||
|
}
|
||||||
|
for (unsigned i = 0; i < maxCycles; i++) {
|
||||||
if (this->_isStopped) {
|
if (this->_isStopped) {
|
||||||
cycles += 1;
|
cycles += 1;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+1
-1
@@ -132,7 +132,7 @@ namespace ComSquare::CPU
|
|||||||
uint8_t vtimeh;
|
uint8_t vtimeh;
|
||||||
|
|
||||||
//! @brief DMA Enable Register
|
//! @brief DMA Enable Register
|
||||||
uint8_t mdmaen;
|
uint8_t dmaEnableRegister;
|
||||||
|
|
||||||
//! @brief HDMA Enable Register
|
//! @brief HDMA Enable Register
|
||||||
uint8_t hdmaen;
|
uint8_t hdmaen;
|
||||||
|
|||||||
@@ -56,4 +56,9 @@ namespace ComSquare::CPU
|
|||||||
throw InvalidAddress("DMA read", addr);
|
throw InvalidAddress("DMA read", addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t DMA::run(unsigned int cycles)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -61,6 +61,11 @@ namespace ComSquare::CPU
|
|||||||
//! @brief Bus helper to write to this channel.
|
//! @brief Bus helper to write to this channel.
|
||||||
void write(uint8_t addr, uint8_t data);
|
void write(uint8_t addr, uint8_t data);
|
||||||
|
|
||||||
|
//! @brief Run the DMA for x cycles
|
||||||
|
//! @param cycles The maximum number of cycles this DMA should run.
|
||||||
|
//! @return the number of cycles taken
|
||||||
|
uint8_t run(unsigned cycles);
|
||||||
|
|
||||||
DMA() = default;
|
DMA() = default;
|
||||||
DMA(const DMA &) = default;
|
DMA(const DMA &) = default;
|
||||||
DMA &operator=(const DMA &) = default;
|
DMA &operator=(const DMA &) = default;
|
||||||
|
|||||||
Reference in New Issue
Block a user