EarthBound/ASM/VRAM DMA Transfer Routines: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(Correct transfer style input)
Line 41: Line 41:


==<tt>$C0865F-$C086DD</tt>: Perform DMA transfer (<tt>JSR</tt>)<span class="anchor" id="$C0865F"></span>==
==<tt>$C0865F-$C086DD</tt>: Perform DMA transfer (<tt>JSR</tt>)<span class="anchor" id="$C0865F"></span>==
Primary memory/VRAM DMA transfer subroutine. Performs a DMA transfer using the parameters saved in [[EarthBound:VRAM_DMA_memory|VRAM DMA memory]].
Depending on the value stored in [[EarthBound:$7E000D|<tt>$7E000D</tt>]], either directly prepares and initiates DMA using the [https://snes.nesdev.org/wiki/DMA_registers SNES DMA registers], or saves the transfer parameters to allow the transfer to be performed upon the next vblank period.


[[Category:EarthBound:ASM|VRAM DMA Transfer Routines]]
[[Category:EarthBound:ASM|VRAM DMA Transfer Routines]]
{{Internal Data|game=EarthBound}}
{{Internal Data|game=EarthBound}}
{{stub}}

Revision as of 21:06, 14 June 2023

This is a sub-page of EarthBound/ASM.

$C085B7-$C08615: Batched memory/VRAM transfer

Batched transfers between main memory (ROM/WRAM) and VRAM. Sets up VRAM DMA memory and makes the transfers using multiple calls to $C08643 for batches of 0x1200 bytes, with a final transfer of the remainder up to 0x1201 bytes. Before each batch, spins on $7E0099, waiting for the value to become #$0000.

Inputs

  • accumulator: Transfer style. Byte index into VRAM DMA Transfer Style Table
  • x: Transfer size (bytes)
  • y: VRAM address (word)
  • $0e..$10: Memory address long pointer

$C08616-$C0865A: Memory/VRAM transfer

Prepares memory (see VRAM DMA memory) and sets Data Bank and Data Page to zero. Then calls $C0865F to perform the DMA transfer.

Subroutine has multiple entry points.

Entry point $C08616

Setup including long pointer for memory address

Inputs

  • accumulator: Transfer style. Byte index into VRAM DMA Transfer Style Table
  • x: Transfer size (bytes)
  • y: VRAM address (word)
  • $0e..$10: Memory address long pointer

Entry point $C0862E

Setup including separated address/bank for memory address

Inputs

  • accumulator: Transfer style. Byte index into VRAM DMA Transfer Style Table
  • x: Transfer size (bytes)
  • y: Memory address
  • $0e: Memory address bank
  • $10: VRAM address (word)

Entry point $C08643

Set up only Data Bank and Data Page registers. Used when VRAM DMA memory has already been prepared separately.

$C0865B-$C0865E: Perform DMA transfer (JSL)

Trivial JSL wrapper around a call to $C0865F.

$C0865F-$C086DD: Perform DMA transfer (JSR)

Primary memory/VRAM DMA transfer subroutine. Performs a DMA transfer using the parameters saved in VRAM DMA memory.

Depending on the value stored in $7E000D, either directly prepares and initiates DMA using the SNES DMA registers, or saves the transfer parameters to allow the transfer to be performed upon the next vblank period.