From 239edc80f637348a4e9c84166efea1af5b1abe0f Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Fri, 19 May 2017 22:52:03 +0200 Subject: [PATCH] Déplacement des fichiers tests et ajout des non-suivis --- Makefile | 2 +- adc.txt | 99 --------------------------------------------------------------------------------------------------- allumertous.txt | 39 --------------------------------------- bouton.txt | 39 --------------------------------------- chen.txt | 62 -------------------------------------------------------------- code.txt | 7 ------- compteur.txt | 53 ----------------------------------------------------- compteurLettre.txt | 106 ---------------------------------------------------------------------------------------------------------- ram.txt | 61 ------------------------------------------------------------- test.asm | 45 --------------------------------------------- tests/adc.txt | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/allumertous.txt | 39 +++++++++++++++++++++++++++++++++++++++ tests/bouton.txt | 39 +++++++++++++++++++++++++++++++++++++++ tests/boutonInt.txt | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/chaudiere.txt | 44 ++++++++++++++++++++++++++++++++++++++++++++ tests/chen.txt | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/code.txt | 7 +++++++ tests/compteur.txt | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/compteurLettre.txt | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/debug.txt | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/glitch.txt | 20 ++++++++++++++++++++ tests/modulo.txt | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/osci.txt | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/ram.txt | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 24 files changed, 835 insertions(+), 512 deletions(-) delete mode 100644 adc.txt delete mode 100644 allumertous.txt delete mode 100644 bouton.txt delete mode 100644 chen.txt delete mode 100644 code.txt delete mode 100644 compteur.txt delete mode 100644 compteurLettre.txt delete mode 100644 ram.txt delete mode 100644 test.asm create mode 100644 tests/adc.txt create mode 100644 tests/allumertous.txt create mode 100644 tests/bouton.txt create mode 100644 tests/boutonInt.txt create mode 100644 tests/chaudiere.txt create mode 100644 tests/chen.txt create mode 100644 tests/code.txt create mode 100644 tests/compteur.txt create mode 100644 tests/compteurLettre.txt create mode 100644 tests/debug.txt create mode 100644 tests/glitch.txt create mode 100644 tests/modulo.txt create mode 100644 tests/osci.txt create mode 100644 tests/ram.txt diff --git a/Makefile b/Makefile index e9ba3dd..594f429 100644 --- a/Makefile +++ b/Makefile @@ -33,5 +33,5 @@ SOURCES=$(wildcard *.txt) clean: rm -rf $(subst md,html,$(wildcard *.md)) *.tmp rm -rf $(subst md,pdf,$(wildcard *.md)) - rm -rf *.hex *.lst + rm -rf *.hex *.lst *.err diff --git a/adc.txt b/adc.txt deleted file mode 100644 index 6b52af1..0000000 --- a/adc.txt +++ /dev/null @@ -1,99 +0,0 @@ -.equ PINA = 0x00 ; définition des adresses des ports -.equ DDRA = 0x01 -.equ PORTA = 0x02 -.equ PINC = 0x06 -.equ DDRC = 0x07 -.equ PORTC = 0x08 - -.equ TTCR0A = 0x24 ; Initialisation du timer -.equ TTCR0B = 0x25 -.equ TMSK0 = 0x6e - -.equ SREG = 0x3F -.equ RAMEND = 0x21FF -.equ SPH = 0x3E ; initialisation de la pile -.equ SPL = 0x3D - -.equ ADMUX = 0x7C -.equ ADCSRB = 0x7B -.equ ADCSRA = 0x7A -.equ ADCH = 0x79 - -.def selAfficheur = r19 -.def tmp = r20 -.def val = r21 -.def aff0 = r5 -.def aff1 = r1 -.def aff2 = r2 -.def aff3 = r3 - -.org 0x000 - ; Vecteur RESET - jmp debut - -.org 0x002e - ; Vecteur TIMER0 - jmp tmr - -.org 0x003A ; ADC - jmp adc - -.org 0x0080 -afficheur: - .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B, 0x77, 0x40, 0x4c, 0x7c, 0x4f, 0x47, 0x40, 0x76, 0x04, 0x3c, 0x40, 0x0E, 0x37, 0x54, 0x5c, 0x40, 0x40, 0x44, 0x5b, 0x4e, 0x1c, 0x1c, 0x40, 0x40, 0x40, 0x40, 0x63, 0x00 - ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, °, space - - -debut: - SREG <- 0b10000000 - DDRA@IO <- 0xFF - DDRC@IO <- 0xFF - TTCR0A@IO <- 0x01 - TTCR0B@IO <- 0x03 - TMSK0 <- 0x01 - selAfficheur <- 0x01 - - ADMUX <- 0b01100000 - ADCSRB <- 0b00000010 - ADCSRA <- 0b11011110 - - PORTA@IO <- 0xAA - PORTC@IO <- 0x00 - SEI - -boucle: - ; On attend et on recommence - saut boucle - - -tempo: - ldi r24,8 -tempoA: - subi r22,1 - sbci r23,0 - sbci r24,0 - brcc tempoA - ret - -adc: - - val <- ADCH - aff0 <- val/1-(val/10)*10 - aff1 <- val/10-(val/100)*10 - aff2 <- val/100 - aff3 <- 0 - ADCSRA <- 0b11011101 - reti - - -tmr: - lsl selAfficheur - si selAfficheur > 8 alors selafficheur <- 1 - portc@IO <- 0xff - selAfficheur - - si selAfficheur == 1 alors porta@IO <- afficheur@ROM[aff0] - si selAfficheur == 2 alors porta@IO <- afficheur@ROM[aff1] - si selAfficheur == 4 alors porta@IO <- afficheur@ROM[aff2] - si selAfficheur == 8 alors porta@IO <- afficheur@ROM[aff3] - reti - diff --git a/allumertous.txt b/allumertous.txt deleted file mode 100644 index 9b21ce7..0000000 --- a/allumertous.txt +++ /dev/null @@ -1,39 +0,0 @@ -.equ PINA = 0x00 ; définition des adresses des ports -.equ DDRA = 0x01 -.equ PORTA = 0x02 -.equ PINB = 0x03 -.equ DDRB = 0x04 -.equ PORTB = 0x05 -.equ PINC = 0x06 -.equ DDRC = 0x07 -.equ PORTC = 0x08 - -.equ RAMEND = 0x21FF -.equ SPH = 0x3E ; initialisation de la pile -.equ SPL = 0x3D - -.org 0x000 - ; Vecteur RESET - jmp debut - -.org 0x0080 - -debut: - DDRA@IO <- 0xFF - DDRC@IO <- 0xFF - -boucle: - PORTA@IO <- 0xFF - PORTC@IO <- 0x00 - jmp boucle ; On recommence - -tempo: - ; On fait une pause - ldi r24,8 -tempoA: - subi r22,1 - sbci r23,0 - sbci r24,0 - brcc tempoA - ret - diff --git a/bouton.txt b/bouton.txt deleted file mode 100644 index 2a967a9..0000000 --- a/bouton.txt +++ /dev/null @@ -1,39 +0,0 @@ -.equ PINA = 0x00 ; définition des adresses des ports -.equ DDRA = 0x01 -.equ PORTA = 0x02 -.equ PINC = 0x06 -.equ DDRC = 0x07 -.equ PORTC = 0x08 - -.equ RAMEND = 0x21FF -.equ SPH = 0x3E ; initialisation de la pile -.equ SPL = 0x3D - -.org 0x000 - ; Vecteur RESET - jmp debut - - -.org 0x0080 - - -debut: - DDRA@IO <- 0xFF - DDRC@IO <- 0x0F - PORTC@IO <- 0x00 - SEI - -boucle: - PORTA@IO <- PINC@IO - ; PORTA@IO <- 0xAA - saut boucle - -tempo: - ldi r24,8 -tempoA: - subi r22,1 - sbci r23,0 - sbci r24,0 - brcc tempoA - ret - diff --git a/chen.txt b/chen.txt deleted file mode 100644 index 49d8172..0000000 --- a/chen.txt +++ /dev/null @@ -1,62 +0,0 @@ -.equ PINA = 0x00 ; définition des adresses des ports -.equ DDRA = 0x01 -.equ PORTA = 0x02 -.equ PINB = 0x03 -.equ DDRB = 0x04 -.equ PORTB = 0x05 - -.equ RAMEND = 0x21FF -.equ SPH = 0x3E ; initialisation de la pile -.equ SPL = 0x3D - -.org 0x000 - ; Vecteur RESET - jmp debut - -.org 0x0080 - -debut: - ldi r16,0xFF ; On configure les ports A et B en sortie - out DDRA,r16 - out DDRB,r16 - r17 <- 0b00000001 ; 8 places de chenillard - - -boucleA: - ; On affiche l'état courant - out porta,r17 - - call tempo - - ; On calcule l'état suivant - lsl r17 - si r17 > 0 saut boucleA - - ; Si le bit "volant" est sorti de l'octet, on passe à l'autre partie du programme sur le port B - out porta,r17 ; On éteint le port A - ; On configure le registre pour qu'il commence de l'autre coté - r17 <- 0b10000000 - saut boucleB ; (pas nécessaire) - -boucleB: - out portb,r17 - - call tempo; - - lsr r17 - si r17 > 0 saut boucleB - - out portb,r17 - r17 <- 0b00000001 - saut boucleA - -; Programme pour faire une pause -tempo: - ; On fait une pause - ldi r24,8 -tempoA: - subi r22,1 - sbci r23,0 - sbci r24,0 - brcc tempoA - ret diff --git a/code.txt b/code.txt deleted file mode 100644 index d29c825..0000000 --- a/code.txt +++ /dev/null @@ -1,7 +0,0 @@ -.org 0x0080 - -debut: - ldi r16,0xFF ; On configure les ports A et B en sortie - out DDRA,r16 - out DDRB,r16 - r17 <- 0b00000001 ; 8 places de chenillard diff --git a/compteur.txt b/compteur.txt deleted file mode 100644 index 04f5bb8..0000000 --- a/compteur.txt +++ /dev/null @@ -1,53 +0,0 @@ -.equ PINA = 0x00 ; définition des adresses des ports -.equ DDRA = 0x01 -.equ PORTA = 0x02 -.equ PINC = 0x06 -.equ DDRC = 0x07 -.equ PORTC = 0x08 - -.equ RAMEND = 0x21FF -.equ SPH = 0x3E ; initialisation de la pile -.equ SPL = 0x3D - -.def compteur = r20 -.def seg = r21 - -.org 0x000 - ; Vecteur RESET - jmp debut - -.org 0x0080 - -afficheur: - .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B - ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 - - -debut: - DDRA@IO <- 0xFF - DDRC@IO <- 0xFF - -boucle: - - ; On affiche compteur sur le 7 segments - seg <- afficheur@ROM[compteur] - out porta,seg - - ; On change de chiffre - inc compteur - si compteur > 9 alors compteur <- 0 - - ; On attend et on recommence - call tempo - call tempo - call tempo - saut boucle - -tempo: - ldi r24,8 -tempoA: - subi r22,1 - sbci r23,0 - sbci r24,0 - brcc tempoA - ret diff --git a/compteurLettre.txt b/compteurLettre.txt deleted file mode 100644 index 0f31299..0000000 --- a/compteurLettre.txt +++ /dev/null @@ -1,106 +0,0 @@ -.equ PINA = 0x00 ; définition des adresses des ports -.equ DDRA = 0x01 -.equ PORTA = 0x02 -.equ PINC = 0x06 -.equ DDRC = 0x07 -.equ PORTC = 0x08 - -.equ TTCR0A = 0x24 ; Initialisation du timer -.equ TTCR0B = 0x25 -.equ TMSK0 = 0x6e - -.equ RAMEND = 0x21FF -.equ SPH = 0x3E ; initialisation de la pile -.equ SPL = 0x3D - -.def selAfficheur = r19 -.def tmp = r20 -.def seg = r21 -.def aff0 = r0 -.def aff1 = r1 -.def aff2 = r2 -.def aff3 = r3 - -.org 0x000 - ; Vecteur RESET - jmp debut - -.org 0x002e - ; Vecteur TIMER0 - jmp tmr - -.org 0x0080 -afficheur: - .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B, 0x77, 0x40, 0x4c, 0x7c, 0x4f, 0x47, 0x40, 0x76, 0x04, 0x3c, 0x40, 0x0E, 0x37, 0x54, 0x5c, 0x40, 0x40, 0x44, 0x5b, 0x4e, 0x1c, 0x1c, 0x40, 0x40, 0x40, 0x40, 0x63, 0x00 - ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, °, space - - -debut: - DDRA@IO <- 0xFF - DDRC@IO <- 0x0F - TTCR0A@IO <- 0x01 - TTCR0B@IO <- 0x03 - TMSK0 <- 0x01 - selAfficheur <- 0x01 - SEI - -boucle: - - ; On change de chiffre - aff0 <- aff1 - aff1 <- aff2 - aff2 <- aff3 - inc aff3 - si aff3 > 37 alors aff3 <- 0 - - - - - - - ; On attend et on recommence - call tempo - call tempo - call tempo - call tempo - call tempo - call tempo - call tempo - call tempo - call tempo - call tempo - call tempo - saut boucle - -tempo: - ldi r24,8 -tempoA: - subi r22,1 - sbci r23,0 - sbci r24,0 - brcc tempoA - ret - -tmr: - lsl selAfficheur - si selAfficheur > 8 alors selafficheur <- 1 - portc@IO <- 0xff - selAfficheur - r18 <- pinC@IO - lsr r18 - lsr r18 - lsr r18 - lsr r18 - tmp <- r18 - and tmp, aff3 - si selAfficheur == 1 alors porta@IO <- afficheur@ROM[tmp] - tmp <- r18 - and tmp, aff2 - si selAfficheur == 2 alors porta@IO <- afficheur@ROM[tmp] - tmp <- r18 - and tmp , aff1 - si selAfficheur == 4 alors porta@IO <- afficheur@ROM[tmp] - tmp <- r18 - and tmp, aff0 - si selAfficheur == 8 alors porta@IO <- afficheur@ROM[tmp] - sei - ret diff --git a/ram.txt b/ram.txt deleted file mode 100644 index adc9f13..0000000 --- a/ram.txt +++ /dev/null @@ -1,61 +0,0 @@ -.equ PINA = 0x00 ; définition des adresses des ports -.equ DDRA = 0x01 -.equ PORTA = 0x02 -.equ PINC = 0x06 -.equ DDRC = 0x07 -.equ PORTC = 0x08 - -.equ TEST = 0x0200 - -.equ RAMEND = 0x21FF -.equ SPH = 0x3E ; initialisation de la pile -.equ SPL = 0x3D - -.org 0x000 - ; Vecteur RESET - jmp debut - - -.org 0x0080 - - -debut: - DDRA@IO <- 0xFF - DDRC@IO <- 0xFF - PORTC@IO <- 0x00 - PORTA@IO <- 0x00 - r11 <- 0x00 - r10 <- 0x00 - -boucle: - - test[2] <- 0x22 - PORTA@IO <- test[2] - - jmp sl - ; test <- 0x22 - - LDI r16,0xAA - - LDI r26,0x02 - LDI r27,0x00 - - ST X,r16 - - LD r10,X - - ;PORTA@IO <- test[1] - -sl: - sleep - saut sl - -tempo: - ldi r24,8 -tempoA: - subi r22,1 - sbci r23,0 - sbci r24,0 - brcc tempoA - ret - diff --git a/test.asm b/test.asm deleted file mode 100644 index e5213cc..0000000 --- a/test.asm +++ /dev/null @@ -1,45 +0,0 @@ -.equ PINA = 0x00 ; définition des adresses des ports -.equ DDRA = 0x01 -.equ PORTA = 0x02 -.equ PINB = 0x03 -.equ DDRB = 0x04 -.equ PORTB = 0x05 -.equ PINC = 0x06 -.equ DDRC = 0x07 -.equ PORTC = 0x08 - -.equ RAMEND = 0x21FF -.equ SPH = 0x3E ; initialisation de la pile -.equ SPL = 0x3D - -.org 0x000 - ; Vecteur RESET - jmp debut - -.org 0x0080 - -debut: - ldi r16,0x01 ; Configuration de la direction des ports - out DDRC,r16 - -boucle: - ldi r16,0x00 - in r16,PINC ; Lecture du port C - lsr r16 ; Décalage vers la droite : le bit associé au bouton va sur celui associé à la LED - ; ldi r16,0x01 - ; out PORTC,r16 ; Écriture du port C - ; call tempo - out PORTC,r16 ; Écriture du port C - ; call tempo - jmp boucle ; On recommence - -tempo: - ; On fait une pause - ldi r24,8 -tempoA: - subi r22,1 - sbci r23,0 - sbci r24,0 - brcc tempoA - ret - diff --git a/tests/adc.txt b/tests/adc.txt new file mode 100644 index 0000000..6b52af1 --- /dev/null +++ b/tests/adc.txt @@ -0,0 +1,99 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 + +.equ TTCR0A = 0x24 ; Initialisation du timer +.equ TTCR0B = 0x25 +.equ TMSK0 = 0x6e + +.equ SREG = 0x3F +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.equ ADMUX = 0x7C +.equ ADCSRB = 0x7B +.equ ADCSRA = 0x7A +.equ ADCH = 0x79 + +.def selAfficheur = r19 +.def tmp = r20 +.def val = r21 +.def aff0 = r5 +.def aff1 = r1 +.def aff2 = r2 +.def aff3 = r3 + +.org 0x000 + ; Vecteur RESET + jmp debut + +.org 0x002e + ; Vecteur TIMER0 + jmp tmr + +.org 0x003A ; ADC + jmp adc + +.org 0x0080 +afficheur: + .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B, 0x77, 0x40, 0x4c, 0x7c, 0x4f, 0x47, 0x40, 0x76, 0x04, 0x3c, 0x40, 0x0E, 0x37, 0x54, 0x5c, 0x40, 0x40, 0x44, 0x5b, 0x4e, 0x1c, 0x1c, 0x40, 0x40, 0x40, 0x40, 0x63, 0x00 + ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, °, space + + +debut: + SREG <- 0b10000000 + DDRA@IO <- 0xFF + DDRC@IO <- 0xFF + TTCR0A@IO <- 0x01 + TTCR0B@IO <- 0x03 + TMSK0 <- 0x01 + selAfficheur <- 0x01 + + ADMUX <- 0b01100000 + ADCSRB <- 0b00000010 + ADCSRA <- 0b11011110 + + PORTA@IO <- 0xAA + PORTC@IO <- 0x00 + SEI + +boucle: + ; On attend et on recommence + saut boucle + + +tempo: + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret + +adc: + + val <- ADCH + aff0 <- val/1-(val/10)*10 + aff1 <- val/10-(val/100)*10 + aff2 <- val/100 + aff3 <- 0 + ADCSRA <- 0b11011101 + reti + + +tmr: + lsl selAfficheur + si selAfficheur > 8 alors selafficheur <- 1 + portc@IO <- 0xff - selAfficheur + + si selAfficheur == 1 alors porta@IO <- afficheur@ROM[aff0] + si selAfficheur == 2 alors porta@IO <- afficheur@ROM[aff1] + si selAfficheur == 4 alors porta@IO <- afficheur@ROM[aff2] + si selAfficheur == 8 alors porta@IO <- afficheur@ROM[aff3] + reti + diff --git a/tests/allumertous.txt b/tests/allumertous.txt new file mode 100644 index 0000000..9b21ce7 --- /dev/null +++ b/tests/allumertous.txt @@ -0,0 +1,39 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINB = 0x03 +.equ DDRB = 0x04 +.equ PORTB = 0x05 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.org 0x000 + ; Vecteur RESET + jmp debut + +.org 0x0080 + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0xFF + +boucle: + PORTA@IO <- 0xFF + PORTC@IO <- 0x00 + jmp boucle ; On recommence + +tempo: + ; On fait une pause + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret + diff --git a/tests/bouton.txt b/tests/bouton.txt new file mode 100644 index 0000000..2a967a9 --- /dev/null +++ b/tests/bouton.txt @@ -0,0 +1,39 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.org 0x000 + ; Vecteur RESET + jmp debut + + +.org 0x0080 + + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0x0F + PORTC@IO <- 0x00 + SEI + +boucle: + PORTA@IO <- PINC@IO + ; PORTA@IO <- 0xAA + saut boucle + +tempo: + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret + diff --git a/tests/boutonInt.txt b/tests/boutonInt.txt new file mode 100644 index 0000000..72bdf9f --- /dev/null +++ b/tests/boutonInt.txt @@ -0,0 +1,78 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 + +.equ SREG = 0x3F + +.equ EIMSK = 0x3D +.equ EICRA = 0x69 +.equ EICRB = 0x6A + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.org 0x000 + ; Vecteur RESET + jmp debut + +.org 0x0002 ; INT0 + jmp valider + +.org 0x0004 ; INT1 + jmp retour + +.org 0x0006 ; INT2 + jmp incrementer + +.org 0x0008 ; INT3 + jmp decrementer + +.org 0x0080 + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0xFF + PORTA@IO <- 0xFF + PORTC@IO <- 0xFF + EIMSK <- 0b00001111 + EICRA <- 0b11111111 ; TODO Oscillations annulables ? + EICRB <- 0b00000000 + SEI + +boucle: + sleep + saut boucle + +valider: + PORTC@IO <- 0x00 + reti + +retour: + PORTC@IO <- 0xFF + reti + +incrementer: + r20 <- PINC@IO + inc r20 + PORTC@IO <- r20 + reti + +decrementer: + r20 <- PINC@IO + dec r20 + PORTC@IO <- r20 + reti + +tempo: + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret + diff --git a/tests/chaudiere.txt b/tests/chaudiere.txt new file mode 100644 index 0000000..f9d7bc3 --- /dev/null +++ b/tests/chaudiere.txt @@ -0,0 +1,44 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 +.equ PING = 0x12 +.equ DDRG = 0x13 +.equ PORTG = 0x14 + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.org 0x000 + ; Vecteur RESET + jmp debut + + +.org 0x0080 + + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0xFF + DDRG@IO <- 0xFF + PORTC@IO <- 0x00 + SEI + +boucle: + ;PORTA@IO <- PINC@IO + ; PORTA@IO <- 0xAA + PORTG@IO <- 0x01 + saut boucle + +tempo: + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret + diff --git a/tests/chen.txt b/tests/chen.txt new file mode 100644 index 0000000..49d8172 --- /dev/null +++ b/tests/chen.txt @@ -0,0 +1,62 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINB = 0x03 +.equ DDRB = 0x04 +.equ PORTB = 0x05 + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.org 0x000 + ; Vecteur RESET + jmp debut + +.org 0x0080 + +debut: + ldi r16,0xFF ; On configure les ports A et B en sortie + out DDRA,r16 + out DDRB,r16 + r17 <- 0b00000001 ; 8 places de chenillard + + +boucleA: + ; On affiche l'état courant + out porta,r17 + + call tempo + + ; On calcule l'état suivant + lsl r17 + si r17 > 0 saut boucleA + + ; Si le bit "volant" est sorti de l'octet, on passe à l'autre partie du programme sur le port B + out porta,r17 ; On éteint le port A + ; On configure le registre pour qu'il commence de l'autre coté + r17 <- 0b10000000 + saut boucleB ; (pas nécessaire) + +boucleB: + out portb,r17 + + call tempo; + + lsr r17 + si r17 > 0 saut boucleB + + out portb,r17 + r17 <- 0b00000001 + saut boucleA + +; Programme pour faire une pause +tempo: + ; On fait une pause + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret diff --git a/tests/code.txt b/tests/code.txt new file mode 100644 index 0000000..d29c825 --- /dev/null +++ b/tests/code.txt @@ -0,0 +1,7 @@ +.org 0x0080 + +debut: + ldi r16,0xFF ; On configure les ports A et B en sortie + out DDRA,r16 + out DDRB,r16 + r17 <- 0b00000001 ; 8 places de chenillard diff --git a/tests/compteur.txt b/tests/compteur.txt new file mode 100644 index 0000000..04f5bb8 --- /dev/null +++ b/tests/compteur.txt @@ -0,0 +1,53 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.def compteur = r20 +.def seg = r21 + +.org 0x000 + ; Vecteur RESET + jmp debut + +.org 0x0080 + +afficheur: + .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B + ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 + + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0xFF + +boucle: + + ; On affiche compteur sur le 7 segments + seg <- afficheur@ROM[compteur] + out porta,seg + + ; On change de chiffre + inc compteur + si compteur > 9 alors compteur <- 0 + + ; On attend et on recommence + call tempo + call tempo + call tempo + saut boucle + +tempo: + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret diff --git a/tests/compteurLettre.txt b/tests/compteurLettre.txt new file mode 100644 index 0000000..0f31299 --- /dev/null +++ b/tests/compteurLettre.txt @@ -0,0 +1,106 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 + +.equ TTCR0A = 0x24 ; Initialisation du timer +.equ TTCR0B = 0x25 +.equ TMSK0 = 0x6e + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.def selAfficheur = r19 +.def tmp = r20 +.def seg = r21 +.def aff0 = r0 +.def aff1 = r1 +.def aff2 = r2 +.def aff3 = r3 + +.org 0x000 + ; Vecteur RESET + jmp debut + +.org 0x002e + ; Vecteur TIMER0 + jmp tmr + +.org 0x0080 +afficheur: + .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B, 0x77, 0x40, 0x4c, 0x7c, 0x4f, 0x47, 0x40, 0x76, 0x04, 0x3c, 0x40, 0x0E, 0x37, 0x54, 0x5c, 0x40, 0x40, 0x44, 0x5b, 0x4e, 0x1c, 0x1c, 0x40, 0x40, 0x40, 0x40, 0x63, 0x00 + ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, °, space + + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0x0F + TTCR0A@IO <- 0x01 + TTCR0B@IO <- 0x03 + TMSK0 <- 0x01 + selAfficheur <- 0x01 + SEI + +boucle: + + ; On change de chiffre + aff0 <- aff1 + aff1 <- aff2 + aff2 <- aff3 + inc aff3 + si aff3 > 37 alors aff3 <- 0 + + + + + + + ; On attend et on recommence + call tempo + call tempo + call tempo + call tempo + call tempo + call tempo + call tempo + call tempo + call tempo + call tempo + call tempo + saut boucle + +tempo: + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret + +tmr: + lsl selAfficheur + si selAfficheur > 8 alors selafficheur <- 1 + portc@IO <- 0xff - selAfficheur + r18 <- pinC@IO + lsr r18 + lsr r18 + lsr r18 + lsr r18 + tmp <- r18 + and tmp, aff3 + si selAfficheur == 1 alors porta@IO <- afficheur@ROM[tmp] + tmp <- r18 + and tmp, aff2 + si selAfficheur == 2 alors porta@IO <- afficheur@ROM[tmp] + tmp <- r18 + and tmp , aff1 + si selAfficheur == 4 alors porta@IO <- afficheur@ROM[tmp] + tmp <- r18 + and tmp, aff0 + si selAfficheur == 8 alors porta@IO <- afficheur@ROM[tmp] + sei + ret diff --git a/tests/debug.txt b/tests/debug.txt new file mode 100644 index 0000000..4011fa7 --- /dev/null +++ b/tests/debug.txt @@ -0,0 +1,67 @@ +; Équivalences + +.equ PINA = 0x00 +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 + +.equ WDTCSR = 0x60 + +.equ TTCR0A = 0x24 +.equ TTCR0B = 0x25 +.equ TMSK0 = 0x6e + +.equ EIMSK = 0x3D +.equ EICRA = 0x69 +.equ EICRB = 0x6A + +.equ ADMUX = 0x7C +.equ ADCSRB = 0x7B +.equ ADCSRA = 0x7A +.equ ADCH = 0x79 + +.equ SPH = 0x3E +.equ SPL = 0x3D + +; Nommage des registres utilisés + +.def etat = r12 +.def reference = r13 ; Température de référence actuelle +.def d3 = r2 ; Digit 3 (tout à gauche) +.def d2 = r3 ; Digit 2 +.def d1 = r4 ; Digit 1 +.def d0 = r5 ; Digit 0 (tout à droite) +.def compteur = r6 ; Utilisé pour modifier des valeurs dans le menu +.def temp = r7 ; Utilisé pour différentes choses mais très brièvement +.def t2 = r8 ; Jour (3 premiers bits) et Heure (5 derniers bits) +.def t1 = r9 ; Minutes +.def t0 = r10 ; Secondes / 2 +.def selaff = r11 ; Digit en cours d'affichage + +.def jours = 0x0200 +.def tempJour = 0x02a8 +.def tempNuit = 0x02a9 + +; Vecteurs d'interruptions + +.org 0x000 ; Vecteur RESET + jmp debut + +.org 0x0080 + +; Tableaux de la mémoire du programme + +afficheur: + .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B + ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 + +; Programme + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0xFF + PORTA@IO <- 0xFF + PORTC@IO <- 0x00 + jmp debut diff --git a/tests/glitch.txt b/tests/glitch.txt new file mode 100644 index 0000000..3a77a71 --- /dev/null +++ b/tests/glitch.txt @@ -0,0 +1,20 @@ +.equ DDRA = 0x01 +.equ DDRC = 0x07 + +.org 0x000 + jmp debut + +.org 0x0080 + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0xFF + +boucle: + LDI r17,0xAA + LDI r26,0x20 + LDI r27,0x02 + ST X,r17 + +sl: + saut sl diff --git a/tests/modulo.txt b/tests/modulo.txt new file mode 100644 index 0000000..5b26e32 --- /dev/null +++ b/tests/modulo.txt @@ -0,0 +1,52 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.def compteur = r20 +.def seg = r21 + +.org 0x000 + ; Vecteur RESET + jmp debut + +.org 0x0080 + +afficheur: + .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B + ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 + + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0xFF + + r2 <- 13 + r3 <- 10 +eti0: + SUB r2,r3 + BRCC eti0 + ADD r2,r3 + + PORTA@IO <- r2 ; Gives + ;PORTA@IO <- 256 - 3 ; Essai + ;PORTA@IO <- 3 ; Should be + +boucle: + sleep + saut boucle + +tempo: + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret diff --git a/tests/osci.txt b/tests/osci.txt new file mode 100644 index 0000000..b37bd0c --- /dev/null +++ b/tests/osci.txt @@ -0,0 +1,107 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 +.equ PIND = 0x09 +.equ DDRD = 0x0A +.equ PORTD = 0x0B + +.equ SREG = 0x3F + +.equ EIMSK = 0x3D +.equ EICRA = 0x69 +.equ EICRB = 0x6A + +.equ TCNT0 = 0x46 +.equ OCR0A = 0x47 +.equ OCR0B = 0x48 +.equ TTCR0A = 0x24 +.equ TTCR0B = 0x25 +.equ TMSK0 = 0x6e + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.org 0x000 + ; Vecteur RESET + jmp debut + +.org 0x0002 ; INT0 + jmp bouton + +.org 0x0004 ; INT1 + jmp bouton + +.org 0x0006 ; INT2 + jmp bouton + +.org 0x0008 ; INT3 + jmp bouton + +.org 0x002E ; Timer Overflow + jmp timer + +.org 0x0080 + +afficheur: + .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B + ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0xFF + ;DDRD@IO <- 0x00 + EIMSK <- 0b00001111 + EICRA <- 0b10101010 ; TODO Oscillations annulables ? + EICRB <- 0b00000000 + ; Timer + ;TTCR0A@IO <- 0b00000001 + ;TTCR0B@IO <- 0b00000011 + ;TMSK0 <- 0b00000011 + ;OCR0A <- 100 + SEI + + PORTC@IO <- 0x00 + PORTA@IO <- 0x3F + r20 <- 0 + +boucle: + sleep + saut boucle + +valider: + inc r20 + si r20 > 9 alors r20 <- 0 + PORTA@IO <- afficheur@ROM[r20] + reti + +bouton: + ;TCNT0 <- 0 + jmp valider + +reti: + reti + + +timer: + ;si (PORTD@IO & 0x01) = 0 saut valider + ;r20 <- PORTC@IO + ;inc r20 + ;PORTC@IO <- r20 + ;PORTA@IO <- PIND@IO + reti + +tca: + reti + +tempo: + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret diff --git a/tests/ram.txt b/tests/ram.txt new file mode 100644 index 0000000..adc9f13 --- /dev/null +++ b/tests/ram.txt @@ -0,0 +1,61 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 +.equ PINC = 0x06 +.equ DDRC = 0x07 +.equ PORTC = 0x08 + +.equ TEST = 0x0200 + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.org 0x000 + ; Vecteur RESET + jmp debut + + +.org 0x0080 + + +debut: + DDRA@IO <- 0xFF + DDRC@IO <- 0xFF + PORTC@IO <- 0x00 + PORTA@IO <- 0x00 + r11 <- 0x00 + r10 <- 0x00 + +boucle: + + test[2] <- 0x22 + PORTA@IO <- test[2] + + jmp sl + ; test <- 0x22 + + LDI r16,0xAA + + LDI r26,0x02 + LDI r27,0x00 + + ST X,r16 + + LD r10,X + + ;PORTA@IO <- test[1] + +sl: + sleep + saut sl + +tempo: + ldi r24,8 +tempoA: + subi r22,1 + sbci r23,0 + sbci r24,0 + brcc tempoA + ret + -- libgit2 0.21.2