5
5
* Ettore Perazzoli <ettore@comm2000.it>
6
6
* Andreas Boose <viceteam@t-online.de>
8
* DTV sections written by
9
* Hannu Nuotio <hannu.nuotio@tut.fi>
10
* Daniel Kahlin <daniel@kahlin.net>
8
12
* This file is part of VICE, the Versatile Commodore Emulator.
9
13
* See README for copyright notice.
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)
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
54
#define VICIIDTV_NUM_COLORS 256
51
56
/* Available video modes. The number is given by
52
57
((vicii.regs[0x11] & 0x60) | (vicii.regs[0x16] & 0x10)) >> 4. */
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,
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,
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. */
83
VICII_NUM_VMODES /* valid for DTV only */
65
85
typedef enum vicii_video_mode_s vicii_video_mode_t;
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)
69
90
#define VICII_IS_BITMAP_MODE(x) ((x) & 0x02)
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)
96
/* The actual modes with modulo bug (possibly incomplete) */
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)
103
/* Temporary list to keep all demos running correctly */
104
#define VICII_MODULO_BUG(x) ((x) == VICII_ILLEGAL_TEXT_MODE)
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)
126
/* Adjusted RASTER_X position to account for -2 pixel difference on some
128
#define VICIIDTV_RASTER_X_ADJ(cycle) (VICII_RASTER_X(cycle) - 2)
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)) )
106
144
/* `clk' value for the beginning of the current line. */
107
145
#define VICII_LINE_START_CLK(clk) (((clk) / vicii.cycles_per_line) \
262
315
/* Data to display in idle state. */
318
/* left border idle data */
320
/* middle idle data */
322
/* right border idle data */
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;
348
411
struct video_chip_cap_s *video_chip_cap;
350
413
unsigned int int_num;
415
/* Flag: DTV extended register enable */
416
unsigned int extended_enable;
418
/* Flag: DTV extended register lockout */
419
unsigned int extended_lockout;
421
/* Flag: DTV badline disable */
422
unsigned int badline_disable;
424
/* Flag: DTV colorfetch disable */
425
unsigned int colorfetch_disable;
427
/* Flag: DTV overscan */
428
unsigned int overscan;
430
/* Flag: DTV high color */
431
unsigned int high_color;
433
/* Flag: DTV border off */
434
unsigned int border_off;
436
/* Pointer to color ram */
352
439
typedef struct vicii_s vicii_t;