--- uae/src/include/drawing.h 2018/04/24 16:57:05 1.1.1.9 +++ uae/src/include/drawing.h 2018/04/24 17:18:51 1.1.1.15 @@ -1,6 +1,6 @@ /* * Data used for communication between custom.c and drawing.c. - * + * * Copyright 1996-1998 Bernd Schmidt */ @@ -26,12 +26,12 @@ /* 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 DISPLAY_LEFT_SHIFT 0x40 #define PIXEL_XPOS(HPOS) (((HPOS)*2 - DISPLAY_LEFT_SHIFT + DIW_DDF_OFFSET - 1) << lores_shift) -#define max_diwlastword (PIXEL_XPOS(maxhpos)) +#define max_diwlastword (PIXEL_XPOS(maxhpos) + 16) -extern int lores_factor, lores_shift, sprite_width; +extern int lores_factor, lores_shift; STATIC_INLINE int coord_hw_to_window_x (int x) { @@ -39,16 +39,28 @@ STATIC_INLINE int coord_hw_to_window_x ( return x << lores_shift; } +STATIC_INLINE int coord_window_to_hw_x (int x) +{ + x >>= lores_shift; + return x + DISPLAY_LEFT_SHIFT; +} + STATIC_INLINE int coord_diw_to_window_x (int x) { return (x - DISPLAY_LEFT_SHIFT + DIW_DDF_OFFSET - 1) << lores_shift; } +STATIC_INLINE int coord_window_to_diw_x (int x) +{ + x = coord_window_to_hw_x (x); + return x - DIW_DDF_OFFSET; +} + extern int framecnt; /* color values in two formats: 12 (OCS/ECS) or 24 (AGA) bit Amiga RGB (color_regs), - * and the native color value; both for each Amiga hardware color register. + * and the native color value; both for each Amiga hardware color register. * * !!! See color_reg_xxx functions below before touching !!! */ @@ -91,7 +103,7 @@ STATIC_INLINE int color_reg_cmp (struct if (currprefs.chipset_mask & CSMASK_AGA) return memcmp (ce1->color_regs_aga, ce2->color_regs_aga, sizeof (uae_u32) * 256); else - return memcmp (ce1->color_regs_ecs, ce2->color_regs_ecs, sizeof (uae_u16) * 32); + return memcmp (ce1->color_regs_ecs, ce2->color_regs_ecs, sizeof (uae_u16) * 32); } /* ugly copy hack, is there better solution? */ STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *src) @@ -122,7 +134,11 @@ struct color_change { }; /* 440 rather than 880, since sprites are always lores. */ -#define MAX_SPR_PIXELS (((MAXVPOS + 1)*2 + 1) * 440) +#define MAX_PIXELS_PER_LINE 1760 + +/* No divisors for MAX_PIXELS_PER_LINE; we support AGA and may one day + want to use SHRES sprites. */ +#define MAX_SPR_PIXELS (((MAXVPOS + 1)*2 + 1) * MAX_PIXELS_PER_LINE) struct sprite_entry { @@ -165,14 +181,14 @@ struct decision { int ctable; uae_u16 bplcon0, bplcon2; - uae_u16 fmode, bplcon4; + uae_u16 bplcon3, bplcon4; uae_u8 nr_planes; uae_u8 bplres; + unsigned int any_hires_sprites:1; + unsigned int ham_seen:1; + unsigned int ham_at_start:1; }; -extern int fetchmode, prefetch, fetchsize, fetchstart, fetchstart_shift; -extern void expand_fetchmodes (int, int); - /* Anything related to changes in hw registers during the DDF for one * line. */ struct draw_info { @@ -181,8 +197,6 @@ struct draw_info { int nr_color_changes, nr_sprites; }; -extern int next_sprite_entry; - extern struct decision line_decisions[2 * (MAXVPOS+1) + 1]; extern struct draw_info line_drawinfo[2][2 * (MAXVPOS+1) + 1]; @@ -216,14 +230,13 @@ extern void vsync_handle_redraw (int lon extern void init_hardware_for_drawing_frame (void); extern void finish_drawing_frame (void); extern void reset_drawing (void); +extern void init_drawing_at_reset (void); extern void drawing_init (void); extern void notice_interlace_seen (void); /* Finally, stuff that shouldn't really be shared. */ extern int thisframe_first_drawn_line, thisframe_last_drawn_line; -extern uae_u16 clxdat, clxcon; -extern int clx_sprmask; extern int diwfirstword,diwlastword; #define IHF_SCROLLLOCK 0