Zx Asm - Rulez!
ZXNet echo conference «zx.spectrum»
From Andrew MOA → To All 25 June 1997
On the day of 19 Jun 97, Michael Kondratyev had the good fortune to write to Andrew MOA:
AM>> The assembler, of course, can separate constants, label constants from
AM>> constant addresses, but the clarity is greatly compromised.
MK> well, this is the gift I got from zilog ;(
No, don’t blame Zilog, it’s not theirs idea. But the assembler is microsoft, and
they did nothing in it to separate the “mnemonic” bracket from the
“expressive” bracket.
MK> Macro Assembler-80 v2.08D (c) 1995,1996,1997 MOA Page 1
MK> 0000' 3A 0009 ld a, (1+2)*3
From the not yet written documentation:
to highlight an expression, use a minor plus, for example,
ld a, +(1+2)*3
Andrew
From George Shepelev → To All 28 June 1997
Hallo Andrew!
Wednesday June 25, 1997 04:52, Andrew MOA wrote to Andrey Mihaylow:
AM> In principle, each symbol (label) in assembler has its own type (if
AM> it does not have a type, there will be one type for all :)
AM> ;abstract example
If possible, I will illustrate the example in TASM syntax from Borland.
It’s true that it’s 80x86 and not Z80, but a lot of clever things have been invented there (though in some places it’s
implemented clumsily). These ideas apply well to an arbitrary assembler.
This is mainly for those who have little idea of non-Z80 assemblers...
AM> const equ 1 ;constant
Constant of string type. Not exactly the same as const = 1
AM> met: ;mark (i.e., a link to a specific address)
Not just a mark, but a mark of executable code. During a "normal" type matching check, you can organize a jump or call using this label, but
you cannot write/read by referring to this label...
AM> label met1 ;also a label (i.e., declared the type of the symbol)
This is a tricky label! Which does not correspond to a specific type - can serve as an
address of both code and an undefined data structure...
AM> proc met2 ;can be declared like that - not the point
Mark of executable code. With this type of declaration, you can also specify additional
parameters (near/far code, memory page number, or more)what...)
AM> byte db 0 ;this is a reference to a byte
Label of a data structure with a byte dimension. You can write/read bytes using this address.
AM> word dw 0 ;this is a reference to a word
Label of a data structure with a word dimension. For word-by-word writing/reading...
AM> st struct ;reference to the structure, and so on
Label of the data structure. The dimensions of the fields are described separately...
AM> In this case, when assembling a command, you can organize
AM> type checking.
And successfully catch the programmer's blunders even at the stage of parsing the syntax of the source text, without bringing the matter to compilation, much less launching the program. That's why I like assemblers with powerful checking tools and don't like C, which will silently "eat up" any garbage as a source... Producing nonsense as executable code...
George
From Andrew MOA → To All 2 July 1997
On the day of 28 Jun 97 George Shepelev had the good fortune to write to All:
AM>> ;abstract example
GS> If possible, I will illustrate an example in the TASM syntax from the company
GS> Borland.
Probably possible, but what?
{skipped}
GS> That’s why I like assemblers with powerful checkers
GS> and I don’t like C, which silently “eats” any garbage as a
GS> source...
no need to disable warnings.
Andrew
From Andrew MOA → To All 2 July 1997
On the day of 29 Jun 97, Michael Kondratyev had the good fortune to write to Andrew MOA:
AM>> ld a, +(1+2)*3
MK> and now a parsley about efforts (as I see them):
most likely, so as not to impair readability:
MK> (1+2)*3 - constant,
error
MK> ((1+2)*3) - address
address
well, that leaves +(...
Andrew
From George Shepelev → To All 9 July 1997
AM> there is no need to disable warnings.
In many cases this will not help. It will interpret garbage in accordance with the obscure ideas of the compiler developers... C
bugs were introduced during the development of the syntax of this language. The standard did not provide for the order in which function arguments were calculated. There are numerous machine-dependent side effects...
As a result, the authors of the language gave advice like "if a line of the program does not
contain formal errors but it is not clear what will be done, compile
it and see the result." It is clear that on different compilers the result could
turn out to be completely different...
So the whole question is what is better, a “smart” compiler, or a fully documented programming language... ;)
George