Algorithms in assemblers...

ZXNet echo conference «zx.spectrum»

From Ilya Aniskovets To All 30 April 1997


Hi All!
Wednesday April 30, 1997 , 20:27 .

Here arose such voppos. following:

jr M1
defs M2,255
M1 ld hl,0
M2 equ 5
Or cheaper:

M4 equ 5
jr M1
e
defs M2,255
M3,M1 M4

With Best Regards,
Ilya .


From Dmitry Grigoryev To All 1 May 1997


Hello, Ilya!

Wednesday April 30, 1997 20:27, Ilya Aniskovets wrote to All:

IA> Here is a question..
IA> Is there any assembler on Speccy (ALASM,ZASM,TASM,...,??)
IA> right broadcast the following:

IA> jr M1
IA> defs M2,255
IA> M1 ld hl,0
IA> M2 equ 5
IA> Or more abruptly:

IA> M4 equ 5
IA> jr M1
IA> defs M2,255
IA> M1 ld hl,0
IA> M2 equ M3
IA> M3 equ M4

Ilya, you probably wanted to prove Masma’s coolness? Unfortunately, it
ds does not support tags :( In general, Masm is the coolest ASM that exists
now - I can prove this at any time (unless the glitches in Alasma have been
corrected).

Question for you - Masm 2, will there still be?

IA> With Best Regards,
IA> Ilya .


Regards, Dmitry (OLDMAN).


From Maxim Polyanskiy To All 2 May 1997

Definitely not, the values of the arguments of the operators DEFS, ORG, PHASE, EQU, etc.
Must be known in the 1st pass when compiling them.
And then what gets in the way:
M1 EQU 5
DEFS M1,255
And how do you imagine compiling such a piece (purely from the point of view view
program implementation of the compiler)?

DEFS M1,255
M1 EQU $

From Dmitry Grigoryev To All 3 May 1997

MP> Definitely not, the values ​​of the arguments of the operators DEFS, ORG, PHASE, EQU
MP>, etc. Must be known in the 1st pass when compiling them.

MASM can. But not with the operators DEFS and ORG... And in general it is implemented
incorrectly - sometimes it swallows it, sometimes it doesn’t.

MP> And then what interferes:
MP> M1 EQU 5
MP> DEFS M1,255

Yes, nothing interferes, in principle. But it frees up your hands ;)

MP> And how do you imagine the compilation of such a piece (purely from the point of view
MP> of the programmatic implementation of the compiler)?

MP> DEFS M1,255
MP> M1 EQU $

What's complicated here? The first pass determines the labels, the second - determines
undefined in the first and compiles.

MP> Bye! It was nice talking to Ilya!

Sincerely, Dmitry (OLDMAN).


From Konstantin Afendikov To All 4 May 1997

^^^^^^^^^^^
IA>> M3 equ M4
^^^^^^^^^^

DG> Ilya, you probably wanted to prove the coolness of Masma? Unfortunately, in it
DG> ds does not support labels :(
What then is the point in this example? And the fact that MASM understands EQU with
references to an undefined label is done _primitively_ without these same DEFS!
But with them... and with REPEAT....
DG> In general, Masm is the coolest ASM that exists now - I can
DG> prove this at any time (unless the glitches in Alasma have been corrected).
Prove it to me, even in an echo, even with soap! Or wait for the ZASM v3.10 demo, and then I
will be ready to listen to you. There will be nothing sensational there, but I doubted the
_coolness_ of MASM from the very beginning.

DG> Question for you - Masm 2, after all. will it be?
Yes, really! Will it be? And _what_ will be in it?

From Konstantin Afendikov To All 4 May 1997

DG> What's so complicated about that? The first pass determines the labels, the second - determines
DG> undefined in the first and compiles.
On the first pass, when creating a table of labels, a variable such as the compilation address is increased and the value of the label (not constants, i.e. EQU 5) is equated
to this variable. In this example, if you do everything as it should, the computer should
freeze and fill all the memory with code 255. I explain:
Pass 1.
Let's say ORG 25000. Then comes DS M1,255. According to DG, we're just skipping it... okay. M1 EQU $ -> M1=25000.
Pass 2.
ORG 25000. DS 25000.255. Fill 25000 bytes with code 255. ok. $=50000
M1 EQU $ -> M1=50000 !!! Oops! Not good, let's do it again. So?
Pass 3. (Wow!)
ORG 25000. DS 50000,255....etc. to infinity.
This is if everything is according to the rules. And if it’s simple, then there will be glitches.
And you say _What_is_complicated_?

From Dmitry Grigoryev To All 5 May 1997

DG>> I can prove it at any time (unless the glitches in Alasma
DG>> have been corrected).

KA> Prove it to me, even in an echo, even with soap!

And in Alasma the glitches have been fixed ;-) So, it’s cooler than Masma.

