39 lines
900 B
C
39 lines
900 B
C
#include <avr/io.h>
|
|
#include <avr/interrupt.h>
|
|
#include "const.h"
|
|
|
|
volatile uint16_t frame;
|
|
volatile uint16_t line;
|
|
volatile char line_buffer[LINE_BUFFER_SIZE];
|
|
|
|
ISR(INT0_vect, ISR_NAKED) {
|
|
asm("jmp int_vertical_sync");
|
|
}
|
|
ISR(INT1_vect, ISR_NAKED) {
|
|
asm("jmp int_horizontal_sync");
|
|
}
|
|
ISR(TIMER0_COMPA_vect, ISR_NAKED) {
|
|
asm("jmp int_timer_0");
|
|
}
|
|
|
|
void setup_c() {
|
|
/*
|
|
for (int i = 0; i < LINE_BUFFER_SIZE; ++i) {
|
|
line_buffer[i] = (i % 2) ? 0x0 : 0xff;
|
|
}
|
|
*/
|
|
}
|
|
|
|
void loop_c() {
|
|
for (;;) {
|
|
const int current_line = line;
|
|
line_buffer[20] = (current_line > 50 && current_line < 100) ? WHITE : BLACK;
|
|
if (current_line % 8 == 0) {
|
|
const uint8_t current_number = frame >> 2;
|
|
for (uint8_t i = 0; i < 8; ++i) {
|
|
line_buffer[i] = ((current_number >> i) & 0x1) ? WHITE : BLACK;
|
|
}
|
|
}
|
|
}
|
|
}
|