News:

11 March 2016 - Forum Rules

Main Menu

Good IDE/Editor for 65816 assembly (SNES)

Started by Squall_FF8, January 07, 2018, 11:36:58 AM

Previous topic - Next topic

Squall_FF8

Hey guys,

I'm trying to start writing assembly code for 65816 (SNES). I will be using WLA-DX compiler. I need a good editor, if possible even an IDE. I consider a good editor the one that can highlight 65816 code words, comments, roll up/down blocks ...

Could you share what you use, and even if possible what would be the best instrument for that?

P.S. Currently I use Notepad++ but it doesnt highlight properly :(
Welcome to the FF5 Den: https://discord.gg/AUqDF85

RedComet

Until recently I used Sublime Text 3 as my editor, but in recent weeks I've switched to using Visual Studio Code.

Syntax plugins are available for both:

https://marketplace.visualstudio.com/items?itemName=joshneta.65816-assembly
https://github.com/DanielOaks/65816-Assembly-TMlanguage

If you're a Vim user, there are a few syntax files available:

https://github.com/ARM9/snes-syntax-vim
https://github.com/NewLunarFire/wla-vim

I didn't realize these were available until now. The first one looks promising.

Hope that helps.
Twilight Translations - More than just Dragonball Z. :P

Squall_FF8

Thank you RedComet!

I tried VIM, because it has support for WLA ... but it is terrible. At first I couldn't understand what is going on, after that I remembered the days when BBS was our internet - all text interface. Anyway I don't care much as far it does the job ... alas it failed miserably. In order to insert a new line in source file it took me like 5 mins.

After that I tried Visual Studio Code. It seems very promising with the build in GID support, Command prompt tab. So even if I don't get how to automatically compile, I will be able to do it manually in the command prompt, really a neat feature. If somebody know how to set-up the environment to compile to any language, please share so I will try to redirect it to WLA.

If you guys use anything else, please share!
Welcome to the FF5 Den: https://discord.gg/AUqDF85

optiroc

Depending on what you want to accomplish, you might want to reconsider your choice of assembler. WLA-DX does have a few unique advantages, but they are often outweighted by its quirks, bad macro support and outright buggy behavior.

That said, I actually went with WLA for my Super Famicom Wars translation in the end. It's the only 65816 assembler I know of that both has pretty decent "patching assembler" features and uses a decent linker which can automatically put code and data in sections you've defined as free.

In other cases I prefer the ca65 assembler (not that it's perfect by any means either, in particular I've never made good friends with its macro language). Most other people seem to prefer xkas or bass.

As for "IDE", using the bsnes+ emulator/debugger in conjuction with a good text editor is probably the best option. Sublime Text is a vastly more efficient text editor than VSCode. For small source files that's no issue (unless when on the go and you don't want a JavaScript app to eat through your laptop battery in no time), but reading trace files which more often than not are 10 000 to 100 000 lines with VSCode is pretty much a no go. Both have excellent syntax highlighting support and can easily invoke a Makefile and output the results in a docked log view.

Squall_FF8

TBH I don't have any preferences except good Macro assembler, easy to use editor (IDE) and if possible, editor that I can press a button and it make the ROM or even start it in emulator (then I will consider the editor an IDE :D ).

That's said I'm no familiar with any of existing. The only thing I know xkas is most used, but quite buggy, which in my book is actually extremely bad - I have to rely that if something in my code doesn't work its because of me rather wrong/bad output.
Welcome to the FF5 Den: https://discord.gg/AUqDF85

optiroc

Quote from: Squall_FF8 on January 10, 2018, 08:15:46 AM
TBH I don't have any preferences except good Macro assembler, easy to use editor (IDE) and if possible, editor that I can press a button and it make the ROM or even start it in emulator (then I will consider the editor an IDE :D ).

Having the built ROM image run in a (debugging) emulator is simple enough to accomplish by adding that to the build script. There's you IDE! ;)

Good macro support is worse. I actually generate all assembly code using python and feed WLA one huge file, which lets me get around WLA's pretty awful macro language and some other quirks I've ran into when linking several object files in "patching" mode.

Nightcrawler