KA> Or wait for the ZASM v3.10 demo, and then I’ll be ready to listen to you.
KA> There won't be anything sensational there,

That is, there won't be not only something that is not in other editors, but also something
that others already have? Then why wait for her?

KA> but I initially doubted the _coolness_ of MASM.

Have you tried working in it? Or did you immediately move from gens to zasm?
He was _cool_ regarding Tasma, Zasma, Xasma and the unfinished Alasma...
Moreover, he was cool in such indicators as the size of memory for the text, the speed
assembly, the size of himself...

From Konstantin Afendikov To All 6 May 1997

DG> Have you tried working there? Or did you immediately move from Gens to ZASM?
Immediately moved from TASM3 to ZASM2.5. Then I wanted to move to MASM (_only_
because of the speed) and that's when the idea to make ZASM3 was born. So Thanx 2
MASM! G8)
DG> He was _cool_ regarding Tasma, Zasma, Xasma and the unfinished
Now _was_, then _of_the_existent_now_ . How can I understand you? 8-\
DG> Alasma... Moreover, it is cool in such indicators as the size of memory for
DG> text,
In ZASM3 - 30383b.
DG> assembly speed,
ZASM3 is 1.4 times faster.
DG> the size of itself...
ZASM3 is larger. But in general, I don’t like these _more or less_. That was the flame
SPF-ZXF, then ZXNet-SpbZXNet, now there will also be asmas.

From Konstantin Afendikov To All 6 May 1997


Hello, Dmitry!

Monday May 05, 1997 11:08, Dmitry Grigoryev wrote to Konstantin Afendikov
these words:


DG> Sun May 04, 1997 11:59, Konstantin Afendikov wrote to Dmitry Grigoryev:

KA>> _Imho_ why so, It’s better not to make such EQUs at all.

DG> By the way, how will your converter handle this? ;)
Well, leave me alone! G8) Take it and write the converter yourself. In my previous letter I wrote how. If you want, I’ll send you the sources or throw them in the echo.

From Ilya Aniskovets To All 7 May 1997

DG> ds tags do not support :( In general, Masm is the coolest ASM of the
DG> existing now - I can prove this at any time (unless
DG> the glitches in Alasma have not been corrected).
No!
The worst thing is that Masm 1.0 does not understand this either ;(
And I wanted to know: will you take something like that?

From Ilya Aniskovets To All 7 May 1997

KA> ZASM no, _definitely_ (c) VVZh Zh8)
KA> Do you really need it?
No, I just want to know, IMHO it will be very slow on the Spectrum;(

Best Regards,
Ilya .


From Ilya Aniskovets To All 7 May 1997


Hello Konstantin!
Wednesday May 07 1997, 16:01 .

Sunday May 04 1997 11:59, Konstantin Afendikov wrote in a message to Dmitry
Grigoryev:

KA> [some of the examples are worn out...]

KA> variable, like the compilation address and the value of the label (not constants, i.e.
KA> EQU 5) are equal to this variable. In this example, if you do
KA> everything as it should, the computer should freeze and fill all the memory with code
KA> 255. I explain:
KA> Pass 1.
KA> Pass 2.
KA> Pass 3. (Wow!)
KA> ORG 25000. DS 50000,255.... and etc. to infinity.
KA> This is if everything is according to the rules. And if in a simple way, then there will be glitches.
KA> And you say _What_is_complicated_ here?
So I’m talking about the fact that you can’t do without recursion here.

Best Regards,
Ilya .


From Ilya Aniskovets To All 7 May 1997

DG>> it does not support ds tags :(
KA> What is the point in this example then? And the fact that MASM understands EQU
KA> with references to an undefined label is done _primitively_ without these
KA> DEFS! But with them... and with REPEAT....
Damn, _primitively_, where _you_ were in 1995?
In general, I didn’t even think to refer to the MASM, he doesn’t understand that either...

From Ilya Aniskovets To All 7 May 1997

VM> And if so:

VM> DEFS m1
VM> m2 ....
VM> m1 EQU 5

VM> The value of the m2 label will not be determined on the first pass, because
VM> it is unknown how many bytes will be allocated by DEFS.
That’s why this has not been done...
In general, I have already said that you can’t do without a recursive search.

Best Regards,
Ilya .


From Ilya Aniskovets To All 7 May 1997

IA>>> M2 equ 5

VM> Here in defs the first parameter (M2) is the length of the allocated memory area
VM>? Hmm, then probably no one. And how did you manage to do this?
Exactly no way :(
The only thing that I have succeeded so far is:
M1 equ M2
M2 equ 5

VM> Question number 2: can you clarify the issue with the authorship of MASM (in the
VM> sense,
VM> what is the role of KSA) and the mysteries of version numbering (like in the ZX Review something
VM> was about MASM 3)? Or is this a coincidence of names?
So let's start...
Somewhere in the beginning of the summer of 1995.
I was sitting at home with nothing to do, writing something in Tasma 2.0 or 3.0 (I don’t remember)
And I was so fed up with it that I wanted to make an assembler.
About a month later I wrote the basis of the editor, the assembly
of all the documented ones, as well as some of the undocumented Masm commands, but
it didn’t have a name yet.
Then KSA came up with the idea to join this venture and everything was
uploaded to him via a CDOS modem...
The work began to boil: Then I write, he fixes glitches and fixes the code, then we switch roles. Besides, Stasy came up with the idea of ​​quickly searching for tags. I remember we sat from morning until evening on the phone... The name “Master” came to my mind and was completely approved. KSA.
Correction of glitches (even after they submitted it for testing to INFORCOM)
fell on the shouldersKSA.
It was MASM 1.0
After some break, I decided to write the next version, but KSA, as always
became _POTNO_. So we shared: I am writing MASM 2.0, he is writing MASM 3.0, we wished
each other good luck and started working.
Soon Stas said that his MASM 3.0 is almost ready, but it has been “almost” for about 5
months (study at the institute probably affected)...
I I entered Baymansky and I also had no time for MASM.
Seisas felt a little better and I got to work.

Best Regards,
Ilya .


From Ilya Aniskovets To All 7 May 1997

MP> etc. Must be known in the 1st pass when compiling them. And then
MP> what interferes: M1 EQU 5
MP> DEFS M1,255
That’s exactly why I asked this question.
In general, nothing interferes, but I would like more freedom ;)

From Konstantin Afendikov To All 8 May 1997

DG>>> Ilya, you probably wanted to prove Masma’s coolness? Unfortunately, in
DG>>> it does not support ds labels :(
KA>> What is the point in this example then? And the fact that MASM understands EQU
KA>> with references to an undefined label is done _primitively_ without these
KA>> DEFS! But with them... and with REPEAT....

From Konstantin Afendikov To All 10 May 1997

DG> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DG> I thought better ;) And I came to the conclusion that I didn’t really lose my mind
DG> see below... (but _namely_ with the DS - I really lost my mind! G8) )

KA>> if everything is according to the rules. And if in a simple way, then there will be glitches. And you
KA>> say _What_is_complicated_
KA>> ?

DG> But will _this_ example of two lines work? Even if not according to the rules ;)
If not according to the rules, then it doesn’t count.

DG> But these are all jokes, and now let’s get serious...
[not very serious thoughts erased]
DG> assignment operators and labels. This is simple. And it’s more complicated, but
DG> more interesting - not to support in these operators only those labels whose values
DG> depend on $.
is not good.
DG> Or even cooler - to support, but only if they are already uniquely
DG> defined.
!!! The thinking process has begun... The percentage of successful completion is ~94.99% Ж8)
DG> That is, to develop an algorithm for catching such ambiguous
DG> definitions...


