Programming - procedure for setting IM2 interrupts.

Realtime #02
 Hello to all DEMOMAKERS and just those
 who uploaded this text. As I promised in
 first issue I'm going to give now pa-
 ru effect texts for designing yours
 programs or writing musical
 monstrations. But first I want to introduce you
 to confuse you with such a thing as interrupts
 of the second kind (judging by the letters, many are not
 were able to figure them out from books, and I
 I want to help them with this). And for those who haven't yet
 I used this type of interruption I want
 I recommend trying it at least once
 and I am sure that you will continue to use
 indulge in them. I won’t cite the advantages
 duh, although I can say that you will forget about
 all sorts of 'twitching' music, implausible
 like looming scrollers, etc. 
                                          
   Interrupt routines IМ_2
 I divided it into three parts: setting the interrupt-
 restrictions of the second kind, canceling interrupts
 of the second kind (needed for correct
 progress from your program. For example TR-DOS
 does not like IМ_2) and the subroutine itself
 interrupt handling.                    
                                          
                                          
           Setting interrupts:          
                                          
 INT DI                                
        LD A,#F0 (#70)           
        LD I,ALD НL,#F000 (#7000)         
        LD DE,#F001 (#7001)         
        LD Sun,#0101                     
        LD (NL), #F1 (#71)           
        LDIR                              
        LD A,#C3                        
 LD (#F1F1),A (#7171)         
        LD НL,INTER                     
        LD (#F1F2),НL (#7172)         
        IМ 2                            
        EI                                
        RET                               
                                          
   When this subroutine is run, it creates
 gives a table at address #F000 of 256
 byte with the value #F1 and sets the
 How to switch to the processing subroutine
 interrupts.  If in your program
 the space with #F000 is occupied by something, then
 you just need to change the addresses in which
 Then a table will be created and everything will be
 O.K.  Values for creation are indicated in parentheses.
 Give the table at #7000.           
                                          
                                          
                                          
            Removing interrupts:            
                                          
 STOR IM 0                            
        LD A,#3F                        
        LD I,ARET                               
                                          
                                          
   We set IM_0 and in register I (century-
 interrupt tor) enter #3F (this is the same sign)
 The value is in register I after switching on.
 computer readings).                       
                                          
                                          
                                          
          Processing subroutine:         
                                          
 INTER РUSН AF                           
РUSН ВС                           
        RUSN DE                           
        RUSN NL                           
        RUSN IX                           
        РUSН IY                           
        .......                           
        Yours can be posted here      
        program or call commands     
        subroutines CALL addr             
        .......                           
        POP IY                           
        ROP IX                           
        POP NL                           
        POP DE                           
        ROR Sun                           
        POP AF                           
        RET It is very important to remember at the very beginning
 all registers, and then restore them,
 since with interrupts installed
 IМ_2 execution of your program is interrupted
 occurs every 1/50th of a second and it doesn’t matter in
 where did she work? Naturally
 that if you don’t remember all the registers, then
 when interrupt processing is completed, they
 will turn out to be spoiled. And if you are in os-
 new program, and in the program, I work-
 you manipulate the stack in the interrupt,
 then it would be advisable for you to save it too
 meaning. I usually do it like this:        
                                          
                                          
 INTER LD (STEK+1), SP                   
        LD #7000, SP                      
            stack pointer set    
            is applied to the free area   
 memory                        
        RUSN......                       
        ..........                       
        your program                    
        ..........                       
        ROR......                       
 STEC LD SP,0000                      
        RET                               
                                          
   That's it!  You can now take on
 something more complicated.                                   
  

Share your thoughts about the article