src/cpu/cpu.cc
/*
 * Executes a cycle of the DMA transfer.
 */
Executes a cycle of the DMA transfer.
Executes a cycle of the DMA transfer .
void Cpu::ExecuteDma(void) {
  if ((dma_cycles_remaining_ < DMA_CYCLE_LENGTH) && !cycle_even_) {
    memory_->Write(PPU_OAM_ADDR, dma_mdr_);
  } else if (dma_cycles_remaining_ < DMA_CYCLE_LENGTH) {
    dma_mdr_ = memory_->Read(dma_addr_.dw);
    dma_addr_.w[WORD_LO]++;
  } else {
    dma_mdr_ = 0;
    dma_addr_.w[WORD_LO] = 0;
  }
  dma_cycles_remaining_--;
  return;
}
void Cpu :: ExecuteDma ( void ) { if ( ( dma_cycles_remaining_ < DMA_CYCLE_LENGTH ) && ! cycle_even_ ) { memory_ -> Write ( PPU_OAM_ADDR , dma_mdr_ ) ; } else if ( dma_cycles_remaining_ < DMA_CYCLE_LENGTH ) { dma_mdr_ = memory_ -> Read ( dma_addr_ . dw ) ; dma_addr_ . w [ WORD_LO ] ++ ; } else { dma_mdr_ = 0 ; dma_addr_ . w [ WORD_LO ] = 0 ; } dma_cycles_remaining_ -- ; return ; }
Executes a cycle of the DMA transfer.
Executes a cycle of the DMA transfer .
// The CPU is idle until there are <= 512 dma cycles remaining. // Odd cycle, so we write to OAM. // Even cycle, so we read from memory.