From 29990cd93ae65a9059265a01b0b33b1830ca783c Mon Sep 17 00:00:00 2001 From: giomba Date: Sat, 26 Jun 2021 22:34:22 +0200 Subject: [PATCH] "diagonal line" not vertically locked, just a test also not the whole screen, just a bit --- main.S | 21 +++++++++++++++++++-- main.c | 14 ++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/main.S b/main.S index c696261..47ee4a0 100644 --- a/main.S +++ b/main.S @@ -2,9 +2,13 @@ #include "macro.h" .data + status: .byte 0x0 +offset: +.byte 78 + .text .global main_s @@ -64,7 +68,17 @@ wait2: .global int0_handler int0_handler: - ldi r31, 80 + push r31 + in r31, IO(SREG) ; status register + push r31 + + lds r31, offset + dec r31 + cpi r31, 1 + brne 1f + ldi r31, 78 +1: + sts offset, r31 loop: dec r31 brne loop @@ -85,5 +99,8 @@ loop: nop cbi IO(PORTB), 4 1: + pop r31 + out IO(SREG), r31 + pop r31 + reti - ret diff --git a/main.c b/main.c index 31732f8..f795dd1 100644 --- a/main.c +++ b/main.c @@ -4,8 +4,18 @@ void main_s(void); void int0_handler(void); -ISR(INT0_vect) { - int0_handler(); +void pippo() { + asm("nop"); + asm("push r1"); + int i = 0; + i = 2; + i += 1; + reti(); +} + + +ISR(INT0_vect, ISR_NAKED) { + asm("jmp int0_handler"); } int main() {