mirror of
https://github.com/BluestormDNA/ProjectPSX.git
synced 2025-04-02 10:52:34 -04:00
SPU: Pass a ref to IRQController to trigger INT on DMA
WIP irq dma
This commit is contained in:
parent
fd7b8bb0a4
commit
a2bd5b5816
3 changed files with 14 additions and 9 deletions
|
@ -34,8 +34,7 @@ namespace ProjectPSX {
|
|||
private static string bios = "./SCPH1001.BIN";
|
||||
private static string ex1 = "./caetlaEXP.BIN";
|
||||
|
||||
public BUS(GPU gpu, CDROM cdrom, SPU spu, JOYPAD joypad, TIMERS timers, MDEC mdec) {
|
||||
interruptController = new InterruptController();
|
||||
public BUS(GPU gpu, CDROM cdrom, SPU spu, JOYPAD joypad, TIMERS timers, MDEC mdec, InterruptController interruptController) {
|
||||
dma = new DMA(this);
|
||||
this.gpu = gpu;
|
||||
this.cdrom = cdrom;
|
||||
|
@ -43,6 +42,7 @@ namespace ProjectPSX {
|
|||
this.mdec = mdec;
|
||||
this.spu = spu;
|
||||
this.joypad = joypad;
|
||||
this.interruptController = interruptController;
|
||||
}
|
||||
|
||||
internal unsafe uint load32(uint address) {
|
||||
|
|
|
@ -19,18 +19,22 @@ namespace ProjectPSX {
|
|||
private Controller controller;
|
||||
private MemoryCard memoryCard;
|
||||
private CD cd;
|
||||
private InterruptController interruptController;
|
||||
|
||||
public ProjectPSX(IHostWindow window, string diskFilename) {
|
||||
controller = new DigitalController();
|
||||
memoryCard = new MemoryCard();
|
||||
|
||||
interruptController = new InterruptController();
|
||||
|
||||
cd = new CD(diskFilename);
|
||||
spu = new SPU(window);
|
||||
spu = new SPU(window, interruptController);
|
||||
gpu = new GPU(window);
|
||||
cdrom = new CDROM(cd, spu);
|
||||
joypad = new JOYPAD(controller, memoryCard);
|
||||
timers = new TIMERS();
|
||||
mdec = new MDEC();
|
||||
bus = new BUS(gpu, cdrom, spu, joypad, timers, mdec);
|
||||
bus = new BUS(gpu, cdrom, spu, joypad, timers, mdec, interruptController);
|
||||
cpu = new CPU(bus);
|
||||
|
||||
bus.loadBios();
|
||||
|
|
|
@ -150,9 +150,12 @@ namespace ProjectPSX.Devices {
|
|||
Status status;
|
||||
|
||||
private IHostWindow window;
|
||||
private InterruptController interruptController;
|
||||
|
||||
public SPU(IHostWindow window) {
|
||||
public SPU(IHostWindow window, InterruptController interruptController) {
|
||||
this.window = window;
|
||||
this.interruptController = interruptController;
|
||||
|
||||
for (int i = 0; i < voices.Length; i++) {
|
||||
voices[i] = new Voice();
|
||||
}
|
||||
|
@ -655,8 +658,7 @@ namespace ProjectPSX.Devices {
|
|||
//ramDataTransferAddressInternal and ramIrqAddress already are >> 3
|
||||
//so check if it's in the size range and trigger int
|
||||
if (ramIrqAddress > ramDataTransferAddressInternal && ramIrqAddress < ramDataTransferAddressInternal + size) {
|
||||
//todo trigger irq...
|
||||
Console.WriteLine("[SPU] Unhandled IRQ on DMA Load");
|
||||
interruptController.set(Interrupt.SPU);
|
||||
}
|
||||
|
||||
ramDataTransferAddressInternal = (uint)(ramDataTransferAddressInternal + size * 4);
|
||||
|
@ -675,8 +677,7 @@ namespace ProjectPSX.Devices {
|
|||
Span<byte> ramDestSpan = ramStartSpan.Slice((int)ramDataTransferAddressInternal);
|
||||
|
||||
if (ramIrqAddress > ramDataTransferAddressInternal && ramIrqAddress < ramDataTransferAddressInternal + size) {
|
||||
//todo trigger irq... also this would probably need to be handled on overflow too...
|
||||
Console.WriteLine("[SPU] Unhandled IRQ on DMA Write");
|
||||
interruptController.set(Interrupt.SPU);
|
||||
}
|
||||
|
||||
if (destAddress <= 0x7FFFF) {
|
||||
|
|
Loading…
Add table
Reference in a new issue