NDX (Nintendulator Debug Extensions)

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

yesyesyall
Posts: 28
Joined: Sat Mar 05, 2011 3:17 pm
Location: Houston, Texas

Post by yesyesyall » Wed Mar 30, 2011 12:47 pm

oh, okay. yeah, it does. every time i press F8, it loads the state, but also automatically switches PPU mode one down. (for example, if i am in PAL and load a state, the state is loaded and the mode is switched to Hybrid. if i am in hybrid, the state is loaded and 'wraps around' to NTSC mode.)

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox » Thu Mar 31, 2011 1:51 am

yesyesyall wrote:oh, okay. yeah, it does. every time i press F8, it loads the state, but also automatically switches PPU mode one down. (for example, if i am in PAL and load a state, the state is loaded and the mode is switched to Hybrid. if i am in hybrid, the state is loaded and 'wraps around' to NTSC mode.)
Yeah then you're using an old version. Get the latest dev build from the official Nintendulator site or my debug extension version from the first post in this thread.

Also, just to remind everybody, this still isn't a generic Nintendulator support thread. :)
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

User avatar
qbradq
Posts: 951
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq » Thu May 19, 2011 12:53 pm

thefox wrote:I worked on timer support yesterday. Timers allow you to count and display CPU cycles between two blocks. Currently it's implemented using special registers: $401E/$401F control timer 0 (VirtuaNES compatible) and $402x/$403x control 16 additional timers.
Would you mind to put that in the top post or the read me or something? I have to go digging through this post every time I wan to use them :D This is a really great feature that has really helped me a lot.

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox » Fri May 20, 2011 1:15 am

qbradq wrote:
thefox wrote:I worked on timer support yesterday. Timers allow you to count and display CPU cycles between two blocks. Currently it's implemented using special registers: $401E/$401F control timer 0 (VirtuaNES compatible) and $402x/$403x control 16 additional timers.
Would you mind to put that in the top post or the read me or something? I have to go digging through this post every time I wan to use them :D This is a really great feature that has really helped me a lot.
Sure, done. :)

User avatar
qbradq
Posts: 951
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq » Fri May 20, 2011 7:12 am

Thanks man! Helpful macros too!

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox » Mon Jul 04, 2011 5:57 pm

Just an FYI to anybody who has been trying this out in the last couple of weeks or wants to do so in the future:

Because of recent changes in CC65, if you use the latest snapshot of CC65, NintendulatorDX won't work correctly (you'll get errors in the Debug Information window). A temporary fix is to use an older snapshot (which unfortunately isn't available for download anywhere).

This is all good in the long run though, as CC65 debug file now supports segment (= banking) and size info for symbols. This means you'll no longer need to type ",w" after symbol names to display 16-bit data as long as the size info is available. It also opens some options for profiling since the size of .proc blocks is known... I hope to put out a new version this month.

Big thanks to Uz (the author of CC65) for adding all the new features in CC65!

User avatar
Banshaku
Posts: 2378
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Post by Banshaku » Tue Jul 05, 2011 5:10 am

Good to see that this project is moving forward. I didn't touch a line of code in a while so didn't try it yet. Hope I will be able someday.

I guess I must be repeating myself. getting older :P

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox » Wed Jul 06, 2011 1:45 am

Banshaku wrote:Good to see that this project is moving forward. I didn't touch a line of code in a while so didn't try it yet. Hope I will be able someday.

I guess I must be repeating myself. getting older :P
Thanks!

Here's the latest version: http://kkfos.aspekt.fi/downloads/ninten ... x-0.27.zip

The fixes/changes are:

- works with the latest CC65 snapshot
- timer titles no longer need to be prefixed with the ASCII identifier
- watch window will try to automatically set the symbol size (byte/word)
- diagnostics will be shown in two cases: 1) if absolute addressing is used when zero page could have been used (can happen by accident) 2) if an unitialized memory location is accessed, i.e. one that is read before a value has been written to it after reset/power on

