Visual 2a03 Questions + DMC Problem

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Visual 2a03 Questions + DMC Problem
by on (#168842)
So I sort of posted this in another thread, but it was pretty far buried and I don't think anyone will see it, so I've decided to post it in its own thread:

I'm trying to do some DMA tests with visual2a03. Though it seems the DMC is not fetching bytes as one would expect.

Here's a simple test program:
http://www.qmtpro.com/~nes/chipimages/v ... 20300010fe

Effectively:
Code:
lda #$4F  ; fastest speed + looping
sta $4010
lda #1     ; nonzero length
sta $4012
sta $4013
lda #$10
sta $4015
jsr some_routine_that_burns_cycles
bpl -2


I would expect this to perform the first DMA shortly after the 4015 write (which it does)
Followed by another DMA ~432 cycles afterwards. But even after 800 cycles, there's no sign of a 2nd DMA.

Can anyone explain why this is happening? Is my program wrong, or is this a bug with visual2a03?



Worse, I can't seem to run visual2a03 for more than 300 cycles before it starts slowing WAY down. And after 900 cycles it completely crashes and I need to reload the page. I assume this is because of memory consumption or something. Is this an issue with my browser? Are there any workarounds?

Thanks
Re: Visual 2a03 Questions + DMC Problem
by on (#168866)
Disch wrote:
Worse, I can't seem to run visual2a03 for more than 300 cycles before it starts slowing WAY down. And after 900 cycles it completely crashes and I need to reload the page. I assume this is because of memory consumption or something. Is this an issue with my browser? Are there any workarounds?

Visual2A03/Visual6502 saves the entire state of the simulation on each cycle so that it can enable backwards stepping. Obviously this leads to huge memory consumption after a while. I don't think there's a way to turn this off without modifying the source.
Re: Visual 2a03 Questions + DMC Problem
by on (#168895)
thefox wrote:
Visual2A03/Visual6502 saves the entire state of the simulation on each cycle so that it can enable backwards stepping. Obviously this leads to huge memory consumption after a while. I don't think there's a way to turn this off without modifying the source.

Trace history has been disabled on Visual2A03 - it was as simple as commenting out a few lines of code (disabling the save-state code as well as the Back button). Visual2C02 never had it to begin with - I got rid of it when I added support for custom reset states, since I had to spend several hours simulating past the initialization frames.
Re: Visual 2a03 Questions + DMC Problem
by on (#168907)
Thanks Q

Any idea on the missing DMA? Is there like some kind of APU warmup that I have to wait through?
Re: Visual 2a03 Questions + DMC Problem
by on (#168914)
Disch wrote:
Any idea on the missing DMA? Is there like some kind of APU warmup that I have to wait through?

It's possible there's a bug in the simulation itself, though I'm not sure if I'll have the time to track it down.
Re: Visual 2a03 Questions + DMC Problem
by on (#168953)
I believe the problem is the LFSR counter (pcm_t) that they used to regulate the period. It generates a clock when the value is $100. However, it starts at 0 at powerup and doesn't get reloaded until it has reached $100. So, it will take around 1000 cycles for it to reach $100 for the first time, after which it's reloaded with $D5, and then starts generating clocks every 54 clocks as you'd expect. You can see pcm_bits changing (0->1) for the first time at cycle 1023, then 1->2 at cycle 1077, and so on. At cycle 1404..1405 after pcm_bits has reached 7 and rolled over to 0, you can see the second DMC fetch happening.

So I don't think there's a bug in the simulation.
Re: Visual 2a03 Questions + DMC Problem
by on (#168957)
AHA! Thanks, thefox.

So in a sense.... the warmup delay was sort of accurate? XD


EDIT:

So it's still crashing for me after ~860 cycles so I can't test that out for myself =/
Re: Visual 2a03 Questions + DMC Problem
by on (#168963)
Disch wrote:
So it's still crashing for me after ~860 cycles so I can't test that out for myself =/

Try turning off the Trace log (i.e. click "Trace less" until all of the columns disappear) or periodically Clearing the trace log.
Re: Visual 2a03 Questions + DMC Problem
by on (#168966)
Also make sure to reload the page (Ctrl+R) to make sure you're not running a cached version. Chrome's Task Manager (Shift+Esc) is a good way to look at the memory usage.
Re: Visual 2a03 Questions + DMC Problem
by on (#169001)
thefox wrote:
Also make sure to reload the page (Ctrl+R) to make sure you're not running a cached version.

A simple reload might not do it - most browsers have an additional means to forcibly reload and ignore cache, and I think Chrome uses Ctrl+Shift+F5 for that (in Firefox, hold Shift and press the Reload button in the toolbar).
Re: Visual 2a03 Questions + DMC Problem
by on (#169008)
Or in Firefox, press Ctrl+Shift+R to reload and ignore local cache. (It does not necessarily bypass caching performed by an MITM in an office or ISP.)

But don't reload that way too often, as Visual 2A03 is on a connection that's kind of slow.
Re: Visual 2a03 Questions + DMC Problem
by on (#169009)
Periodically clearing the log seems to be the most effective. So it looks like both my problems are addressed! I'll have some work to do this weekend.
Re: Visual 2a03 Questions + DMC Problem
by on (#169027)
If using Chrome: in the Developer Tools (hit F12), you can actually disable the cache entirely with a checkbox: go to the Network tab, and check "Disable cache". This applies only while the Developer Tools pane remains is open.