Mercurial > repos > blastem
annotate jag_video.h @ 1285:76e47254596b
Remove hacky post-DMA delay add proper pre-DMA delay based on logic analyzer capture. 512 color screen is a bit messed up but mostly works. Needs investigation
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 18 Mar 2017 17:09:14 -0700 |
parents | faa3a4617f62 |
children |
rev | line source |
---|---|
1087
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #ifndef JAG_VIDEO_H_ |
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #define JAG_VIDEO_H_ |
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 |
1088
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
4 enum { |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
5 VID_HCOUNT, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
6 VID_VCOUNT, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
7 VID_HLPEN, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
8 VID_VLPEN, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
9 VID_REG_C, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
10 VID_REG_E, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
11 VID_OBJ0, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
12 VID_OBJ1, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
13 VID_OBJ2, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
14 VID_OBJ3, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
15 VID_REG_18, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
16 VID_REG_1A, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
17 VID_REG_1C, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
18 VID_REG_1E, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
19 VID_OBJLIST1, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
20 VID_OBJLIST2, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
21 VID_REG_24, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
22 VID_OBJFLAG, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
23 VID_VMODE, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
24 VID_BORDER_RG, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
25 VID_BORDER_B, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
26 VID_HPERIOD, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
27 VID_HBLANK_BEGIN, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
28 VID_HBLANK_END, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
29 VID_HSYNC, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
30 VID_HVSYNC, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
31 VID_HDISP_BEGIN1, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
32 VID_HDISP_BEGIN2, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
33 VID_HDISP_END, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
34 VID_VPERIOD, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
35 VID_VBLANK_BEGIN, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
36 VID_VBLANK_END, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
37 VID_VSYNC, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
38 VID_VDISP_BEGIN, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
39 VID_VDISP_END, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
40 VID_VEQUAL_BEGIN, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
41 VID_VEQUAL_END, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
42 VID_VINT, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
43 VID_PIT0, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
44 VID_PIT1, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
45 VID_HEQUAL_END, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
46 VID_REG_56, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
47 VID_BGCOLOR, |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
48 JAG_VIDEO_REGS |
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
49 }; |
1087
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 #define LINEBUFFER_WORDS 720 |
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 |
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
52 typedef struct { |
1090
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
53 uint64_t im_data; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
54 uint64_t prefetch; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
55 uint32_t cycles; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
56 uint32_t obj_start; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
57 uint32_t link; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
58 uint32_t data_address; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
59 uint32_t cur_address; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
60 uint32_t increment; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
61 uint32_t line_pitch; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
62 uint32_t lb_offset; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
63 int16_t xpos; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
64 uint16_t ypos; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
65 uint16_t height; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
66 int16_t hscale; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
67 int16_t vscale; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
68 int16_t hremainder; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
69 int16_t remainder; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
70 uint8_t bpp; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
71 uint8_t line_phrases; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
72 uint8_t state; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
73 uint8_t type; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
74 uint8_t im_bits; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
75 uint8_t pal_offset; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
76 uint8_t has_prefetch; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
77 uint8_t hflip; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
78 uint8_t addpixels; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
79 uint8_t transparent; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
80 uint8_t leftclip; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
81 } object_processor; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
82 |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
83 typedef struct { |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
84 void *system; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
85 uint32_t *output; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
86 uint32_t output_pitch; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
87 uint16_t regs[JAG_VIDEO_REGS]; |
1087
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
88 |
1090
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
89 uint16_t clut[256]; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
90 uint16_t line_buffer_a[LINEBUFFER_WORDS]; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
91 uint16_t line_buffer_b[LINEBUFFER_WORDS]; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
92 uint16_t *write_line_buffer; |
1087
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
93 |
1090
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
94 uint32_t cycles; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
95 uint32_t op_cycles; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
96 uint8_t pclock_div; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
97 uint8_t pclock_counter; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
98 uint8_t mode; |
1097
faa3a4617f62
Get Jaguar video interrupt working
Michael Pavone <pavone@retrodev.com>
parents:
1090
diff
changeset
|
99 uint8_t cpu_int_pending; |
1090
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
100 |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
101 object_processor op; |
a68274a25e2f
Initial stab at implementing the Jaguar object processor
Michael Pavone <pavone@retrodev.com>
parents:
1089
diff
changeset
|
102 |
1087
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
103 } jag_video; |
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
104 |
1088
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
105 |
1087
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
106 jag_video *jag_video_init(void); |
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
107 void jag_video_run(jag_video *context, uint32_t target_cycle); |
1088
c0a026e974f4
Basic handling of video/object processor register writes
Michael Pavone <pavone@retrodev.com>
parents:
1087
diff
changeset
|
108 void jag_video_reg_write(jag_video *context, uint32_t address, uint16_t value); |
1097
faa3a4617f62
Get Jaguar video interrupt working
Michael Pavone <pavone@retrodev.com>
parents:
1090
diff
changeset
|
109 uint32_t jag_next_vid_interrupt(jag_video *context); |
1087
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
110 |
6433d4d05934
Added placeholder code for video output hardware/object processor
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
111 #endif //JAG_VIDEO_H_ |