 
     
    
        
         
     
    
        
        
                        
            
                
                
                
                
            
            
            
                        
                
                
                    URL
                    https://opencores.org/ocsvn/rf6809/rf6809/trunk
                
             
            
            
[/] [rf6809/] [trunk/] [software/] [boot/] [timer.asm] - Blame information for rev 12
Go to most recent revision |
Details |
Compare with Previous |
View Log
   
      
      | Line No. | Rev | Author | Line | 
   
   
      
         | 1 | 9 | robfinch | ; ============================================================================
 | 
      
         | 2 |  |  | ;        __
 | 
      
         | 3 |  |  | ;   \\__/ o\    (C) 2022  Robert Finch, Waterloo
 | 
      
         | 4 |  |  | ;    \  __ /    All rights reserved.
 | 
      
         | 5 |  |  | ;     \/_//     robfinch@opencores.org
 | 
      
         | 6 |  |  | ;       ||
 | 
      
         | 7 |  |  | ;
 | 
      
         | 8 |  |  | ;
 | 
      
         | 9 |  |  | ; Timer routines for a WDC6522 compatible circuit.
 | 
      
         | 10 |  |  | ;
 | 
      
         | 11 |  |  | ; This source file is free software: you can redistribute it and/or modify
 | 
      
         | 12 |  |  | ; it under the terms of the GNU Lesser General Public License as published
 | 
      
         | 13 |  |  | ; by the Free Software Foundation, either version 3 of the License, or
 | 
      
         | 14 |  |  | ; (at your option) any later version.
 | 
      
         | 15 |  |  | ;
 | 
      
         | 16 |  |  | ; This source file is distributed in the hope that it will be useful,
 | 
      
         | 17 |  |  | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
      
         | 18 |  |  | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
      
         | 19 |  |  | ; GNU General Public License for more details.
 | 
      
         | 20 |  |  | ;
 | 
      
         | 21 |  |  | ; You should have received a copy of the GNU General Public License
 | 
      
         | 22 |  |  | ; along with this program.  If not, see .
 | 
      
         | 23 |  |  | ;
 | 
      
         | 24 |  |  | ; ============================================================================
 | 
      
         | 25 |  |  | ;
 | 
      
         | 26 |  |  | TimerInit:
 | 
      
         | 27 |  |  |         ldd             #$61A80                                 ; compare to 400000 (100 Hz assuming 40MHz clock)
 | 
      
         | 28 |  |  |         stb             VIA+VIA_T3CMPL
 | 
      
         | 29 |  |  |         sta             VIA+VIA_T3CMPH
 | 
      
         | 30 |  |  |         clr             VIA+VIA_T3LL
 | 
      
         | 31 |  |  |         clr             VIA+VIA_T3LH
 | 
      
         | 32 |  |  |         lda             VIA+VIA_ACR                     ; set continuous mode for timer
 | 
      
         | 33 |  |  |         ora             #$100
 | 
      
         | 34 |  |  |         sta             VIA+VIA_ACR                     ; enable timer #3 interrupts
 | 
      
         | 35 |  |  |         lda             #$810
 | 
      
         | 36 |  |  |         sta             VIA+VIA_IER
 | 
      
         | 37 |  |  |         rts
 | 
      
         | 38 |  |  |  
 | 
      
         | 39 |  |  | TimerIRQ:
 | 
      
         | 40 |  |  |         ; Reset the edge sense circuit in the PIC
 | 
      
         | 41 |  |  |         lda             #31                                                     ; Timer is IRQ #31
 | 
      
         | 42 |  |  |         sta             IrqSource               ; stuff a byte indicating the IRQ source for PEEK()
 | 
      
         | 43 |  |  |         sta             PIC+16                                  ; register 16 is edge sense reset reg
 | 
      
         | 44 |  |  |         lda             VIA+VIA_IFR
 | 
      
         | 45 |  |  |         bpl             notTimerIRQ
 | 
      
         | 46 |  |  |         bita    #$800
 | 
      
         | 47 |  |  |         beq             notTimerIRQ
 | 
      
         | 48 |  |  |         clr             VIA+VIA_T3LL
 | 
      
         | 49 |  |  |         clr             VIA+VIA_T3LH
 | 
      
         | 50 |  |  |         inc             $E00037                                 ; update timer IRQ screen flag
 | 
      
         | 51 |  |  | notTimerIRQ:
 | 
      
         | 52 |  |  |         rts
 | 
      
         | 53 |  |  |  
 | 
      
         | 54 |  |  |  
 | 
      
         | 55 |  |  |  
 | 
   
 
 
         
                
        
            
            
        
        
             
    
        © copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.