Nicron #07
14 ноября 1996

Programming - a course of study assembler Wlodek Black, continued.

<b>Programming</b> - a course of study assembler Wlodek Black, continued.
                   The training course assembler


(C) WLODEK BLACK

        007h. TEAM 16-bit hop.

They are not very many:
_______________________________________________
LD HL, d16 LD HL, (addr) LD (addr), HL
LD DE, d16 - "- -" LD BC, d16 - "- -" LD IX, d16 - "- -" LD IY, 
d16 - "- -" LD SP, d16 - "- -" (D16 - 16-bit constant).

_______________________________________________

LD SP, HL
LD SP, IX
LD SP, IY
___________

EX DE, HL - share the values ​​of HL and DE.
____________________________________________

EX (SP), HL - HL share values ​​and a word from the top of the 
stack. 

EX (SP), IX
EX (SP), IY
______________________________________________________________

Team with a pair HL the shortest and most effective.

      Addition to the theme of "eight-forwarding."
        Command group transfers.

This group of commands is very modest in number but very
important because of the tremendous performance of its member 
only 4 commands:


LDIR (Load with Increment of Register)
LDDR (Load with Decrement of Register)
LDI
LDD
All these commands use register pair HL, DE and BC
and a register of flags F:
HL = address of "source"
DE = address of the "where"
BC = number of bytes sent.

LDIR operates on the basis of the increment, that is, 
"Increment" - each elementary stage of the operation sends 
bytes and This current source and destination addresses are 
incremented by 1. Count on a pair of BC reduces its value to 
1.Strogy alignment LDIR operations on the workflow is as 
follows: 1. Is taken from an address byte (HL);

2. Byte is stored at (DE);
3. HL and DE are increased by 1;
4. BC value is reduced by 1;
5. Checked to see if BC zero. If so, then reset to 0

   Flag P / V, and the operation is completed. If not, then:
6. Program counter is decreased by 2 (the length of the command 
code); 7. The command code is read again from memory, and the 
process repeats from step 1. 

Penetrating the subtleties of the above sequence, you can do
A number of important conclusions:
- At the exit of LDIR: HL and DE indicate the address to the 
unit 

  more addresses all forwarded the block and the host region
  STI; flag P / V is 0;
- Register-battery will not change its current
  of values;
- LDIR is not an elementary team and, in fact, complex

  operator of the cycle. The fact that after the transfer of 
each byte 

  command code is read again from memory entails for

  At least two consequences. One of them is obvious: forward

  block codes in memory with overlapping command itself LDIR 
impossible. 

  The second consequence of the more tricky: the work of the 
team can exceed LDIR   discontinuity interrupts (sounds ugly, 
but how else to say?). 

Team LDDR sends a block of codes in the direction of decreasing 
addresses; otherwise it is similar LDIR. The presence of teams 
like LDIR, and LDDR can effectively transmit block codes with 
partial superposition of the field receiver on the source 
region. 

LDI and LDD carry forward only one byte for a single call to 
the team. On completion of sending the whole unit can be judged 
the flag P / V - in which case it will be reset to 0. 

Command group forward - the only operating transfer from memory 
to memory, bypassing the 8-bit general purpose registers. 

                        (C) WLODEK BLACK





Other articles:

Entry - Introduction and TOC.

BBS - list of stations BBS ZXNet.

Iron - an overview of the microprocessor Zilog Z380, continued.

Programming - a course of study assembler Wlodek Black, continued.

Games - "Citizens, go in the game ..." - announcement of a new category.

Graphics - kartinka ANSI graphics.

Samizdat - the play "How trezveyut SysOp-s", act second. Savin Boris.

Advertising - advertising and announcements.

Feedback - contact the publisher.


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

Similar articles:
Hit Parade - the top 10 programs on the basis of sales of firm Welcome.
cafe2002 report - a report from the Kazan Scremer'a party.

В этот день...   21 November