Compare commits
2 Commits
2e4854c2ff
...
0ceba17139
Author | SHA1 | Date |
---|---|---|
Rekai Nyangadzayi Musuka | 0ceba17139 | |
Rekai Nyangadzayi Musuka | 821a56a165 |
|
@ -107,8 +107,8 @@ pub fn DmaController(comptime id: u2) type {
|
|||
}
|
||||
|
||||
switch (sad_adj) {
|
||||
.Increment => self._sad +%= offset,
|
||||
.Decrement => self._sad -%= offset,
|
||||
.Increment => self._sad += offset,
|
||||
.Decrement => self._sad -= offset,
|
||||
.Fixed => {},
|
||||
|
||||
// TODO: Figure out correct behaviour on Illegal Source Addr Control Type
|
||||
|
@ -116,16 +116,14 @@ pub fn DmaController(comptime id: u2) type {
|
|||
}
|
||||
|
||||
switch (dad_adj) {
|
||||
.Increment, .IncrementReload => self._dad +%= offset,
|
||||
.Decrement => self._dad -%= offset,
|
||||
.Increment, .IncrementReload => self._dad += offset,
|
||||
.Decrement => self._dad -= offset,
|
||||
.Fixed => {},
|
||||
}
|
||||
|
||||
self._word_count -= 1;
|
||||
|
||||
if (self._word_count == 0) {
|
||||
if (!self.cnt.repeat.read()) {
|
||||
// If we're not repeating, Fire the IRQs and disable the DMA
|
||||
if (self.cnt.irq.read()) {
|
||||
switch (id) {
|
||||
0 => bus.io.irq.dma0.set(),
|
||||
|
@ -134,12 +132,8 @@ pub fn DmaController(comptime id: u2) type {
|
|||
3 => bus.io.irq.dma0.set(),
|
||||
}
|
||||
}
|
||||
self.cnt.enabled.unset();
|
||||
}
|
||||
|
||||
// We want to disable our internal enabled flag regardless of repeat
|
||||
// because we only want to step A DMA that repeats during it's specific
|
||||
// timing window
|
||||
self.cnt.enabled.unset();
|
||||
self.enabled = false;
|
||||
}
|
||||
|
||||
|
@ -159,13 +153,6 @@ pub fn DmaController(comptime id: u2) type {
|
|||
.VBlank => self.enabled = self.cnt.enabled.read() and self.cnt.start_timing.read() == 0b01,
|
||||
.Immediate, .Special => {},
|
||||
}
|
||||
|
||||
if (self.cnt.repeat.read() and self.enabled) {
|
||||
self._word_count = if (self.word_count == 0) std.math.maxInt(@TypeOf(self._word_count)) else self.word_count;
|
||||
|
||||
const dad_adj = std.meta.intToEnum(Adjustment, self.cnt.dad_adj.read()) catch unreachable;
|
||||
if (dad_adj == .IncrementReload) self._dad = self.dad;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue