"diagonal line"
not the whole screen, but vertically locked actually it has some issues, there is a single dot (at the end/beginning of a cycle) that messes up the horizontal sync and moves all the picture... must be fixed
This commit is contained in:
parent
29990cd93a
commit
97e0ff26fa
40
main.S
40
main.S
@ -9,6 +9,9 @@ status:
|
||||
offset:
|
||||
.byte 78
|
||||
|
||||
line:
|
||||
.word 0
|
||||
|
||||
.text
|
||||
|
||||
.global main_s
|
||||
@ -21,10 +24,10 @@ main_s:
|
||||
out IO(MCUCR), r16
|
||||
out IO(MCUCR), r17
|
||||
|
||||
ldi r16, 0x3 ; enable falling edge interrupt 0
|
||||
ldi r16, 0xa ; external interrupt 0 and 1, falling edge
|
||||
sts EICRA, r16
|
||||
|
||||
ldi r16, 0x1 ; external interrupt mask enable
|
||||
ldi r16, 0x3 ; external interrupt 0 and 1, mask enable
|
||||
sts EIMSK, r16
|
||||
|
||||
sei
|
||||
@ -66,26 +69,33 @@ wait2:
|
||||
|
||||
jmp again
|
||||
|
||||
.global int0_handler
|
||||
int0_handler:
|
||||
.global int_horizontal_sync
|
||||
int_horizontal_sync:
|
||||
push r31
|
||||
in r31, IO(SREG) ; status register
|
||||
push r31
|
||||
|
||||
lds r31, line
|
||||
cpi r31, 255
|
||||
brsh int_horizontal_sync_end
|
||||
inc r31
|
||||
sts line, r31
|
||||
|
||||
lds r31, status
|
||||
cpi r31, 0
|
||||
brne int_horizontal_sync_end
|
||||
|
||||
lds r31, offset
|
||||
dec r31
|
||||
cpi r31, 1
|
||||
brne 1f
|
||||
ldi r31, 78
|
||||
ldi r31, 140
|
||||
1:
|
||||
sts offset, r31
|
||||
loop:
|
||||
dec r31
|
||||
brne loop
|
||||
|
||||
lds r31, status
|
||||
cpi r31, 1
|
||||
brne 1f
|
||||
sbi IO(PORTB), 4
|
||||
nop
|
||||
nop
|
||||
@ -98,9 +108,21 @@ loop:
|
||||
nop
|
||||
nop
|
||||
cbi IO(PORTB), 4
|
||||
1:
|
||||
|
||||
int_horizontal_sync_end:
|
||||
pop r31
|
||||
out IO(SREG), r31
|
||||
pop r31
|
||||
reti
|
||||
|
||||
.global int_vertical_sync
|
||||
int_vertical_sync:
|
||||
push r31
|
||||
ldi r31, 0
|
||||
sts line, r31
|
||||
ldi r31, 140
|
||||
sts offset, r31
|
||||
pop r31
|
||||
reti
|
||||
|
||||
|
||||
|
15
main.c
15
main.c
@ -2,20 +2,13 @@
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
void main_s(void);
|
||||
void int0_handler(void);
|
||||
|
||||
void pippo() {
|
||||
asm("nop");
|
||||
asm("push r1");
|
||||
int i = 0;
|
||||
i = 2;
|
||||
i += 1;
|
||||
reti();
|
||||
}
|
||||
|
||||
|
||||
ISR(INT0_vect, ISR_NAKED) {
|
||||
asm("jmp int0_handler");
|
||||
asm("jmp int_vertical_sync");
|
||||
}
|
||||
ISR(INT1_vect, ISR_NAKED) {
|
||||
asm("jmp int_horizontal_sync");
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
Loading…
Reference in New Issue
Block a user