Confusing byte format in APU docs

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
wbrian
Posts: 11
Joined: Wed Feb 15, 2017 6:41 pm

Confusing byte format in APU docs

Post by wbrian »

I'm reading through the triangle generator docs here and I had a question about the following snippet:
DPCM samples must begin in the memory range $C000-FFFF at an address set by register $4012 (address = %11AAAAAA.AA000000).
The length of the sample in bytes is set by register $4013 (length = %LLLL.LLLL0001).
I'm confused by the formats used for address and length calculations—What does the "%" prefix mean, and what's the significance of the period? It's unlike any format I've seen while reading through the PPU docs, so I want to make sure I'm interpreting it correctly.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Confusing byte format in APU docs

Post by lidnariq »

wbrian wrote:What does the "%" prefix mean
Binary number. From what I've seen, it's actually vaguely standard among 6502 assemblers.
and what's the significance of the period?
Byte separator.
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: Confusing byte format in APU docs

Post by dougeff »

Binary. Those are the digits.

You set the address with 1 byte (8 bits). Bit-shift left 6 times, OR with 0xc0 (the upper byte of a 2 byte address) gets a CPU address between 0xc000 and 0xffc0 as the start address of the DMC sample.

(Edited slightly.)
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Confusing byte format in APU docs

Post by Zepper »

Let me translate them to you.

Code: Select all

              dmc_address = 0xC000 | (reg4012 << 6);
              dmc_length = (reg4013 << 4) | 1;
Post Reply