8 users online: Kaan, karls_Corinthia,  Kevin, Mohamad20ZX, scratch, SHMUP4EVER, TokZone, Zavok - Guests: 58 - Bots: 86
Users: 57,945 (2,499 active)
Latest user: karls_Corinthia

Asar: Under new management

In case patches like the VWF patch doesn't start at a bank boundary but instead in the middle of a bank?
Melba: The Peach Saga - basic concept of 'hub' world finished

The Shrine Policy - Always think you're better than me
Yes, I know that patches may start in the middle of a bank.
And I have no idea how that would matter. Growing patches is not a problem (Asar will just move them), and any patch that uses absolute addressing in a way that makes it break if placed at a bad freespace should never pass moderation.
<blm> zsnes users are the flatearthers of emulation
I was thinking of a feature that might be of value. Straight after a freecode or freedata command, the starting and ending addresses could be accessed elsewhere in the patch. Probably for patches like the original Screen-Scrolling Pipes.
Melba: The Peach Saga - basic concept of 'hub' world finished

The Shrine Policy - Always think you're better than me
Already exists. It's called "label".
<blm> zsnes users are the flatearthers of emulation
So how is it used or am I really that stupid?
Melba: The Peach Saga - basic concept of 'hub' world finished

The Shrine Policy - Always think you're better than me

;useful code goes here


...though I'm not entirely sure why that would be useful. Asar adds RATS tags automatically, and I can't think of any other possible use.
<blm> zsnes users are the flatearthers of emulation
Because sometimes in patches, this could be stumbled upon.

This is an example:

!SumCode = !Freespace+$40
!SumCode2 = !Freespace+$80
...and so on...

Note how the starting address of the freespace is needed.

