The nested macros are possible and should generally work, although they will exercise some not pretty parts of the code, and the maximum depth of nesting is limited (like 20 probably). So I can't promise there's no hidden bug nobody reported yet, but try it, it should work.![]()
NEO SPECTRUMAN(19.09.2020)
меня периодически достает такая бага
или может быть я чего то не вижу?
Код:SjASMPlus Z80 Cross-Assembler v1.17.0 (https://github.com/z00m128/sjasmplu Pass 1 complete (0 errors) Pass 2 complete (0 errors) test.asm(34): error: [IF] No ENDIF Pass 3 complete Errors: 1, warnings: 0, compiled: 14 lines, work time: 0.000 secondsв исходнике из которого я эту конструкция скопировал (упрощенно)Код:mode = 1 if mode = 6 lua allpass for temp_cnt = 0,255,2 do var = 0 if var > 65535 then var = 65535 end end endlua endif
ошибка происходит уже на pass 3
- - - Добавлено - - -
при этом если сделать
fix.asmКод:mode = 1 if mode = 6 include "fix.asm endif
то все работает...Код:lua allpass for temp_cnt = 0,255,2 do var = 0 if var > 65535 then var = 65535 end end endlua
так тоже без ошибокКод:SjASMPlus Z80 Cross-Assembler v1.17.0 (https://github.com/z00m128/sjasmplu Pass 1 complete (0 errors) Pass 2 complete (0 errors) Pass 3 complete Errors: 0, warnings: 0, compiled: 24 lines, work time: 0.000 seconds
Код:mode = 1 if mode = 6 lua allpass for temp_cnt = 0,255,2 do var = 0 --if var > 65535 then --var = 65535 --end end endlua endif
Последний раз редактировалось NEO SPECTRUMAN; 28.10.2020 в 01:25.
Ped7g(28.10.2020)
I get "error: [IF] No ENDIF" too, and I also don't see anything wrong about the code you posted = bug in sjasmplus.
Thanks for reporting it (I will let you know later when I will have time to investigate, what is happening, seems like the lua part derails the parser in wrong way, but I don't see the reason).
нужны нормальные временные метки с именами
типа
Код:temp_label ld hl,temp_label.f jp temp_label.b temp_label
или же нужно доделывание временных меток которые есть сейчас
так как сейчас такое не сделать
например чтобы отличать от цифр можно было бы использовать какойто дополнительный символКод:ld de,$5555 ld sp,$4555 ld ix,1f jp some_procedure 1 ld de,$6666 ld sp,$4444 ld ix,1f jp some_procedure 1 ld de,$7777 ld sp,$4333 ld ix,1f jp some_procedure 1
ld ix,1_f
1_f 100% not valid label
ld ix,1.f
но цифрами не очень удобно пользоваться
есть вероятность поставить ту что уже есть
и переход будет не туда
а с временной меткой у которой есть имя проблем бы не было...
сейчас случаем нет ограничения на максимально возможное число для временной метки?
Последний раз редактировалось NEO SPECTRUMAN; 09.11.2020 в 00:29.
С любовью к вам, Yandex.Direct
Размещение рекламы на форуме способствует его дальнейшему развитию
It must be positive 32 bit integer (maybe zero works too? So non-negative 32b integer.), i.e. ~2e9 numbers.
You can use the same number multiple times, the relative position is important, i.e.:
About your suggestion... feels like quite a big departure from the original concept (whatever you may think about it ... I rarely use temporary labels, feels usually wrong, but I don't write very complex projects). I will think about it more, but I don't see any nice "fit" to the current syntax, so feels like something to be discussed again when/if v2.0 happens...Код:1 daa jr 1f ; to cpl jr 1b ; to daa 1 cpl jr 1b ; to cpl
About your actual problem... maybe define juggling? I will try to prepare some example, what I have on mind (I need to verify first if it even works, my first simpler idea did NOT work).
fixed, the false IF-ENDIF block was reading lua script, finding the "if" inside lua, adding nest-level to the current conditional block.
In v1.17.0 use workaround, hide the lua script definition inside macro or include (as you figured out).
NEO SPECTRUMAN(11.11.2020)
проблема возникает когда
Код:1 jr 2b ;not in view ... 100 lines of code some code ... 100 lines of code 2 jr 1b ;not in view
при редактировании легко можно сделать ошибку
Код:1 jr 2b ;not in view ... 100 lines of code 1 jr 3f some code jr 1b ... 100 lines of code 2 jr 1b ;not in view ;wrong jump !!!!!
и все перестнет работать...
- - - Добавлено - - -
в оригинальном концепте
метки не могут начинаться с цифры
а шестнадцатеричные цифры должны обязательно начинаться с символа $ # 0x или заканчиваться на h
и по идеи любые *f *b не могут быть valid numbers-ами
почему такая конструкция это правильно
а такая нет ?Код:label ld hl,label jp label
выглядит как недоделка компилятораКод:1 ld hl,1b jp 1b
когда добавляли временные метки
или не учли такого варианта использования
или просто забыли
в придачу если имеется в виду именно переход на $001b
и будет временная метка 1
то всё скомпилируется совершенно не так как нужно
изначальные вариант ставить B и F сразу после цифры
не есть правильным
нужен был символ разделитель
но его изначально не сделали...
конечно если добавлять все это сейчас
может возникнуть вероятность появления несовместимостей со старыми исходниками...
Последний раз редактировалось NEO SPECTRUMAN; 11.11.2020 в 02:35.
Da. Temporary labels *smells*.(but sometimes they may be handy, like in macro which is used many times, and you don't want to insert many new symbols into label table in the listing file)
that's a valid way how to write binary number in sjasmplus (suffix form with "b" at end).
It's actually super annoying to me, because:
The risk of real collision in source is very low, but I dislike this feature, feels like it was added by somebody not foreseeing the ambiguity.Код:1000 jp 1000b ; jumps back to the temporary label, not address 8 ld hl,1000b ; HL = 8
Anyway, the solution is simple, don't use temporary labels.
But I guess your original problem is about generating some code by generator or what... making some "previous/next" label handy?
в данном случая я хотел использовать для имитация call
когда занят SP
я очень сильно не люблю конструкции типа
jp $+5
так как проблем от них когда нужно добавить даже 1 байт между...
поэтому хотел сделать с временными метками внутри dup цикла
по типу
dup 100500
;some code
ld ix,label
jp some_procedure
label
edup
some_procedure
;some code
push bc
jp (ix)
сделать макросами не получится так как вокруг сплошная LUA
Последний раз редактировалось NEO SPECTRUMAN; 11.11.2020 в 06:05.
Эту тему просматривают: 2 (пользователей: 0 , гостей: 2)