~ubuntu-branches/ubuntu/raring/vice/raring

« back to all changes in this revision

Viewing changes to src/vicii/viciitypes.h

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2009-03-31 00:37:15 UTC
  • mfrom: (1.1.7 upstream) (9.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090331003715-i5yisvcfv7mgz3eh
Tags: 2.1.dfsg-1
* New major upstream release (closes: #495937).
* Add desktop files (closes: #501181).

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *  Ettore Perazzoli <ettore@comm2000.it>
6
6
 *  Andreas Boose <viceteam@t-online.de>
7
7
 *
 
8
 * DTV sections written by
 
9
 *  Hannu Nuotio <hannu.nuotio@tut.fi>
 
10
 *  Daniel Kahlin <daniel@kahlin.net>
 
11
 *
8
12
 * This file is part of VICE, the Versatile Commodore Emulator.
9
13
 * See README for copyright notice.
10
14
 *
40
44
 
41
45
#define VICII_40COL_START_PIXEL vicii.screen_leftborderwidth
42
46
#define VICII_40COL_STOP_PIXEL  (vicii.screen_leftborderwidth + VICII_SCREEN_XPIX)
43
 
#define VICII_38COL_START_PIXEL (vicii.screen_leftborderwidth + 7)
44
 
#define VICII_38COL_STOP_PIXEL  (vicii.screen_leftborderwidth + 311)
 
47
/* these are one pixel 'off' on the DTV */
 
48
#define VICII_38COL_START_PIXEL (vicii.screen_leftborderwidth + 7 + vicii.viciidtv)
 
49
#define VICII_38COL_STOP_PIXEL  (vicii.screen_leftborderwidth + 311 + vicii.viciidtv)
45
50
 
46
51
#define VICII_NUM_SPRITES      8
47
52
#define VICII_MAX_SPRITE_WIDTH 56  /* expanded sprite in bug area */
48
53
#define VICII_NUM_COLORS       16
49
 
 
 
54
#define VICIIDTV_NUM_COLORS    256
50
55
 
51
56
/* Available video modes.  The number is given by
52
57
   ((vicii.regs[0x11] & 0x60) | (vicii.regs[0x16] & 0x10)) >> 4.  */
 
58
/* Also for DTV: 
 
59
   | (vicii.regs[0x3c] & 0x04)<<1 | (vicii.regs[0x3c] & 0x01)<<3
 
60
   + FRED/FRED2, CHUNKY/PIXEL/ILLEGAL_LINEAR separation */
53
61
enum vicii_video_mode_s {
54
62
    VICII_NORMAL_TEXT_MODE,
55
63
    VICII_MULTICOLOR_TEXT_MODE,
59
67
    VICII_ILLEGAL_TEXT_MODE,
60
68
    VICII_ILLEGAL_BITMAP_MODE_1,
61
69
    VICII_ILLEGAL_BITMAP_MODE_2,
 
70
/* DTV modes */
 
71
    VICII_8BPP_NORMAL_TEXT_MODE,
 
72
    VICII_8BPP_MULTICOLOR_TEXT_MODE,
 
73
    VICII_8BPP_HIRES_BITMAP_MODE, /* TODO: doesn't exist */
 
74
    VICII_8BPP_MULTICOLOR_BITMAP_MODE,
 
75
    VICII_8BPP_EXTENDED_TEXT_MODE,
 
76
    VICII_8BPP_CHUNKY_MODE,
 
77
    VICII_8BPP_TWO_PLANE_BITMAP_MODE,
 
78
    VICII_8BPP_FRED_MODE,
 
79
    VICII_8BPP_FRED2_MODE,
 
80
    VICII_8BPP_PIXEL_CELL_MODE,
 
81
    VICII_ILLEGAL_LINEAR_MODE,
62
82
    VICII_IDLE_MODE,           /* Special mode for idle state.  */
63
 
    VICII_NUM_VMODES
 
83
    VICII_NUM_VMODES  /* valid for DTV only */
64
84
};
65
85
typedef enum vicii_video_mode_s vicii_video_mode_t;
66
86
 
67
87
#define VICII_IS_ILLEGAL_MODE(x) ((x) >= VICII_ILLEGAL_TEXT_MODE \
68
 
                                 && (x) != VICII_IDLE_MODE)
 
88
                                 && (x) <= VICII_ILLEGAL_BITMAP_MODE_2)
 
89
 
69
90
#define VICII_IS_BITMAP_MODE(x)  ((x) & 0x02)
70
91
 
71
92
#define VICII_IS_TEXT_MODE(x)    ((x) == VICII_NORMAL_TEXT_MODE \
72
93
                                 || (x) == VICII_MULTICOLOR_TEXT_MODE \
73
94
                                 || (x) == VICII_EXTENDED_TEXT_MODE)
74
95
 
 
96
/* The actual modes with modulo bug (possibly incomplete) */
 
