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