User Tag List

Показано с 1 по 10 из 699

Тема: SjASMPlus от z00m

Комбинированный просмотр

Предыдущее сообщение Предыдущее сообщение   Следующее сообщение Следующее сообщение
  1. #1

    Регистрация
    10.05.2019
    Адрес
    Prague, Czech Republic
    Сообщений
    229
    Спасибо Благодарностей отдано 
    51
    Спасибо Благодарностей получено 
    103
    Поблагодарили
    77 сообщений
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от Shadow Maker Посмотреть сообщение
    Basically I only want to see readable text inside same file. If we use some external convertor, then it would mean I have to:
    1. Do a sh script which will compile everything
    2. Do a generator, which will generate converted db "abwgde" strings.asm file and include that strings.asm file in main asm file
    ...
    I would rather suggest option 1 for medium-large projects, as you can benefit from using tools like Make quite a bit. But let's assume you don't want to.

    SHELLEXEC will execute first time in third pass, so any INCLUDE of results in first/second pass will have nothing to include. You can wrap INCLUDE in `IF 3 == __PASS__`, but that will probably cause different issues with labels changing values in final pass.

    So if you really want to convert it from inside the .asm source, lua script is the only option (as lua script can execute already in first pass). I haven't tried it myself, but I guess you can call `iconv` from lua, cache the result for following passes, and add the bytes from the result every pass, like Neo shows with `sj.add_byte(...)`.

    Also another option is to edit your sources in cp1251 or dos-866 encoding, depends on your editor, but I'm using Kate, and it does remember the encoding I was using for particular file, so once I switch it from utf-8 to something else, I can edit whole source in different encoding.

    So with utf-8 files - in the end you can have macro `db_cp1251` and call it like:
    Код:
        db_cp1251 "some text"
    which will call the lua script, and receive the converted bytes.

    Syntax like "db 'РУССКИЙ ТЕКСТ' | strConvert" is problematic, as pipe is already binary-or operator, etc... plus you would have to wait until somebody creates the fix, while you can add macro+lua script with current sjasmplus (maybe not "easily", I would need to google a bit for lua syntax to write it, but should be like hour-two of work, let me know if you can't figure it out)


    Цитата Сообщение от NEO SPECTRUMAN Посмотреть сообщение
    а так мне иногда приходится жутко коверкать название меток
    чтоб только обойти этот долбанный баг с define
    а теперь еще таже гадость объявилась в макросах
    well, I'm pretty sure the macro arguments were sensitive to the old bug too. If Alone coder writes source like this, and it works in older sjasmplus versions (1.07), it may be just one change in label/macro argument away from breaking. The 1.12.0+ will break consistently always.

    I guess you don't find it funny.... fair enough. But I'm not sure how to resolve it... maybe disabling mid-word substitution globally by some option? That sounds actually quite OK, it can help with importing project from different assemblers, and it would be optional change. - I can imagine adding this.

    I don't like the idea of doing the "correct" fix (for "v1.x"), switching mid-word substitutions to identifiers with underscore only, it makes lot of sense on syntax level, but would break other sources which depend on the current substitution. (if I ever create some "v2.x", I'm definitely going to change the substitution rules, current situation is not good ... but I have currently no plans/timeline to work on "v2.x", not any time soon)

    - - - Updated - - -

    Цитата Сообщение от NEO SPECTRUMAN Посмотреть сообщение
    вот
    Code:

    lua allpass
    function angry_russian_text(string)
    But this works only if your current source encoding is cp1251? Lua doesn't do utf8->cp1251 conversion, right?? (too lazy to try)
    But if you have source already in cp1251, you don't need to do anything, just use regular DB like `DB "Злые русские пишут злые русские тексты"` - it will work.
    Последний раз редактировалось Ped7g; 22.03.2021 в 17:18.

  2. #1
    С любовью к вам, Yandex.Direct
    Размещение рекламы на форуме способствует его дальнейшему развитию

  3. #2

    Регистрация
    22.05.2011
    Адрес
    г. Дзержинск, Украина
    Сообщений
    6,829
    Спасибо Благодарностей отдано 
    483
    Спасибо Благодарностей получено 
    663
    Поблагодарили
    513 сообщений
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от Ped7g Посмотреть сообщение
    But if you have source already in cp1251
    Цитата Сообщение от Ped7g Посмотреть сообщение
    DB like `DB "Злые русские пишут злые русские тексты"` - it will work.
    у меня компилирует db и с utf8 (вроде бы)
    а нужный конвертер можно написать на lua
    Последний раз редактировалось NEO SPECTRUMAN; 22.03.2021 в 17:44.

  4. #3

    Регистрация
    10.05.2019
    Адрес
    Prague, Czech Republic
    Сообщений
    229
    Спасибо Благодарностей отдано 
    51
    Спасибо Благодарностей получено 
    103
    Поблагодарили
    77 сообщений
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от NEO SPECTRUMAN Посмотреть сообщение
    у меня компилирует db и с utf8 (вроде бы)
    yeah, of course sjasmplus will also assemble UTF8 source file, but then the resulting machine code is also UTF8 string, which is probably not what you want to process in Z80 assembly...

    Technically whatever binary values you have in source within quotes, the `DB` will emit 1:1 as is, nothing is damaged, except three values having special meaning: 0, 10 and 13. Those three must be escaped like "\0\n\r".

    So the issue is how to write your source in utf8, but assemble into some other encoding like cp1251. And Czechs may want cp1250, etc, etc... there's hundreds of difference encodings.

    The more we discuss it, the more I'm inclining toward these preferences (from the most simple and robust to worst):
    1) edit the source in target encoding, if your text editor allows it
    2) iconv the whole source as part of the build step (I'm usually building from text editor, where I can enter the whole sequence `iconv | sjasmplus ...` for single-file projects, or I tend to use makefiles for multi-file projects)
    3) some lua script calling iconv from inside the asm (or implementing custom encoding which is not available in iconv set)
    4) ??
    10) enter in source the numbers instead of text like `msgTxt: HEX cc ed e5 20 ee e4 ed ee ec f3 20 ea e0 e6 e5 f2 f1 ff`

    Anyway, at this moment of time I believe the encoding translations should be not part of sjasmplus, so I don't plan to add utf8->cp1251. If you prefer the lua script for that, but you don't know how to create such "db_1251" macro, let me know, I will create more complete example.
    (^^ Shadow Maker ^^, but also anyone else struggling with it)

    The 8bit->8bit transformations - some magic syntax to define and use the translation easily -> this one would be nice addition, but I'm failing to see that magic syntax which makes it considerably better than what sjasmplus already could do now (you can for example put the translation table into the DEVICE memory, and use `{b table+char}` to translate it in expressions, or just calculate the value for cases like ASCII -> 5 bit, similar to this https://github.com/ped7g/ZXSpectrumN...cked.i.asm#L26 (although this example also packs the 5bit values into bit-stream, so it's more complicated than just simple conversion).

    But in summary, I have no plans to add anything to sjasmplus right now, in my eyes the current support is reasonable, and the missing bits can be filled in by iconv or macro/lua scripts.

    -----------------------------------

    NEO: so... how about the global option disabling mid-word substitution? Do you think that's a good idea? To enable macro/define identifiers like `x`, but not substitute them into `label_x` then.

  5. #4

    Регистрация
    22.05.2011
    Адрес
    г. Дзержинск, Украина
    Сообщений
    6,829
    Спасибо Благодарностей отдано 
    483
    Спасибо Благодарностей получено 
    663
    Поблагодарили
    513 сообщений
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от Ped7g Посмотреть сообщение
    NEO: so... how about the global option disabling mid-word substitution? Do you think that's a good idea? To enable macro/define identifiers like `x`, but not substitute them into `label_x` then.
    лично я сейчас нигде не использую замену внутри слов
    а так как я пишу все слова через "_" и ненавижу unreadablewritestyle
    эта внезапная замена вызывает только проблемы
    тем более в командах от которых этого совершенно не ожидаешь

    я бы сделал это отключение по умолчанию

    но при этом было бы не плохо иметь midword_define midword_macro по отдельности

    я уже много раз просил команды которые бы меняли все что угодно несмотря не на что
    (как автозамена в любом текстовом редакторе)
    по типу replaceall "44 l" "abc"
    с результатом
    label44 ldir
    |
    V
    labelabcdir



    - - - Добавлено - - -

    Цитата Сообщение от NEO SPECTRUMAN Посмотреть сообщение
    эта внезапная замена вызывает только проблемы
    кстати
    можно же писать все аргументы макроса вот так

    macro maaacro X
    label_x = X
    endm

    я уже пишу все что для difine через UPPERCASE чтоб не конфликтовало с ****_***
    можно же такое делать и с макросами

    но опять же
    это лично я сижу в этой теме
    и уже знаю некоторые не очевидные тонкости поведения sjasm
    но другие же тут не сидят и не знают
    и спотыкаются об это
    Последний раз редактировалось NEO SPECTRUMAN; 23.03.2021 в 13:42.

    Этот пользователь поблагодарил NEO SPECTRUMAN за это полезное сообщение:

    Ped7g(23.03.2021)

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Похожие темы

  1. SjASMPlus Z80 кросс ассемблер
    от Aprisobal в разделе Программирование
    Ответов: 1663
    Последнее: 19.06.2021, 01:36
  2. Исходники TR-DOS для SjASMPlus
    от Keeper в разделе Программирование
    Ответов: 20
    Последнее: 11.02.2011, 11:57
  3. Запуск STS из .sna, сгенерированного sjasmplus.
    от siril в разделе Программирование
    Ответов: 7
    Последнее: 11.10.2010, 21:33
  4. Breakpoints в связке Sjasmplus+UnrealSpeccy
    от Kurles в разделе Программирование
    Ответов: 19
    Последнее: 26.01.2009, 12:36
  5. Disturbed COverMAnia ( music disk with z00m music collection)
    от kyv в разделе Музыка
    Ответов: 10
    Последнее: 27.03.2008, 10:01

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •