
Сообщение от
NEO SPECTRUMAN
это удвоит видимый размер кода в 2 раза
который и без того плохо читается
well... the original sjasmplus design has some limits... but in some cases (in your original example) you can swap the order:
Код:
cnt = 0
cnt = cnt + 4 : ld a,b
cnt = cnt + 7 : and $70
Because the `ld` and `and` does not use `cnt`, it doesn't matter if you have it ahead/after the instruction. (you can even remove the colon if you like it more without, the parser will parse only valid expression for the "=" (alias DEFL), and then it will try to parse instruction after, but I would personally use colon. (although colon will split it in listing file to two lines, if that is your problem)
If the ld would be using `cnt`, then you can't swap them easily, but you can do `ld a,cnt-4` to load the "old" value before +4 ... it's ugly, but should work too.
Wait a second, are you trying to count T-states of instructions? :-o
That's ... interesting ... looks a bit dumb approach at first sight, but actually may be valid approach. But seems really tedious, omg.
I wouldn't want to create this manually.
But in such case you can leave the T-state counter at beginning of the line, if you indent the instructions enough, it may be even not-that-bad on reading the source.
But makes me wonder if it would be better to somehow calculate it, but there's no simple way. Even if you would create some horrible macro to calculate T-states of particular block reading the device memory, it's valid only in pass3, so for first two passes the calculated T-states would be 0 all the time, ruining the conditional assembling of later blocks.
Other option is to use the IDE/editor plugin to calculate the T-states for selected block (there's Z80 meter plugin for VSC doing this), and do the cnt = cnt + XYZ after full block adding just one total number.
Either way, feels a bit messy, but I have no better workaround for you.
-------------------------
About binary DISPLAY, how about:
Код:
DISPLAY "value ",/B,123
--> outputs:
> value %0111'1011
I'm not sure about the group-separator in the middle... the C++ syntax is apostrophe (also supported by sjasmplus), but if you will later parse such data in Excel or something, the apostrophes will probably derail the tool a lot... then again you can always use `sed` to remove them from the log before processing it further, and the separator helps to find the 4bit group... So I guess I will do it like this, with the separator.