Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CGB_Registers.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ tested on Echo RAM, OAM, FEXX, IO and HRAM\]. Trying to specify a source
address in VRAM will cause garbage to be copied.

The four lower bits of this address will be ignored and treated as 0.
The address specified by those registers is incremented by $10 for each block of $10 bytes transfered successfully.

#### FF53–FF54 — HDMA3, HDMA4 (CGB Mode only): VRAM DMA destination (high, low) \[write-only\]

These two registers specify the address within 8000-9FF0 to which the
data will be copied. Only bits 12-4 are respected; others are ignored.
The four lower bits of this address will be ignored and treated as 0.
The address specified by those registers is incremented by $10 for each block of $10 bytes transfered successfully.
Comment thread
Phidias618 marked this conversation as resolved.
Outdated

Comment on lines +42 to +69

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the "State of the VRAM DMA source/destination registers after a transfer" is redundant and just add noise to the page.

I think the best way representing this info is by adding the lines you added to FF51-FF52 to FF53-FF54 too by just copy pasting it.

Something like this:

Suggested change
After a transfer the address contained in this register pair is
by $10 for each block of $10 bytes transfered, these
registers being write-only, this can only be observed by doing another
transfer without updating these registers.
#### FF53–FF54 — HDMA3, HDMA4 (CGB Mode only): VRAM DMA destination (high, low) \[write-only\]
These two registers specify the address within 8000-9FF0 to which the
data will be copied. Only bits 12-4 are respected; others are ignored.
The four lower bits of this address will be ignored and treated as 0.
#### State of the VRAM DMA source/destination registers after a transfer
After a transfer, the source/destination registers are incremented by $10
for each block of $10 bytes transfered.
Despite both the VRAM DMA source/destination registers being write-only,
knowing their state after a transfer can turn useful when performing
multiple transfer in a row.
For instance, a transfer of one large block is mostly equivalent to
multiple transfers of smaller blocks, without needing to update the source
nor the destination registers between each of the smaller transfers.
Another use case would be to fill VRAM with the same $10 bytes block repeated
all over, as only the source address register would need be updated after each
transfer, the destination register being automatically incremented by
the block size after each transfer.
After a transfer the address pointed by those two registers equals `initial_address + ($10 * num_of_blocks_transferred)`.
Since those are write-only registers, this can only be observed by doing another transfer without writing them again.
#### FF53–FF54 — HDMA3, HDMA4 (CGB Mode only): VRAM DMA destination (high, low) \[write-only\]
These two registers specify the address within 8000-9FF0 to which the
data will be copied. Only bits 12-4 are respected; others are ignored.
The four lower bits of this address will be ignored and treated as 0.
After a transfer the address pointed by those two registers equals `initial_address + ($10 * num_of_blocks_transferred)`.
Since those are write-only registers, this can only be observed by doing another transfer without writing them again.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found that it makes sense to describe the overall functioning of the system in a single place, so that the reader can start to form a vague mental picture before getting into the individual components; otherwise, IME, the scattered information is very hard to assemble into the big picture. This line of reasoning is what has led us to creating the Graphics or Audio introduction pages.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pretty much agree with you about the overview sections for complex systems, I just don't think that this specific case (post-transfer register state) rises to that level.
It's niche enough that IMO most developers will never really need it, and I worry that a dedicated section gives it more focus than it deserves and risks burying the more critical parts about the VRAM DMA system.

#### FF55 — HDMA5 (CGB Mode only): VRAM DMA length/mode/start

Expand Down