Asar is a Super Nintendo assembler, intended to replace xkas v0.06 as the preferred assembler around here.
It's got a freespace finder (no more staring at slogger and wondering if the freespace is large enough (if the patch is configured to use this feature)), it will ask for filenames if double clicked (no more copying cmd.exe everywhere and making batch files), it can use parentheses and proper priority in math (or it can act like xkas and count left to right), it can assemble SPC-700 and SuperFX codes, and a lot of other improvements, while still offering a familiar environment for coders used to xkas6.
Note that xkas patches will require ";@xkas" at the top if you're using Asar on them, or they'll act weirdly.
Why you dont upload the 1.60 asar version @Looney Balloon i compiled it on my windows 10 with visual studio and it works fine its the 1.60 version and the 1.50 version works to your get are strange error right you need to click on allowed left button
Works great with Windows 10, not sure the other person's problem. I originally found a link to a download of Asar from a forum post, but I found the version was too old to patch for me. I luckily found this easily, unlike a lot on SMWCentral. Worked fast, just wish I had known not to put file extension in the first time.
To get the notepad++ XML (syntax-highlighting.xml) to run, copy that file and paste it in Notepad++\plugins\APIs. Then run notepad++, and on the menubar, Language -> Define Your Language..., click on "Import", and navigate to where you placed the file, and select the file, and you're done.
It would've been nice if the freespace finder worked with the xkas thing because I added ;@xkas to the patch and then Mario stopped existing and it was Bad ROM which was a problem. It seems a magic MarioFanGamer or someone else shows up and replies to problems though, please someone suggest something
There is a bug with the readfile and canreadfile functions where asar crashes if these functions are used to read from 17 or more different files. I know that these functions are able to cache up to 16 files simultaneously, but I would have expected asar to close the oldest opened file when attempting to open more than 16 files.
This bug has been complicating some of the stuff I've worked on recently, and it'd be nice if it was fixed.
Be careful that this version still have a bug with the labels that crosses over a %callMacro(). If inside the macro has the same label as outside of it (or that the macro have a perent label when a sublabel jumps over it), causes glitches, as the exe treats contents inside the macro as if its located in the same location as the call itself, so be aware of that. Here is Alcaro's example
Originally posted by alcaro
%macro() containing ?bar:
should attach .baz to foo:, not ?bar:.
This also happens on +/- symbols too, as tested on GPS.
Possibly the most annoying bug I've experienced when using GPS and PIXI. Thank god uberasm tool's library does not use that, instead it uses filename_label:
Actually, judging by test.cpp being made for Windows and Linux simultaneously (backslashes, but also including sys/stat.h), someone dropping a libasar.so in the source directory, and the empty help.sfc, there's a fair chance it doesn't.
Good news, I just ran this latest asar on my entire Yoshi disassembly, which has tons of 65816, super fx, and SPC code and various features, basically a good "testing ground", and it worked the same as before. So, I APPROVE OF this latest version!!
Added API to Asar lib for getting information on all blocks of data written by Asar.
Added API to Asar lib for getting the mapper currently used by Asar.
Added support for ExLoROM and ExHiROM mappers.
NOTE: Based entirely on conversion tables I got from Ladida; don't know if these conversions are actually correct. Some features may not work as intended when using those mappers (such as freedata, for example), but I can't verify this.
Added pushtable and pulltable commands, which let you back-up or restore the current character table to the/from the stack.
Added "ext\notepad-plus-plus\syntax-highlighting.xml". This file can be imported into Notepad++ as a user-defined language to add syntax highlighting for Asar patches, featuring all commands currently supported by Asar. By default, this syntax highlighting is enabled on all files with an extension of .asm or .asr, but this can be customized via Notepad++.
Lines starting with @ or ;@ that don't map to a recognized special command now only throw warnings at best and no errors.
Rewrote code of tests a little to make them easier to execute and make them clean up their own mess.
C# wrapper for Asar DLL was non-functional since it didn't specify a calling convention, making it always lead to an exception in some scenarios.
Just like the last version, this version of Asar was built in MSVC rather than g++, but this time I also updated the Asar DLL (which I had overlooked last time). I'm not sure if Windows applications are compatible with DLLs that were built by a different compiler, so if you're planning to use the DLL, this is something to watch out for. If you're planning to use a compiler other than MSVC, I recommend just rebuilding the DLL from source in whatever compiler you're using (or directly including the Asar library code in your project).
Just copy-pasting the list of new features from the changelog:
readfile functions: readfile1(filename, offset), readfile2(filename, offset), readfile3(filename, offset), readfile4(filename, offset) - similiar to read1() etc. functions, except data is read from another file instead of from the ROM (note that offset is a PC offset, not a SNES offset). You can pass an optional third value which is returned if the read fails.
canreadfile functions: canreadfile1(filename, offset), canreadfile2(filename, offset), canreadfile3(filename, offset), canreadfile4(filename, offset), canreadfile(filename, offset, length) - basically the readfile() equivalents of canread1() etc.
snestopc(address) and pctosnes(address) functions: for manually converting addresses (note that those functions are dependent on the ROM's mapping mode, so use them with caution - chance are you'll never need them, anyways)
max(a, b), min(a, b) and clamp(value, min, max) functions: max()/min() return the maximum/minimum of two values, whereas clamp() makes sure that that value is >= min and <= max
safediv(dividend, divisor, exception) function: divides dividend by divisor, unless divisor is 0, in which case exception is returned
select(statement, true, false) function: if statement is 0, false is returned, in any other case, true is returned. Basically, a mathematical version of "if/else". Please note that unlike if/else blocks, function arguments in asar are always evaluated before a function returns. In other words: if you do select(1, 1/1, 1/0), asar will throw a "division by zero" error, even though the function would return 1/1. In this particular case, it's recommended to simply use the safediv() function in place of a regular division.
not(value) function: returns 1 if value is 0 and 0 in any other case
comparison functions: equal(a, b), notequal(a, b), less(a, b), lessequal(a, b), greater(a, b), greaterequal(a, b) - rather self-explanatory, return 1 if the respective comparison is true and 0 otherwise. Primarily intended to be passed as statement to select() function.
logical functions: and(a, b), or(a, b), nand(a, b), nor(a, b), xor(a, b) - also self-explanatory, return 1 if the respective logical operation is true and 0 otherwise. Primarily intended to be passed as statement to select() function.
while loops: Added compile-time while loops to Asar. Those work similar to if conditionals, with the difference that their blocks are compiled repeatedly until their condition becomes false. For easier implementation and higher compatibility, while loops are terminated with endifs, just like if conditionals. When using while loops, be careful not to cause an infinite loop.
Multiline commands: You can now put \ at the end of any line of source code and Asar will append the following lines to that line. This is similar to putting , at the end of a line, with the difference, that the \ does not appear in the concatenated string, whereas the , does. This is useful to split long functions into multiplie lines, for example. Note that all whitespace following the \ is removed, whereas whitespace preceeding the \ isn't. So
for example, whereas
double(num) print function: Can be passed to print to print a double variable with its fractional part. Has a default precision of 5 decimal places, but can be passed a second argument to override the precision.
round(num, precision) function: Rounds the double variable num to precision decimal places. Pass 0 to precision to round to the nearest integer.
Asar 1.37 suppported overloaded versions of read1() to read4(), but always threw "Wrong number of parameters to function" errors when actually using those overloaded versions
Asar 1.37 threw "Wrong number of parameters to function" for function canread() when passing 2 arguments to it, because it actually treated it as canread1() due to an error in string comparison
Using better double -> int conversions in some places - where dd $FFFFFFFF would assemble to 00 00 00 80 ($80000000) in Asar 1.37, it now assembles to FF FF FF FF
Defines in elseif conditionals now get properly resolved
The #= define operator now doesn't truncate its value when using "math round off", making it possible to do double-precision math with it
Asar 1.37 detected misplaced elses and endifs, but not misplaced elseifs
Putting "@xkas : @asar 1.37" on the first line would previously lead to an error, whereas putting "@asar 1.37 : @xkas" there would not. Both variations lead to an error message now, since it really doesn't make much sense to use them together in any combination.
Special commands like @asar or @include could previously be used on the first line only and needed to be chained with a : inbetween. They can now be used on any line as long as no other command comes before or inbetween them.
Asar 1.37 fixed a bug in SuperFX compilation, but src/test/arch-superfx.asm was never edited to acknowledge this fix, so the test always failed
Added different define operators (=, +=, :=, #=, ?=) to manual.txt. Those have been in Asar for quite a while, but were never documented yet, although they can be quite useful.
This version of Asar was build in MSVC rather than g++, mainly because I already had that installed and use Visual Studo as an IDE, anyways. Functionally, this shouldn't make any difference, unless using Asar in unintended ways, where anything goes. I did build the Linux version in g++ to confirm compatibility, though.