nesdev.com
http://forums.nesdev.com/

Confusing byte format in APU docs
http://forums.nesdev.com/viewtopic.php?f=3&t=15846
Page 1 of 1

Author:  wbrian [ Sat Apr 22, 2017 11:34 am ]
Post subject:  Confusing byte format in APU docs

I'm reading through the triangle generator docs here and I had a question about the following snippet:

Quote:
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.

Author:  lidnariq [ Sat Apr 22, 2017 11:38 am ]
Post subject:  Re: Confusing byte format in APU docs

wbrian wrote:
What does the "%" prefix mean
Binary number. From what I've seen, it's actually vaguely standard among 6502 assemblers.
Quote:
and what's the significance of the period?
Byte separator.

Author:  dougeff [ Sat Apr 22, 2017 11:39 am ]
Post subject:  Re: Confusing byte format in APU docs

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.)

Author:  Zepper [ Sat Apr 22, 2017 3:12 pm ]
Post subject:  Re: Confusing byte format in APU docs

Let me translate them to you.
Code:
              dmc_address = 0xC000 | (reg4012 << 6);
              dmc_length = (reg4013 << 4) | 1;

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/