DG> P.S. Something is wrong here, in my opinion... Come on, trample me ;)
You pulled yourself out. G8) IMHO, everyone will be better off from this G8)

From Konstantin Afendikov To All 10 May 1997

KA>> What, just in these 3-4 days they took everything and fixed it? Were there glitches before?
KA>> Ж8)

[skip]
DG> I don’t have a library. I will do something more complicated - I will switch to
DG> Alasm, but I hope that by then the new Masm will be released.
2All: Well, give me the announcement of MASM2!

DG> Upon closer examination, Alasm revealed several very unpleasant features - there is no line numbering at all, binary
DG> numbers do not understand :(((
A 2.8 The version polled the extended keyboard crookedly. It’s good that Stalker
Scorpio was sent with an extended keyboard and this was no longer the case in ALASM 3.8.

DG> Tasm 4 also failed - PCT was too lazy to load files using the cursor
DG> :(
And he What, is it already ready (specifically from RST)? I'm behind the times! DG> Should I put myself in your position? I’ll try... I’m also more of a hacker,
DG> than an author ;)
And I’m already more of an author than a hacker. I haven’t broken anything for a year.
DG> That’s your problem - your idea of remaking an outdated assembler without
DG> rewriting it again was doomed in advance.failure.
And 3.10 was 90% rewritten from scratch (except for the compiler). The editor has been rewritten, the
interface has been rewritten.... but the compiler is more important to you, right?

DG> You can’t with a hack or a remix outdo programs that were “originally
DG> conceived this way.” The only thing you can do and what you successfully
DG> is to tighten up the interface, improve or add individual functions.
DG> That's it! Then you will drown in numerous transitions, overlays, etc. Your
DG> demonstration of the program already occupies 500 sectors - where does it fit :(
DG> It’s up to you, of course, but I would have given up on this matter, and would have recompiled
DG> the entire kernel again. You have already written gadgets for it several times
DG> more...
The only _gadget_ that needs to be added is the compiler. And she takes up
6 kilos - 24 sectors.
As for the kernel - it is already being recompiled G8) For more details, see below/further. Ж8)

KA>> I would call editing 9 or more texts at the same time sensational,

DG> With extended memory - at least 60... but why? 2-4 is the most optimal.
Sorry, but I can’t name 16-kilobyte chunks in text.

[skip]

From Konstantin Afendikov To All 10 May 1997

KA>> Well, leave me alone! G8) Take it and write the converter yourself. I wrote in
KA>> the previous letter how. Do you want me to send you the source code or throw it into the echo chamber?

DG> Don’t you get the joke?
What’s the point of the smiley? G8)

From Ilya Aniskovets To All 10 May 1997


Hi Dmitry!
Saturday May 10 1997, 11:13 .

Thursday May 08 1997 20:51, Dmitry Grigoryev wrote in a message to Ilya
Aniskovets:

IA>> No, I just want to know, IMHO this will be very slow on
IA>> Spectrum ;(

DG> Depending on how many times you need to make the “first pass” so that
DG> all the labels are identified. In this case - three times. How long in Masma
DG> does the first pass last? 1...3 seconds? So, the slowdown will be 1...n
DG> sec, where n depends on what the programmer did with the labels.
DG> So even now the compilation time depends not only on the number of
DG> lines, but also on their contents. But - freedom :)
I already wrote about this, but you can optimize it:

Simply if you find an undefined label, search not only in the current table of
tags, but also below in the text. That's all!
But all this will slow down very much if further,
for example, there is INCLUDE :(
Well, if such things are in INCLUDE, then there will be no hassle at all ;(

Of course, in ds, db, dw, phase, org, etc, you still need to remove labels or
think about uncertainty of the $ icon, when meeting an indefinite mark $
also becomes _UNDETERMINED_, then everything is ok.

Best Regards,
Ilya .