|
|
1.1 root 1: /*
2: * Data used for communication between custom.c and drawing.c.
3: *
4: * Copyright 1996-1998 Bernd Schmidt
5: */
6:
7: #define SMART_UPDATE 1
8:
9: #ifdef SUPPORT_PENGUINS
10: #undef SMART_UPDATE
11: #define SMART_UPDATE 1
12: #endif
13:
14: /*
1.1.1.2 root 15: * This doesn't work very well
1.1 root 16: */
17:
1.1.1.3 root 18: #undef EMULATE_AGA
1.1 root 19:
20: #ifndef EMULATE_AGA
21: #define AGA_CHIPSET 0
22: #else
23: #define AGA_CHIPSET 1
24: #endif
25:
26: #if AGA_CHIPSET == 1
27: #define MAX_PLANES 8
28: #else
29: #define MAX_PLANES 6
30: #endif
31:
1.1.1.4 root 32: #define RES_LORES 0
33: #define RES_HIRES 1
34: #define RES_SUPERHIRES 2
35:
36: /* calculate shift depending on resolution (replaced "decided_hires ? 4 : 8") (TW) */
37: #define RES_SHIFT(res) ((res) == RES_LORES ? 8 : (res) == RES_HIRES ? 4 : 2)
38: #define RES_ADJUST(res) ((res) == RES_LORES ? 8 : (res) == RES_HIRES ? 4 : 2)
39:
1.1 root 40: /* We ignore that many lores pixels at the start of the display. These are
41: * invisible anyway due to hardware DDF limits. */
42: #define DISPLAY_LEFT_SHIFT 0x38
43: #define PIXEL_XPOS(HPOS) (((HPOS)*2 - DISPLAY_LEFT_SHIFT) << lores_shift)
44:
45: /* @@@ Is maxhpos + 4 - 1 correct? (4 less isn't enough) */
1.1.1.6 root 46: #define max_diwlastword (PIXEL_XPOS(maxhpos + 4 - 1))
1.1 root 47:
48: extern int lores_factor, lores_shift, sprite_width;
49:
1.1.1.7 ! root 50: STATIC_INLINE int coord_hw_to_window_x (int x)
1.1 root 51: {
52: x -= DISPLAY_LEFT_SHIFT;
53: return x << lores_shift;
54: }
55:
56: extern int framecnt;
57:
58: struct color_entry {
59: #if AGA_CHIPSET == 0
1.1.1.2 root 60: /* Color values in two formats: 12 bit Amiga RGB (color_regs), and
61: * the native color value; both for each Amiga hardware color register.
62: */
63: /* X86.S expects acolors at the start of the structure. */
1.1 root 64: xcolnr acolors[32];
65: uae_u16 color_regs[32];
66: #else
67: uae_u32 color_regs[256];
68: #endif
69: };
70:
71: /*
72: * The idea behind this code is that at some point during each horizontal
73: * line, we decide how to draw this line. There are many more-or-less
74: * independent decisions, each of which can be taken at a different horizontal
75: * position.
76: * Sprites, color changes and bitplane delay changes are handled specially:
77: * There isn't a single decision, but a list of structures containing
78: * information on how to draw the line.
79: */
80:
81: struct color_change {
82: int linepos;
83: int regno;
84: unsigned long value;
85: };
86:
87: struct sprite_draw {
88: int linepos;
89: int num;
90: int ctl;
91: uae_u32 datab;
92: };
93:
94: struct delay_change {
95: int linepos;
96: unsigned int value;
97: };
98:
99: /* Way too much... */
1.1.1.4 root 100: #define MAX_REG_CHANGE ((MAXVPOS + 1) * 2 * MAXHPOS)
1.1 root 101:
102: #ifdef OS_WITHOUT_MEMORY_MANAGEMENT
103: extern struct sprite_draw *sprite_positions[2];
104: extern struct color_change *color_changes[2];
105: extern struct delay_change *delay_changes;
106: #else
107: extern struct sprite_draw sprite_positions[2][MAX_REG_CHANGE];
108: extern struct color_change color_changes[2][MAX_REG_CHANGE];
109: /* We don't remember those across frames, that would be too much effort.
110: * We simply redraw the line whenever we see one of these. */
111: extern struct delay_change delay_changes[MAX_REG_CHANGE];
112: #endif
113:
1.1.1.4 root 114: extern struct color_entry color_tables[2][(MAXVPOS+1) * 2];
1.1 root 115: extern struct color_entry *curr_color_tables, *prev_color_tables;
116:
117: extern struct sprite_draw *curr_sprite_positions, *prev_sprite_positions;
118: extern struct color_change *curr_color_changes, *prev_color_changes;
119: extern struct draw_info *curr_drawinfo, *prev_drawinfo;
120:
121: /* struct decision contains things we save across drawing frames for
122: * comparison (smart update stuff). */
123: struct decision {
124: unsigned long color0;
125: int which;
1.1.1.7 ! root 126:
! 127: /* Data fetching coordinates. */
1.1 root 128: int plfstrt, plflinelen;
1.1.1.7 ! root 129: /* Records the leftmost access of BPL1DAT. */
! 130: int plfleft;
1.1 root 131: /* Display window: native coordinates, depend on lores state. */
132: int diwfirstword, diwlastword;
133: int ctable;
134:
135: uae_u16 bplcon0, bplcon1, bplcon2;
136: #if 0 /* We don't need this. */
137: uae_u16 bplcon3;
138: #endif
139: #if AGA_CHIPSET == 1
140: uae_u16 bplcon4;
141: #endif
142: };
143:
1.1.1.3 root 144: /* Compute the number of bitplanes from a value written to BPLCON0 */
145: #define GET_PLANES(x) ((((x) >> 12) & 7) | (((x) & 0x10) >> 1))
146:
1.1 root 147: /* Anything related to changes in hw registers during the DDF for one
148: * line. */
149: struct draw_info {
150: int first_sprite_draw, last_sprite_draw;
151: int first_color_change, last_color_change;
152: int first_delay_change, last_delay_change;
153: int nr_color_changes, nr_sprites;
154: };
155:
1.1.1.4 root 156: extern struct decision line_decisions[2 * (MAXVPOS+1) + 1];
157: extern struct draw_info line_drawinfo[2][2 * (MAXVPOS+1) + 1];
1.1 root 158:
1.1.1.4 root 159: extern uae_u8 line_data[(MAXVPOS+1) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
1.1 root 160:
1.1.1.7 ! root 161: extern uae_u8 *real_bplpt[8];
! 162:
1.1 root 163: /* Functions in drawing.c. */
164: extern int coord_native_to_amiga_y (int);
165: extern int coord_native_to_amiga_x (int);
166:
167: extern void record_diw_line (int first, int last);
168: extern void hardware_line_completed (int lineno);
169:
170: /* Determine how to draw a scan line. */
171: enum nln_how {
172: /* All lines on a non-doubled display. */
173: nln_normal,
174: /* Non-interlace, doubled display. */
175: nln_doubled,
176: /* Interlace, doubled display, upper line. */
177: nln_upper,
178: /* Interlace, doubled display, lower line. */
1.1.1.2 root 179: nln_lower,
180: /* This line normal, next one black. */
181: nln_nblack
1.1 root 182: };
183:
1.1.1.2 root 184: extern void hsync_record_line_state (int lineno, enum nln_how, int changed);
1.1 root 185: extern void vsync_handle_redraw (int long_frame, int lof_changed);
186: extern void init_hardware_for_drawing_frame (void);
187: extern void finish_drawing_frame (void);
188: extern void reset_drawing (void);
189: extern void drawing_init (void);
190: extern void notice_interlace_seen (void);
191:
192: /* Finally, stuff that shouldn't really be shared. */
193:
194: extern int thisframe_first_drawn_line, thisframe_last_drawn_line;
195: extern uae_u16 clxdat, clxcon;
196: extern int clx_sprmask;
197: extern int diwfirstword,diwlastword;
1.1.1.3 root 198:
199: #define IHF_SCROLLLOCK 0
200: #define IHF_QUIT_PROGRAM 1
201: #define IHF_PICASSO 2
202: #define IHF_SOUNDADJUST 3
203:
204: extern int inhibit_frame;
205:
1.1.1.5 root 206: STATIC_INLINE void set_inhibit_frame (int bit)
1.1.1.3 root 207: {
208: inhibit_frame |= 1 << bit;
209: }
1.1.1.5 root 210: STATIC_INLINE void clear_inhibit_frame (int bit)
1.1.1.3 root 211: {
212: inhibit_frame &= ~(1 << bit);
213: }
1.1.1.5 root 214: STATIC_INLINE void toggle_inhibit_frame (int bit)
1.1.1.3 root 215: {
216: inhibit_frame ^= ~(1 << bit);
217: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.