-
Notifications
You must be signed in to change notification settings - Fork 0
/
tvout.h
69 lines (60 loc) · 2.05 KB
/
tvout.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Copyright Jacques Deschênes 2018, 2019
* This file is part of BP_CHIPCON.
*
* BP_CHIPCON is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* BP_CHIPCON is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BP_CHIPCON. If not, see <http://www.gnu.org/licenses/>.
*/
/*
video interface
NTST composite output signal.
16 colors
*/
#ifndef TVOUT_H
#define TVOUT_H
#define HRES 180 // horizontal resolution
#define VRES 112 // vertical resolution
#define BPP 4 // bits per pixel
#define BPR (HRES*BPP/8) // bytes per row
#define VIDEO_BUFFER_SIZE (VRES*BPR)
typedef enum VIDEO_MODES{
VM_BPCHIP, // 180x112 16 colors (default)
// VM_XOCHIP, // 128x64 4 colors
VM_SCHIP, // 128x64 monochrome
// VM_CHIP8, // 64x32 monochrome
MODES_COUNT
}vmode_t;
typedef struct vmode_params{
vmode_t mode; // video mode
uint16_t video_start; // first visible scan line
uint16_t video_end; // last visible scan line
uint16_t left_margin; // left margin delay
uint8_t bpr; // bytes per row
uint8_t rpt; // scan lines repeat per row
uint8_t pdly; // pixel delay
uint16_t hres; // horizontal pixels
uint16_t vres; // vertical pixels
}vmode_params_t;
extern volatile uint16_t game_timer;
extern volatile uint16_t sound_timer;
extern vmode_t video_mode;
extern volatile uint32_t ntsc_ticks;
extern uint8_t video_buffer[VIDEO_BUFFER_SIZE];
void set_video_mode(vmode_t mode);
vmode_params_t* get_video_params();
void tvout_init();
void frame_sync();
void wait_sync_end();
void game_pause(uint16_t frame_count);
void micro_pause(uint32_t count);
#endif // TVOUT_H