User Tag List

Страница 13 из 70 ПерваяПервая ... 91011121314151617 ... ПоследняяПоследняя
Показано с 121 по 130 из 699

Тема: SjASMPlus от z00m

  1. #121

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

    По умолчанию

    Цитата Сообщение от NEO SPECTRUMAN Посмотреть сообщение
    С low $ не будет правильно работать!
    Indeed, good catch. I will probably fix it by using _c("$&0x1F") in the official example, but your fix is correct too. (didn't verify my idea yet, but should be ok)

    это сильно не экономично!
    LUL. "... compiled: 119 lines, work time: 0.002 seconds" ... it's even less economic to comment on this point...

    и все таки нужно как то измерять количество байт в процедуре
    между allocateOpMemory и finishOpAllocate
    I'm not sure if I understand you... while inside the opcode-function code, you can measure byte usage at any particular spot by `code_size = $ - opcode_XX_impl` where "XX" is hexa opcode in lowercase (i.e. "opcode_1a_impl" for opcode 26 == 0x1a)

    I would need code size ahead before allocating memory for more optimal solutions, and that *is* problem. It can be probably worked around by defining each subroutine first as macro, and then assemble all of them twice, first time at $0000 to collect code size, second time at final destination. But such solution requires lot of cooperation, the macros for subroutines must be written in certain way, etc... not a prefect fit for generic example.

    завести массив с минимальным начальным адресом в странице

    чтобы можно было предотвратить перезапись кода
    и переместить процедуру в следующую свободную страницу
    *fresh new idea* Thinking about it... I can actually collect code-sizes during pass1 (unless the subroutine does something stupid with if/ifdef/dup to modify it's size between pass1 and pass3)... and use that info in pass2 and pass3 to create the final placement.

    That should be possible with current sjasmplus, maybe I will try to create it as "version 2" somewhere in the future.

    может будет проще
    добавить средства генерации таких таблиц в сам sjasm?
    I don't see how to fit that into sjasmplus in some nice versatile generic way. Also I already forgot all the "algorithm" stuff from the high school, so I can't even recall what was the optimal solution to "pack the boxes"... (can't even count how many times we had similar task at programming contests, hehe)

    If somebody will show me some good designs, how to do it (I mean designs of everything: syntax, docs, algorithm), and it will be compatible with current implementation, then it may happen, but so far only very few people did any kind of "pull request" with new improvements, and people who want to try must be prepared that I will comment on their code a lot and it may take several iterations before the code will be accepted.

    At this stage of development I don't want to spend my time on this, it's very specialized, while I have major general issues with labels, big memory and define substitutions.

    например мне нужно будет делать несколько таких таблиц одновременно
    при этом остается много места
    куда можно было бы поместить другие процедуры
    lua здесь уже не поможет
    или нужно индексировать каждый байт
    и искать свободное место немного по другому
    Lua is full scripting programming language. If your requirements needs O(N*M*K*J) complex algorithm, then so be it. Who cares. We are talking about hundreds of subroutines. I.e. even some ugly brute force O(N^4) on modern CPU will take maybe 10s to generate final machine code. I don't care. In my paid work right now I have Android Studio and I'm forced to use corporate notebook with windows and antivirus, so only "clean" of the project needs 20+ seconds (on my home notebook with linux the "clean" of large projects takes usually between 0.5s to 3s and most of that is that f*cking gradle starting up), and full rebuild takes 4 to 7 minutes. If I would have project build times at 10s, I would be super happy.

    The point is, that you *can* do it in Lua. You don't even need sjasmplus at all, you can just write machine code into file straight from the Lua script. It will be probably ugly and difficult to debug and maintain (the generator in Lua), and I would probably rather write it in C++, but stop crying in the way "it's not possible to do it in lua". It's just difficult and ugly, but by the Turing computational theory, if you can clearly (in computational way) specify the desired outcome, it surely can be calculated also in Lua. Or in Z80 machine code. Or in PHP. Or in hundreds of other programming languages.

    The question is not if it is possible, but which tool is best fit. For such complex generators the sjasmplus is currently a bit cumbersome. If you can do it better in some other assembler, just use it. Programming languages, compilators and assemblers are just tools. Pick the best one for your current task.

    And if you need more runtime memory, use ZX Spectrum Next ... ... 756kiB in base model, and some people will have them extended to 1.75MiB.... :P (or you can code for x86_64 and have gigabytes of memory available).

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

  3. #122

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

    По умолчанию

    Цитата Сообщение от Ped7g Посмотреть сообщение
    756kiB in base model
    православный zx evo имеет 4MB

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

    Цитата Сообщение от Ped7g Посмотреть сообщение
    while inside the opcode-function code, you can measure byte usage at any particular spot by `code_size = $ - opcode_XX_impl` where "XX" is hexa opcode in lowercase (i.e. "opcode_1a_impl" for opcode 26 == 0x1a)
    если измерять так
    тогда боюсь мне не хватит 3 проходов компилятора...

  4. #123

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

    По умолчанию

    You have basically only pass1 for any shenanigans. Pass2 should have already the same layout as pass3 (labels positions, machine code can differ).

    As far as I can tell what you are trying to do (place routines into memory = different labels), at the beginning of pass2 you must already know precisely how you will generate the final code (in the same way, in both pass2 and pass3).

    The N-pass will make this a bit more relaxed, that the requirement will be to have stable two passes (when lastpass == previouspass => finish assembling), but still it will have to happen in some reasonable amount of passes (probably configurable at command line).

    I still believe the N-pass will be substantially less universal (= more limited) than Lua itself, which is full scripting language surpassing by far any limits of 3-pass or N-pass assembling. Although it's pain to write, and it's pain to read such code generators back, and try to guess how they work...

    But maybe you have some nice idea for which the N-pass would be perfect fit, it's quite possible. The current 3-pass is sufficient only for simple straight assembler, any sort of more dynamic stuff is problematic.

  5. #124

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

    По умолчанию

    вроде бы написал какой то безобразие
    которое индексирует каждый байт
    ищет свободное место и втыкает туда процедуру...



    смайлики символизируют процесс написания...
    задолбался перебирать pass1 pass2 pass3...
    Последний раз редактировалось NEO SPECTRUMAN; 10.07.2019 в 17:30.

  6. #125

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

    По умолчанию

    The UTF BOM markers are now detected and skipped.
    Only UTF8 is of course "legal", UTF16/32 will cause fatal error, as the assembler is still 8bit ASCII only, with *some* support for the two DOS age Cyrillic encodings even for values, like DB "...". (The UTF8 Cyrillic characters are not correctly processed and will be NOT converted to target encoding (DOS 866, or some windows), i.e. UTF8 chars are legal only for comments or maybe for Lua parts, although not sure what you can do with them in Lua).

    It's just support to not die on the UTF8 BOM, and to correctly warn user that UTF16/32 are completely off limits.

    (pushed to github, will be released in next v1.13.3 ... which will happen no idea when, I'm thinking about adding few more small fixes, and release v1.13.3 maybe even next week, or maybe in another month... If you want it *now*, build from sources of course)

  7. #126

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

    По умолчанию

    PASS1 - interpret Lua script in first pass only.
    PASS2 - interpret Lua script in second pass only.
    PASS3 - interpret Lua script in third pass only. By default.
    ALLPASS - interpret Lua script in all passes. It is need, if you generate some Z80 code.
    не хватает
    PASS1,2
    PASS2,3
    PASS1,3
    приходиться дублировать один и тот же код!!!!!11111одинодинодин

    или нужна глобальная переменная из которой можно прочитать текущее состояние
    типа так
    if sj_pass = 2...

  8. #127

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

    По умолчанию

    You should always generate the same code in every pass. i.e. "ALLPASS" is usually the only correct setting (hmm, makes me wonder why it is not "default" if you write just "lua").

    The PASS1 / PASS2 / PASS3 are special extras, if you know what you are doing (PASS1 is OK to define global variables and functions in lua, although with ALLPASS you will just redefine them every time = usually works too).

    You can create the "pass" variable in lua like this:
    Код:
        lua pass1
            lua_pass = 1
        endlua
    
        ; ... some code
    
        lua allpass
            print("Lua pass: "..lua_pass)
            lua_pass = lua_pass + 1
        endlua
    But you should generate the same code at the same positions in every pass.

    If you understand how it internally works, you can get away by generating slightly different code in pass1 (the relative positions of labels must be valid already (and all labels must be emitted), but absolute positions in memory (and machine code emitted between) may change between pass1 and pass2, pass3 should be identical to pass2.

    edit:
    "приходиться дублировать один и тот же код!!!!!11111одинодинодин"

    I think I now better understand what you mean, and you don't understand it correctly, it's not "adding" code, like you can generate some code in pass1, some in pass2 and final in pass3.

    The assembler needs pretty much the identical source 3 times to produce correct machine code.

    The pass1 can look somewhat different than final one, although already *all* [global] labels and ideally in correct relative order should be defined, only some absolute positions may change. pass2 should produce the same source as pass3, any difference there may cause unexpected results.

    My comment about that dynamic allocator was going like this, to remember subroutine sizes from pass1 (where they would be allocated all into the same page, overwriting each other), and using that info at end of pass1 to calculate final positions for pass2 and pass3, but that must be done quite carefully to bend the assembling internal state correctly, to get correct machine code at end of pass3, it's a bit more advanced trick (you should probably read first source code of sjasmplus to understand how it works, before trying these kind of tricks).

    edit2:
    And if the N-pass will be added, that again does not mean you can add small bits of code in every pass, but it means that the dynamic source, which is seen by assembler (produced by lua/includes/dups/macros/...), must be identical between passN and pass(N-1). If you will keep changing the generated code, the N-pass will never finish assembling, as it waits for identical passes (well, it would error out on max-passes reached). So you need to design the dynamic parts like that, producing same source as early as possible (some difference between pass1 and pass2 are ok, some are not, pass2 and pass3 should be identical to be safe, although for example same-size opcode change like "nop" in pass2 vs "ret" in pass3 don't cause any harm, "ret" is produced in the final binary).
    Последний раз редактировалось Ped7g; 16.07.2019 в 09:09.

  9. #128

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

    По умолчанию

    Цитата Сообщение от NEO SPECTRUMAN Посмотреть сообщение
    вроде бы написал какой то безобразие
    которое индексирует каждый байт
    ищет свободное место и втыкает туда процедуру...
    собственно вот
    https://zx-pk.ru/threads/30694-vyrav...v-i-sjasm.html

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

    Ped7g(18.07.2019)

  10. #129

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

    По умолчанию

    https://github.com/z00m128/sjasmplus...es/tag/v1.13.3

    v1.13.3 changelog:
    - bugfixes, new examples (check tests/lua_examples)
    - UTF BOM are now detected, UTF8 BOM is silently skipped, UTF16/32 BOMs cause fatal error
    - ZXSPECTRUMNEXT device is now initialized with whole memory zeroed (no more ZX48 sysvars)
    - DEFL documented, "no forward reference" rule relaxed for EQU
    - some error messages reworded to make them easier to comprehend

    Documentation http://z00m128.github.io/sjasmplus/documentation.html (or in the package/cloned source).

    P.S.
    I managed to set up "coverage" measuring in the project, and connected it with web service coveralls.io:
    https://coveralls.io/github/z00m128/sjasmplus

    I'm already at 81% for base sjasm sources (excluding lua/tolua++ which are external projects), which I find "not bad", but in following days I will now use the coverage data to see which parts of sjasmplus lack testing, and add tests where appropriate (my guess is the optimal coverage for this project should be somewhere in 90-95% range).

    That will probably lead to few more bugfixes and release of few more v1.13.x versions of z00m's sjasmplus...

    But I think there will be no v1.14, but v2.0 after that, which will have some changes in default settings, so old sources (used with v1.13.x) may not compile and will require some small changes to "fix" them. (I already managed to break few things between 1.10.4 and 1.13.3, but those compatibility issues were due to desperate situations where it was very difficult to maintain old behaviour ... in v2.x I will break few more only due to "better style/syntax" reasons)

    So if you have some nice archive of sjasmplus projects, please test with v1.13.3 if they still work correctly, and report any bugs (if 1.13.3 fails and they work in v1.07 - v1.10.4 or in the mkoloberdin branch, try to read through "what's new" list in docs to see if your problem is actually announced change, like MAP removal back in v1.11 or when it was, etc).

    I will certainly try to support v1.13.x even after I will start working on v2.0, but only bugfixes and similar, no major rewrites or new features.

    The plans for v2.0 so far (may change easily):
    - n-pass
    - syntax tuned to be a bit more strict (similar to `--syntax=abf` in v1.13.3, but also with "keywords", so labels like "hl" will be not possible any more.
    - DEFINE substitution even more formalized and documented, with the algorithm adjusted
    - operators precedence changed to C++ precedence
    - more operators and better support for "large" memory devices like 4MiB soviet machines or ZX Next
    - some details here and there to make sjasmplus behave more similarly to common tools like gcc/clang (so various text editors supporting gcc/clang will probably work for sjasmplus reasonably well)

    As the amount of changes is considerable, and will need probably months of effort, the v2.x may just as well never happen (because I often get distracted by other projects), so take the list and plans described above more like a "dream", not a "promise".

    I still believe the sjasmplus v1.13.x is now very mature and solid tool, and can be used for Speccy SW development for another decade or two, even if we would release only few more bugfixes and nothing else.

    Thank you for all the support so far, and keep the feedback coming, bugs reported, etc, it's very important part of the project, and you helped a lot already. Thank you all.

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

    Dexus(24.07.2019)

  11. #130

    Регистрация
    21.01.2011
    Адрес
    г.Кстово
    Сообщений
    703
    Спасибо Благодарностей отдано 
    8
    Спасибо Благодарностей получено 
    5
    Поблагодарили
    4 сообщений
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Can you add support of defining big text blocks in source?
    Something like
    Код:
    LabelTXT DEFTXT 
    sometext
    another text
    blablabla
    ENDDEFTXT
    Zx-Evolution rev.c
    ZS Scorpion 1024K rev.2013

Страница 13 из 70 ПерваяПервая ... 91011121314151617 ... ПоследняяПоследняя

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

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

Эту тему просматривают: 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

Ваши права

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