Mercurial > repos > blastem
comparison vdp.h @ 54:3b79cbcf6846
Get Flavio's color bar demo kind of sort of working
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 18 Dec 2012 02:16:42 -0800 |
parents | 3fc57e1a2c56 |
children | a28b1dfe1af2 |
comparison
equal
deleted
inserted
replaced
53:44e661913a51 | 54:3b79cbcf6846 |
---|---|
23 #define FBUF_SRC_A 0x0000 | 23 #define FBUF_SRC_A 0x0000 |
24 #define FBUF_SRC_W 0x2000 | 24 #define FBUF_SRC_W 0x2000 |
25 #define FBUF_SRC_B 0x4000 | 25 #define FBUF_SRC_B 0x4000 |
26 #define FBUF_SRC_S 0x6000 | 26 #define FBUF_SRC_S 0x6000 |
27 #define FBUF_SRC_BG 0x8000 | 27 #define FBUF_SRC_BG 0x8000 |
28 | |
29 #define MCLKS_LINE 3420 | |
28 | 30 |
29 enum { | 31 enum { |
30 REG_MODE_1=0, | 32 REG_MODE_1=0, |
31 REG_MODE_2, | 33 REG_MODE_2, |
32 REG_SCROLL_A, | 34 REG_SCROLL_A, |
56 uint8_t index; | 58 uint8_t index; |
57 int16_t y; | 59 int16_t y; |
58 } sprite_info; | 60 } sprite_info; |
59 | 61 |
60 typedef struct { | 62 typedef struct { |
63 uint32_t cycle; | |
64 uint16_t value; | |
65 uint8_t partial; | |
66 } fifo_entry; | |
67 | |
68 typedef struct { | |
69 fifo_entry *fifo_cur; | |
70 fifo_entry *fifo_end; | |
71 uint16_t address; | |
72 uint8_t cd; | |
73 uint8_t flags; | |
61 //cycle count in MCLKs | 74 //cycle count in MCLKs |
62 uint32_t cycles; | 75 uint32_t cycles; |
63 uint8_t *vdpmem; | 76 uint8_t *vdpmem; |
64 //stores 2-bit palette + 4-bit palette index + priority for current sprite line | 77 //stores 2-bit palette + 4-bit palette index + priority for current sprite line |
65 uint8_t *linebuf; | 78 uint8_t *linebuf; |
78 sprite_draw sprite_draw_list[MAX_DRAWS]; | 91 sprite_draw sprite_draw_list[MAX_DRAWS]; |
79 sprite_info sprite_info_list[MAX_SPRITES_LINE]; | 92 sprite_info sprite_info_list[MAX_SPRITES_LINE]; |
80 uint16_t col_1; | 93 uint16_t col_1; |
81 uint16_t col_2; | 94 uint16_t col_2; |
82 uint8_t v_offset; | 95 uint8_t v_offset; |
83 uint8_t flags; | |
84 uint8_t *tmp_buf_a; | 96 uint8_t *tmp_buf_a; |
85 uint8_t *tmp_buf_b; | 97 uint8_t *tmp_buf_b; |
86 } vdp_context; | 98 } vdp_context; |
87 | 99 |
88 void init_vdp_context(vdp_context * context); | 100 void init_vdp_context(vdp_context * context); |
89 void vdp_run_context(vdp_context * context, uint32_t target_cycles); | 101 void vdp_run_context(vdp_context * context, uint32_t target_cycles); |
90 //runs from current cycle count to VBLANK for the current mode, returns ending cycle count | 102 //runs from current cycle count to VBLANK for the current mode, returns ending cycle count |
91 uint32_t vdp_run_to_vblank(vdp_context * context); | 103 uint32_t vdp_run_to_vblank(vdp_context * context); |
92 void vdp_load_savestate(vdp_context * context, FILE * state_file); | 104 void vdp_load_savestate(vdp_context * context, FILE * state_file); |
105 void vdp_control_port_write(vdp_context * context, uint16_t value); | |
106 void vdp_data_port_write(vdp_context * context, uint16_t value); | |
107 uint16_t vdp_control_port_read(vdp_context * context); | |
108 uint16_t vdp_data_port_read(vdp_context * context); | |
93 | 109 |
94 #endif //VDP_H_ | 110 #endif //VDP_H_ |