Skip to content

Commit

Permalink
fifo
Browse files Browse the repository at this point in the history
  • Loading branch information
akatsuki105 committed Apr 14, 2021
1 parent ac62239 commit 14ab104
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/gba/apu.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func (g *GBA) fifoACopy() {
}

for i := uint32(0); i < 4; i++ {
fifoA[fifoALen] = int8(g._getRAM(ram.FIFO_A + i))
fifoA[fifoALen] = int8(byte(g._getRAM(ram.FIFO_A + i)))
fifoALen++
}
}
Expand All @@ -461,7 +461,7 @@ func (g *GBA) fifoBCopy() {
}

for i := uint32(0); i < 4; i++ {
fifoB[fifoBLen] = int8(g._getRAM(ram.FIFO_B + i))
fifoB[fifoBLen] = int8(byte(g._getRAM(ram.FIFO_B + i)))
fifoBLen++
}
}
Expand Down
12 changes: 12 additions & 0 deletions pkg/gba/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ func (g *GBA) _setRAM8(addr uint32, b byte) {
g.resetSoundChan(addr, b)
}
}
case addr == ram.SOUNDCNT_H+1:
if util.Bit(b, 3) {
fifoA = [32]int8{}
fifoALen = 0
}
g.RAM.Set8(addr, b)
case addr == ram.SOUNDCNT_H+3:
if util.Bit(b, 7) {
fifoB = [32]int8{}
fifoBLen = 0
}
g.RAM.Set8(addr, b)
case addr == ram.SOUNDCNT_X:
old := byte(g._getRAM(addr))
old = (old & 0xf) | (b & 0xf0)
Expand Down

0 comments on commit 14ab104

Please sign in to comment.