97
/*
 
98
#define VICII_MODULO_BUG(x)      ((x) == VICII_8BPP_FRED_MODE \
 
99
                                 || (x) == VICII_8BPP_FRED2_MODE \
 
100
                                 || (x) == VICII_ILLEGAL_TEXT_MODE \
 
101
                                 || (x) == VICII_8BPP_TWO_PLANE_BITMAP_MODE)
 
102
*/
 
103
/* Temporary list to keep all demos running correctly */
 
104
#define VICII_MODULO_BUG(x)      ((x) == VICII_ILLEGAL_TEXT_MODE)
 
105
 
75
106
/* These timings are taken from the ``VIC Article'' by Christian Bauer
76
107
   <bauec002@goofy.zdv.uni-mainz.de>.  Thanks Christian!
77
108
   Note: we measure cycles from 0 to 62, not from 1 to 63 as he does.  */
92
123
   SCREEN_WIDTH if outside the visible range.  */
93
124
#define VICII_RASTER_X(cycle)      (((int)(cycle) - 17) * 8 + vicii.screen_leftborderwidth)
94
125
 
 
126
/* Adjusted RASTER_X position to account for -2 pixel difference on some
 
127
   C64DTV stores */
 
128
#define VICIIDTV_RASTER_X_ADJ(cycle)     (VICII_RASTER_X(cycle) - 2)
 
129
 
95
130
/* Current vertical position of the raster.  Unlike `rasterline', which is
96
131
   only accurate if a pending drawing event has been served, this is
97
132
   guarranteed to be always correct.  It is a bit slow, though.  */
102
137
/* Cycle # within the current line.  */
103
138
#define VICII_RASTER_CYCLE(clk)    ((unsigned int)((clk) \
104
139
                                   % vicii.cycles_per_line))
 
140
/* DTV Cycle # within the current line.
 
141
   Handles the "hole" on PAL systems at cycles 54-55 and the 1 cycle shift */
 
142
#define VICIIDTV_RASTER_CYCLE(clk) ((unsigned int)( (((clk)-1) % vicii.cycles_per_line) + ((vicii.cycles_per_line == 63 && (((clk)-1) % vicii.cycles_per_line) > 53)?2:0)) )
105
143
 
106
144
/* `clk' value for the beginning of the current line.  */
107
145
#define VICII_LINE_START_CLK(clk)  (((clk) / vicii.cycles_per_line) \
152
190
    raster_t raster;
153
191
 
154
192
    /* VIC-II registers.  */
155
 
    int regs[64];
 
193
    int regs[0x50];
 
194
 
 
195
    /* DTV Linear Counters */
 
196
    int counta;
 
197
    int counta_mod;
 
198
    int counta_step;
 
199
    int countb;
 
200
    int countb_mod;
 
201
    int countb_step;
 
202
 
 
203
    /* DTV Palette lookup */
 
204
    BYTE dtvpalette[256];
 
205
 
 
206
    /* DTV raster IRQ */
 
207
    int raster_irq_offset;
 
208
    int raster_irq_prevent;
156
209
 
157
210
    /* Interrupt register.  */
158
211
    int irq_status;             /* = 0; */
262
315
    /* Data to display in idle state.  */
263
316
    int idle_data;
264
317
 
 
318
    /* left border idle data */
 
319
    int idle_data_l[4];
 
320
    /* middle idle data */
 
321
    int idle_data_m[4];
 
322
    /* right border idle data */
 
323
    int idle_data_r[4];
 
324
 
265
325
    /* Where do we currently fetch idle state from?  If `IDLE_NONE', we are
266
326
       not in idle state and thus do not need to update `idle_data'.  */
267
327
    vicii_idle_data_location_t idle_data_location;
335
395
    /* Flag: Enable VIC-IIe features.  */
336
396
    unsigned int viciie;
337
397
 
 
398
    /* Flag: Enable DTV VIC-II features.  */
 
399
    unsigned int viciidtv;
 
400
 
338
401
    /* VIC-IIe clock mode.  */
339
402
    unsigned int fastmode;
340
403
 
348
411
    struct video_chip_cap_s *video_chip_cap;
349
412
 
350
413
    unsigned int int_num;
 
414
 
 
415
    /* Flag: DTV extended register enable */
 
416
    unsigned int extended_enable;
 
417
 
 
418
    /* Flag: DTV extended register lockout */
 
419
    unsigned int extended_lockout;
 
420
 
 
421
    /* Flag: DTV badline disable */
 
422
    unsigned int badline_disable;
 
423
 
 
424
    /* Flag: DTV colorfetch disable */
 
425
    unsigned int colorfetch_disable;
 
426
 
 
427
    /* Flag: DTV overscan */
 
428
    unsigned int overscan;
 
429
 
 
430
    /* Flag: DTV high color */
 
431
    unsigned int high_color;
 
432
    
 
433
    /* Flag: DTV border off */
 
434
    unsigned int border_off;
 
435
 
 
436
    /* Pointer to color ram */
 
437
    BYTE *color_ram_ptr;
351
438
};
352
439
typedef struct vicii_s vicii_t;
353
440