ZX Forum #04
19 ноября 1997

Technology sprites - Part 6: preparation of data for publication.

<b>Technology sprites</b> - Part 6: preparation of data for publication.
  PREPARING DATA FOR PRINTING


   Before you print
sprite on the screen, we have to prepare the necessary
data in order to print without being distracted by these 
details. 

   Let us isolate a few variables, which we will
stored data:


   COORD - print coordinates 1 -
Y, 2 - X.

   LENHGT - the length of the sprite (in
familiarity) and height (in
pixels).

   ADRSPR - data address sprite
in memory.


   And now let's see
how do we put the required data in these variables. Previously, 
we you have already talked about the different

how to store data and, correspondingly, different blocks
sprites and headers to them. For
beginning to fill these variables
for sprites of the same size. One of the parameters such
block is the full length of a sprite (length + length of the 
mask Sprite + (if any) length attributes):


   At the entrance to the register A must
be the number of sprites (numbered from
0). The output of the variable ADRSPR will address the sprite, 
in a variable LENHGT its length and height. 140.

ODINAK LD HL, SPRDATA +4; In HL address these sprites. Since
                           ; Since the first 4 bytes are Headers
                           ; Wok, we skip them.

        AND A; If the number of sprite 0, proceed.

        JR Z, ODINAK1

        LD B, A; organize cycle.

        LD DE, LINESPR; In DE the length of one sprite.

        ADD HL, DE; adds up.

        DJNZ $ -1; completes the cycle.
ODINAK1 LD (ADRSPR), HL; In a variable enters the address data

                           ; Sprite.

        LD HL, (ZAGOLOWOK); In HL length and height of the 
sprite, which 

                           , Indicated in the header block 
sprites 

                           ; (Remember, there must be those 
given                            ; Ones).


        LD (LENHGT), HL; variable in them.

        RET; Exit.
2

   We now turn to the second
type blocks sprite - sprite heterogeneous, ie sprites
This block can have different
sizes. Variables remained the
same as when entering the subroutine in
A register should be number
sprite (numbered from 0). To get started fill in the variables
Separate tables:
140.
OTDEL LD L, A; Writes sprite number in the register L.

       LD H, # 00; Zeroing H.

       ADD HL, HL; Since each sprite in the table of
                         ; Usual 4 bytes, multiply the number 
of valid                          ; That by 4.


       ADD HL, HL

       LD DE, SPRDATA; In DE address table.

       ADD HL, DE; obtain the HL data address on the sprite.

       LD E, (HL); Writes a DE address of the sprite to

                         , Which reads data at a Regis
                         ; Friction HL.

       INC HL

       LD D, (HL)

       INC HL

       PUSH HL
------------------------
       LD HL, SPRDATA; we have already said that, instead of to
                         ; Nkretnogo address sprites can decrees
                         ; Vatsya offset to sprite from the 
address 

                         ; Downloads. If it is set to offset

                         , Then in DE register with us to this 
model                          ; Cop is offset to the desired


                         ; We sprite. To get the address

                         ; Sprite, we add the offset to hell
                         ; Res downloads. Wondered if the 
address 

                         And these two lines must be removed.

       ADD HL, DE
------------------------ OTDEL1 LD (ADRSPR), HL; Writes to the 
variable address data 

                         ; Sprite.

       POP HL

140. LD C, (HL); Writes in BC length and height, on which
                         ; Rye points HL.

       INC HL

       LD B, (HL)

       LD (LENHGT), BC; Writes a variable length and height.

       RET; Exit.
2

   Now fill in the data for
CROSS-CUTTING table. Variables remained the same.
140.
SKWOZ LD HL, SPRDATA; In HL load address of sprites.

       AND A; If the number of sprite 0, proceed.

       JR Z, SKWOZ1

       LD B, A; The B number sprite, organize cycle.
SKWOZ2 LD E, (HL); Writes a DE address of the next sprite.

       INC HL

       LD D, (HL)

       EX DE, HL
------------------------
       LD DE, SPRDATA; we have already said that, instead of to
                         ; Nkretnogo address sprites can decrees
                         ; Vatsya offset to sprite from the 
address 

                         ; Downloads. If it is set to offset

                         , Then in DE register with us to this 
model                          ; Cop is offset to the desired


                         ; We sprite. To get the address

                         ; Sprite, we add the offset to hell
                         ; Res downloads. Wondered if the 
address 

                         And these two lines must be removed.

       ADD HL, DE
