Premiere headings - New Topic "Likbez - Assembler: a view from afar.
Hacker Rasp
On the anniversary of "OPTRON" We timed the premiere of a new
column - "literacy campaign". It will published a variety of
"educational" materials on soft, hard, etc.
Of course, this topic - is not an invention of our editorial
staff. Such published Deja Vu, Proton, Aspect and many others
electronic publications.
A "Plutonium" from the very first issue contains a section
with the same as that us, the name (though in "Plutoniume" she
not so much "education" as
"Journalistic" and purely "educational" materials are placed
outside this column).
So "Optron" just to be a common example.
Of course, we can say: "You what,
so lazy that you are going to fill the volume of newspaper
rewritten reference materials? But at the same time deprive the
user joy of self-search, to wean
to use workbooks and textbooks? "
But we do not intend to do so!
"Formerly known information" will be placed in the
"Optocouplers" only in cases when it:
- For one reason or another unavailable
readers of the newspaper;
- Was scattered on different sources and
shows the author in a system;
- Regarded by the author with his
own particular point of view.
In short, the motto of our new column will: a special look at
the well-known.
Opens the Field series of articles on Assembler. Infarh, the
author of this series, the sign Readers' Optron "as the lead
"Litstranichki. But this time it appears in the new incarnation.
"Infarh excellent command of words, knows the needs and
concerns of our users - reasoned editorial. - So who else but
him to be a guru? "Therefore, since this
release, Infarh addition to concerns about
"Litstranichke" shoulder to shoulder
More and Likbez. So wish him luck
in this endeavor!
Assembler: a view from afar
Infarh, 1998
Entry
Greetings, dear readers
Optocoupler! Today on your numerous
applications we begin a series of articles that
is an assembler and what it eats. " A
"Eat" it, I should say, first with a headache, and then with
pleasure.
In fact, not in vain because the assembler is the main
programming language on Speccy. None of the other languages
(BASIC, Pascal, C, ...) does not give a tenth of
opportunities assembler. Program in assembly language much
faster, takes up less space in memory and provides programmer
is much more room for "Bullying" over the machine.
To begin with I want to warn that this
the story is designed for those with speech
"Number system" does not cause an irresistible urge to kick
your feet the corpse of a mathematics teacher. And I guess you
already familiar with the "Basic". It is difficult to start
from the beginning: always turns out that there was something
to that. So, we turn to an acquaintance.
What is a computer code
Z80 processor receives signals from the bus
Data (SM) and arranged in such a way that
Different combinations of these signals require that the
processor to perform one or different function. State line SM
usually described in binary form: "1" -
there is a signal, "0" - no signal. Typical
machine language command might look
as follows:
001111000
I think this is somewhat different from the familiar to
"Basic"
LET A = A +1
Nevertheless, the essence of this command is
follows. That is the machine code. All
the necessary combination of ones and zeros, with
by which management
processor, previously housed in
computer memory.
I must say that the program in codes
has its drawbacks:
1) They are difficult to read and debug;
2) They are longer in the team;
3) It is difficult to perform arithmetic
action.
Apparently, some readers have already pulled
hand to the forty-first button with the idea
that this language - only for high-risk
maniacs able to enter into the computer
tens of thousands of combinations of units
and zeros, subject knowledge by heart all
their appointments.
And here you are absolutely right. Rare fanatic can do in
such circumstances. More than normal people use ASSEMBLER.
The essence of the assembly
Assembly language was invented just
to not try to understand the meaning of
programs like
00100001
00000000
01000000
etc. Fortunately, for each such combination is possible to
choose a name that can be read and understood. Such names are
called mnemonics. For example, at this stage, learning
construction type
INC A
you may not understand, but at least
read. And if you say that the INC -
standard abbreviation of the word INCREMENT
(Sequential increase / increment;
modification of the summation), and "A" - a variable, then you
will already have some idea of what's happening. Anyway
case, "INC A" certainly more understandable,
than "00111100".
Between assembly language and machine code
There is only one difference: the assembler to
one level above machine language. Person to read it more easily
than native code, but On the other hand, the computer can not
read the language assembler.
It is not an adaptation of a machine language like "Basic",
where each operation must be doing a lot of processor commands.
In assemlere each team corresponds to identical purpose machine
language command.
To write a program to
assembly and bring it into a form understandable
your Speccy, (ie machine code), there are special programs which
further and will be discussed.
Editors and monitors
Editor Assembler (hereinafter - just
"Assembler") is a program with which you can enter your computer
program code in assembly language and compile this program into
machine code, "clear" the processor. That is how the team "INC
A" transformed into "00111100".
At present, there are many editors assembly, both for 48K
machines, and to 128K. You are faced with having to choose from
them one that is more suitable.
Now for the monitors. This word means
some kind of program, whose purpose - to help you observe what
is happening in the computer memory during the execution of
your (and not just yours) program. About They will be discussed
in more detail later.
And now I'll try to help you choose
The assembler itself, which you'll use and in the future. I
recommend to take this subject carefully, as each Assemler
stores program code in its unique format. Wrap text in your
program (source code) from one editor to another is sometimes
paired with great difficulties, and success is not always
guaranteed. Changing the assembler, you risk
lose all your previous work.
What do we have?
To start recall the memory of your Speccy. True, now there
are already very few 48-x machines, but still ... For
those - assemblers are much smaller. In
this case, a rare unanimity.
Almost all recommend ispolzobat package
"DEVPAC", which includes assembler "Gens" and
a monitor program "Mons". This combination (assembler and
monitor in a "one bottle") provides maximum comfort. "Mons",
everything else can disassemble the program into machine code,
turning it into a source code format Assembler "Gens". I have
been using "DEVPAC" - and no complaints about his work is not
had. However, things were so
just before I got
Speccy-128.
Here - very differently. Assemblers are
many, and your choice I did not at once. List some say a few
words about each.
TASM
This editor from version to version improved, so the format
of the text version 2 is not compatible with later. Beginning
with Version 3, has a function "Import 2.0"
for format conversion. Version 4.0
incorporates a monitor "STS". Assembler is not bad, but
somewhat limited in opportunities, and the font to 64
characters per line not always easy to read. About him well
as well as other programs that I mention, we strongly recommend
that you read complete description.
MASM
Very similar to the "TASM", as the external
design and capabilities. Has
of "STS" and the import of TASM 3.
The good news is that the choice of a file for work carried out
is not putting his name and the cursor.
Both of the above assembly language (and not
only they) have in their composition, such
standard features, like search in the text
fragment with the possibility of replacement, the inclusion
in assembling the text and the assembler code blocks from the
disk, and, of course, input program text with its subsequent
assembling.
ALASM
But this is a thing more powerful. This assembly provides the
ability to customize the way the switch memory pages of your
machine with loadable drivers written, again, in the format
"ALASM". This gives the opportunity to work with several
different texts simultaneously. It is also possible to change
character set (font). Built-in "STS", obviously, has become the
standard.
But it was not without flaws. To those may be the
impossibility of the compilation of texts of several pages at
once, the complexity of the syntax and indication errors. And
most importantly - received after compiled code can not be
burned to CD means of the assembler. For this
have to use Basic or "STS".
ZX-ASM
It implemented a different approach. If
in previous assemblers is controlled by keyboard shortcuts, then
"ZX-ASM" has an extensive menu system. But
At the same time, it is certain
inconvenience, since the choice of the necessary
function goes sometimes too much (in
Anyway, for me) time.
XAS
In general, leaves a very pleasant experience. Scrolling text
is quite rapidly accelerated disc surgery. Can
work with texts in two pages. And Podgruzka text when assembling
going into the second page, thereby
it is possible to process at a time
up to 30 KB of text. There is also a transcoder
(File) to convert text
other formats in "XAS". Another page
reserved for macros that can, at any time to edit. There is a
possibility of reduced recruitment and avtotabulyatsiya.
Fly in the ointment: the inability to change with
search in the text, there is no priority in arithmetic. There
are no function "Merge", but it pays the possibility of
transfer of text from page to page.
STORM
Scrolling text here is ... well
very fast! This applies to the assembly. Abbreviated dialing
and avtotabulyatsiya, the right priorities in arithmetic
operations, as well as a very quick search text.
The disadvantages are unusual
management and the inability to work simultaneously with
multiple texts.
STS
Well, here we get to it. As already
mentioned, this is a monitor program. AND
I say again, that for the moment replace her
you will not find, for "STS", literally
words, is indispensable for the 128-x machines. With its
means you can monitor the status of
all computer resources in the process step by step
execution (trace) program in machine code. In this screen you
watch full-length dizasseblera rather than binary numbers.
From version to version "STS" improved, acquiring new
features. There version 3.2 with the ability to view unit
data as graphs. A version of "STS 4.3 + @"
provide an opportunity to conveniently work with
MAGIK-files.
In short, take and use. Not
sorry!
In conclusion ...
Come to an end of an introductory course. Must
add that the advantages and disadvantages Asseblerov I have
described is not everything, but it already - self-paced ...
It remains to you to pick yourself right
tool and wait for the continuation of this
article in which we try to understand
already specifically with the assembly language.
All the described software you
help find our editorial staff. At the same time add that
without your letters and calls we do not can give the
information that you really need!
Coordinates, as amended, and my
own, you'll find on our site
"About".
See you!
Other articles:
|
|
|
|
|
|
|
|
Premiere headings - New Topic "Likbez - Assembler: a view from afar.
|
|
|
|
|