Assembler - demo effect of “flying mesh”

Faultless #08
Preface
                             ───────────

 In many demos, for example, U.S.,ICE
CREAM; in many boot's you probably
encountered such an effect as "flying
grid" along a smooth trajectory, simply
saying - "PUSH's EFFECT" as it's called
also called.
 Its principle is not very complicated, as it may be
appear for the first time, actually
the “foundation” in it is still the same
PUSH command, which at one time, like you
you know, it can copy 2 bytes.
 So, in this text I will give an example -
ry programs that will help you do
such an effect (PUSH's). So let's
Let's get straight to the point:
 First we have to build a sign,
on which your sprite will fly
(listen to your spragues, you sprite),
The sprite must be 2*16 in size (by
X - 2,Y - 16). The plate is usually built
with a native program in BASIC:

 10 LET adr1=30000:LET adr2=30500
 20 FOR n=0 TO 2*PI STEP PI/64
 30 POKE adr1,128+127*SIN n:POKE adr2,8
8+87*COS n
 40 PLOT PEEK adr1,PEEK adr2
 50 LET adr1=adr1+1:LET adr2=adr2+1:NEXT
n

 As a result of this example in memory
under address 30000 there will be X coordinates
plates, and under 30500 - the corresponding
its Y coordinates. Those who are more understanding can
experiment with the 30th line,
changing the values of SIN and COS in it and adding
barking something of his own. Now you have the sprite
yes, there is a sign, it remainsthe most important thing
noe - codes; let's move on to them....

 To fly we need 256 spry-
coms shifted cyclically in this way:
the original sprite is flexed first
16 times to the right, then one point lower,
and fall 16 times if you have done everything
correctly, then, having unloaded this sprite block
Comrade you should get 256 sprites
total length 8192 (sprite length * no.
quantity = total length). Who doesn't want
or cannot manually bend such
armada of sprites, I bring a program that
heaven will do everything for you, i.e.  right
will move all sprites:

 ORG 25000
 LD HL, address of your sprite
 LD DE, buffer size 8192 for shifting
       that sprite (let's say #C000)
 LD BC, sprite length (32)
 PUSH DE
 LDIR
 POP HL
 LD C,16
 CALL CRUNCH2 <--DEC1
 LD B,16
 CALL CRUNCH1 <--DEC2
 DJNZ DEC2
 DEC C
 JR NZ,DEC1
 RET
 PUSH BC <--CRUNCH1
 LD BC,32
 LDIR
 PUSH HL
 LD B,16
 INC HL <--CR1
 LD A,(HL)
 RRA
 DEC HL
 RR (HL)
 INC HL
 RR (HL)
 INC HL
 DJNZ CR1
 POP HL
 POP B.C.
 RET
 PUSH BC <--CRUNCH2
 PUSH DE
 PUSH HL
 LD BC,#001E
 ADD HL,BC
 LD E,(HL)
 INC HL
 LD D,(HL)
 PUSH DE
 LD D,H
 LD E,L
 DEC HL
 DEC HL
 LDDR
 EX DE,HL
 POP DE
 LD(HL),D
 DEC HL
 LD(HL),E
 POP HL
 POP DE
 POP B.C.
 RET

 After running this program, you will have
under the address 49152 these will be located
the most shifted sprites. So, tab-
you have a personal note, you also have sprites, te-
featherprocedure that calculates but-
measures the sprite and removes it from the buffer, ku-
Yes, it copies it in advance.

 ORG 30000
 LD HL,30000 <-- START1;plate address
                         by X
 LD A,(HL)
 AND A
 JR NZ,LET1
 LD HL,30000
 LD (START1+1),HL
 JR START1
               <--LET1
 LD (START1+1),HL
 AND #0F
 LD H,0
 LD L,A
 ADD HL,HL
 ADD HL,HL
 ADD HL,HL
 ADD HL,HL
 ADD HL,HL
 LD DE,#C000
 ADD HL,DE
 PUSH HL
 LD HL,30500 <-- START2;plate address
                          in Y
 LD A,(HL)
 AND A
 JR NZ,LET2
 LD HL,30500
 LD (START2+1),HL
 JR START2
               <--LET2
 LD (START2+1),HL
 AND #0F
 LD H,0
 LD L,A
 ADD HL,HL
 ADD HL,HL
 ADD HL,HL
 ADD HL,HL
 ADD HL,HL
 ADD HL,HL
 ADD HL,HL
 ADD HL,HL
 ADD HL,HL
 POP DE
 ADD HL,DE
 LD DE,#FFFF-32 ;buffer address of one
                  sprite (32 bytes)
 LDI ;32 times LDI
 LD (STACK+1),SP ;remember STACK
 LD SP,#4000
 LD HL,(65503+00);buffer address +0
 PUSH HL ;8 times
 LD SP,#4100
 LD HL,(65503+02);buffer address +2
 PUSH HL ;8 times
 LD SP,#4200
 LD HL,(65503+04);buffer address +4
 PUSH HL ;8 times
 LD SP,#4300
 LD HL,(65503+06);buffer address +6
 PUSH HL ;8 times
 LD SP,#4400
 LD HL,(65503+08);buffer address +8
 PUSH HL ;8 times
 LD SP,#4500
 LD HL,(65503+10);buffer address +10
 PUSH HL ;8 times
 LD SP,#4600
 LD HL,(65503+12);buffer address +12
 PUSH HL ;8times
 LD SP,#4700
 LD HL,(65503+14);buffer address +14
 PUSH HL ;8 times
 LD SP,#4020
 LD HL,(65503+16);buffer address +16
 PUSH HL ;8 times
 LD SP,#4120
 LD HL,(65503+18);buffer address +18
 PUSH HL ;8 times
 LD SP,#4220
 LD HL,(65503+20);buffer address +20
 PUSH HL ;8 times
 LD SP,#4320
 LD HL,(65503+22);buffer address +22
 PUSH HL ;8 times
 LD SP,#4420
 LD HL,(65503+24);buffer address +24
 PUSH HL ;8 times
 LD SP,#4520
 LD HL,(65503+26);buffer address +26
 PUSH HL ;8 times
 LD SP,#4620
 LD HL,(65503+28);buffer address +28
 PUSH HL ;8 times
 LD SP,#4720
 LD HL,(65503+30);buffer address +30
 PUSH HL ;8 times
 .......................................
 and so on you can multiply this
 procedure so that the address
 the buffer had a period of 0 - 30, after 30 -
 again 0, etc.
  At the very end you should put it like this

 LD SP,0 <-- STACK ; restored
                             STACK
 RET

 Now if you run this in a loop,
then you will have quite a lot of flying on your screen
a beautiful little thing consisting of your per-
initial sprite.

                             Afterword
                             ───────────

 As you may have noticed, in the magazine menu
flying mesh with a beautiful sprite, this one
the effect was made using exactly the same algorithm
rhythm like this text above.
The magazine application has everything you needsuitable sources for writing such an effective
fect, including a sign, sprite, program
mu - shifting and flying. You only have to
Let's launch TASM4.0 (BY XLD) and dare!

──────────────────── ────────────────────

           Sincerely, Bazhenov Stanislav

                       (AKA ACTIVATOR).

Share your thoughts about the article