Programming - crawling line procedure.

Realtime #02
CREAKING LINES              
              --------------              
                                          
   An integral attribute of all programs
 is the so-called scroller (running
 string).  So I decided first of all
 give an example not of the 3D-SUPER effect, but of the
 a regular fixed scroller that
 then easily converted into 'swim-
 ". Here is the listing of the program (without commentary -
 riev):                                   
                                          
                                          
 BUFF DEFS 256                          
 SCROLL LD A,8                          
        DEC A                            
        JR NZ,SDVG                      
 ВУК LD НL,TEXT                      
        INC NL                           
        BIT 7,(NL)                       
        JR Z,SCRL1                      
        LD НL,TEXT                      
 SCRL1 LD (ВУК+1),НL                   
        LD A,(NL)                       
 LD L,A                          
        LD Н,0                          
        ADD NL,NL                        
        ADD NL,NL                        
        ADD NL,NL                        
        LD DE,(23606)                   
        ADD NL,DE                        
        EX DE,HLLD НL,ВUFF+32                   
        LD V,8                          
 SCRL2 RUSN VS                           
        LD А,(DE)                       
        LD (HL), A                       
        INC DE                           
        LD Sun,33                        
        ADD NL,BC                        
        ROR Sun                           
        DJNZ SCRL2                        
        LD A,8                          
 SDVG LD (SCROLL+1),A                 
        LD НL,ВUFF+255                  
        LD V,8                          
 SCRL3 LD С,33                         
 SCRL4 RL (NL)                         
        DEC NL                           
        DEC C                            
        JR NZ,SCRL4                     
        AND A                            
        DJNZ SCRL3                        
 ............................             
 Now let's put the contents             
 buffer to screen                          
 ............................             
        LD DE,#4000 (!!!)              
        LD НL,ВUFF                      
        LD V,8                          
 SСRL5 РUSН DE                           
        LD С,32                         
 SCRL6 LD A,(NL)LD (DE),A                       
        INC NL                           
        INC E                            
        DEC C                            
        JR NZ,SCRL6                     
        INC NL                           
        POP DE                           
        CALL DOWN                         
        DJNZ SCRL5                        
        RET                               
 DOWN INC D;subroutine finding 
        LD A,D ;screen address values 
        AND 7 ;one pixel lower 
        RET NZ ;available          
        LD A,E                          
        ADD A,32                         
        LD E,A                          
        RET C                            
 LD A,D                          
        SUВ 8                            
        LD D,A                          
        RET                               
 TEXT DEFВ "RUNNING LINE 32*8"        
        DEFВ #FF                          
                                          
                                          
   But, as you know, any program can be
 improve, increase it quickly
 action (see section 'PROGRAMMING' in
 RT-1) and here I leave room for yours
 creativity.  Well, in order to do
 scroller 'floating' is necessaryconstantly
 change the address to which it is output
 scroller (where it is '!!!') Replace
 command LD НL,#4000 for such a subprogram
 mu:                                      
                                          
 FLP LD NL,MASS                      
        LD A,(NL)                       
        SR #FF                          
        JR NZ,FLР1                      
        LD NL,MASS                      
 FLP1 LD E,(HL)                       
        INC NL                           
        LD D,(NL)                       
        INC NL                           
        LD (FLP+1),NL                   
        ...............                   
                                          
 MASS DEFW #4000                        
        DEFW #4100                        
        DEFW #4200                        
        ..........                        
        this is an array of screen addresses, i.e.    
        scroller movement path     
        ..........                        
 DEFВ #FF                          
                                          
                                          
   And don't forget before outputting 'floating'
 go' scroller erase old image
 on the screen!                               

Share your thoughts about the article