As with the command 'freecode', you cannot control or even predict where the data is stored to, the above cannot be used unless there is a workaround I've not though about yet.
!SumCode = CodeStart+$40 will work in 95% of the cases, and getting a saner coder (aka one that doesn't depend on fixed offsets like that) will work in 99.5% of the cases.
Note that you may need to adjust the +$40s for RATS tags.

...but I still have a feeling that you're thinking in wrong paths. The VWF patch had nothing to do with starting on a bank border, and I've got an odd feeling that you're doing something strange again.
If it's !currentwidth = !varram+41 (and similar) from the VWF patch, those are RAM addresses. Asar has no improvements over xkas when it comes to finding freeram.
<blm> zsnes users are the flatearthers of emulation
A saner code? So fixed defines to do with freespaces aren't favourable???

Did fix the VWF patch but this concept is still confusing me somehow.
Melba: The Peach Saga - basic concept of 'hub' world finished

The Shrine Policy - Always think you're better than me
Yes, I am saying fixed offsets is a strange idea with high potential for errors. Labels in the middle of the tables makes much more sense in 99.95% of the cases.

But in the case of the VWF patch, those defines must point to RAM. Repointing RAM is much harder than repointing ROM (there is no such thing as org $7FB000), labels in RAM is annoying, and since one byte of RAM is useful while one byte of ROM isn't, shuffling around the RAM addresses to fit properly is much easier than making a ROM table grow.

Keeping it as it is sounds like the best solution to me. If you're using freecode for something that should be RAM, you've got bigger problems than labels in RAM being annoying.
<blm> zsnes users are the flatearthers of emulation
Aha, so it's SWR's rip of FuSoYa's screen scrolling pipes, and not the VWF patch.
That one is indeed a crazy coder. Here you go. As expected, it works perfectly with the weird defines being replaced with labels.
Silly SWR, code alignment has no effect on a 65c816.

...oh, and I just remembered that SWR hates Asar.
My only feeling about that is "serves him right".
<blm> zsnes users are the flatearthers of emulation
bah, why am I never done with this thing
  • Made asardll.h and asardll.cpp work if compiled as both C and C++, and renamed asardll.cpp to asardll.c, for greater compatibility with other languages (hi, Objective-C). As an effect of this, the library name argument has disappeared from asar_init, but renaming the library is a violation of my license anyways, so I don't care. If your build system only cares about .cpp files, just create an asardll.cpp that #includes "asardll.c".
  • Reworded the documentation for prot, because imamelia got confused by it. It isn't the most obvious command.
  • base off is now a valid operation. It tosses the base address back to the current code insertion location.
  • New command: bank. It makes the label optimizer act as if it's in another bank. This is not the same as base; LDA Label,x : Label: db $01,$02,$03,$04 will use 24-bit addressing for the LDA if bank is active. It's intended for long codes that assume the data bank register is not the same as the code bank register.
  • Asar now throws a warning if a freespace block appears to be leaked.
  • Adjusted "autoclean at the end of a RATS tag" error a bit.
  • Made Asar not read uninitialized/garbage memory if there's crappy content at the end of a macro.
  • Fixed infinite loop if a freespace of size 32768 is requested.
  • Added a copy of GPLv3 to, since LGPL is apparently meaningless on its own. These licenses are starting to get a little tricky.

  • JMP and JSR within the current bank with bank active has been fixed.
  • xkas appears to allow sublabels starting with numbers. Asar has been updated to do the same.
  • fastrom no longer messes up branches.
  • autoclean read3($123456) can now be used before the first org.
  • db ($04<<2)|($80>>1) no longer breaks due to unmatched parentheses.
  • Fixed problem with autoclean $123456, where it read a pointer from $123456 instead of removing $123456.
  • Fixed a crash if a freespace block protects itself.
  • Prefixing a command with @ will now make Asar not print warnings for that line.

Edit 2:
  • Removed most of the emulation mode. The only remaining change is that it makes Asar print the errors to stdout instead of stderr, since that quirk isn't fixable by editing the ASM files.
  • Fixed fastrom mode again... looks like I busted the freespace finder. I need some kind of automatic test suite.
  • Fixed crashes when closing Asar while waiting for input. I thought I fixed that long ago... must've been another tool.
  • Macro definitions are now ignored inside if 0 blocks.
  • Macros and incsrc may now be called inside if 1 blocks.
  • Locked banks $F0-$FF from usage. I misread something in bsnes' source code; they are not usable.
This should be the final one. It hasn't moved anywhere for two weeks.
Edit 3:
  • Added a random icon, to fit the Nordic theme of Asar's name.
  • Made asar_patch destroy the ROM if any errors are encountered, to ensure that nobody attempts to use a ROM that may contain subtle breakage.
  • A label can now be on the same line as a macro call.
  • Fixed the bug that makes macros look like they're called from themselves if the macro call is broken.
I need to stop thinking any version is final.

Edit 4: Killed a crash bug. Editing this post is getting boring.
<blm> zsnes users are the flatearthers of emulation
bumpety bump. I've been holding this one far too long.
  • freecode/freedata have been expanded: They now take an optional parameter containing comma separated parameters on how to hand out the freespace. Valid parameters are ram, noram, and static. ram tells Asar that this code needs the RAM mirrors and puts the code in banks 10-3F; noram tells Asar that the code (or table) does not need the RAM mirrors, and therefore uses banks 40-6F if possible; static demands that the freespace does not move; if it grows, Asar throws an error. freespace has also been added; freecode is a shortcut to freespace ram.
  • Added hirom support. Just use it like xkas: hirom : org $C00000 : JML Main. Also added norom, where the PC address is the same as the SNES address (not counting SMC headers); use this (and base) if you want to implement your own mapper (preferably in a macro), because copying address conversion codes to 50 places can get quite annoying.
  • Simplified table code, and made it accept assigning stuff to the = character.
  • Fixed fastrom again again again. What an annoying command.
  • LDY #Label>>16 (and LDA/LDX/etc) is now considered 8bit. This should reduce the need for explicit .b hints.
  • Labels before the first org/freecode/etc are now considered to be at $008000, not $FFFFFFFF. (They're still considered invalid.)
  • Asar can now use the last byte of the ROM as freespace.
  • Made the default value for untouched table bytes be more random, to make it more obvious that you're doing it wrong.
  • Some minor fixes in autoclean dl Label.
  • Lowered the recursion limit a bit. Looks like I can crash before hitting 5000 stack entries.
  • Repaired the ** operator.
  • Calling a function no longer hits a user-defined function starting with the name of called function.
  • You can now drop the extensions on both filenames, if you want to.
  • Fixed skip command, which previously only edited the base address for some crappy reason.
  • Asar now tries to not no longer parses defines inside if 0 blocks. Note that this doesn't help on single-line if statements; you'll need a multiline if if you want this.
  • Added !def := val, which expands everything inside the value before setting it (making !a := a!a a perfectly safe operation).
  • Added !def #= val, which expands the value into an integer and stores it into the define. !a #= 1+1 : L!a: is a valid operation.
The big changes are hirom and allowing static freespaces. The rest are bugfixes and some useless toys.
<blm> zsnes users are the flatearthers of emulation
Nice. You might want to update changes.txt, though, since it still says that there is no HiROM support (or, at least, no explicit command for it). In fact, why isn't there an actual readme? I know that almost everyone who uses Asar has already used xkas, but I still think it should come with some sort of user guide. You might not feel like taking the time to write one, though, I suppose.


I'm working on a hack! Check it out here.
Okay, I added freecode static and norom to changes.txt (too lazy to submit a new 1.20).
But writing proper documentation is boring, and I'm not sure where to start. It's a good idea, but I doubt it'll become anything more than an idea.

Edit: Wait a second, where did read1/etc go? I was planning on using them. Fixed.

  • Fixed an uninitialized value in the macro handling code that may (but usually doesn't) throw errors if a macro has no arguments.
  • Repaired partial incbin if the filename is quoted.
  • Added a few special cases for some functions, and adjusted some compiler flags. The result is dramatically improved performance.
  • Adjusted the string table a bit.
  • Increased the version number to 1.22.

Edit3: Fixed around ten broken SPC700 opcodes.

  • Fixed a phantom error if prot isn't used directly after a free* statement.
  • Fixed a bogus error if prot is placed at any of the first eight bytes of a bank.
  • Repaired autoclean, which appears to have broken a few versions ago.
  • Added SA-1 support. Syntax is sa1rom 0,1,2,3, where the four numbers are the bank numbers, 0 through 7. It's allowed to not give them; that will result in 0,1,2,3 being picked as default.
  • Added freespace finding support for hirom and sa1rom.
  • Fixed a crash bug if the ROM does not exist and couldn't be created.
  • Made Asar remove extranous quotes around filenames if a file is pulled to the Asar window.
  • Minor adjustment to the ROM title verifier.

  • Killed a bunch of moving label errors if a PROT is misplaced. No point throwing 300 errors for one misplaced line.
  • Moved the Errors were detected messages to stdout instead of stderr.
  • Fixed errors with prot being incompatible with fastrom.
  • Fixed an uninitialized variable.
  • Fixed a buffer underflow Valgrind whined about.
  • Rewrote the .NET library as a C# wrapper around asar.dll using P/Invokes, for better Linux compatibility (Mono really seems to hate C++/CLI). This also means that asar-clr.dll no longer exists.
  • Made errors not shred the ROM in the library frontend.
  • Zapped a null pointer bug in the library if a file was not found.
  • Nuked a bug where the library did not clear out previous errors when applying a new patch.

  • Removed some more files made useless by dropping asar-clr.dll.
  • Added support for db +1. There's no reason not to allow it.
  • Fixed a bug where db $12,$34 broke in the spc700 modes.
  • Fixed a bug where an invisible bank border was hit if a base command was used without an org command.

  • Zapped a phantom error if the code arch spc700-raw : org $010000 : db $00 is used.
  • Nuked some pointless errors with static freespaces.
  • Made freespace fixed a synonym of freespace static.
  • Made Asar try to autodetect whether the ROM is LoROM or HiROM. Homebrews default to LoROM.
  • Zapped a bunch of bugs with static/fixed freespace.
  • Killed a bug that crashed Asar if a line contained both commas and unmatched quotes. I could shrink the testcase down to two bytes.
  • Replaced the Press Enter to continue with the standard Press any key to continue prompt on Windows. It's a little distracting how it doesn't match anything else.
  • Refactored some parts of the math parser, to get rid of some possible escaping NaNs.
  • Added some #errors if no frontend is chosen, and edited some others a bit.
  • Adjusted Linux support a bit. Looks like it bitrotted.
  • Fixed some off-by-one errors in spc700-inline.
I've got an odd feeling nobody reads these changelogs.

  • Flipped the switch to autocorrect the checksum to on by default.
  • Nuked some double spaces in outputs.
  • Fixed sa1rom mapping breaking on everything except the first megabyte.
  • Fixed a couple of bugs with valid table files being rejected.

Edit (1.29):
  • Added an error message for mov (x)+,a in the SPC700 modes.
  • Nuked a bug making tabs not treated as spaces in all contexts.
  • Added -v and -version switches.
  • Fixed a bug where Label = 123 checked that there is an org in front. That thing shouldn't matter.
  • Removed the lock on $700000-$7DFFFF in HiROM. I don't know where SRAM is, but p4plus2 says it's not there.
  • Fixed a bug where the line number was removed if the last code block on a line crossed a bank border.
  • Edited the library API a bit.

<blm> zsnes users are the flatearthers of emulation
Bump because why not.

Changes in 1.30, sorted by approximate importance:
  • Added SuperFX mapper and arch superfx.
  • Unlocked $[F0-FF]:[8000-FFFF] in lorom again. Turns out bsnes only maps SRAM to the lower halves of those banks.
  • Added an elseif command.
  • Added && and || support to if/etc conditionals.
  • Reworked the Relative branch out of bounds errors a little, so it tells how far outside the bounds they are.
  • Added print dec($1234) and print hex(1234).
  • Attached my regression test suite in the source zip, in case some other programmers are interested. Ignore it if you just want to use or make Asar patches, you only have any reason to poke it if you're trying to edit Asar itself.
  • Reworded the 125 freespaces limit to make sure nobody can think there's a limit of 250 labels.
  • Made readN()ing and writing to the same byte in ROM well defined (it gives the same value as it had in the input ROM).
  • Added @include and @includefrom, which throws errors if Asar is invoked directly on them.
  • Added a -pause=<action> flag on the command line. Valid actions are "yes", "warn", "err", and "no" (default).
  • Made the size guesser a little smarter. It now assumes .b for LDA #$123456/65536.
  • Added a couple of synonyms to the single-bit SPC700 opcodes.
  • Killed a phantom error on the very rare code pattern db $80/(Label2-Label1) : Label1: : db 0 : Label2: and similar.
  • Adjusted the error messages read1/etc gives if the address is invalid.
  • Suppressed a couple of useless errors if labels are redefined.
  • Added underscore-prefixed versions of all builtin functions.
  • Added error-safe readN and canreadN.
  • Killed a couple of Invalid endif errors if an if statement is invalid.
  • Repaired nested pushpc/freedata.
Edit: Whoops, missed a slash.
<blm> zsnes users are the flatearthers of emulation
Very nice addition, Alcaro, especially the SuperFX one, this should make things easier for hackers that wants to learn the SuperFX instruction set.
Have you done anything to allow .bin files to cross banks? Last time I checked, Asar didn't like certain dynamic sprites for that reason, and I don't remember if that was ever changed.


I'm working on a hack! Check it out here.
Just allowing incbin to cross banks would throw the label access optimizer off track in various ugly ways, and it'd make the freespace finder not have any idea where in the bank the freespace should start. Therefore, I'll need a new command for this, and I haven't figured out which syntax it should have, so I haven't made it.

tldr: No, there is no such button, though I agree that it would be a welcome addition.
<blm> zsnes users are the flatearthers of emulation
I dunno if there's a function like that but since I work with Genesis ASM, sometimes we could use decimal numbers without relying too much on the hexadecimal numbers, for example:

move.w #60,(Super_Sonic_frame_count).w
tst.w (Ring_count).w

"#xx" - Decimal ; "#$xx" - Hexadecimal

The code is loading the decimal number 60 but it's assembled in hexadecimal, thus making a bit easier when messing around with some values, I think this function could be handy.