User Tag List

Страница 11 из 70 ПерваяПервая ... 789101112131415 ... ПоследняяПоследняя
Показано с 101 по 110 из 699

Тема: SjASMPlus от z00m

  1. #101

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

    Angry

    4 часа пытаюсь заставить sjasm скомпилировать подобный код...


    Код:
    aaa = 0
    	lua allpass
    		_pc("if aaa = 0")
    		_pc("defb $ff")
    		_pc("defb $ff")
    		_pc("defb $ff")
    		_pc("defb $ff")
    		_pc("endif")
    
    		_pl("	if aaa = 3")
    		_pl("	defb $f0")
    		_pl("	endif")
    	endlua


    SjASMPlus Z80 Cross-Assembler v1.07 RC7 (build 02-04-2008)
    Test.asm(11): error: Unexpected end of file


    Pass 1 complete (0 errors)
    Pass 2 complete (0 errors)
    Test.asm(11): error: [IF] No ENDIF
    Test.asm(18): error: ENDIF without IF/IFN/IFUSED/IFNUSED/IFDEF/IFNDEF
    Test.asm(20): error: [IF] No ENDIF
    Test.asm(22): error: ENDIF without IF/IFN/IFUSED/IFNUSED/IFDEF/IFNDEF
    Pass 3 complete
    Errors: 4, warnings: 0, compiled: 17 lines, work time: 0.000 seconds
    но при этом одни $00

    заставить сделать if не получается никак

    на pass1 pass2 pass3 отдельно тоже без результатно

    просто все стало на этой ХЕРНЕ

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



    Ped7g, а нельзя сделать что то типа такого?

    defarray the_array

    the_array[1] = 4
    the_array[5] = the_array[4] + 1
    the_array[counter] = 2



    или такое

    {0} = 3
    {5} = 3
    if {$4000} = 5
    nop
    eif
    Последний раз редактировалось NEO SPECTRUMAN; 03.07.2019 в 00:53.

  2. #102

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

    По умолчанию

    About LUA approach: if it's "complete" block of code, you can extract the if/def logic into lua, emitting only instructions
    I guess I have some idea why it fails like this, and I think I was already fixing similar case for something else? Can't remember... I may take a look later if it's possible to make similar LUA code generator work, your idea seems valid to me.

    About defarray: I really don't want to, that feels like can of worms being opened ... defines feel to me more like C preprocessor than actual script language
    when you write "the_array[1] = 4", the line is substituted very early right after reading buffered input into "3 = 4", then are the directives/instructions being parsed. What you propose would require to parse this array-assignment directive ahead of substitution, adding like whole new step in the compiling "pipeline". Maybe it would work well (or maybe it would backfire later), but it really feels like changing defines into something what they are not.

    About memory approach: {0} = 3 is `ORG 0 : DW 3`, so this part is not a problem, but the `IF` part is problem, because pass1 and pass2 will see {$4000} as 0, only in pass3 there will be real value... Thinking what you did want to achieve originally, this will not work either.

    As long as only fixed control variables are involved like "aaa", you can do that in the asm like:
    Код:
    aaa = 3
    bbb = $c0
       dup 10
         if aaa = 5 : db $ff : endif
         db bbb+aaa
    aaa = aaa + 1
    bbb = bbb -  $10
      edup
    But if you want "array" of control variables, then I'm afraid currently you must elevate *all* the logic into Lua, and write full code generator in Lua, can't think of good hack how to do that in asm/define way.

    I will take a look if there's a way to fix IF/ENDIF emitted by _pc from Lua script ... that sounds like something what "should" work, if you don't know the sjasmplus internals, and you just follow the documentation, so fixing this would be good. But it may be too difficult.

    I believe you can actually make that work if you will emit whole IF->ENDIF block into _pc/_pl, i.e. _pc("if aaa = 0 : db 1,2,3,4 : endif") -> that MAY work?
    But I'm not sure if it is enough for you to resolve all your issues.

    EDIT: the colons will actually break _pc, right? sorry, I don't have time to try it now, I have really urgent work project upon me, so sorry if my advice is broken. Will take second look later, when I will be more free from work.

    - - - Updated - - -

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

    v1.13.2 changelog:
    - OPT has now also "listoff" and "liston" commands
    - added to --syntax option: case insensitive instructions, "bBw" added/changed
    - new macro examples, minor fixes and refactoring
    - SAVETRD implementation refactored (more checks, less bugs, "replace" file feature)
    - operators "{address}" and "{b address}" are now official and documented

    Documentation http://z00m128.github.io/sjasmplus/documentation.html (or in the package/cloned source).
    Последний раз редактировалось Ped7g; 03.07.2019 в 08:42.

  3. #103

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

    По умолчанию

    Цитата Сообщение от Ped7g Посмотреть сообщение
    I believe you can actually make that work if you will emit whole IF->ENDIF block into _pc/_pl, i.e. _pc("if aaa = 0 : db 1,2,3,4 : endif") -> that MAY work?
    But I'm not sure if it is enough for you to resolve all your issues.
    нет это не работает
    да и мне нужно будет вставить много кода между if endif

    Код:
    		for all_addr_cnt1 = op_jptabs_haddr_start,op_jptabs_haddr_end,1 do
    		print (all_addr_cnt1)
    		temp1 = string.gsub("if op_addr_xxx = 0 : nop : endif","xxx",string.format("%x",all_addr_cnt1))
    		_pc(temp1)
    		end

    SjASMPlus Z80 Cross-Assembler v1.13.2 (https://github.com/z00m128/sjasmplus)
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    Pass 1 complete (0 errors)
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    Pass 2 complete (0 errors)
    32
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    33
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    34
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    35
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    36
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    37
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    38
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    39
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    40
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    41
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    42
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    43
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    44
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    45
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    46
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    47
    Test.asm(33): error: [IF] No ENDIF
    Test.asm(33): error: Unexpected: : nop : endif
    Pass 3 complete
    Errors: 32, warnings: 0, compiled: 61 lines, work time: 0.031 seconds
    - - - Добавлено - - -

    Цитата Сообщение от Ped7g Посмотреть сообщение
    because pass1 and pass2 will see {$4000} as 0, only in pass3 there will be real value...
    а сильно тяжело увеличить количество проходов?
    мне кажется что 3 прохода это маловато для работы сложных генераторов кода

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

    Цитата Сообщение от Ped7g Посмотреть сообщение
    But if you want "array" of control variables,
    мне нужен переменный набор переменных
    чтоб сделать подобный код

    Код:
    vars = 3
    
    a1 = 0
    a2 = 0
    a3 = 0
    
    ...
    if a1 = 0
    code
    a1=a1+5
    endif
    ...
    if a3 = 0
    code
    a3=a3+10
    endif
    
    a1=a1-1
    a2=a2-1
    a3=a3-1

    Код:
    vars = 200
    
    a1 = 0
    ...
    a200 = 0
    
    if a1 = 0
    code
    a1=a1+10
    endif
    ....
    if a200 = 0
    code
    a200=a200+44
    endif
    
    a1=a1-1
    a2=a2-1
    ...
    a200=a200-1
    а дальше будет генерироваться адреса для org-ов
    Последний раз редактировалось NEO SPECTRUMAN; 03.07.2019 в 14:44.

  4. #104

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

    По умолчанию

    а сильно тяжело увеличить количество проходов?
    мне кажется что 3 прохода это маловато для работы сложных генераторов кода
    It's long term goal to make it N-pass assembler (I think we are pretty close, maybe even v1.14.0 or v1.15.0).
    But `{ address }` will basically always return real value only in the last pass, again it's device memory, not script language.

    I mean, there is already LUA, so as long as you will write the whole code generator in it, you are golden, even in current sjasmplus version, but you must do all the dynamic logic in the Lua, to emit only final stream of instructions without conditionals/dups/macros/etc.. = "blocks".

    Of course it would be better if things like IF+ENDIF would work also in `_pc`, but it's problematic.

    Basically I need to collect all `_pc()` calls into buffer, and **then** parse it similarly like "include", so if you have 100 lines of Lua script doing _pc(...), you would learn about 14th line using invalid instruction after the `endlua`, not at 14th `_pc(...)`, which is not good error reporting...

    Or I need to rewrite whole internals to regular C++, where Lua script would be just another input stream like reading the file and the rest of assembler would have no idea the code is produced by Lua - I'm afraid this one will not happen due to my time (but maybe the sjasmplus/sjasmplus branch can make this one work, that source is now lot more proper C++ and better style quality, maybe there it needs only few changes)

    Or maybe I can do another hack... add `_pc_buffered(...)` so people like you have at least some option, even if the error reporting will be delayed down to `endlua` line.

    ... still not much time, so I didn't study your ending example yet, sorry, will try to take a look during weekend or so.

    - - - Updated - - -

    I did take a quick look at the ending example, and I don't get it, can't tell which parts are unique and which can be calculated/generated... like why a1+5 in case of 3 vars and a1+10 in case of 200, and why do you even change those variables, if you don't repeat the whole block, etc...

    Mind you, you can create dynamic amount 1..N of labels through a bit of hackery with DUP (with MAX_N repeats) and macros with partial name substitution, but those constant coefficients in those IF/ENDIF then has to be calculated or form some fixed array. But I guess the end result would be very difficult to read and maintain.

    I'm still not sure why you don't use full Lua generator, if you need such complex stuff, I would expect it to be even easier to write, if you are experienced in Lua (unfortunately I am not, I'm just beginner).

    - - - Updated - - -

    And colons in _pc("nop : nop") are like different topic, that thing is maybe easiest to fix from this whole discussion ... (but still not that easy, even that may be complicated, probably not 2-3 lines fix).

  5. #105

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

    По умолчанию

    Цитата Сообщение от Ped7g Посмотреть сообщение
    I'm still not sure why you don't use full Lua generator,
    а как мне организовать переменный набор переменных в lua?
    опять же было бы там _write_to_memory(16384.255)
    и я бы как то выкрутился
    да и документации на lua которая встроена в sjasm нет
    неизвестно какие команды в ней есть а какие нет

    может там как то можно завести массив на 256 значений
    и использовать его

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

    вот нагуглил такое
    Код:
        a = {}    -- new array
        for i=1, 1000 do
          a[i] = 0
        end
    пойду пробовать
    заработает ли подобное в lua sjasm-a

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

    Код:
    	a = {}
    	for i=1,1000,1 do
    	a[i] = i*2
    	end
    	print (a[3])
    	print (a[6])
    	print (a[10])
    на вид работает

    Код:
    SjASMPlus Z80 Cross-Assembler v1.13.2 (https://github.com/z00m128/sjasmplus)
    6
    12
    20
    Pass 1 complete (0 errors)
    6
    12
    20
    Pass 2 complete (0 errors)
    6
    12
    20
    Pass 3 complete
    Errors: 0, warnings: 0, compiled: 18 lines, work time: 0.000 seconds
    - - - Добавлено - - -

    Цитата Сообщение от Ped7g Посмотреть сообщение
    I'm still not sure why you don't use full Lua generator, if you need such complex stuff, I would expect it to be even easier to write,
    ну это должна быть надстройка уже над готовым кодом
    в которым тоже куча своих if endif
    а результат работы lua кода должен быть специальный адрес для org
    так что переписать на lua может не получиться...

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

    Цитата Сообщение от Ped7g Посмотреть сообщение
    I'm still not sure why you don't use full Lua generator
    и как мне сделать на lua такое?


    lua (use code_size)

    code
    defb $01
    defb $01
    code_end
    code_size = code_end - code


    lua (use code_size)

    code
    defb $02
    defb $02
    defb $02
    code_end
    code_size = code_end - code

    lua (use code_size)

    code
    defb $03
    defb $03
    code_end
    code_size = code_end - code

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

    Ped7g, а еще в целях отладки не хватает pause
    чтоб через display и print ()
    можно было пошагово проследить
    правильно ли идет сложная генерация кода

  6. #106

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

    По умолчанию

    В общем пока ничего не получается...

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

  8. #107

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

    По умолчанию

    Вопрос от AloneCoder. Сам по каким-то причинам он не может его задать здесь, а на почту как он говорит ответа не дождался.


    Hello!

    We are developing a new operating system for Speccy, NedoOS: http://nedoos.ru/
    Recently I tried the new version of sjasmplus.
    It's very nice because now it can export labels in 0..3fff.

    Can you please restore support for backslash-escaped characters in single-quoted character constants? Rationale: it was supported in v1.07, and it's used in NedoLang output (it exports constants directly from *.c).

    Also I see, support for UTF8-encoded sources was dropped, so it shows an error at the beginning BOM marker. Can you please restore it? There was a bug previously: BOM marker should be followed by a blank line.

    One more question: is it possible to remove the following messages in the output:
    Pass 1 complete (0 errors)
    Pass 2 complete (0 errors)
    INCBIN: name=winto866 Offset=0 Len=256

    Pass 3 complete
    Errors: 0, warnings: 0, compiled: 2311 lines, work time: 0.047 seconds

    And make error lines RED? That's crucial because there are so many programs in the project.

    Thanks!
    Zx-Evolution rev.c
    ZS Scorpion 1024K rev.2013

  9. #108

    Регистрация
    24.12.2006
    Адрес
    р.п. Маслянино, Новосибирская обл.
    Сообщений
    5,605
    Спасибо Благодарностей отдано 
    254
    Спасибо Благодарностей получено 
    268
    Поблагодарили
    187 сообщений
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от Demige Посмотреть сообщение
    Сам по каким-то причинам он не может его задать здесь
    Гордость?
    ___________

  10. #109

    Регистрация
    28.02.2006
    Адрес
    г. Тольятти
    Сообщений
    442
    Спасибо Благодарностей отдано 
    118
    Спасибо Благодарностей получено 
    82
    Поблагодарили
    53 сообщений
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от ZX_NOVOSIB Посмотреть сообщение
    Гордость?
    Он же забанен, вроде.

  11. #110

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

    По умолчанию

    Цитата Сообщение от Demige Посмотреть сообщение
    Can you please restore support for backslash-escaped characters in single-quoted character constants? Rationale: it was supported in v1.07, and it's used in NedoLang output (it exports constants directly from *.c).
    hmmm... maybe as extra --syntax option, but not sure if/when...

    I have a suspicion it's a bit more difficult than it may seem ... although maybe if I would treat apostrophe the same way as quote, it would work as long as you will not try to break it ... i.e. 'don\'t do it' would parser see as "don\'t do it", which would work, but then <apostrophe><quote><apostrophe> would be invalid (would need <apostrophe><backslash><quote><apostrophe> to work), and 'text" would become valid (!)... if such hack is enough for you, maybe it will happen. But to do it properly would basically need two versions of buffered-reader and line parser code, as both are hardcoded to parse strings as defined in the documentation. Basically I'm not a big fan of this idea.

    Also I see, support for UTF8-encoded sources was dropped, so it shows an error at the beginning BOM marker. Can you please restore it? There was a bug previously: BOM marker should be followed by a blank line.
    I don't recall it was even there, but maybe it worked due to some quirk... definitely good idea, I will make a note to my TODO. But you can also just strip the BOM marker out of the file... I have to do that pretty often in our commercial Android projects.... I think in some projects I have even some batch shell script to scan all the files and cut it out where it's found. I think in linux world BOM marker is not that important, not sure about elsewhere. (that's like "workaround" suggestion, I will try to fix BOM parsing in future)

    One more question: is it possible to remove the following messages in the output:
    Pass 1 complete (0 errors) ...
    --msg=none|war|err

    And make error lines RED? That's crucial because there are so many programs in the project.
    hmm... maybe... but if you are building from IDE/text editor, they usually do it for you, like for example this is how it looks on my machine in Kate:

    Нажмите на изображение для увеличения. 

Название:	Kate_error_parsing.jpg 
Просмотров:	707 
Размер:	23.8 Кб 
ID:	69455

    ... so, depends what you are using, also if you are using command line, then you can also catch output into file and open it in text editor...
    This is also small asnwer for NEO SPECTRUMAN, if I understand his problem correctly? ("Ped7g, а еще в целях отладки не хватает pause")

    you can do `sjasmplus --some-options file.asm 2> error.log.txt` and open that in the text editor, then you can use Search all to highlight Error lines... (but warnings/errors are now channelled to STDERR, not STDOUT, so you must redirect with "2>", not simple ">" or "1>")

    - - - Updated - - -

    But I'm glad you find sjasmplus useful... hopefully some of these will make it even more useful... I'm kinda really unhappy about that apostrophe thing, sjasmplus had this syntax defined long time ago, I just fixed the parsers, it was not my idea. And for assembler purposes the "no escaping" is often helpful, while in C/C++ I think the escape-always makes more sense. ... I would like lot more if you would fix your output instead to produce "correct" asm source..
    Последний раз редактировалось Ped7g; 05.07.2019 в 22:33. Причина: Here we go again, fighting zx-pk.ru forum eating backslashes ahead of quotes...

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

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

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

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

Ваши права

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