Yes yes... I know there are some legitimate applications to using absolute addressing for zero page addresses (timing stuff) and reading seemingly uninitialized memory (detecting power on/reset). Maybe I'll add an option to turn the feature off later if people find it too annoying.

User avatar
qbradq
Posts: 951
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq » Thu Jul 28, 2011 6:19 am

Looks like the debug format change on the latest snapshot of CC65. When I try to load my ROM I get messages like the one below.

Error:

Code: Select all

Debug info error on line 8227: Unexpected input token 27
Line:

Code: Select all

sym	name="_graphics_chr",value=0x0,addrsize=absolute,type=label,segment=6
If I remove the ",segment=6" bit from the end it works.

I also get this error:

Code: Select all

Debug info error on line 8292: Unexpected input token 28
For this line:

Code: Select all

sym	name="L0280",value=0x814C,addrsize=absolute,type=label,size=3,segment=0
And it works if I remove the ",size=3,segment=0" part.

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox » Thu Jul 28, 2011 7:40 am

qbradq wrote:Looks like the debug format change on the latest snapshot of CC65. When I try to load my ROM I get messages like the one below.
Works fine here. Are you sure you're using the latest version of NintendulatorDX (v0.27)? v0.26 had this problem.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

User avatar
qbradq
Posts: 951
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq » Thu Jul 28, 2011 7:54 am

Ack! My bad TheFox. I thought that was the problem yeseterday, so I downloaded your latest version. Too bad I forgot to unpack the new version :D Works like a charm.

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox » Wed Aug 03, 2011 9:28 am

Version 0.28 released. Download link is in the first post.

Changes:
- Preliminary support for debug messages
- Sources added to the package because somebody ratted my violation of GPL to Quietust... just kidding, no hard feelings. :=) I was going to release the source at some point anyways.

How to use debug output feature

This feature allows you to do "printf" style debugging from your applications. It works like this: when the emulator detects a write to $4040, it reads a string from PC+3 and outputs it in the debug window. This feature can thus be used from any assembler. Some simple number formatting is also supported.

Some helper macros for CA65:

Code: Select all

.macro debugOut str
    .local over
    sta $4040
    jmp over
        .byte str, 0
    over:
.endmacro

.define fHex8( addr ) 1, 0, <(addr), >(addr)
.define fDec8( addr ) 1, 1, <(addr), >(addr)
.define fHex16( addr ) 1, 2, <(addr), >(addr)
.define fDec16( addr ) 1, 3, <(addr), >(addr)
Some usage examples:

Code: Select all

.zeropage
  some_var:    .res 2
  other_var:   .res 1

.code
entry:
  lda #$34
  sta some_var
  lda #$12
  sta some_var+1
  debugOut {"entry point reached, some_var = ", fHex16{some_var}, ", isn't that exciting?"}

  lda #123
  sta other_var
  debugOut {"other var is ", fDec8{other_var}, " in decimal"}
Last edited by thefox on Mon Aug 15, 2011 2:39 am, edited 2 times in total.

User avatar
Memblers
Site Admin
Posts: 3862
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers » Wed Aug 03, 2011 5:19 pm

Nice, with an alternate macro that could work on NES too (printing through the controller port to a terminal) - with a significant speed penalty though, if execution time matters.

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox » Thu Aug 04, 2011 8:52 am

Memblers wrote:Nice, with an alternate macro that could work on NES too (printing through the controller port to a terminal) - with a significant speed penalty though, if execution time matters.
Yeah, I initially intended to supply just a single register to handle character output to the terminal, and let the 6502 side handle all formatting, but opted for this because it takes constant time. Still need to add some more formatting options.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox » Mon Sep 12, 2011 3:36 am

Version 0.33 released. Download link in the first post as usual.

Changes are:
- Modified to work with the latest version of CC65 snapshot (I also included this snapshot in the package).
- .proc/.scope profiling information can be collected (see first post).
- Better support for multiple line infos from the same line.

The profiling feature is very useful/cool IMO. As long as your functions are wrapped in .proc/.endproc, you simply have to write to $4041 (to enable profiling) to get an idea where the hotspots are in your program.

Post Reply