Search found 207 matches

by beannaich
Tue Mar 15, 2016 10:23 am
Forum: NESemdev
Topic: Emulator is not work correctly with the background scrolling
Replies: 4
Views: 2089

Re: Emulator is not work correctly with the background scrol

You are probably calculating your sprite zero hit bit ($2002.6) incorrectly. SMB uses sprite zero hits for timing related updates.
by beannaich
Sun Mar 13, 2016 10:03 am
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

Found the problem, and the crosstalk pattern is now going at a 45° angle: http://i.imgur.com/X26NwqI.png The problem code was in the decoder: for (int v = 0; v < 262; v++) { for (int h = 0; h < 341 * 2; h++) { auto center = (v * 8 * 341) + ((h / 2) * 8); auto x1 = center - 4; auto x2 = center + 4; T...
by beannaich
Sat Mar 12, 2016 5:32 pm
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

lidnariq wrote:Just for curiosity's sake, if you look at the contents of counters[0] at the beginning of each scanline, what do you see?
A repeating pattern of 0,4,8,0,4,8.
by beannaich
Sat Mar 12, 2016 11:58 am
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

A scanline is 341 pixels. That's 2728 half-master-clocks. There are 12 half-master-clocks for a NTSC chroma period. So there's 227+1/3 chroma periods on a scanline. Every 3 pixels the chroma-pixel phase realigns, so we can skip any multiple of 3 pixels and have the chroma phase be the same before a...
by beannaich
Sat Mar 12, 2016 9:53 am
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

As far as the other point ... because the PPU generates 227+⅓ colorburst periods per scanline, so each scanline should be earlier by ⅓ of a period... I'm not understanding this one. But the code I have for encoding is pretty straightforward, so unless I overlooked something I might need some clarif...
by beannaich
Tue Mar 08, 2016 10:11 pm
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

edit: I think you're not generating the "pulse" (the rarely missing) pixel correctly; phase 0 is always brighter than anything else on the same row in the 2C02 palette. Do you mean the pixel between the black and left border at h:329? If so, I am currently sending it out as DC, but perhaps AM would...
by beannaich
Tue Mar 08, 2016 9:04 pm
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

Anyway, the 2C02's phasors are generated using two six-bit Johnson counters, one clocked on falling edges and one clocked on rising edges. (Visual2c02 nodes 193-198 and 224-230). They don't restart on each scanline. Interesting. I'm currently just doing it the naive way of incrementing 12 integers ...
by beannaich
Tue Mar 08, 2016 8:32 pm
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

If your working model is "generate a 2728x262 frame image and decode it" (as it looks), you're not generating the colorburst. The colorburst reference is required by the decoder for phase (and maybe for amplitude) I was generating it, but due to a double->uint8_t conversion it was being forced to 0...
by beannaich
Tue Mar 08, 2016 7:59 pm
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

I have managed to encode the frame into a NTSC signal: http://i.imgur.com/2ciLH1b.png Now to read up further on NTSC decoding. In particular, determining which part of the signal you're looking at so I can begin separating the luma/chroma. Any advice? I've read that low-pass filtering the signal to ...
by beannaich
Tue Mar 08, 2016 1:37 pm
Forum: NESemdev
Topic: 6502 emulation, "page boundary crossed"
Replies: 3
Views: 3056

Re: 6502 emulation, "page boundary crossed"

Is the extra cycle "triggered" with this example or have I got it wrong? ldx #1 adc $00FF,x That would do it. Basically this means that the addition of the low address byte and the offset carried, which causes the high byte to need to be corrected (hence the extra cycle). The following pseudo-code ...
by beannaich
Mon Mar 07, 2016 10:22 pm
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

That seems to be an accurate description of how the 2C02 generates video, yes; any given scanline can be divided into 2728 half-master-clock periods. (Except one, which is one pixel / 8 half-master-clock periods short due to the missing pixel) Right. I guess I'll try and make an encoder/decoder and...
by beannaich
Mon Mar 07, 2016 9:55 pm
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

Does following along with my manual modulation and demodulation in the 2C02 and an NTSC TV explain anything? I'll list what I understand so far about the color generator, taken from the screen shots, the wiki, and a little from NTSC signal descriptions found on the web: 1. the sub-carrier used in t...
by beannaich
Mon Mar 07, 2016 9:28 pm
Forum: NESemdev
Topic: Scanline- vs pixelengine
Replies: 57
Views: 10792

Re: Scanline- vs pixelengine

Not sure if this will help, or if you're interested, but I recently started writing a half-cycle accurate stand-alone PPU emulator . The goal was for it to be used as a reference implementation for other emulators. If you're anything like me, seeing the code can be more valuable than any number of w...
by beannaich
Mon Mar 07, 2016 9:14 pm
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

In each pixel period (8 master clock half-periods), there is still at least one transition from high to low or vice versa, enough to perfectly recover the phase/hue in theory. But you often get more of the low voltage than the high or vice versa in any given pixel period. And because the TV doesn't...
by beannaich
Mon Mar 07, 2016 7:56 pm
Forum: NESemdev
Topic: NTSC Color Generator
Replies: 23
Views: 5813

Re: NTSC Color Generator

You can't "align" it at all; as far as NTSC is concerned the phase is the hue. By "align" I meant phase shift. I think I may have misunderstood the page in any case :D So the 8 samples would not have an (approximately) ideal square wave represented in them at all, but would instead have ramps from ...