90 lines
1.6 KiB
Plaintext
90 lines
1.6 KiB
Plaintext
.equ PINA = 0x00
|
|
.equ DDRA = 0x01
|
|
.equ PORTA = 0x02
|
|
.equ PINC = 0x06
|
|
.equ DDRC = 0x07
|
|
.equ PORTC = 0x08
|
|
|
|
.equ WDTCSR = 0x60
|
|
.equ TCCR0A = 0x24
|
|
.equ TCCR0B = 0x25
|
|
.equ TIMSK0 = 0x6E
|
|
.equ TIFR0 = 0x35
|
|
|
|
.equ RAMEND = 0x21FF
|
|
.equ SPH = 0x3E ; initialisation de la pile
|
|
.equ SPL = 0x3D
|
|
|
|
.def d2 = r19
|
|
.def d1 = r20
|
|
.def d0 = r21
|
|
.def select = r22
|
|
|
|
.org 0x000
|
|
; Vecteur RESET
|
|
jmp debut
|
|
|
|
.org 0x0018 ; Interruption du watchdog
|
|
jmp wd
|
|
|
|
.org 0x002E ; Interruption du timer
|
|
jmp tm
|
|
|
|
.org 0x0080
|
|
|
|
afficheur:
|
|
.DB 0x7E, 0x0C, 0x37, 0x9F, 0x4D, 0xDB, 0xFB, 0x0E, 0xFF, 0xDF
|
|
; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
|
|
|
|
debut:
|
|
d2 <- 0
|
|
d1 <- 0
|
|
d0 <- 0
|
|
select <- 0b00100000
|
|
|
|
cli
|
|
; Configuration des ports
|
|
DDRA@IO <- 0xFF
|
|
DDRC@IO <- 0xFF
|
|
|
|
; Watchdog toutes les secondes
|
|
WDTCSR <- 0x10
|
|
WDTCSR <- 0b01000110
|
|
|
|
; Timer toutes les 2 ms
|
|
TCCR0A@IO <- 0x00
|
|
TCCR0B@IO <- 0x04
|
|
TIMSK0 <- 0x01
|
|
TIFR0 <- 0x01
|
|
sei
|
|
|
|
boucle:
|
|
sleep
|
|
jump boucle
|
|
|
|
wd:
|
|
inc d0
|
|
si d0 < 10 saut affichage
|
|
d0 <- 0
|
|
inc d1
|
|
si d1 < 10 saut affichage
|
|
d1 <- 0
|
|
inc d2
|
|
si d2 < 10 saut affichage
|
|
d2 <- 0
|
|
affichage:
|
|
; Affichage Simulateur
|
|
; PORTC@IO <- afficheur@ROM[d0]
|
|
; PORTB@IO <- afficheur@ROM[d1]
|
|
; PORTA@IO <- afficheur@ROM[d2]
|
|
reti
|
|
|
|
tm:
|
|
PortC@IO <- select
|
|
si select = 0b10000000 alors PortA@IO <- afficheur@ROM[d2]
|
|
si select = 0b01000000 alors PortA@IO <- afficheur@ROM[d1]
|
|
si select = 0b00100000 alors PortA@IO <- afficheur@ROM[d0]
|
|
lsl select
|
|
si select = 0 alors select <- 0b00100000
|
|
reti
|