
Сообщение от
breeze
nop. SjASMPlus Z80 Cross-Assembler v1.18.3
I think it physically cannot detect trailing spaces, since the text in this case is not in quotes.
I'm really failing to replicate this:
Код:
ped@ped7g-sb:~$ sjasmplus-1.18.3 --version
SjASMPlus Z80 Cross-Assembler v1.18.3 (https://github.com/z00m128/sjasmplus)
ped@ped7g-sb:~$ sjasmplus-1.18.3 - --msg=lst
define appName testapp ; Краткое название приложения
LUA ALLPASS
sj.insert_define("SAVEPATH", '"install/bin/' .. sj.get_define("appName") .. '1"')
ENDLUA
db SAVEPATH
# file opened: console_input
1 0000 define appName testapp ; Краткое название приложения
2 0000 LUA ALLPASS
3 0000 ~ sj.insert_define("SAVEPATH", '"install/bin/' .. sj.get_define("appName") .. '1"')
4 0000 ENDLUA
5 0000 69 6E 73 74 db "install/bin/testapp1"
5 0004 61 6C 6C 2F
5 0008 62 69 6E 2F
5 000C 74 65 73 74
5 0010 61 70 70 31
6 0014
# file closed: console_input
I know this is not important for you, but makes me wonder what is happening and if there is some other bug in sjasmplus, that's why I'm poking into this detail. The trailing spaces should be now removed from DEFINEs. Maybe you have the DEFINE in some other code path like IF/ENDIF block or inside MACRO, or I don't know... interesting. If you will find some time, can you try to produce full example where v1.18.3 fails to remove the trailing space? Thank you.
About string operators in sjasmplus - there are none, unfortunately. For any complex string manipulation the best way is to use lua script. The hack to figure out length by `ORG` macro is usable when in DEVICE mode, but would ruin the output in raw/OUTPUT mode (although you can open OUTPUT file for rewrite and rewind position back, I would probably rather opt for lua solution instead).
Macro arguments to lua -> definitely possible, there is some test/example somewhere... Check this test in particular and whole folder "lua_examples" and maybe also "macro_examples": https://github.com/z00m128/sjasmplus...macro_arg2.asm
Not sure if it will answer all your questions/issues, but maybe you will be able to pick up some trick or two.
I'm following this conversation a bit half-minded as I'm focusing on some work stuff, so in case you are waiting for some example from me or you are stuck with final version of your attempt, post that as new post clearly saying you expect specific help from me, otherwise I may miss it (right now I think you are trying to resolve it all yourself, so I'm giving you just pointers where to look, not preparing any full example).
EDIT: actually going through that example, that's not useful for string manipulation... the older https://github.com/z00m128/sjasmplus..._macro_arg.asm is then probably more relevant, but I'm still not sure how well the string is passed through, I would have to write some actual code and test it to be 100% sure how it works. "It should be possible" is all I can say at this moment.