URL
https://opencores.org/ocsvn/rf6809/rf6809/trunk
Subversion Repositories rf6809
[/] [rf6809/] [trunk/] [software/] [boot/] [timer.asm] - Rev 21
Compare with Previous | Blame | View Log
; ============================================================================; __; \\__/ o\ (C) 2022 Robert Finch, Waterloo; \ __ / All rights reserved.; \/_// robfinch<remove>@opencores.org; ||;;; Timer routines for a WDC6522 compatible circuit.;; This source file is free software: you can redistribute it and/or modify; it under the terms of the GNU Lesser General Public License as published; by the Free Software Foundation, either version 3 of the License, or; (at your option) any later version.;; This source file is distributed in the hope that it will be useful,; but WITHOUT ANY WARRANTY; without even the implied warranty of; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; GNU General Public License for more details.;; You should have received a copy of the GNU General Public License; along with this program. If not, see <http://www.gnu.org/licenses/>.;; ============================================================================;TimerInit:ldd #$61A80 ; compare to 400000 (100 Hz assuming 40MHz clock)stb VIA+VIA_T3CMPLsta VIA+VIA_T3CMPHclr VIA+VIA_T3LLclr VIA+VIA_T3LHlda VIA+VIA_ACR ; set continuous mode for timerora #$100sta VIA+VIA_ACRlda #$880 ; enable timer #3 interruptssta VIA+VIA_IERrtsTimerIRQ:; Reset the edge sense circuit in the PIClda #31 ; Timer is IRQ #31sta PIC+16 ; register 16 is edge sense reset reglda PIC+$FF ; Timer active interrupt flagbeq notTimerIRQclr PIC+$FF ; clear the flaglda #31 ; Timer is IRQ #31sta IrqSource ; stuff a byte indicating the IRQ source for PEEK()clr VIA+VIA_T3LL ; should clear the interruptclr VIA+VIA_T3LHlda #31 ; Timer is IRQ #31sta PIC+16 ; register 16 is edge sense reset regclr PIC+$FF ; clear the flaginc $E0003F ; update timer IRQ screen flagldd milliseconds+2addd #10std milliseconds+2ldd millisecondsadcb #0stb milliseconds+1adca #0sta milliseconds; Update XModem timer, we just always do it rather than testing if XModem; is active. The increment is set to give approximately 3s before the MSB; gets set.ldb xm_timeraddb #4stb xm_timernotTimerIRQ:rts
