Annotation of uae/src/include/drawing.h, revision 1.1.1.5

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) */
                     46: #define max_diwlastword (PIXEL_XPOS(maxhpos + 4 -1))
                     47: 
                     48: extern int lores_factor, lores_shift, sprite_width;
                     49: 
1.1.1.5 ! root       50: STATIC_INLINE int coord_hw_to_native_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;
                    126:     int plfstrt, plflinelen;
                    127:     /* Display window: native coordinates, depend on lores state.  */
                    128:     int diwfirstword, diwlastword;
                    129:     int ctable;
                    130: 
                    131:     uae_u16 bplcon0, bplcon1, bplcon2;
                    132: #if 0 /* We don't need this. */
                    133:     uae_u16 bplcon3;
                    134: #endif
                    135: #if AGA_CHIPSET == 1
                    136:     uae_u16 bplcon4;
                    137: #endif
                    138: };
                    139: 
1.1.1.3   root      140: /* Compute the number of bitplanes from a value written to BPLCON0  */
                    141: #define GET_PLANES(x) ((((x) >> 12) & 7) | (((x) & 0x10) >> 1))
                    142: 
1.1       root      143: /* Anything related to changes in hw registers during the DDF for one
                    144:  * line. */
                    145: struct draw_info {
                    146:     int first_sprite_draw, last_sprite_draw;
                    147:     int first_color_change, last_color_change;
                    148:     int first_delay_change, last_delay_change;
                    149:     int nr_color_changes, nr_sprites;
                    150: };
                    151: 
1.1.1.4   root      152: extern struct decision line_decisions[2 * (MAXVPOS+1) + 1];
                    153: extern struct draw_info line_drawinfo[2][2 * (MAXVPOS+1) + 1];
1.1       root      154: 
1.1.1.4   root      155: extern uae_u8 line_data[(MAXVPOS+1) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
1.1       root      156: 
                    157: /* Functions in drawing.c.  */
                    158: extern int coord_native_to_amiga_y (int);
                    159: extern int coord_native_to_amiga_x (int);
                    160: 
                    161: extern void record_diw_line (int first, int last);
                    162: extern void hardware_line_completed (int lineno);
                    163: 
                    164: /* Determine how to draw a scan line.  */
                    165: enum nln_how {
                    166:     /* All lines on a non-doubled display. */
                    167:     nln_normal,
                    168:     /* Non-interlace, doubled display.  */
                    169:     nln_doubled,
                    170:     /* Interlace, doubled display, upper line.  */
                    171:     nln_upper,
                    172:     /* Interlace, doubled display, lower line.  */
1.1.1.2   root      173:     nln_lower,
                    174:     /* This line normal, next one black.  */
                    175:     nln_nblack
1.1       root      176: };
                    177: 
1.1.1.2   root      178: extern void hsync_record_line_state (int lineno, enum nln_how, int changed);
1.1       root      179: extern void vsync_handle_redraw (int long_frame, int lof_changed);
                    180: extern void init_hardware_for_drawing_frame (void);
                    181: extern void finish_drawing_frame (void);
                    182: extern void reset_drawing (void);
                    183: extern void drawing_init (void);
                    184: extern void notice_interlace_seen (void);
                    185: 
                    186: /* Finally, stuff that shouldn't really be shared.  */
                    187: 
                    188: extern int thisframe_first_drawn_line, thisframe_last_drawn_line;
                    189: extern uae_u16 clxdat, clxcon;
                    190: extern int clx_sprmask;
                    191: extern int diwfirstword,diwlastword;
1.1.1.3   root      192: 
                    193: #define IHF_SCROLLLOCK 0
                    194: #define IHF_QUIT_PROGRAM 1
                    195: #define IHF_PICASSO 2
                    196: #define IHF_SOUNDADJUST 3
                    197: 
                    198: extern int inhibit_frame;
                    199: 
1.1.1.5 ! root      200: STATIC_INLINE void set_inhibit_frame (int bit)
1.1.1.3   root      201: {
                    202:     inhibit_frame |= 1 << bit;
                    203: }
1.1.1.5 ! root      204: STATIC_INLINE void clear_inhibit_frame (int bit)
1.1.1.3   root      205: {
                    206:     inhibit_frame &= ~(1 << bit);
                    207: }
1.1.1.5 ! root      208: STATIC_INLINE void toggle_inhibit_frame (int bit)
1.1.1.3   root      209: {
                    210:     inhibit_frame ^= ~(1 << bit);
                    211: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.