Add: vga_cycles control api
This commit is contained in:
parent
48c1fb7041
commit
8b0ac6a400
|
@ -34,9 +34,7 @@
|
||||||
|
|
||||||
//#define VSYNC
|
//#define VSYNC
|
||||||
|
|
||||||
#define SHOW_FRAME_UPDATE
|
//#define DEBUG
|
||||||
|
|
||||||
#define CALCULATE_CLOCK_FREQUENCY
|
|
||||||
#define CALCULATE_CLOCK_FREQUENCY_INTERVAL 1
|
#define CALCULATE_CLOCK_FREQUENCY_INTERVAL 1
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -9,3 +9,4 @@ void nvboard_init();
|
||||||
void nvboard_quit();
|
void nvboard_quit();
|
||||||
void nvboard_bind_pin(void *signal, bool is_rt, bool is_output, int len, ...);
|
void nvboard_bind_pin(void *signal, bool is_rt, bool is_output, int len, ...);
|
||||||
void nvboard_update();
|
void nvboard_update();
|
||||||
|
void nvboard_set_vga_cycles(int cycles); //default: 1
|
||||||
|
|
|
@ -24,6 +24,7 @@ private:
|
||||||
int vga_pos;
|
int vga_pos;
|
||||||
int vga_pre_clk, vga_pre_vsync, vga_pre_hsync;
|
int vga_pre_clk, vga_pre_vsync, vga_pre_hsync;
|
||||||
int vga_vaddr, vga_haddr;
|
int vga_vaddr, vga_haddr;
|
||||||
|
int vga_clk_cnt;
|
||||||
public:
|
public:
|
||||||
VGA(SDL_Renderer *rend, int cnt, int init_val, int it, int ct);
|
VGA(SDL_Renderer *rend, int cnt, int init_val, int it, int ct);
|
||||||
~VGA();
|
~VGA();
|
||||||
|
|
|
@ -103,7 +103,7 @@ static void nvboard_update_output(PinMap *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvboard_update() {
|
void nvboard_update() {
|
||||||
#ifdef CALCULATE_CLOCK_FREQUENCY
|
#ifdef DEBUG
|
||||||
calculate_clock_frequency();
|
calculate_clock_frequency();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -195,3 +195,9 @@ void nvboard_bind_pin(void *signal, bool is_rt, bool is_output, int len, ...) {
|
||||||
if (is_rt) { p->next = rt_pin_map; rt_pin_map = p; }
|
if (is_rt) { p->next = rt_pin_map; rt_pin_map = p; }
|
||||||
else { p->next = pin_map; pin_map = p; }
|
else { p->next = pin_map; pin_map = p; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vga_cycles = 1;
|
||||||
|
|
||||||
|
void nvboard_set_vga_cycles(int cycles) {
|
||||||
|
vga_cycles = cycles;
|
||||||
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ VGA::VGA(SDL_Renderer *rend, int cnt, int init_val, int it, int ct):
|
||||||
Component(rend, cnt, init_val, it, ct),
|
Component(rend, cnt, init_val, it, ct),
|
||||||
vga_screen_width(VGA_DEFAULT_WIDTH), vga_screen_height(VGA_DEFAULT_HEIGHT),
|
vga_screen_width(VGA_DEFAULT_WIDTH), vga_screen_height(VGA_DEFAULT_HEIGHT),
|
||||||
vga_pre_clk(0), vga_pre_hsync(0), vga_pre_vsync(0),
|
vga_pre_clk(0), vga_pre_hsync(0), vga_pre_vsync(0),
|
||||||
vga_pos(0), vga_vaddr(0), vga_haddr(0) {
|
vga_pos(0), vga_vaddr(0), vga_haddr(0), vga_clk_cnt(1) {
|
||||||
SDL_Texture *temp_texture = SDL_CreateTexture(rend, SDL_PIXELFORMAT_ARGB8888,
|
SDL_Texture *temp_texture = SDL_CreateTexture(rend, SDL_PIXELFORMAT_ARGB8888,
|
||||||
SDL_TEXTUREACCESS_STATIC, vga_screen_width, vga_screen_height);
|
SDL_TEXTUREACCESS_STATIC, vga_screen_width, vga_screen_height);
|
||||||
set_texture(temp_texture, 0);
|
set_texture(temp_texture, 0);
|
||||||
|
@ -48,6 +48,12 @@ void VGA::update_gui() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VGA::update_state() {
|
void VGA::update_state() {
|
||||||
|
extern int vga_cycles;
|
||||||
|
if(vga_clk_cnt != vga_cycles){
|
||||||
|
vga_clk_cnt ++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vga_clk_cnt = 1;
|
||||||
int vga_vsync = output_map[VGA_VSYNC];
|
int vga_vsync = output_map[VGA_VSYNC];
|
||||||
int vga_hsync = output_map[VGA_HSYNC];
|
int vga_hsync = output_map[VGA_HSYNC];
|
||||||
int vga_blank_n = output_map[VGA_BLANK_N];
|
int vga_blank_n = output_map[VGA_BLANK_N];
|
||||||
|
|
Loading…
Reference in New Issue