Competition - competition for young programmers: teams LDIR and LDDR.

Platinum #01
                       
We bring to your attention   
the next section of our magazine 
 YOUNG PROGRAMMERS COMPETITION   
                          
First of all, a small mistake 
in executing LDIR and LDDR commands.
Try to tell whether   
work like this:       
      
 ORG 30000         
 LD HL,M2     
LD DE,M1+1         
LD BC,65535        
 LDDR          DEFS    198,0           
M1      DEFB    0               
        DEFB    #5Е             
        JP      CONTINUE        
        DEFS    195,0           
M2      DEFS,0                  
                                
 Результатом работы этой        
маленькой програмки будет выход 
по адресу CONTINUE с включением 
режима прерываний IM 2.         
 Все дело в том , что процессорwhen executing the LDDR command     
after transferring the next one     
byte rereads the code again    
commands and after transferring the buy- 
ta #5E instead of LDDR processor   
will accept the command IM 2 well a command- 
yes JP has already been transferred   
 Note: in this example  
200 bytes are transferred.       
In the BC register the quantity is supposedly  
transferred bytes - obviously 
more number of bytes between    
first byte of the LDDR command and    
 label M1       
 DEFS 198.0 array can be   
filled with, for example, a program    
initializing something.       
DEFS 195.0 array can be   
interrupt processing program 
or anything else.     
The JP CONTINUE command can be used -  
change any other .           
 now we need to talk about the element  
ment DEFB #5E   
 This is the second byte of the koto command  
raya will be executed instead    
LDDR after the procedure has been completed  
in this case it will be     
IM 2 command                
IF YOU SUBSTITUT #5E INSTEAD     
 #B8 CONSEQUENCES MAY BE  
 UNPREDICTABLE (WHY?)    
                             
 AND NOW A MINI TASK      
                              
What will happen in the aircraft register after  
perform the following procedure  
                               
ORG 30000           
LD BC,32           
LD DE,M2+1         
LD HL,M3           
M2 LDIR                    
JP CONTINUE        
M3 DEFB #XX             
DEFS 99,#XX          
(#XX IS EQUAL TO #79)        
And what will be the results of it   
work ?                      
                               
The most complete answers will be   
rated, and their authors will receive   
small prizes!               
 Large hackers please do not   
 worry, this is a competition for  
beginners!!!!        
                       
Send your answers to    
                                
 Tomsk 634062     
 IRKUTSKY TRAKT 128-A      
APARTMENT 6                     
 SLOBODYAN ALEXANDRU        
VLADIMIROVICH                  
                   
 Marked:            
 "YOUNG CODER competition"       
                                
SEE YOU FRIENDS!     
03.08.96 NIKANOR.     
   

Share your thoughts about the article