Public Spirit #01
17 мая 1997
  Софт  

Discussion - a good idea to update the assembler. "Why are so few large program goes to the Spectrum? "

<b>Discussion</b> - a good idea to update the assembler.

"It would be nice to update the assembler"

 Music: author:
(C) Dave (c) V. Mednonogov



   Why are so few large
program goes to the Spectrum?
IMHO, one reason is
difficulty writing
significant in size
source in assembler.
Hinder the process has already begun
not the speed of assembly (and
on the Spectrum, and on the PC now
Asma is a high-speed)
simply suppresses the sheer volume of
information - a bunch of files
sources in hundreds of lines,
eternal confusion with I / O
parameters, and the text itself,
even abundantly watered
commentary, it remains difficult
readable. Recent months
Debugging is usually filled
rustling prints with
listings, an attempt
dock disparate
procedures and search for "stupid"
errors, which in terms of
assembler errors not
are. What today is
alternatives? Someone might say:
C, Pascal. As
the only available examples
consider the firm's products
HiSoft. If we discard
standard library
forced to cling to each
program, the analysis generated
code will show at least two
weaknesses: the transfer
parameters of the function is
relative index
registers, and all variables
stored in memory (even in C,
even those for which the storage
would suffice and a set of registers)
Naturally, this dramatically lowers the
performance and significantly
increases the length of the object
code. I mean, normal
programmer so would not write.
You can, of course, would be
try to write new
C compiler, but it is unlikely
able to do it kandachka
optimally. It seems to me more
the real way - to try to
"Screw" self assembly.
The first step in this direction have already been
made: macros. The second step
was the emergence in some
assembler commands, replacing
chain of command that
are (according to the authors)
the most common.
About this and should
dance (IMHO). Here are a few
thoughts:
 1. All teams
assembly remains intact and
integrity, and can
always be inserted at any
space program.
 2. To
assembler is different from the new team
from the standard, or must give
them any new names or
poses a team of professional.
symbol: <.>, <$> <#> or any other
 3. Variables are described
the standard way - through
DEFB, DEFW - that, accordingly,
determine their type. However, when
Optionally, enter any
INT, BYTE, ARRAY, etc., etc.
 4.Peremennye whose names
coincide with the standard
registers must be
Identity of these
registers. Variables in the form
mnemonic names are
just a constant. Conclusion
variable name in brackets
a reference to it.
 5. Then we can introduce the concept of
assignment expression.
For example:

B = (DAT0) +5 C + (DAT1) + DAT2-(HL)


  In principle,
to slow down
instruction decoder can be
agree to set
a string or one of the LET
proposed special symbols. This
string is transformed into something
Type:

 In the Kutch-ve basic
a set of actions to limit
+, -, Simple logic
(Or, xor, etc. - in the notation C
or Gens) and shift operations
(>>,<<). Complement the taste:)
Of course, it is necessary to stipulate
priority operations (in
the simplest case - all
equal), you can enter parenthesis.
The bottleneck will be joining the
Qual-ve parameter expressions
battery and HL, as well as
type conversion. Solved
simple - more restrictions
the user. For example
limited to expressions of
one or two operands. Or
prohibit the entry of A in the right
parts other than the first
parameter. Or permit, but
give warning. But you never know ...
Plenty to take from the Sea. Type
Shortened: A + = 5, B>> = 2, etc.
If fantasy is not enough
surgery "equals" (=)
simply an alternative to LD - all
still easier to read.
 6.Massivy. Well, leaving two
Standard - IX and IY.
Allow the treatment of type
IX [n]. For others (who
By the way, to define the same
DEFB, DEFW, DEFS) apparently
will have to introduce additional r-tion. T.
e. DAT [C] <=> LD A, C / LD HL,
DAT / CALL adr_mas, where n / n
adr_mas simply gives a
battery element value
array, starting with HL.
(Damn, again drift towards
additional libraries.)
For the velocity function adr_mas
You can disclose, though ...
However, arrays can not
do.
 7. Subroutine.
Because parameters they are passed by
largely through registers
General purpose (for
speed), then take into
attention to just such a mechanism
transmission. For example:

 PROC sub_name (var HL, var A,
B) ...

  body s / n

  ...

  RETURN sub_name


   - If before the parameter is not
is var - keep it on
stack. The same applies to
parameters after the colon. T.
is, the first line of the form:
 sub_name PUSH BC

         PUSH DE

         ...

   - RETURN statement
first normalizes
stack if necessary. Can
specify the name of semiconductors, for which he
is (by default, to
last otkompilirovanoy) In
this case it turns into:


         POP DE

         POP BC

         RET


   Estestvenno, RETURN'ov can
be many. - Call
routines will have the
form (if you do not like GOSUB,
let it be as you wish): GOSUB
sub_name (20,, C)

   For example, so that
becomes:

   LD HL, 20

  And the second parameter (A) is omitted
and adopted the current LD B, C

  CALL sub_name

   Possible to specify an expression
as parameters.
Naturally,
assembly to check
line parameters (and for
What is all this parsley
divorce).
 8. What else? A
transitions. There are a lot does not
invent - to leave JR and JP.
You can enter a universal
GOTO, which will itself
determine what to put - JR,
JP. It is true, how much Globe
will be your assembler is already
another question. We can take
computed GOTO from the old
Good Fortran (his way,
almost all can take,
discarding the complex mathematics and
I / O, all there WRITE,
READ, FORMAT), which looks
like this: GOTO (ADR1,
ADR2, ... ADRn), (switch); instead
(Switch) m.byt expression and
becomes:


      LD A, (switch)

      LD HL, _TAB1

      CALL adr_mas2

      JP (HL)

