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

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: /*
                     15:  * Several people have tried this define, with not much success. Turning on
                     16:  * AGA garbles the screen. A place you could start looking is the calcdiw()
                     17:  * function - the AGA timing parameters are different, and apparently I
                     18:  * haven't figured out the correct formula yet. Pity, the current one looks
                     19:  * logical.
                     20:  *
                     21:  * @@@ Probably won't compile in this version.
                     22:  */
                     23: 
                     24: /* #define EMULATE_AGA */
                     25: 
                     26: #ifndef EMULATE_AGA
                     27: #define AGA_CHIPSET 0
                     28: #else
                     29: #define AGA_CHIPSET 1
                     30: #endif
                     31: 
                     32: #if AGA_CHIPSET == 1
                     33: #define MAX_PLANES 8
                     34: #else
                     35: #define MAX_PLANES 6
                     36: #endif
                     37: 
                     38: /* We ignore that many lores pixels at the start of the display. These are
                     39:  * invisible anyway due to hardware DDF limits. */
                     40: #define DISPLAY_LEFT_SHIFT 0x38
                     41: #define PIXEL_XPOS(HPOS) (((HPOS)*2 - DISPLAY_LEFT_SHIFT) << lores_shift)
                     42: 
                     43: /* @@@ Is maxhpos + 4 - 1 correct? (4 less isn't enough) */
                     44: #define max_diwlastword (PIXEL_XPOS(maxhpos + 4 -1))
                     45: 
                     46: extern int lores_factor, lores_shift, sprite_width;
                     47: 
                     48: static __inline__ int coord_hw_to_native_x (int x)
                     49: {
                     50:     x -= DISPLAY_LEFT_SHIFT;
                     51:     return x << lores_shift;
                     52: }
                     53: 
                     54: extern int framecnt;
                     55: 
                     56: struct color_entry {
                     57: #if AGA_CHIPSET == 0
                     58:     /* X86.S expects this at the start of the structure. */
                     59:     xcolnr acolors[32];
                     60:     uae_u16 color_regs[32];
                     61: #else
                     62:     uae_u32 color_regs[256];
                     63: #endif
                     64: };
                     65: 
                     66: /*
                     67:  * The idea behind this code is that at some point during each horizontal
                     68:  * line, we decide how to draw this line. There are many more-or-less
                     69:  * independent decisions, each of which can be taken at a different horizontal
                     70:  * position.
                     71:  * Sprites, color changes and bitplane delay changes are handled specially:
                     72:  * There isn't a single decision, but a list of structures containing
                     73:  * information on how to draw the line.
                     74:  */
                     75: 
                     76: struct color_change {
                     77:     int linepos;
                     78:     int regno;
                     79:     unsigned long value;
                     80: };
                     81: 
                     82: struct sprite_draw {
                     83:     int linepos;
                     84:     int num;
                     85:     int ctl;
                     86:     uae_u32 datab;
                     87: };
                     88: 
                     89: struct delay_change {
                     90:     int linepos;
                     91:     unsigned int value;
                     92: };
                     93: 
                     94: /* Way too much... */
                     95: #define MAX_REG_CHANGE ((maxvpos+1) * 2 * maxhpos)
                     96: 
                     97: #ifdef OS_WITHOUT_MEMORY_MANAGEMENT
                     98: extern struct sprite_draw  *sprite_positions[2];
                     99: extern struct color_change *color_changes[2];
                    100: extern struct delay_change *delay_changes;
                    101: #else
                    102: extern struct sprite_draw sprite_positions[2][MAX_REG_CHANGE];
                    103: extern struct color_change color_changes[2][MAX_REG_CHANGE];
                    104: /* We don't remember those across frames, that would be too much effort.
                    105:  * We simply redraw the line whenever we see one of these. */
                    106: extern struct delay_change delay_changes[MAX_REG_CHANGE];
                    107: #endif
                    108: 
                    109: extern struct color_entry color_tables[2][(maxvpos+1) * 2];
                    110: extern struct color_entry *curr_color_tables, *prev_color_tables;
                    111: 
                    112: extern struct sprite_draw *curr_sprite_positions, *prev_sprite_positions;
                    113: extern struct color_change *curr_color_changes, *prev_color_changes;
                    114: extern struct draw_info *curr_drawinfo, *prev_drawinfo;
                    115: 
                    116: /* struct decision contains things we save across drawing frames for
                    117:  * comparison (smart update stuff). */
                    118: struct decision {
                    119:     unsigned long color0;
                    120:     int which;
                    121:     int plfstrt, plflinelen;
                    122:     /* Display window: native coordinates, depend on lores state.  */
                    123:     int diwfirstword, diwlastword;
                    124:     int ctable;
                    125: 
                    126:     uae_u16 bplcon0, bplcon1, bplcon2;
                    127: #if 0 /* We don't need this. */
                    128:     uae_u16 bplcon3;
                    129: #endif
                    130: #if AGA_CHIPSET == 1
                    131:     uae_u16 bplcon4;
                    132: #endif
                    133: };
                    134: 
                    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: extern char line_changed[2 * (maxvpos+1)];
                    147: 
                    148: extern uae_u8 line_data[(maxvpos+1) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
                    149: 
                    150: /* Functions in drawing.c.  */
                    151: extern int coord_native_to_amiga_y (int);
                    152: extern int coord_native_to_amiga_x (int);
                    153: 
                    154: extern void record_diw_line (int first, int last);
                    155: extern void hardware_line_completed (int lineno);
                    156: 
                    157: /* Determine how to draw a scan line.  */
                    158: enum nln_how {
                    159:     /* All lines on a non-doubled display. */
                    160:     nln_normal,
                    161:     /* Non-interlace, doubled display.  */
                    162:     nln_doubled,
                    163:     /* Interlace, doubled display, upper line.  */
                    164:     nln_upper,
                    165:     /* Interlace, doubled display, lower line.  */
                    166:     nln_lower
                    167: };
                    168: 
                    169: extern void hsync_record_line_state (int lineno, enum nln_how);
                    170: extern void vsync_handle_redraw (int long_frame, int lof_changed);
                    171: extern void init_hardware_for_drawing_frame (void);
                    172: extern void finish_drawing_frame (void);
                    173: extern void reset_drawing (void);
                    174: extern void drawing_init (void);
                    175: extern void notice_interlace_seen (void);
                    176: 
                    177: /* Finally, stuff that shouldn't really be shared.  */
                    178: 
                    179: extern int thisframe_first_drawn_line, thisframe_last_drawn_line;
                    180: extern uae_u16 clxdat, clxcon;
                    181: extern int clx_sprmask;
                    182: 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.