This commit is contained in:
Matthew Berry 2021-04-22 22:14:54 -07:00
parent c57bb1e4bf
commit d92d37e875
2 changed files with 8 additions and 1 deletions

View file

@ -91,7 +91,6 @@ class DMA
end
end
# todo: vdma
def trigger_hdma : Nil
4.times do |channel|
dmacnt_h = @dmacnt_h[channel]
@ -99,6 +98,13 @@ class DMA
end
end
def trigger_vdma : Nil
4.times do |channel|
dmacnt_h = @dmacnt_h[channel]
trigger channel if dmacnt_h.enable && dmacnt_h.start_timing == StartTiming::VBlank.value
end
end
# todo: maybe abstract these various triggers
def trigger_fifo(fifo_channel : Int) : Nil
dmacnt_h = @dmacnt_h[fifo_channel + 1]

View file

@ -64,6 +64,7 @@ class PPU
@dispstat.vblank = false
elsif @vcount == 160
@dispstat.vblank = true
@gba.dma.trigger_vdma
@gba.interrupts.reg_if.vblank = true if @dispstat.vblank_irq_enable
@bgref.each_with_index { |bgrefs, bg_num| bgrefs.each_with_index { |bgref, ref_num| @bgref_int[bg_num][ref_num] = bgref.num } }
draw