Coding - I’m throwing here the procedure for outputting sprites, with pixel accuracy from Slava Mednonogov himself.


-++++++++++++++++++++++++++++++++++++++++- 
                 CODING                   
-++++++++++++++++++++++++++++++++++++++++- 
                                          
 Coded by Sokol/Infotek               
               
 I'm throwing here the procedure for displaying the sprite 
comrade, accurate to the pixel from the very 
Slava Mednonogov;  incidentally used in 
Black Crow:                            
                                          
        ;E-mask, D-byte of sprite, HL-by- 
position on the screen.                           
                                          
HEZ LD A,E ;output mask by AND        
        RRCA                              
        RRCA                              
RRCA                              
        RRCA                              
        LD C,A                            
        AND #1F                           
        AND (HL)                          
        LD(HL),A                         
        LD A,C                            
        AND #E0                           
        INC L                             
        AND (HL)                          
        LD(HL),A                         
        ;LD A,D ;output sprite by OR       
        RRCA                              
        RRCA                              
        RRCA                              
        LD C,A                            
        AND #E0                           
        OR(HL)                           
        LD(HL),A                         
LD A,C                            
        AND #1F                           
        DEC L                             
        OR(HL)                           
        LD(HL),A                         
                                          
    The example is taken from CV.  What was there in 
UFO-2 - I vaguely remember :)))               
                                          
    I can add:                       
    a) for speed, sprite sampling - 
stack (i.e. this piece is preceded by POP 
DE).  Accordingly, the sprite is stored - 
"mask byte", "image byte","byte 
masks", "image byte", "mask byte", 
"image byte"...                     
    b) this piece ends, of course, 
teams to organize the cycle (transition 
to next screen line).                   
    c) therefore, to unify the conclusion 
Sprites of any width are stored in columns 
    d) there are 8 such items in total. If not- 
you need to trim the sprites according toright/left 
border of the screen - there will be another 8+8 p/p        
    e) (in the example, the mask/sprite is displayed 
by AND/OR, but in fact I’m in CV 
I output using OR/XOR :)))                     
                                          
    I would like to know (from the demomakers, 
of course :) - is it possible to output faster - 
e?  The thought pops into my head to store it in advance. 
all shifts to all bytes (we get two bytes 
that), but only the sign will be 256*8*2 
=8-[ ]                                    
                                          
             (c)Copper Feet 

Share your thoughts about the article