mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 22:25:41 +12:00
Implement 8-bit VRAM writes
This commit is contained in:
parent
f2b67a2757
commit
cba1ce8fb8
3 changed files with 13 additions and 3 deletions
|
@ -95,6 +95,7 @@ namespace KernelMemoryTypes {
|
|||
class Memory {
|
||||
u8* fcram;
|
||||
u8* dspRam;
|
||||
u8* vram; // Provided to the memory class by the GPU class
|
||||
|
||||
u64& cpuTicks; // Reference to the CPU tick counter
|
||||
using SharedMemoryBlock = KernelMemoryTypes::SharedMemoryBlock;
|
||||
|
@ -237,6 +238,7 @@ public:
|
|||
u8* getDSPMem() { return dspRam; }
|
||||
u8* getDSPDataMem() { return &dspRam[DSP_DATA_MEMORY_OFFSET]; }
|
||||
u8* getDSPCodeMem() { return &dspRam[DSP_CODE_MEMORY_OFFSET]; }
|
||||
|
||||
u32 getUsedUserMem() { return usedUserMemory; }
|
||||
|
||||
void setVRAM(u8* pointer) { vram = pointer; }
|
||||
};
|
|
@ -7,6 +7,7 @@ using namespace Floats;
|
|||
|
||||
GPU::GPU(Memory& mem) : mem(mem), renderer(*this, regs) {
|
||||
vram = new u8[vramSize];
|
||||
mem.setVRAM(vram); // Give the bus a pointer to our VRAM
|
||||
}
|
||||
|
||||
void GPU::reset() {
|
||||
|
@ -256,7 +257,6 @@ void GPU::fireDMA(u32 dest, u32 source, u32 size) {
|
|||
std::memcpy(&vram[dest - vramStart], &fcram[source - fcramStart], size);
|
||||
} else {
|
||||
printf("Non-trivially optimizable GPU DMA. Falling back to byte-by-byte transfer");
|
||||
std::memcpy(&vram[dest - vramStart], mem.getReadPointer(source), size);
|
||||
|
||||
for (u32 i = 0; i < size; i++) {
|
||||
mem.write8(dest + i, mem.read8(source + i));
|
||||
|
|
|
@ -143,7 +143,15 @@ void Memory::write8(u32 vaddr, u8 value) {
|
|||
*(u8*)(pointer + offset) = value;
|
||||
}
|
||||
else {
|
||||
Helpers::panic("Unimplemented 8-bit write, addr: %08X, val: %02X", vaddr, value);
|
||||
// VRAM write
|
||||
if (vaddr >= VirtualAddrs::VramStart && vaddr < VirtualAddrs::VramStart + VirtualAddrs::VramSize) {
|
||||
// TODO: Invalidate renderer caches here
|
||||
vram[vaddr - VirtualAddrs::VramStart] = value;
|
||||
}
|
||||
|
||||
else {
|
||||
Helpers::panic("Unimplemented 8-bit write, addr: %08X, val: %02X", vaddr, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue