bsnes-plus and xkas-plus (new debugger and assembler)

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
User avatar
jwdonal
Posts: 719
Joined: Sat Jun 27, 2009 11:05 pm
Location: New Mexico, USA
Contact:

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by jwdonal »

I'm experiencing some sort of color math emulation bug in bsnes-plus (accuracy version). I've tried this test ROM in several other emulators (no$sns, higan, snes9x, etc) and it looks correct. However, when running in bsnes-plus-accuracy the fog/clouds are displayed with a different random color on each power-on/reset/load/reload. I'm running v073+3a. It seems to be picking a random color out of thin air. The color that it randomly chooses is usually not even from the existing palette. Lol.
translucent.sfc
(32 KiB) Downloaded 691 times
AWJ
Posts: 433
Joined: Mon Nov 10, 2008 3:09 pm

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by AWJ »

jwdonal wrote:I'm experiencing some sort of color math emulation bug in bsnes-plus (accuracy version). I've tried this test ROM in several other emulators (no$sns, higan, snes9x, etc) and it looks correct. However, when running in bsnes-plus-accuracy the fog/clouds are displayed with a different random color on each power-on/reset/load/reload. I'm running v073+3a. It seems to be picking a random color out of thin air. The color that it randomly chooses is usually not even from the existing palette. Lol.
translucent.sfc
You're not initializing $2132 (COLDATA) properly. You need to write %11100000 ($e0) to set it to black, not 0. The upper 3 bits are which channels to change and the lower 5 bits are the value to change them to. Writing 0 does absolutely nothing.
User avatar
ikari_01
Posts: 141
Joined: Sat Jul 04, 2009 2:28 pm
Location: Wunstorf, Germany

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by ikari_01 »

Dang, beat me to it. :P Just commented here: https://github.com/devinacker/bsnes-plu ... -305454286
User avatar
HihiDanni
Posts: 186
Joined: Tue Apr 05, 2016 5:25 pm

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by HihiDanni »

You should probably be using an initialization routine to set initial values for all the registers as well as zero out the memory. This way you're starting with a known state. bsnes-plus is likely simulating the real hardware behavior of RAM effectively being filled with random values on power on.

There's an InitSNES routine floating around that you can use.
SNES NTSC 2/1/3 1CHIP | serial number UN318588627
User avatar
jwdonal
Posts: 719
Joined: Sat Jun 27, 2009 11:05 pm
Location: New Mexico, USA
Contact:

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by jwdonal »

AWJ wrote:You're not initializing $2132 (COLDATA) properly. You need to write %11100000 ($e0) to set it to black, not 0. The upper 3 bits are which channels to change and the lower 5 bits are the value to change them to. Writing 0 does absolutely nothing.
Sneaky :evil: Lol. I haven't done much (really anything) with color math yet, so that's why I didn't know about that special write behavior. Thanks!
User avatar
nicklausw
Posts: 376
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by nicklausw »

HihiDanni wrote:There's an InitSNES routine floating around that you can use.
This works for me, but it's a mess due to taking code from different locations. I've cleaned it up myself but haven't put it online yet and probably won't for a while, so.
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by calima »

After using bsnes-plus for a couple days, here are my impressions. Compilation was easy compared to higan, though I needed to edit some files to disable pulseaudio and to shrink the cheats.xml file, it's not nice to drop a 3mb file to my home dir without asking me. The tilemap viewer in particular was good. The debugger on the other hand fell short in many ways.
- why does it only show instructions after break/step? I expected a continuous view
- why does the disassembler show such a small amount of code? I couldn't find any way to increase it
- I couldn't figure out how to set breakpoints
- the disassembler showed wrong code once, perhaps it took the code as 16-bit when the registers were set to 8-bit (and shown as 8-bit in the debugger window)

Finally, I couldn't set right shift to the select key. Any other key was accepted, but not shift for some reason. Maybe a Qt quirk?
niconii
Posts: 219
Joined: Sun Mar 27, 2016 7:56 pm

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by niconii »

calima wrote:- why does it only show instructions after break/step? I expected a continuous view
I don't think that'd work that well. Thousands of instructions could be executed every frame. Even if the UI can handle printing them that fast, it would be limited by only being able to refresh at 60 Hz too, so if it shows, say, fifty instructions on screen at once, 99% of the instructions would never even appear on the screen. Furthermore, if the UI's refresh is synced up to the game's, you'd just see the last fifty instructions executed each frame, probably showing something boring like the start of vblank.

That all said, I do think there are things that'd be nice to have a continuous view of; I just don't see it working that well for the main debugger log. For instance, something that could keep track of variables in real-time would be nice, rather than having to look at the memory viewer. I've also seen some interesting visualizations in Retro Game Mechanics Explained's videos that might be nice to see in real-time.
calima wrote:- I couldn't figure out how to set breakpoints
Tools -> Breakpoint Editor. "Address Range" is the address range to break on, "R/W/X" is whether you want it to break on a read, write, or execute of those addresses, and "Data" is if you want it to break only when reading/writing a certain value from that address.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by Oziphantom »

the problem is the SNES is such a big machine that the spaghetti gui style of debugger just gets to unweildy, the NES is pushing it, you end up with 5 windows you have to shuffle to get all the data you need. Factor in the SNES has lots more code, lots more registers, lots more visual state, more palletes, more sprites, a whole spereate sound processor, dma, hdma, ram,vram,sram it just gets too much to make a "button for the thing" debugger. And then you have SA-1, Super FX, DSP, C4 etc etc It gets to the point it needs a monitor so all the commands are in text form, and you can query what you need when you need it. Having some of the other things in a visual format is nice, but I think having a monitor first would be the way to go.
Revenant
Posts: 462
Joined: Sat Apr 25, 2015 1:47 pm
Location: FL

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by Revenant »

calima wrote: - why does the disassembler show such a small amount of code? I couldn't find any way to increase it
- the disassembler showed wrong code once, perhaps it took the code as 16-bit when the registers were set to 8-bit (and shown as 8-bit in the debugger window)
These are both shortcomings of the crusty old bsnes 73 disassembler; as you guessed, it does show all currently displayed code with the current register sizes regardless of what was actually executed.

You might be interested in the new WIP debugger GUI which improves the disassembler portion substantially, among other things.
Finally, I couldn't set right shift to the select key. Any other key was accepted, but not shift for some reason. Maybe a Qt quirk?
You'll need to check the "allow modifier keys to be assigned standalone" option in order to bind things to Shift/Ctrl/Alt/etc. On the other hand if it only doesn't work for one/both of the shift keys in particular, that might be an issue with the current input driver.

Anyway, I've been very recently working to finally(!) wrap up the v4 release which I should be able to get out there fairly soon. After that I'm going to be focusing on officially migrating the project to Qt 5, as well as continuing and merging Benny's excellent work with the redesigned debugger frontend. (That said, if you have any feedback/suggestions specifically pertaining to that, feel free to post them in the other thread for now)
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by KungFuFurby »

v4's the last native release I'll be working with, citing a version incompatibility with Qt 5. Still, I managed to compile it with a modification to the makefiles...
Revenant
Posts: 462
Joined: Sat Apr 25, 2015 1:47 pm
Location: FL

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by Revenant »

KungFuFurby wrote:v4's the last native release I'll be working with, citing a version incompatibility with Qt 5.
Is that because of an incompatibility with a particular version of OS X or something? Do you know if it affects all Qt 5 releases or just more recent ones?
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by KungFuFurby »

I'm on Mac OS X 10.6.8. I actually modified the makefiles on my end to account for the SDK version, and thanks to Macports, I have C++11 support, which was a previous sore spot for compilation on my end.

I actually looked it up one day via MacPorts. Qt is utilizing features on newer versions of the Mac operating system that are not supported on my version of Mac... and 5.3.2, which I would have to manually build (or hunt it down somewhere...), is the absolute last version I can use, if I've been doing the correct lookup.
Revenant
Posts: 462
Joined: Sat Apr 25, 2015 1:47 pm
Location: FL

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by Revenant »

Hopefully it shouldn't be any harder to build that way after officially transitioning to 5.x, at least. I don't really foresee the frontend code (even with the new debug GUI) relying on any extremely recent Qt features considering it's all written for Qt 4 right now anyway; I could certainly try accounting for older OS/library versions in the build process somehow.

