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

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: 
                     18: /* #define EMULATE_AGA */
                     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: 
                    132: /* Anything related to changes in hw registers during the DDF for one
                    133:  * line. */
                    134: struct draw_info {
                    135:     int first_sprite_draw, last_sprite_draw;
                    136:     int first_color_change, last_color_change;
                    137:     int first_delay_change, last_delay_change;
                    138:     int nr_color_changes, nr_sprites;
                    139: };
                    140: 
                    141: extern struct decision line_decisions[2 * (maxvpos+1) + 1];
                    142: extern struct draw_info line_drawinfo[2][2 * (maxvpos+1) + 1];
                    143: 
                    144: extern uae_u8 line_data[(maxvpos+1) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
                    145: 
                    146: /* Functions in drawing.c.  */
                    147: extern int coord_native_to_amiga_y (int);
                    148: extern int coord_native_to_amiga_x (int);
                    149: 
                    150: extern void record_diw_line (int first, int last);
                    151: extern void hardware_line_completed (int lineno);
                    152: 
                    153: /* Determine how to draw a scan line.  */
                    154: enum nln_how {
                    155:     /* All lines on a non-doubled display. */
                    156:     nln_normal,
                    157:     /* Non-interlace, doubled display.  */
                    158:     nln_doubled,
                    159:     /* Interlace, doubled display, upper line.  */
                    160:     nln_upper,
                    161:     /* Interlace, doubled display, lower line.  */
1.1.1.2 ! root      162:     nln_lower,
        !           163:     /* This line normal, next one black.  */
        !           164:     nln_nblack
1.1       root      165: };
                    166: 
1.1.1.2 ! root      167: extern void hsync_record_line_state (int lineno, enum nln_how, int changed);
1.1       root      168: extern void vsync_handle_redraw (int long_frame, int lof_changed);
                    169: extern void init_hardware_for_drawing_frame (void);
                    170: extern void finish_drawing_frame (void);
                    171: extern void reset_drawing (void);
                    172: extern void drawing_init (void);
                    173: extern void notice_interlace_seen (void);
                    174: 
                    175: /* Finally, stuff that shouldn't really be shared.  */
                    176: 
                    177: extern int thisframe_first_drawn_line, thisframe_last_drawn_line;
                    178: extern uae_u16 clxdat, clxcon;
                    179: extern int clx_sprmask;
                    180: extern int diwfirstword,diwlastword;

unix.superglobalmegacorp.com

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