_TAB1 DEFW ADR1, ADR2, ... ADRn


   9. Conditional branches. Well,
very simple - again from the
same Fortran (not to be confused with
conventional translation, called
it is not IF, but, for example, IFS):
IFS (expression) METKA1, METKA2,
METKA3 is transformed into
expression evaluation, followed by
are: OR A; needed if
the last operation did not affect
the flags JP M, METKA1; if rezt negative JP Z, METKA2;
if 0 JP METKA3; if more
You can add a zero like
operator which will
respond to the flag of CY, but not on
SiGN - a thread of IFC ... If
one of the labels is not specified,
resp. transition is absent (this
applies to the case if one
of the labels refers to the line
immediately after the IF). As the heavier
the case - all sorts of contingencies
transitions, such as IF (vyr1> vyr2)
GOTO metka1 or more
heaped with
ELSE, ELSEIF, ENDIF It
possible to use operators
type of begin / end in Pascal, and
better than the curly parenthesis in
C for allocating program
blocks (as is known, the operators
frame block is converted
Just in time labels). In
Basically, it does not impose
no restrictions on
assembler. Do not forget to and about
cycles. Probably, it will
just a beautiful backdrop for
DJNZ and the like.

   10. Tags.
Because they will be used
Now in many different
operator, not a bad thing to
enter a qualifier for the FAR
"Distant" marks the transition to
which will be implemented
by JP. If the specifier
absent, the assembler
inserts a JR (or DJNZ for
cycle). For example:
IFC (A>> 1) m1, FAR m2, FAR m3


   11. It seems just by a few
touched. By the way, still need
decide what to convert
original text - in a clean
assembler, or directly in code. Well,
on kazhnom step must remember to
optimization.


   12. It is clear that
it simply estimates, specific
Implementation - dark matter
(Especially optimization). Very
I would like to know who to
what thoughts came to this
account (if very large thoughts
it is possible to soap). Maybe
literature which is on this
subject? I write because
zadolbalo, stuck to their ears in
wilds, "Black Crow"
want to think about the future;)
Incidentally, in the ZX Rewyu ran
article, that someone is already doing
C - (not C, but not
assembler) - maybe someone could hear
What is this animal?


   13. It seems
use the new commands
have a very thoughtful, well-
imagining when they
converted to code optimally
when not to. However, increased
Optimization need not always -
for text adventyur,
quests, working with menus, etc.
importantly - to keep the code easily and
fast write, and then
worked correctly. At the end of
all, the assembler always
will be on hand. Well, the work
with graphics as written in pure
ACME, and will.
 14. A snack - how about
may look like the source:

subr_ix

PROC (var HL, IX, A): BC

      GOSUB s1 (# 5800, A + color)

      . IX [10] = IX [1] + shift [A] - # 7

      IFC (IX [10] -100) m1, m2, m3
m1. IX [10] -= 1

      GOTO m2
m3. IX [10] = (mmx)

      . IX = IX +16
m2 RETURN


   And on the assembly it would be
perhaps because (as if we
there is a good optimizer:


subr_ix PUSH IX

        PUSH AF

        PUSH BC

        LD DE, # 5800

        ADD A, color

        CALL s1

        ADD A, (IX +1)

        LD HL, shift

        CALL adr_mas

        SUB # 7F

        LD (IX +10), A

        SUB 100

        JR Z, m2

        JR NC, m3
m1 DEC (IX +10)

        JR m2
m3 LD A, (mmx)

        LD (IX +10), A

        PUSH DE

        LD DE, 16

        ADD IX, DE

        POP DE
m2 POP BC

        POP AF

        POP IX

        RET


  Horseradish then you'll understand. I mean,
Feel the difference with
Warm greetings, Glory. All in
development of international standard!

 05.apr.97




Other articles:

Authors - Address management CODERS 'ACADEMY.

News - MICROEDITOR v.3.09, PCX - VIEW, Spectrofon to ZX-Word coder, FAST READER, The Fast Packet v1.0x, RETURN TO HOME 4, STRIP REVERSI, MORTAL KOMBAT,

Masterpieces - Novella: Star Heritage or Rocambole in Ruxley.

Hits - Description of programs from: HEAVY METAL MOVER, TRANTOR, PENTIX, DIGITAL STUDIO COMPILER (LPT-Colox version).

Discussion - a good idea to update the assembler. "Why are so few large program goes to the Spectrum? "

Coder - transfer of the screen for the interruption, Packers.

Coder - an overview of current data packer: MS-Pack, Mega LZ, ZX-ZIP, ASC LZ PACK.

Iron - CONTROLLER Flash / RAM / ROM-DISK, ZX LPRINT III, AY-8910.

Haha - Humor.

TOP TEN - Game sales leaders for the year 1997 at Taganrog.

Forecast - Presentation not yet released games: HEAVY METAL MOVER II, WING COMMANDER, PENTIX, SODOM 3D.

Mail - Announcement section.

Advertising - Different ads.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Opinion - A dangerous disease of the new means of communication.
WANTED !!! - The editorial board is looking for the following programs: Little Computer People, New York Warrior, Dark Sise.
CC'999 Report - Report of Peter Sobolev's get-together scene.
Shelezyaka - the prefix to the phone to remove noise and clicks.

В этот день...   6 May