Might be just as well since AFAIK, options for getting prebuilt 64-bit Qt 5 binaries on Windows are still limited - the only official ones are for MSVC (which isn't an option for this project right now), and the Qt64-NG project stopped at 5.5.0. msys2 lets you install newer versions but I'm not yet sure how those compare in terms of size/dependencies since I haven't tried that option yet.
Revenant
Posts: 462
Joined: Sat Apr 25, 2015 1:47 pm
Location: FL

Re: bsnes-plus and xkas-plus (new debugger and assembler)

Post by Revenant »

https://github.com/devinacker/bsnes-plu ... -04-x64.7z

I've finally had time to finish all the miscellaneous stuff I'd been putting off this year. Changes in no particular order:

Code: Select all

v04 [2018-06-18]
Added reworked tile viewer, fully replaces original VRAM viewer [UnDisbeliever]
Added tilemap export option and various other improvements to tilemap viewer [UnDisbeliever]
Added mouse and gamepad/joystick support to input driver on macOS [Optiroc]
Added reworked Cx4 low level emulation based on ikari's documentation [Revenant]
	(WIP, improves timing in Mega Man X2/X3 intro/attract modes, etc.)
Added experimental 'snesmusic' plugin for SPC/SNSF file playback [Revenant]
Added autodetection of MSU-1 ROMs with no manifest required [Revenant]
Added various additional items to Properties Viewer [Revenant, koitsu, ARM9]
Added option to automatically save/load breakpoints between sessions [Revenant]
Added support for saving unfiltered screenshots [UnDisbeliever]
Added more flexible command-line loading (for BS-X, Sufami Turbo, Super GB games) [Revenant]
Added "Cart ROM" usage mapping for SuperFX code/data [Revenant]
Added support for larger Satellaview data files and more accurate reset state [LuigiBlood]
Added hotkey to pause and advance a single frame [Revenant]
Added hotkey to toggle system power [Revenant]
Added "auto-save SRAM" setting to UI [Revenant]
Added manifest viewer to tools menu/window [Revenant]
Fullscreen mode now auto-hides mouse cursor after 5 sec [Revenant]
Most debug windows are now given focus if opened when already open [Revenant]
Debugger no longer shows cart memory on CPU bus when SuperFX is accessing it [Revenant]
Debugger window is now forced open when a debug event occurs [Revenant]
CGRAM viewer now displays 5-bit color values instead of shifted 8-bit ones [ARM9]
Fixed interrupt-related (and other) dummy reads uselessly triggering breakpoints, etc. [Revenant]
Fixed SuperFX disassembly/logging not always properly accounting for pipelining [Revenant]
Fixed BS-X memory mapping registers causing severe unnecessary slowdown [Revenant]
	(fixes Treasure Conflix, possibly others)
Fixed mouse not automatically being released when powering off or changing inputs [Revenant]
Fixed soft-patching headered ROMs when snesreader plugin wasn't loaded [Revenant]
Fixed ROM cheats and ranged breakpoints ignoring address mirroring [Revenant]
Fixed emulation speed hotkeys sometimes failing to restore normal speed afterward [Revenant]
Updated emulation of auto joypad refresh timing [byuu?]
Updated emulation of SMP wait state control [byuu, AWJ]
Updated emulation of SuperFX PLOT dithering (fixes Star Fox) [qwertymodo]
Updated emulation of horizontal scroll latching (fixes PD Pac-Man) [AWJ]
Updated emulation of DSP-n status flags [AWJ]
Updated emulation of S-DSP's ENDX state (fixes Magical Drop) [AWJ]
Updated memory mapping heuristics for some cartridge types (fixes SRAM mapping w/ ExHiROM, etc.)
As usual, thanks to everybody who contributed patches, bug reports and suggestions.

All future releases are going to (finally) target Qt 5, and I'm planning to integrate Benny's new debugging frontend as well. I'll probably have some stuff to discuss about that frontend once I get to that.

macOS build also coming soon (i.e. probably this weekend when I bother getting the repo set up on my work laptop). 32-bit Windows builds are also available on request. (Also, the Windows builds more or less officially use msys2 now, but I still need to update the build instructions...)
Post Reply