In this section we want to tell you
about the "rules of good manners" in programming
Vania. Unfortunately, on the pages "ZX-Review"
and "SPECTROFON" enough has already accumulated
statements and creations of would-be programmers
coms who believe that they have learned enough
learn assembler, and you can already write
racial programs. If only it were like this
simply, why do universities exist, in which
many are taught the “military” craft of programming
comrade, and why are entire students being bullied there?
five (sometimes five and a half) years?
And everything is very simple: the programmer must
know a lot of things at first glance
not related to programming, but on
actually being indispensable. Nes-
looking at this "bet" ("SPECTROFON", "IN-
FORKOM") gave the green light to copyright
programs, forgetting about it (or maybe just
didn't know?). And the “pile” poured into the light
consumer goods copyright programs suitable
only for their authors to show
their creations to the ignorant representative
to men of the opposite sex and said:
"look how smart I am, such a program is on-
wrote, let's have dinner together today."
So we decided to somehow fix it...
positionThis section is not intended for
professionals, it is for everyone for whom
"SPECTRUM" a little more than just a game
machine howl. We will try not to "load"
you in professional terms, "pervert-
new programming techniques, but
tell you how to (and how not to)
it is necessary) to compose programs for "SPECTRUM"
(whether it's a game "for sale" or just
a shady program for "purely home
use"). By the way, along the way we co-
we take an excursion into the history of computers, which is very
even a fun activity. In the following
numbers we plan to tell you about the history
ria and reasons for coming into this world
Computers, cybernetics, computer viruses, and
etc. (of course not in the form of tedious lectures
with phrases like: “thus”, “in
consequence of which", ... ) all this is quite
interesting stories, sometimes reminiscent
fantasy novels (but all this is ours and
history by you - i.e. true stories) and detective stories. Yes
that, as they say in one excellent co-
Vetsky cartoon - "buy our words-
new!
Let's start, as always, with terms. Personally
us phrase "I wrote the program in machine
codes" causes alternately two kinds of emotions
tions:hysterical laughter and intense pity for
to the speaker. Laughter because of the picture standing up
before our eyes. Pity - because
the main character of this picture in the near future
I will end up in a mental hospital. In class
in computer science, if you attended them, the most
first of all, they “drill into” everyone about the peace
computers, isn't it? Well, that's it. First
The computers did not have the keyboard we are used to,
let alone displays. And how do they program
did? In those same MACHINE CODES. Operation
computer operator (this is where this specialty came from)
in order to free up the programmer for more
hard work, he himself was involved in introducing the program
frames. And guess how he did it? Co-
absolutely true. Using eight toggle switches
he was typing the next byte (toggle switch up -
bit set, toggle switch down - bit reset
shen), and then pressed the enter button
bytes into memory, then did the same thing
with the next byte. What did you do during this
time programmer? And he wrote the program in
in the form of these same bytes (often in BINARY
NOM (!!!) form) - program on MACHINE
LANGUAGE. Do you feel how romantic it is? A
how much time does it take to draw up a program?
frames and its input into the computer! By the way, such
programs were written and debugged for months -
mi, but had the size...just a few ki-
lobyte. Then everyone got tired of it all and
thought of other ways to enter programs, and
most importantly PROGRAMMING LANGUAGES. Te-
now it’s clear, what does a mental hospital have to do with it? If
If you haven’t guessed, I’ll give you a hint: mental
the programmers' workload was so high
juice that they periodically have "balls for
The rollers were skipping." Yes, here's another thing, hell-
Program placement resources were presented
also in binary form, and the programmer must
was to operate with them. And the line of program
in machine language we looked approximately
like this:
0001000101 111010101
where the first binary number is the command address,
and the second is the team itself.
If you want to paint, then
at least take a quick look at the classic ones
canvases. And if you program, then
shame on you if you can't in the middle of the night
nothing to say about the history of computers, which
By the way, it is only fifty years old -
your grandparents didn’t even know yet
what is a computer and what is a piece of iron anyway?
can count, and even much faster and
more precisely a person, in addition, without the participation of it-
th.
The very firstLANGUAGEPROGRAMMING
became... ASSEMBLY language. It was (and is)
low-level language - it stands exactly
middle ground between machine language (a set of
BINARY (!!) codes) and human
spoken language. Each team
sampler uniquely matches the command
machine language, and vice versa. Difference between
them is the same as between the number “3” and the word
vom "three": mean the same thing, but one
part of the Arabic number system, and the other
part of the Russian language!!!!! Next two
programs are one and the same, but on-
written in different languages (machine codes,
which are supposed to be represented in binary
form, we will convert to hexadecimal
code so as not to clutter the screen):
Assembler: Machine codes:
LOOP LD A,1 #3E,1
CALL #3D13 #CD,#13,#3D
JR Z,LOOP #28,#F9
OR A #B7
JR NZ,LOOP #20,#F6
RET #C9
Guess which one is easier to understand? Which one
easier to modify? Hint: if you
want to insert a command after the line "LD
A,1", then in machine codes you will need
manually (!!) recalculate the offsets for the co-
short conditional transitions (bytes #F9 and
#F6) i.e. recalculate the address and this
only in such a small and simple
program (it was “taken from the ceiling” and, es-
obviously inoperative)!
So let's speak correctly and
correctly: "I wrote a program in Ac-
assembler" ! Otherwise you will end up in ... (everything is in
tighter chamber).
Let's move on. Bit grid.
What else is this? And this, gentlemen,
something that affects the accuracy of mathematical
calculations on any type of computer. This is me tothen-
Well, what if you decide to make a program,
engaged in accurate calculations, it is useful
know about the pitfalls and inform in advance
to deal with the error in calculations (which is not
saves you from having to calculate
this error and bring it to the attention of
users).
Let's say you decide to make a program,
calculating the state of the solar system
at some point in time, or game - by -
flight simulator of a spaceship "by
formulas" (imitation is not the same as in ELITE,
and taking into account the real laws of celestial mechanics
nicks: by the way, I’ve been “sweating” for about a year now
honkyu" am engaged in "sculpting" similar to them -
tator), or just make purely earthly
engineering calculations. For example, let's take
astronomical program. On your way
there are several fairly large icebergs
gov.
Well, first of all. Maximum accuracy
"SPECTRUM" is seven digits after
comma, but this is for serious calculations
quite a bit. Astronomy operates with
very large numbers, error of 1%
astronomical unit is ca-
some 1 million 495 thousand kilometers. Ma-
nice, isn't it? And the most unpleasant thing about
any error - it is constantly increasing
happens, and withincreasing speed.
Where there were 0.01 percent very soon there will be
children 0.1 percent. Here come the developers
systems for precise information processing on special
social tricks (we will now touch on them
we won’t), implement which on our
favorite "SPECTRUM" not so easy (and even
if they are nevertheless applied, then the calculation may
continue for a long time). So no
forget about the bit grid.
If you tried to write a program using
on the basis of "Lunoletov" for programmable
microcalculators (see magazines "Technical
nickname-Youth"starting from issue 8 of 1985
year), in BASIC for "SPECTRUM" (and I'm
I've been wanting to do this before and I'm going to
va, but with new knowledge), then probably
you know one "glitch" - without special tricks -
Rhenium CANNOT calculate the projection correctly
vector to the coordinate axis (for example, with
using the expression SIN ()*),
since trigonometric functions give
noticeable error, which, when multiplied by
a rather large value of the vector gives absolutely
a fabulous mistake.
Secondly. To calculate the position of the heavens -
of a body at a given point in time, it is necessary
know its parametersorbits and position on
it at some initial moment in time. And
the more time has passed since the initial
moment, the greater the error (about this
read a few lines above). And,
the further the orbit from the Sun, the...
again the error is larger.
“How, how, - someone else will say - after hearing -
us, what do you say about the article?
S. Krushinsky (Moscow) in "ZX-Review" No
9.10 for 1993 "SPECCY + ASTROLOGY"? This is
and there is thirdly. The author himself says: "in
astrology does not require great precision,
angle error of ∓10 minutes is quite
will arrange." True, the author forgot to say that
these 10 minutes, even for Mars, “result” in
663 thousand kilometers, which is approx.
about 100 (!!) diameters of Mars itself. Well, well
As for astrology, everything has been here for a long time
clear: "V-e-n-e-r-a in s-o-z-v-e-z-d-i-i
V-o-d-o-l-e-ya. V-a-s w-d-e-t v-s-t-r-e-h-a
with b-l-i-z-k-i-m-i d-r-u-z-i-m-i. V-o-z-
m-o-f-n-y n-e-k-o-t-o-r-y-e p-r-i-o-b-r-e-
t-e-n-i-ya."
Fourthly, the “pronounced” PI number is good
for rough calculations only. If you
not difficult, it’s better to write this number in the pen-
belt, and use it as a constant.
And you should enter the following number:3.141592653.
Well, fifthly. If you decide to do
a serious program, and not a purely demonstrative
tion of one’s skills and passions, then “re-
return the mountain of literature and find EVERYTHING
factors influencing the calculation. Of course, no one
then using your program there will be no dis-
read the “real” flight to Mars or
spaceship of the third millennium, but still...
So, when planning to write any program,
frame that performs accurate calculations, pre-
please look at the correction, at least not
which errors, and fair warning
let users know the value of "uncorrected"
measured" calculation error. Otherwise
because someone can, with the help of yours
programs to obtain data, evidence-
rumors that the Moon will fall in 2050
Earth, and believe it! Can you imagine?
what will start here?
And finally. For the sake of Allah, do not switch
read pages of 128th memory using port
that #FD. This is a big "crap" for which you
no one will praise. Command "OUT (#FD),A"
gives you ABSOLUTELY no gain in
speed - time spent by the process
waste on retrieving an argument from memory
commands (port numbers, in this case -
bytes#FD) just one (!) beat less
command execution time "OUT (C),r".
If performance is so important to you, then
bring the number #7FFD to a couple of aircraft, and let it
sitting there.
Such a team takes up a couple of aircraft, say
#FD-port fans say. Really? What
what kind of programmer is he if he doesn’t
can design his algorithm like this:
so that “the wolves are fed and the sheep are safe” (and
compliance with this condition is the main
the task of ANY programmer when creating
ANY program)? After all, there is a stack, alter-
native registers, memory finally!!! A
everything is explained simply: someone once
“messed up” (maybe I just didn’t know about
this glitch), and when he was politely told:
"man, your programs don't work on ours
computers because of the #FD port: please change
please such and such bytes (list
attached) in existing programs
max, and please, in the next developments
kah use the full port address" it's just
stubborn "like a flock of sheep" (sorry for
comparison, but it is very difficult to restrain the emotions
i). "I'm the author, and you're a hacker goat, your co-
Vets are not a decree for me, I don’t care about you. You have
does not work - remake your computer or
throw it out altogether." After which he stubbornly
does his dirty work, inventing a bunch
arguments in your defense. Ascoundrel, co-
green,... - hacker to hooting and spitting
"SPECTROFON" (I apologize to him, I’m still
haven’t dealt with my emotions yet), ra-
Rubbing his hands earnestly, he “breaks into” a new
the creation of this “poor” author, adds
normal operation with port #7FFD (so
we are “breathing” new life into the program), not
forgetting to write your name in INTRO (forcing
ke, information about the authors, ...), and then
looking around furtively, he sells it to his
to the sidekick reseller of the “hacked” one. Right here
It turns out to be an American detective story.
And the criminal, as always, is a hacker - violating
copyright and public supporter
actions... And if it weren’t for the hackers, then how would
in general, progressive humanity learned about
errors in this or that program?
Of course, the position of the Authors can also be
know who wants to listen from other managers
rivers in incompetence, publicizing
This information about the causes of malfunctions
programs?
But, fortunately, our Samara ZX-Club is not
shares"SPECTROFON"mania of oppression
the opinion of all hackers and puts good hackers
Kerov (we won’t die from modesty, right?)
on a par with good authors, therefore
in our cityyou can always find
the "normal" version of the program you need.
About the programs that you can buy at
ZX-Club stores,we will be there for you regularly
tell.
Well, since we touched on hackers, then
"towards the end" a couple of lines about running lines
(pun, you can write it down), although this
is very remotely related to our section.
Why "SPECTROFON" doesn't like running people so much
lines (by the way, software distributors consider
They know that a good ticker will only increase
exudes the beauty of the program) ? No, of course-
but, the lines where solid FUCK hit hard
they praise seasoned professional alcoholics
Mom, well, what about the rest (where there are greetings, but
everything according to the rules of social etiquette)? But
everything is very simple - they contain
there is information about shortcomings or obliquities
shady habits of some Authors who
paradise spreads throughout the country and reduces
rating of these Authors. That's how things are.
Well, that's enough for today. On-
I hope you will forgive me that our first
the meeting is somewhat chaotic
ter. See you in the next issue. Write-
those that you would like to read about in"LIK-
MERINGUE", and how do you generally see this category?
ku. Addresses for contacting usyou will find in
section "ABOUT EVERYTHING".
(C) E. Milun.
══════════════ ════════════════════════════
* * * * *
Share your thoughts about the article