--- uae/src/include/drawing.h 2018/04/24 16:42:29 1.1 +++ uae/src/include/drawing.h 2018/04/24 16:50:22 1.1.1.6 @@ -12,16 +12,10 @@ #endif /* - * Several people have tried this define, with not much success. Turning on - * AGA garbles the screen. A place you could start looking is the calcdiw() - * function - the AGA timing parameters are different, and apparently I - * haven't figured out the correct formula yet. Pity, the current one looks - * logical. - * - * @@@ Probably won't compile in this version. + * This doesn't work very well */ -/* #define EMULATE_AGA */ +#undef EMULATE_AGA #ifndef EMULATE_AGA #define AGA_CHIPSET 0 @@ -35,17 +29,25 @@ #define MAX_PLANES 6 #endif +#define RES_LORES 0 +#define RES_HIRES 1 +#define RES_SUPERHIRES 2 + +/* calculate shift depending on resolution (replaced "decided_hires ? 4 : 8") (TW) */ +#define RES_SHIFT(res) ((res) == RES_LORES ? 8 : (res) == RES_HIRES ? 4 : 2) +#define RES_ADJUST(res) ((res) == RES_LORES ? 8 : (res) == RES_HIRES ? 4 : 2) + /* We ignore that many lores pixels at the start of the display. These are * invisible anyway due to hardware DDF limits. */ #define DISPLAY_LEFT_SHIFT 0x38 #define PIXEL_XPOS(HPOS) (((HPOS)*2 - DISPLAY_LEFT_SHIFT) << lores_shift) /* @@@ Is maxhpos + 4 - 1 correct? (4 less isn't enough) */ -#define max_diwlastword (PIXEL_XPOS(maxhpos + 4 -1)) +#define max_diwlastword (PIXEL_XPOS(maxhpos + 4 - 1)) extern int lores_factor, lores_shift, sprite_width; -static __inline__ int coord_hw_to_native_x (int x) +STATIC_INLINE int coord_hw_to_native_x (int x) { x -= DISPLAY_LEFT_SHIFT; return x << lores_shift; @@ -55,7 +57,10 @@ extern int framecnt; struct color_entry { #if AGA_CHIPSET == 0 - /* X86.S expects this at the start of the structure. */ + /* Color values in two formats: 12 bit Amiga RGB (color_regs), and + * the native color value; both for each Amiga hardware color register. + */ + /* X86.S expects acolors at the start of the structure. */ xcolnr acolors[32]; uae_u16 color_regs[32]; #else @@ -92,7 +97,7 @@ struct delay_change { }; /* Way too much... */ -#define MAX_REG_CHANGE ((maxvpos+1) * 2 * maxhpos) +#define MAX_REG_CHANGE ((MAXVPOS + 1) * 2 * MAXHPOS) #ifdef OS_WITHOUT_MEMORY_MANAGEMENT extern struct sprite_draw *sprite_positions[2]; @@ -106,7 +111,7 @@ extern struct color_change color_changes extern struct delay_change delay_changes[MAX_REG_CHANGE]; #endif -extern struct color_entry color_tables[2][(maxvpos+1) * 2]; +extern struct color_entry color_tables[2][(MAXVPOS+1) * 2]; extern struct color_entry *curr_color_tables, *prev_color_tables; extern struct sprite_draw *curr_sprite_positions, *prev_sprite_positions; @@ -132,6 +137,9 @@ struct decision { #endif }; +/* Compute the number of bitplanes from a value written to BPLCON0 */ +#define GET_PLANES(x) ((((x) >> 12) & 7) | (((x) & 0x10) >> 1)) + /* Anything related to changes in hw registers during the DDF for one * line. */ struct draw_info { @@ -141,11 +149,10 @@ struct draw_info { int nr_color_changes, nr_sprites; }; -extern struct decision line_decisions[2 * (maxvpos+1) + 1]; -extern struct draw_info line_drawinfo[2][2 * (maxvpos+1) + 1]; -extern char line_changed[2 * (maxvpos+1)]; +extern struct decision line_decisions[2 * (MAXVPOS+1) + 1]; +extern struct draw_info line_drawinfo[2][2 * (MAXVPOS+1) + 1]; -extern uae_u8 line_data[(maxvpos+1) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; +extern uae_u8 line_data[(MAXVPOS+1) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; /* Functions in drawing.c. */ extern int coord_native_to_amiga_y (int); @@ -163,10 +170,12 @@ enum nln_how { /* Interlace, doubled display, upper line. */ nln_upper, /* Interlace, doubled display, lower line. */ - nln_lower + nln_lower, + /* This line normal, next one black. */ + nln_nblack }; -extern void hsync_record_line_state (int lineno, enum nln_how); +extern void hsync_record_line_state (int lineno, enum nln_how, int changed); extern void vsync_handle_redraw (int long_frame, int lof_changed); extern void init_hardware_for_drawing_frame (void); extern void finish_drawing_frame (void); @@ -180,3 +189,23 @@ extern int thisframe_first_drawn_line, t extern uae_u16 clxdat, clxcon; extern int clx_sprmask; extern int diwfirstword,diwlastword; + +#define IHF_SCROLLLOCK 0 +#define IHF_QUIT_PROGRAM 1 +#define IHF_PICASSO 2 +#define IHF_SOUNDADJUST 3 + +extern int inhibit_frame; + +STATIC_INLINE void set_inhibit_frame (int bit) +{ + inhibit_frame |= 1 << bit; +} +STATIC_INLINE void clear_inhibit_frame (int bit) +{ + inhibit_frame &= ~(1 << bit); +} +STATIC_INLINE void toggle_inhibit_frame (int bit) +{ + inhibit_frame ^= ~(1 << bit); +}