Add documentation.
This commit is contained in:
parent
a5b5fb17c6
commit
05f231d8ba
22
const.h
22
const.h
@ -1,15 +1,21 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define FRAME_PIXEL_WIDTH 1024 // [system clock]
|
#define FRAME_SYSCLOCK_WIDTH 1024 // [sysclock]
|
||||||
#define FRAME_PIXEL_HEIGHT 256 // [line]
|
#define FRAME_LINE_HEIGHT 256 // [line]
|
||||||
|
|
||||||
#define BACK_PORCH_OFFSET 100 // [system clock]
|
#define BACK_PORCH_SYSCLOCK_OFFSET 80 // [sysclock]
|
||||||
#define FRONT_PORCH_OFFSET 40 // [system clock]
|
#define FRONT_PORCH_SYSCLOCK_OFFSET 40 // [sysclock]
|
||||||
|
|
||||||
#define SPRITE_WIDTH 80 // [system clock]
|
#define SPRITE_PIXEL_WIDTH 80 // [sysclock]
|
||||||
#define SPRITE_HEIGHT 64 // [line]
|
#define SPRITE_LINE_HEIGHT 64 // [line]
|
||||||
|
|
||||||
|
#define SYSCLOCK_PER_PIXEL 4
|
||||||
|
#define SPRITE_SYSCLOCK_WIDTH (SPRITE_PIXEL_WIDTH * SYSCLOCK_PER_PIXEL)
|
||||||
|
|
||||||
// Time spent from the horizontal sync pulse,
|
// Time spent from the horizontal sync pulse,
|
||||||
// to the first displayed dot.
|
// to the first displayed dot.
|
||||||
// This is given as HSYNC_INT_TUNE + HSYNC_TIMER_TUNE + C part
|
// This is given as the sum of:
|
||||||
#define HSYNC_TUNE 70
|
// + HSYNC_INT_TUNE
|
||||||
|
// + HSYNC_TIMER_TUNE
|
||||||
|
// + sysclock duration of "C" interrupt part
|
||||||
|
#define HSYNC_SYSCLOCK_TUNE 70 // [sysclock] (approx)
|
4
main.S
4
main.S
@ -64,7 +64,7 @@ int_horizontal_sync_s:
|
|||||||
|
|
||||||
; total: 25
|
; total: 25
|
||||||
; HSYNC_INT_TUNE = 25
|
; HSYNC_INT_TUNE = 25
|
||||||
; this adds up for HSYNC_TUNE
|
; this adds up for HSYNC_SYSCLOCK_TUNE
|
||||||
|
|
||||||
pop r30
|
pop r30
|
||||||
pop r31
|
pop r31
|
||||||
@ -107,7 +107,7 @@ int_timer_1:
|
|||||||
|
|
||||||
; total: 39
|
; total: 39
|
||||||
; HSYNC_TIMER_TUNE = 39
|
; HSYNC_TIMER_TUNE = 39
|
||||||
; this adds up for HSYNC_TUNE
|
; this adds up for HSYNC_SYSCLOCK_TUNE
|
||||||
|
|
||||||
.global jump_table_return_address
|
.global jump_table_return_address
|
||||||
jump_table_return_address:
|
jump_table_return_address:
|
||||||
|
10
main.c
10
main.c
@ -39,12 +39,12 @@ ISR(INT0_vect) {
|
|||||||
// invert bouncing direction
|
// invert bouncing direction
|
||||||
if (vpos == 0)
|
if (vpos == 0)
|
||||||
vinc = +1;
|
vinc = +1;
|
||||||
if (vpos == FRAME_PIXEL_HEIGHT - SPRITE_HEIGHT)
|
if (vpos == FRAME_LINE_HEIGHT - SPRITE_LINE_HEIGHT)
|
||||||
vinc = -1;
|
vinc = -1;
|
||||||
if (hpos == BACK_PORCH_OFFSET)
|
if (hpos == BACK_PORCH_SYSCLOCK_OFFSET)
|
||||||
hinc = +1;
|
hinc = +1;
|
||||||
if (hpos ==
|
if (hpos == FRAME_SYSCLOCK_WIDTH - SPRITE_SYSCLOCK_WIDTH -
|
||||||
FRAME_PIXEL_WIDTH - SPRITE_WIDTH - FRONT_PORCH_OFFSET - HSYNC_TUNE)
|
FRONT_PORCH_SYSCLOCK_OFFSET - HSYNC_SYSCLOCK_TUNE)
|
||||||
hinc = -1;
|
hinc = -1;
|
||||||
|
|
||||||
int_vertical_sync_s();
|
int_vertical_sync_s();
|
||||||
@ -57,7 +57,7 @@ ISR(INT1_vect) {
|
|||||||
line += 1;
|
line += 1;
|
||||||
|
|
||||||
// we are past the last line of the sprite
|
// we are past the last line of the sprite
|
||||||
if (line >= vpos + SPRITE_HEIGHT)
|
if (line >= vpos + SPRITE_LINE_HEIGHT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (line >= vpos)
|
if (line >= vpos)
|
||||||
|
Loading…
Reference in New Issue
Block a user