------------------------ SKWOZ3 DJNZ SKWOZ2; Close the loop.
SKWOZ1 INC HL; In the HL data address sprite.

       INC HL; Increment HL at two. Now HL indicated
                         , Shows the length and height of the 
sprite. Time                          ; Simultaneously store.


       PUSH HL

       INC HL; increasing the HL for 2, we get e

                         ; Data sprite.

       INC HL

       LD (ADRSPR), HL; In a variable enters the address data

                         ; Sprite.

       POP HL; Restore HL.

       LD C, (HL); In BC enters the length and height.

       INC HL

       LD B, (HL)

       LD (LENHGT), BC; variable in them.

       RET; Exit.
2

   Well, now you can work with almost any type of headings. The 
main difference between the different programs sprite formation 
is exactly in the format of the formed

their title. We reviewed
basic, and should not be difficult to alter these protsedurki 
for slightly modified types of headers.







Other articles:

Help - Description of the shell of an electronic book "ZX-FORUM 4.

Secrets of Successful Design - Head for the book "Design your Programs

screen effects - Running a string of R-Type.

screen effects - clearing the screen of Zynaps.

screen effects - "minimize" the screen from Comando Tracer.

screen effects - smooth "decay" of the screen Sommando Tracer.

screen effects - changed the character set for the original stylized font from the game Rockstar.

screen effects - "running out the string" out of the game Rockstar.

screen effects - "pouring" the screen of the game Rockstar.

screen effects - a complex multi-effects from the game Bubbler.

New top 40 procedures - scrolling display, a fusion of two images, inverting screen, rotate characters, replacement of attributes, fill a closed loop, the calculation of addresses in the screen, copy of the screen, etc.

Technology sprites - Part 1: Introduction.

Technology sprites - Part 2: The hunt for sprites (search and pulling).

Technology sprites - Part 3: Format of sprites.

Technology sprites - Part 4: Format of sprites with a mask.

Technology sprites - Part 5: Structure sprite blocks (both co-exist in memory sprite and mask, what data to help us quickly find the address of the sprite in memory, and much more.)

Technology sprites - Part 6: preparation of data for publication.

Technology sprites - Part 8: Printing sprites (coordinates are given in familiarity).

Technology sprites - Part 9: Printing sprites (coordinates given in pixels).

Technology sprites - Part 10: a review of programs to work with sprites and graphics.

world of sound Spectrum - Chapter 1: The Physics of Sound.

world of sound Spectrum - Chapter 2: Operator BEEP, Creating effects on BEEPe, Making Music on BEEPe.

world of sound Spectrum - Chapter 3: How is the sound device (BEEP'ra and methods of sound production).

world of sound Spectrum - Chapter 4: Programming sound in assembler.

world of sound Spectrum - Chapter 4.1: Programming sound effects - Tone, Noise, Complexes effects.

world of sound Spectrum - Chapter 4.2: Programming Sound Effects - Volume Control.

world of sound Spectrum - chapter 4.3: Sound Effects - Management timbre.

world of sound Spectrum - Chapter 4.4: Programming sound effects - music programming.

world of sound Spectrum - Chapter 4.5: Programming sound effects - Polyphonic ringtones (polyphonic).

world of sound Spectrum - chapter 4.6: Treatment of external signals - digitization.

world of sound Spectrum - Chapter 4.7: Handling of external signals - Reverberation.

world of sound Spectrum - chapter 4.8: Synthesis of speech.

world of sound Spectrum - Chapter 4.9: audio playback interrupt.

world of sound Spectrum - Chapter 5: The operator PLAY for music coprocessor AY- 3-8910 (AY-3-8912).

world of sound Spectrum - Chapter 5.1: Creating effects operator PLAY.

world of sound Spectrum - Chapter 5.2: Making Music on PLAYe.

world of sound Spectrum - Chapter 6.1: Description of the coprocessor registers of the musical AY- 3-8910 (AY-3-8912).

world of sound Spectrum - Chapter 6.2: Programming effects and music under the musical coprocessor AY- 3-8910 (AY-3-8912).

world of sound Spectrum - Chapter 7: Software Review ZX-Spectrum to create sounds and music.

world of sound Spectrum - chapter 7.1: Editor, Sound Effects SUPER SOUND.

world of sound Spectrum - Chapter 7.2: Music Editor Wham the Music Box.

world of sound Spectrum - Annex 1, 2: Listings sound effects SUPER SOUND'a, tips assembler.


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

Similar articles:
Games - Cheats Times of Lore.
HOT GAMES - Top Ten on the Visual / MS.
Plus-minus - the fact that such CB RADIO, about its pros and cons.

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