Studies - The program plugs sprite.

ZX Review #7-8-9-10
(C) Kobyakov MV Nakhodka


   This procedure has been pulled out
me out of the game "SPACE CRUSADE" and
slightly refined (the program
Ignition sprite).
140.

          ORG 50000

          ENT


          LD HL, 16384

          LD DE, BUFF +3

          LD BC, 32

; The upper left corner
; Sprite in the file system on display
, And the height of the sprite in pixels

L1 PUSH BC

          PUSH HL

          LD B, 32; width

                        ; Sprite

          LDIR

          POP HL

140. CALL DLINE

          POP BC

          DJNZ L1

          PUSH IY
AGAIN CALL FIRE

          LD A, # 7F

          IN A, (254)

          RRA

          JR C, AGAIN

          POP IY

          RET
FIRE CALL RND

          AND 31

          LD D, A

          CALL RND

          LD E, A

          PUSH DE

          POP IY

          LD IX, BUFF +3

          LD C, 32

          LD HL, 16384

; Height of the sprite in pixels
; The upper left
, Corner of the sprite that appears on the
; Screen


          LD E, L

          LD D, H
OH2 PUSH HL

          LD B, 32
OH1 XOR (IY +0)

          OR (IY +1)

          AND (HL)

          OR (IX +0)

          LD (DE), A

          INC L

          INC E

          INC IX

          INC IY

          DJNZ OH1

          POP HL

          LD E, L

          LD D, H

          CALL DLINE

          DEC C

          LD A, B

          OR C

          JR NZ, OH2

          RET
RND PUSH DE

          PUSH HL

          LD A, R

          LD L, A

          LD A, (BUFF)

          ADD A, L

          XOR 7

          RLCA

          ADD A, 31

          LD (BUFF), A

          LD HL, (BUFF +1)

          LD DE, 29711

          ADD HL, DE

          RLC L

          LD (BUFF +1), HL

          XOR L

          XOR H

          POP HL

          POP DE

          RET
DLINE INC H

          LD A, H

          AND 7

          RET NZ

          LD A, L

          ADD A, 32

          LD L, A

          RET C

          LD A, H

          SUB 8

          LD H, A

          RET
BUFF DEFB 0

START: 50,000
LEN: 145 bytes
2

   Now a brief comment
to the program. First and foremost, we must put the sprite on 
the screen and run the program, which then

begins to enter it into memory. A Place in the sprite is 
reserved for label BUFF + 3 byte offset. Yes, do not forget

specify the coordinates of the upper-left corner of the sprite 
to the display bar file and its height, in pixels, and

width of familiarity. In this
example, given the coordinates of the top-left corner of the 
screen (16384), the height is 32 pixels and width 32 
familiarity. 

   Tagged by RND is called pseudorandom number generator.
Tagged by FIRE - in fact,
the procedure is "burning".


           *