First, Notepad++ allows you to do custom syntax highlighting, so you can make it work however you'd like. I'm pretty sure someone around here has already made one for the SNES if I recall, but with a quick search I was only able to find one for 6502 over on NESDev. (that's most of the way there already.)

http://forums.nesdev.com/viewtopic.php?t=6267

Second, few people know about this setup, but it can very nice to use nonetheless. You use this, make a few tweaks to Notepad++ and you can have a cobbled together fully functional IDE environment for the SNES if you'd like.

https://www.romhacking.net/utilities/749/
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

Gideon Zhi

Been using Textpad for my assembly coding, but I'm going to have to look into switching to sublime (potentially) given the syntax file RC linked. Neat! Will investigate.

optiroc

Here's my Sublime syntax defs for ca65-flavored 65816/SPC700/GSU-1 assembler, btw.

Squall_FF8

Thank you for the suggestions guys! My responses are slow, because I try to evaluate each one!

Quote from: optiroc on January 10, 2018, 06:57:58 AM
WLA-DX does have a few unique advantages, but they are often outweighted by its quirks, bad macro support and outright buggy behavior.
Could you elaborate more? More precisely I'm interested in your observations on macros.

I took sometime to read all directives and I'm very impressed - .macro .struct, .include, .define and their variations are the difference between 'writing in asm is painful' and 'easy almost as higher level language'. Especially variations ... sin/cos/random tables, especially FilterMacro is unique. On top of that some SNES specifics like .SNESHEADER, .SNESNATIVEVECTOR,... make building a ROM from a scratch 'easy-pizzi'.

Quote from: Nightcrawler on January 10, 2018, 09:17:58 AM
Second, few people know about this setup, but it can very nice to use nonetheless. You use this, make a few tweaks to Notepad++ and you can have a cobbled together fully functional IDE environment for the SNES if you'd like.

https://www.romhacking.net/utilities/749/
Nightcrawler I tried that. I added the plugin and it showed in Plugins. What else I need to do? Where should I put xcas and bsnes?
Welcome to the FF5 Den: https://discord.gg/AUqDF85

optiroc

Quote from: Squall_FF8 on January 14, 2018, 04:49:45 PM
Thank you for the suggestions guys! My responses are slow, because I try to evaluate each one!
Could you elaborate more? More precisely I'm interested in your observations on macros.

The showstopper for me is that it doesn't support using several important assembler directives in code expanded from macros. You can't create new memory sections/segments via macros for example, something ca65 supports (it also has directives for pushing/popping segments).

So depending on what you want to accomplish it may be perfectly suitable, but when I had decided to use WLA for a pretty big ROM hack I quickly realized I needed a separate macro preprocessor and basically only used WLA as a basic assembler/linker.

Squall_FF8

What really bothers me is this:
QuoteNote that WLA's macros are in fact more like procedures than real macros, because WLA doesn't substitute macro calls with macro data. Instead WLA jumps to the macro when it encounters a macro call at compile time.

Does WLA really have macro support???
"doesn't substitute macro calls with macro data" ... isn't that the very essence of what macro is???
"Instead WLA jumps to the macro when it encounters a macro call at compile time" What exactly that mean? it add jmp instruction to the macro or ???

If I have definition:
.macro Clear
       clc
.endm

Clear


what will I get as output in 'Clear'?
Welcome to the FF5 Den: https://discord.gg/AUqDF85

optiroc

Quote from: Squall_FF8 on January 15, 2018, 10:15:03 AM
What really bothers me is this:
Does WLA really have macro support???
"doesn't substitute macro calls with macro data" ... isn't that the very essence of what macro is???
"Instead WLA jumps to the macro when it encounters a macro call at compile time" What exactly that mean? it add jmp instruction to the macro or ???

If I have definition:
.macro Clear
       clc
.endm

Clear


what will I get as output in 'Clear'?

Yeah, well, that blurb in the docs is pretty confusing I guess. I suppose what they mean is that macros aren't expanded in a pass prior to assembly – it's all done during the first pass (pass_1.c). A call to your Clear macro will output the clc opcode.

Squall_FF8

Thank you for the fast answer!!! It was pretty confusing in the description  :laugh:
Welcome to the FF5 Den: https://discord.gg/AUqDF85