Skip to content

Commit

Permalink
Added DMA Write Control
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherrytree56567 committed Oct 23, 2023
1 parent a376d38 commit 6f78ab3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions PSEMU/Bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Bus {
std::cout << "[BUS] WARNING: IRQ CONTROL NOT IMPLEMENTED. IRQ control: " << std::to_string(offset.value()) << " " << std::to_string(value) << "\n";
return;
} else if (auto offset = _DMA.contains(abs_addr); offset.has_value()) {
std::cout << "[BUS] WARNING: DMA NOT IMPLEMENTED. DMA write: " << std::to_string(abs_addr) << std::to_string(value) << "\n";
set_dma_reg(offset.value(), value);
return;
} else if (auto offset = GPU.contains(abs_addr); offset.has_value()) {
std::cout << "[BUS] WARNING: GPU NOT IMPLEMENTED. GPU write " << std::to_string(offset.value()) << " " << std::to_string(value) << "\n";
Expand Down Expand Up @@ -196,12 +196,24 @@ class Bus {
break;

default:
std::cout << "[BUS] Unhandled DMA access\n";
std::cout << "[BUS] ERROR: Unhandled DMA access\n";
return 0;
break;
}
}

void set_dma_reg(uint32_t offset, uint32_t value) {
switch (offset){
case 0x70:
dma.set_control(value);
break;

default:
std::cout << "[BUS] ERROR: Unhandled DMA write access\n";
break;
}
}

Bios bios;
RAM ram;
DMA dma;
Expand Down
1 change: 1 addition & 0 deletions PSEMU/DMA.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class DMA {
}

uint32_t get_control() { return control; }
void set_control(uint32_t value) { control = value; }

private:
uint32_t control;
Expand Down

0 comments on commit 6f78ab3

Please sign in to comment.