trunk/src/mame/includes/atari.h
| r31991 | r31992 | |
| 14 | 14 | |
| 15 | 15 | #include "machine/6821pia.h" |
| 16 | 16 | #include "sound/pokey.h" |
| 17 | #include "video/antic.h" |
| 17 | 18 | #include "video/gtia.h" |
| 18 | 19 | |
| 19 | 20 | |
| r31991 | r31992 | |
| 84 | 85 | #define FRAME_RATE_50HZ (double)1789790/114/TOTAL_LINES_50HZ |
| 85 | 86 | #define FRAME_RATE_60HZ (double)1789790/114/TOTAL_LINES_60HZ |
| 86 | 87 | |
| 87 | | #define HWIDTH 48 /* total characters per line */ |
| 88 | | #define HCHARS 44 /* visible characters per line */ |
| 89 | | #define VHEIGHT 32 |
| 90 | | #define VCHARS (VDATA_END-VDATA_START+7)/8 |
| 91 | | #define BUF_OFFS0 (HWIDTH-HCHARS)/2 |
| 92 | | #define MIN_X ((HWIDTH-42)/2)*8 |
| 93 | | #define MAX_X MIN_X+42*8-1 |
| 94 | | #define MIN_Y VDATA_START |
| 95 | | #define MAX_Y VDATA_END-8-1 |
| 96 | 88 | |
| 97 | | #define PMOFFSET 32 /* # of pixels to adjust p/m hpos */ |
| 98 | | |
| 99 | | #define VPAGE 0xf000 /* 4K page mask for video data src */ |
| 100 | | #define VOFFS 0x0fff /* 4K offset mask for video data src */ |
| 101 | | #define DPAGE 0xfc00 /* 1K page mask for display list */ |
| 102 | | #define DOFFS 0x03ff /* 1K offset mask for display list */ |
| 103 | | |
| 104 | | #define DLI_NMI 0x80 /* 10000000b bit mask for display list interrupt */ |
| 105 | | #define VBL_NMI 0x40 /* 01000000b bit mask for vertical blank interrupt */ |
| 106 | | |
| 107 | | #define ANTIC_DLI 0x80 /* 10000000b cmds with display list intr */ |
| 108 | | #define ANTIC_LMS 0x40 /* 01000000b cmds with load memory scan */ |
| 109 | | #define ANTIC_VSCR 0x20 /* 00100000b cmds with vertical scroll */ |
| 110 | | #define ANTIC_HSCR 0x10 /* 00010000b cmds with horizontal scroll */ |
| 111 | | #define ANTIC_MODE 0x0f /* 00001111b cmd mode mask */ |
| 112 | | |
| 113 | | #define DMA_ANTIC 0x20 /* 00100000b ANTIC DMA enable */ |
| 114 | | #define DMA_PM_DBLLINE 0x10 /* 00010000b double line player/missile */ |
| 115 | | #define DMA_PLAYER 0x08 /* 00001000b player DMA enable */ |
| 116 | | #define DMA_MISSILE 0x04 /* 00000100b missile DMA enable */ |
| 117 | | |
| 118 | | #define OFS_MIS_SINGLE 3*256 /* offset missiles single line DMA */ |
| 119 | | #define OFS_PL0_SINGLE 4*256 /* offset player 0 single line DMA */ |
| 120 | | #define OFS_PL1_SINGLE 5*256 /* offset player 1 single line DMA */ |
| 121 | | #define OFS_PL2_SINGLE 6*256 /* offset player 2 single line DMA */ |
| 122 | | #define OFS_PL3_SINGLE 7*256 /* offset player 3 single line DMA */ |
| 123 | | |
| 124 | | #define OFS_MIS_DOUBLE 3*128 /* offset missiles double line DMA */ |
| 125 | | #define OFS_PL0_DOUBLE 4*128 /* offset player 0 double line DMA */ |
| 126 | | #define OFS_PL1_DOUBLE 5*128 /* offset player 1 double line DMA */ |
| 127 | | #define OFS_PL2_DOUBLE 6*128 /* offset player 2 double line DMA */ |
| 128 | | #define OFS_PL3_DOUBLE 7*128 /* offset player 3 double line DMA */ |
| 129 | | |
| 130 | | #define PFD 0x00 /* 00000000b playfield default color */ |
| 131 | | |
| 132 | | #define PBK 0x00 /* 00000000b playfield background */ |
| 133 | | #define PF0 0x01 /* 00000001b playfield color #0 */ |
| 134 | | #define PF1 0x02 /* 00000010b playfield color #1 */ |
| 135 | | #define PF2 0x04 /* 00000100b playfield color #2 */ |
| 136 | | #define PF3 0x08 /* 00001000b playfield color #3 */ |
| 137 | | #define PL0 0x11 /* 00010001b player #0 */ |
| 138 | | #define PL1 0x12 /* 00010010b player #1 */ |
| 139 | | #define PL2 0x14 /* 00010100b player #2 */ |
| 140 | | #define PL3 0x18 /* 00011000b player #3 */ |
| 141 | | #define MI0 0x21 /* 00100001b missile #0 */ |
| 142 | | #define MI1 0x22 /* 00100010b missile #1 */ |
| 143 | | #define MI2 0x24 /* 00100100b missile #2 */ |
| 144 | | #define MI3 0x28 /* 00101000b missile #3 */ |
| 145 | | #define T00 0x40 /* 01000000b text mode pixels 00 */ |
| 146 | | #define P000 0x48 /* 01001000b player #0 pixels 00 */ |
| 147 | | #define P100 0x4a /* 01001010b player #1 pixels 00 */ |
| 148 | | #define P200 0x4c /* 01001100b player #2 pixels 00 */ |
| 149 | | #define P300 0x4e /* 01001110b player #3 pixels 00 */ |
| 150 | | #define P400 0x4f /* 01001111b missiles pixels 00 */ |
| 151 | | #define T01 0x50 /* 01010000b text mode pixels 01 */ |
| 152 | | #define P001 0x58 /* 01011000b player #0 pixels 01 */ |
| 153 | | #define P101 0x5a /* 01011010b player #1 pixels 01 */ |
| 154 | | #define P201 0x5c /* 01011100b player #2 pixels 01 */ |
| 155 | | #define P301 0x5e /* 01011110b player #3 pixels 01 */ |
| 156 | | #define P401 0x5f /* 01011111b missiles pixels 01 */ |
| 157 | | #define T10 0x60 /* 01100000b text mode pixels 10 */ |
| 158 | | #define P010 0x68 /* 01101000b player #0 pixels 10 */ |
| 159 | | #define P110 0x6a /* 01101010b player #1 pixels 10 */ |
| 160 | | #define P210 0x6c /* 01101100b player #2 pixels 10 */ |
| 161 | | #define P310 0x6e /* 01101110b player #3 pixels 10 */ |
| 162 | | #define P410 0x6f /* 01101111b missiles pixels 10 */ |
| 163 | | #define T11 0x70 /* 01110000b text mode pixels 11 */ |
| 164 | | #define P011 0x78 /* 01111000b player #0 pixels 11 */ |
| 165 | | #define P111 0x7a /* 01111010b player #1 pixels 11 */ |
| 166 | | #define P211 0x7c /* 01111100b player #2 pixels 11 */ |
| 167 | | #define P311 0x7e /* 01111110b player #3 pixels 11 */ |
| 168 | | #define P411 0x7f /* 01111111b missiles pixels 11 */ |
| 169 | | #define G00 0x80 /* 10000000b hires gfx pixels 00 */ |
| 170 | | #define G01 0x90 /* 10010000b hires gfx pixels 01 */ |
| 171 | | #define G10 0xa0 /* 10100000b hires gfx pixels 10 */ |
| 172 | | #define G11 0xb0 /* 10110000b hires gfx pixels 11 */ |
| 173 | | #define GT1 0xc0 /* 11000000b gtia mode 1 */ |
| 174 | | #define GT2 0xd0 /* 11010000b gtia mode 2 */ |
| 175 | | #define GT3 0xe0 /* 11100000b gtia mode 3 */ |
| 176 | | #define ILL 0xfe /* 11111110b illegal priority */ |
| 177 | | #define EOR 0xff /* 11111111b EOR mode color */ |
| 178 | | |
| 179 | | #define LUM 0x0f /* 00001111b luminance bits */ |
| 180 | | #define HUE 0xf0 /* 11110000b hue bits */ |
| 181 | | |
| 182 | | #define TRIGGER_VBLANK 64715 |
| 183 | | #define TRIGGER_STEAL 64716 |
| 184 | | #define TRIGGER_HSYNC 64717 |
| 185 | | |
| 186 | | #define GTIA_MISSILE 0x01 |
| 187 | | #define GTIA_PLAYER 0x02 |
| 188 | | #define GTIA_TRIGGER 0x04 |
| 189 | | |
| 190 | | /***************************************************************************** |
| 191 | | * If your memcpy does not expand too well if you use it with constant |
| 192 | | * size_t field, you might want to define these macros somehow different. |
| 193 | | * NOTE: dst is not necessarily UINT32 aligned (because of horz scrolling)! |
| 194 | | *****************************************************************************/ |
| 195 | | #define COPY4(dst,s1) *dst++ = s1 |
| 196 | | #define COPY8(dst,s1,s2) *dst++ = s1; *dst++ = s2 |
| 197 | | #define COPY16(dst,s1,s2,s3,s4) *dst++ = s1; *dst++ = s2; *dst++ = s3; *dst++ = s4 |
| 198 | | |
| 199 | | struct ANTIC_R { |
| 200 | | UINT8 antic00; /* 00 nothing */ |
| 201 | | UINT8 antic01; /* 01 nothing */ |
| 202 | | UINT8 antic02; /* 02 nothing */ |
| 203 | | UINT8 antic03; /* 03 nothing */ |
| 204 | | UINT8 antic04; /* 04 nothing */ |
| 205 | | UINT8 antic05; /* 05 nothing */ |
| 206 | | UINT8 antic06; /* 06 nothing */ |
| 207 | | UINT8 antic07; /* 07 nothing */ |
| 208 | | UINT8 antic08; /* 08 nothing */ |
| 209 | | UINT8 antic09; /* 09 nothing */ |
| 210 | | UINT8 antic0a; /* 0a nothing */ |
| 211 | | UINT8 vcount; /* 0b vertical (scanline) counter */ |
| 212 | | UINT8 penh; /* 0c light pen horizontal pos */ |
| 213 | | UINT8 penv; /* 0d light pen vertical pos */ |
| 214 | | UINT8 antic0e; /* 0e nothing */ |
| 215 | | UINT8 nmist; /* 0f NMI status */ |
| 216 | | }; /* read registers */ |
| 217 | | |
| 218 | | struct ANTIC_W { |
| 219 | | UINT8 dmactl; /* 00 write DMA control */ |
| 220 | | UINT8 chactl; /* 01 write character control */ |
| 221 | | UINT8 dlistl; /* 02 display list low */ |
| 222 | | UINT8 dlisth; /* 03 display list high */ |
| 223 | | UINT8 hscrol; /* 04 horz scroll */ |
| 224 | | UINT8 vscrol; /* 05 vert scroll */ |
| 225 | | UINT8 pmbasl; /* 06 player/missile base addr low */ |
| 226 | | UINT8 pmbash; /* 07 player/missile base addr high */ |
| 227 | | UINT8 chbasl; /* 08 character generator base addr low */ |
| 228 | | UINT8 chbash; /* 09 character generator base addr high */ |
| 229 | | UINT8 wsync; /* 0a wait for hsync */ |
| 230 | | UINT8 antic0b; /* 0b nothing */ |
| 231 | | UINT8 antic0c; /* 0c nothing */ |
| 232 | | UINT8 antic0d; /* 0d nothing */ |
| 233 | | UINT8 nmien; /* 0e NMI enable */ |
| 234 | | UINT8 nmires; /* 0f NMI reset */ |
| 235 | | }; /* write registers */ |
| 236 | | |
| 237 | | /* per scanline buffer for video data (and optimization variables) */ |
| 238 | | struct VIDEO { |
| 239 | | UINT32 cmd; /* antic command for this scanline */ |
| 240 | | UINT16 data[HWIDTH]; /* graphics data buffer (text through chargen) */ |
| 241 | | }; |
| 242 | | |
| 243 | | typedef void (*atari_renderer_func)(address_space &space, VIDEO *video); |
| 244 | | |
| 245 | | struct ANTIC { |
| 246 | | atari_renderer_func renderer; /* current renderer */ |
| 247 | | UINT32 cmd; /* currently executed display list command */ |
| 248 | | UINT32 steal_cycles; /* steal how many cpu cycles for this line ? */ |
| 249 | | UINT32 vscrol_old; /* old vscrol value */ |
| 250 | | UINT32 hscrol_old; /* old hscrol value */ |
| 251 | | INT32 modelines; /* number of lines for current ANTIC mode */ |
| 252 | | UINT32 chbase; /* character mode source base */ |
| 253 | | UINT32 chand; /* character and mask (chactl) */ |
| 254 | | UINT32 chxor; /* character xor mask (chactl) */ |
| 255 | | UINT32 scanline; /* current scan line */ |
| 256 | | UINT32 pfwidth; /* playfield width */ |
| 257 | | UINT32 dpage; /* display list address page */ |
| 258 | | UINT32 doffs; /* display list offset into page */ |
| 259 | | UINT32 vpage; /* video data source page */ |
| 260 | | UINT32 voffs; /* video data offset into page */ |
| 261 | | UINT32 pmbase_s; /* p/m graphics single line source base */ |
| 262 | | UINT32 pmbase_d; /* p/m graphics double line source base */ |
| 263 | | ANTIC_R r; /* ANTIC read registers */ |
| 264 | | ANTIC_W w; /* ANTIC write registers */ |
| 265 | | UINT8 cclock[256+32]; /* color clock buffer filled by ANTIC */ |
| 266 | | UINT8 pmbits[256+32]; /* player missile buffer filled by GTIA */ |
| 267 | | UINT8 *prio_table[64]; /* player/missile priority tables */ |
| 268 | | VIDEO *video[312]; /* video buffer */ |
| 269 | | UINT32 *cclk_expand; /* shared buffer for the following: */ |
| 270 | | UINT32 *pf_21; /* 1cclk 2 color txt 2,3 */ |
| 271 | | UINT32 *pf_x10b; /* 1cclk 4 color txt 4,5, gfx D,E */ |
| 272 | | UINT32 *pf_3210b2; /* 1cclk 5 color txt 6,7, gfx 9,B,C */ |
| 273 | | UINT32 *pf_210b4; /* 4cclk 4 color gfx 8 */ |
| 274 | | UINT32 *pf_210b2; /* 2cclk 4 color gfx A */ |
| 275 | | UINT32 *pf_1b; /* 1cclk hires gfx F */ |
| 276 | | UINT32 *pf_gtia1; /* 1cclk gtia mode 1 */ |
| 277 | | UINT32 *pf_gtia2; /* 1cclk gtia mode 2 */ |
| 278 | | UINT32 *pf_gtia3; /* 1cclk gtia mode 3 */ |
| 279 | | UINT8 *used_colors; /* shared buffer for the following: */ |
| 280 | | UINT8 *uc_21; /* used colors for txt (2,3) */ |
| 281 | | UINT8 *uc_x10b; /* used colors for txt 4,5, gfx D,E */ |
| 282 | | UINT8 *uc_3210b2; /* used colors for txt 6,7, gfx 9,B,C */ |
| 283 | | UINT8 *uc_210b4; /* used colors for gfx 8 */ |
| 284 | | UINT8 *uc_210b2; /* used colors for gfx A */ |
| 285 | | UINT8 *uc_1b; /* used colors for gfx F */ |
| 286 | | UINT8 *uc_g1; /* used colors for gfx GTIA 1 */ |
| 287 | | UINT8 *uc_g2; /* used colors for gfx GTIA 2 */ |
| 288 | | UINT8 *uc_g3; /* used colors for gfx GTIA 3 */ |
| 289 | | bitmap_ind16 *bitmap; |
| 290 | | }; |
| 291 | | |
| 292 | | #define RDANTIC(space) space.read_byte(antic.dpage+antic.doffs) |
| 293 | | #define RDVIDEO(space,o) space.read_byte(antic.vpage+((antic.voffs+(o))&VOFFS)) |
| 294 | | #define RDCHGEN(space,o) space.read_byte(antic.chbase+(o)) |
| 295 | | #define RDPMGFXS(space,o) space.read_byte(antic.pmbase_s+(o)+(antic.scanline>>1)) |
| 296 | | #define RDPMGFXD(space,o) space.read_byte(antic.pmbase_d+(o)+antic.scanline) |
| 297 | | |
| 298 | | #define PREPARE() \ |
| 299 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET] |
| 300 | | |
| 301 | | #define PREPARE_TXT2(space,width) \ |
| 302 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 303 | | int i; \ |
| 304 | | for( i = 0; i < width; i++ ) \ |
| 305 | | { \ |
| 306 | | UINT16 ch = RDVIDEO(space,i) << 3; \ |
| 307 | | if( ch & 0x400 ) \ |
| 308 | | { \ |
| 309 | | ch = RDCHGEN(space,(ch & 0x3f8) + antic.w.chbasl); \ |
| 310 | | ch = (ch ^ antic.chxor) & antic.chand; \ |
| 311 | | } \ |
| 312 | | else \ |
| 313 | | { \ |
| 314 | | ch = RDCHGEN(space,ch + antic.w.chbasl); \ |
| 315 | | } \ |
| 316 | | video->data[i] = ch; \ |
| 317 | | } |
| 318 | | |
| 319 | | #define PREPARE_TXT3(space,width) \ |
| 320 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 321 | | int i; \ |
| 322 | | for( i = 0; i < width; i++ ) \ |
| 323 | | { \ |
| 324 | | UINT16 ch = RDVIDEO(space,i) << 3; \ |
| 325 | | if( ch & 0x400 ) \ |
| 326 | | { \ |
| 327 | | ch &= 0x3f8; \ |
| 328 | | if( (ch & 0x300) == 0x300 ) \ |
| 329 | | { \ |
| 330 | | if (antic.w.chbasl < 2) /* first two lines empty */ \ |
| 331 | | ch = 0x00; \ |
| 332 | | else /* lines 2..7 are standard, 8&9 are 0&1 */ \ |
| 333 | | ch = RDCHGEN(space,ch + (antic.w.chbasl & 7));\ |
| 334 | | } \ |
| 335 | | else \ |
| 336 | | { \ |
| 337 | | if (antic.w.chbasl > 7) /* last two lines empty */ \ |
| 338 | | ch = 0x00; \ |
| 339 | | else /* lines 0..7 are standard */ \ |
| 340 | | ch = RDCHGEN(space,ch + antic.w.chbasl); \ |
| 341 | | } \ |
| 342 | | ch = (ch ^ antic.chxor) & antic.chand; \ |
| 343 | | } \ |
| 344 | | else \ |
| 345 | | { \ |
| 346 | | if( (ch & 0x300) == 0x300 ) \ |
| 347 | | { \ |
| 348 | | if (antic.w.chbasl < 2) /* first two lines empty */ \ |
| 349 | | ch = 0x00; \ |
| 350 | | else /* lines 2..7 are standard, 8&9 are 0&1 */ \ |
| 351 | | ch = RDCHGEN(space,ch + (antic.w.chbasl & 7));\ |
| 352 | | } \ |
| 353 | | else \ |
| 354 | | { \ |
| 355 | | if (antic.w.chbasl > 7) /* last two lines empty */ \ |
| 356 | | ch = 0x00; \ |
| 357 | | else /* lines 0..7 are standard */ \ |
| 358 | | ch = RDCHGEN(space,ch + antic.w.chbasl); \ |
| 359 | | } \ |
| 360 | | } \ |
| 361 | | video->data[i] = ch; \ |
| 362 | | } |
| 363 | | |
| 364 | | #define PREPARE_TXT45(space,width,shift) \ |
| 365 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 366 | | int i; \ |
| 367 | | for( i = 0; i < width; i++ ) \ |
| 368 | | { \ |
| 369 | | UINT16 ch = RDVIDEO(space,i) << 3; \ |
| 370 | | ch = ((ch>>2)&0x100)|RDCHGEN(space,(ch&0x3f8)+(antic.w.chbasl>>shift)); \ |
| 371 | | video->data[i] = ch; \ |
| 372 | | } |
| 373 | | |
| 374 | | |
| 375 | | #define PREPARE_TXT67(space,width,shift) \ |
| 376 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 377 | | int i; \ |
| 378 | | for( i = 0; i < width; i++ ) \ |
| 379 | | { \ |
| 380 | | UINT16 ch = RDVIDEO(space,i) << 3; \ |
| 381 | | ch = (ch&0x600)|(RDCHGEN(space,(ch&0x1f8)+(antic.w.chbasl>>shift))<<1); \ |
| 382 | | video->data[i] = ch; \ |
| 383 | | } |
| 384 | | |
| 385 | | #define PREPARE_GFX8(space,width) \ |
| 386 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 387 | | int i; \ |
| 388 | | for( i = 0; i < width; i++ ) \ |
| 389 | | video->data[i] = RDVIDEO(space,i) << 2 |
| 390 | | |
| 391 | | #define PREPARE_GFX9BC(space,width) \ |
| 392 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 393 | | int i; \ |
| 394 | | for( i = 0; i < width; i++ ) \ |
| 395 | | video->data[i] = RDVIDEO(space,i) << 1 |
| 396 | | |
| 397 | | #define PREPARE_GFXA(space,width) \ |
| 398 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 399 | | int i; \ |
| 400 | | for( i = 0; i < width; i++ ) \ |
| 401 | | video->data[i] = RDVIDEO(space,i) << 1 |
| 402 | | |
| 403 | | #define PREPARE_GFXDE(space,width) \ |
| 404 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 405 | | int i; \ |
| 406 | | for( i = 0; i < width; i++ ) \ |
| 407 | | video->data[i] = RDVIDEO(space,i) |
| 408 | | |
| 409 | | #define PREPARE_GFXF(space,width) \ |
| 410 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 411 | | int i; \ |
| 412 | | for( i = 0; i < width; i++ ) \ |
| 413 | | video->data[i] = RDVIDEO(space,i) |
| 414 | | |
| 415 | | #define PREPARE_GFXG1(space,width) \ |
| 416 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 417 | | int i; \ |
| 418 | | for( i = 0; i < width; i++ ) \ |
| 419 | | video->data[i] = RDVIDEO(space,i) |
| 420 | | |
| 421 | | #define PREPARE_GFXG2(space,width) \ |
| 422 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 423 | | int i; \ |
| 424 | | for( i = 0; i < width; i++ ) \ |
| 425 | | video->data[i] = RDVIDEO(space,i) |
| 426 | | |
| 427 | | #define PREPARE_GFXG3(space,width) \ |
| 428 | | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 429 | | int i; \ |
| 430 | | for( i = 0; i < width; i++ ) \ |
| 431 | | video->data[i] = RDVIDEO(space,i) |
| 432 | | |
| 433 | | /****************************************************************** |
| 434 | | * common end of a single antic/gtia mode emulation function |
| 435 | | ******************************************************************/ |
| 436 | | #define POST() \ |
| 437 | | --antic.modelines |
| 438 | | |
| 439 | | #define POST_GFX(width) \ |
| 440 | | antic.steal_cycles += width; \ |
| 441 | | if( --antic.modelines == 0 ) \ |
| 442 | | antic.voffs = (antic.voffs + width) & VOFFS |
| 443 | | |
| 444 | | #define POST_TXT(width) \ |
| 445 | | antic.steal_cycles += width; \ |
| 446 | | if( --antic.modelines == 0 ) \ |
| 447 | | antic.voffs = (antic.voffs + width) & VOFFS; \ |
| 448 | | else \ |
| 449 | | if( antic.w.chactl & 4 ) \ |
| 450 | | antic.w.chbasl--; \ |
| 451 | | else \ |
| 452 | | antic.w.chbasl++ |
| 453 | | |
| 454 | | /* erase a number of color clocks to background color PBK */ |
| 455 | | #define ERASE4 { \ |
| 456 | | *dst++ = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 457 | | *dst++ = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 458 | | *dst++ = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 459 | | *dst++ = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 460 | | } |
| 461 | | |
| 462 | | #define ZAP48() \ |
| 463 | | dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 464 | | dst[ 0] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 465 | | dst[ 1] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 466 | | dst[ 2] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 467 | | dst[45] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 468 | | dst[46] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 469 | | dst[47] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK |
| 470 | | |
| 471 | | #define ERASE8 \ |
| 472 | | ERASE4; \ |
| 473 | | ERASE4 |
| 474 | | |
| 475 | | #define REP08(FUNC) \ |
| 476 | | ERASE8; \ |
| 477 | | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 478 | | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 479 | | ERASE8 |
| 480 | | |
| 481 | | #define REP10(FUNC) \ |
| 482 | | ERASE4; \ |
| 483 | | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 484 | | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 485 | | FUNC( 8); FUNC( 9); \ |
| 486 | | ERASE4 |
| 487 | | |
| 488 | | #define REP12(FUNC) \ |
| 489 | | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 490 | | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 491 | | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11) |
| 492 | | |
| 493 | | #define REP16(FUNC) \ |
| 494 | | ERASE8; \ |
| 495 | | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 496 | | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 497 | | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 498 | | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 499 | | ERASE8 |
| 500 | | |
| 501 | | #define REP20(FUNC) \ |
| 502 | | ERASE4; \ |
| 503 | | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 504 | | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 505 | | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 506 | | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 507 | | FUNC(16); FUNC(17); FUNC(18); FUNC(19); \ |
| 508 | | ERASE4 |
| 509 | | |
| 510 | | #define REP24(FUNC) \ |
| 511 | | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 512 | | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 513 | | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 514 | | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 515 | | FUNC(16); FUNC(17); FUNC(18); FUNC(19); \ |
| 516 | | FUNC(20); FUNC(21); FUNC(22); FUNC(23) |
| 517 | | |
| 518 | | #define REP32(FUNC) \ |
| 519 | | ERASE8; \ |
| 520 | | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 521 | | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 522 | | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 523 | | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 524 | | FUNC(16); FUNC(17); FUNC(18); FUNC(19); \ |
| 525 | | FUNC(20); FUNC(21); FUNC(22); FUNC(23); \ |
| 526 | | FUNC(24); FUNC(25); FUNC(26); FUNC(27); \ |
| 527 | | FUNC(28); FUNC(29); FUNC(30); FUNC(31); \ |
| 528 | | ERASE8 |
| 529 | | |
| 530 | | #define REP40(FUNC) \ |
| 531 | | ERASE4; \ |
| 532 | | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 533 | | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 534 | | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 535 | | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 536 | | FUNC(16); FUNC(17); FUNC(18); FUNC(19); \ |
| 537 | | FUNC(20); FUNC(21); FUNC(22); FUNC(23); \ |
| 538 | | FUNC(24); FUNC(25); FUNC(26); FUNC(27); \ |
| 539 | | FUNC(28); FUNC(29); FUNC(30); FUNC(31); \ |
| 540 | | FUNC(32); FUNC(33); FUNC(34); FUNC(35); \ |
| 541 | | FUNC(36); FUNC(37); FUNC(38); FUNC(39); \ |
| 542 | | ERASE4 |
| 543 | | |
| 544 | | #define REP48(FUNC) \ |
| 545 | | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 546 | | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 547 | | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 548 | | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 549 | | FUNC(16); FUNC(17); FUNC(18); FUNC(19); \ |
| 550 | | FUNC(20); FUNC(21); FUNC(22); FUNC(23); \ |
| 551 | | FUNC(24); FUNC(25); FUNC(26); FUNC(27); \ |
| 552 | | FUNC(28); FUNC(29); FUNC(30); FUNC(31); \ |
| 553 | | FUNC(32); FUNC(33); FUNC(34); FUNC(35); \ |
| 554 | | FUNC(36); FUNC(37); FUNC(38); FUNC(39); \ |
| 555 | | FUNC(40); FUNC(41); FUNC(42); FUNC(43); \ |
| 556 | | FUNC(44); FUNC(45); FUNC(46); FUNC(47); |
| 557 | | |
| 558 | | /*----------- defined in video/antic.c -----------*/ |
| 559 | | |
| 560 | | extern ANTIC antic; |
| 561 | | |
| 562 | | void antic_start(running_machine &machine); |
| 563 | | void antic_vstart(running_machine &machine); |
| 564 | | void antic_reset(void); |
| 565 | | void antic_render(address_space &space, int param1, int param2, int param3); |
| 566 | | |
| 567 | | |
| 568 | 89 | #endif /* ATARI_H */ |
trunk/src/mame/video/antic.c
| r31991 | r31992 | |
| 7 | 7 | ******************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "emu.h" |
| 10 | #include "antic.h" |
| 11 | #include "includes/atari.h" |
| 10 | 12 | #include "cpu/m6502/m6502.h" |
| 11 | | #include "includes/atari.h" |
| 12 | 13 | |
| 13 | 14 | #ifdef MAME_DEBUG |
| 14 | 15 | #define VERBOSE 1 |
| r31991 | r31992 | |
| 21 | 22 | // declaration of renderer functions |
| 22 | 23 | #define ANTIC_RENDERER(name) void name(address_space &space, VIDEO *video) |
| 23 | 24 | |
| 24 | | ANTIC_RENDERER( antic_mode_0_xx ); |
| 25 | | ANTIC_RENDERER( antic_mode_2_32 ); |
| 26 | | ANTIC_RENDERER( antic_mode_2_40 ); |
| 27 | | ANTIC_RENDERER( antic_mode_2_48 ); |
| 28 | | ANTIC_RENDERER( antic_mode_3_32 ); |
| 29 | | ANTIC_RENDERER( antic_mode_3_40 ); |
| 30 | | ANTIC_RENDERER( antic_mode_3_48 ); |
| 31 | | ANTIC_RENDERER( antic_mode_4_32 ); |
| 32 | | ANTIC_RENDERER( antic_mode_4_40 ); |
| 33 | | ANTIC_RENDERER( antic_mode_4_48 ); |
| 34 | | ANTIC_RENDERER( antic_mode_5_32 ); |
| 35 | | ANTIC_RENDERER( antic_mode_5_40 ); |
| 36 | | ANTIC_RENDERER( antic_mode_5_48 ); |
| 37 | | ANTIC_RENDERER( antic_mode_6_32 ); |
| 38 | | ANTIC_RENDERER( antic_mode_6_40 ); |
| 39 | | ANTIC_RENDERER( antic_mode_6_48 ); |
| 40 | | ANTIC_RENDERER( antic_mode_7_32 ); |
| 41 | | ANTIC_RENDERER( antic_mode_7_40 ); |
| 42 | | ANTIC_RENDERER( antic_mode_7_48 ); |
| 43 | | ANTIC_RENDERER( antic_mode_8_32 ); |
| 44 | | ANTIC_RENDERER( antic_mode_8_40 ); |
| 45 | | ANTIC_RENDERER( antic_mode_8_48 ); |
| 46 | | ANTIC_RENDERER( antic_mode_9_32 ); |
| 47 | | ANTIC_RENDERER( antic_mode_9_40 ); |
| 48 | | ANTIC_RENDERER( antic_mode_9_48 ); |
| 49 | | ANTIC_RENDERER( antic_mode_a_32 ); |
| 50 | | ANTIC_RENDERER( antic_mode_a_40 ); |
| 51 | | ANTIC_RENDERER( antic_mode_a_48 ); |
| 52 | | ANTIC_RENDERER( antic_mode_b_32 ); |
| 53 | | ANTIC_RENDERER( antic_mode_b_40 ); |
| 54 | | ANTIC_RENDERER( antic_mode_b_48 ); |
| 55 | | ANTIC_RENDERER( antic_mode_c_32 ); |
| 56 | | ANTIC_RENDERER( antic_mode_c_40 ); |
| 57 | | ANTIC_RENDERER( antic_mode_c_48 ); |
| 58 | | ANTIC_RENDERER( antic_mode_d_32 ); |
| 59 | | ANTIC_RENDERER( antic_mode_d_40 ); |
| 60 | | ANTIC_RENDERER( antic_mode_d_48 ); |
| 61 | | ANTIC_RENDERER( antic_mode_e_32 ); |
| 62 | | ANTIC_RENDERER( antic_mode_e_40 ); |
| 63 | | ANTIC_RENDERER( antic_mode_e_48 ); |
| 64 | | ANTIC_RENDERER( antic_mode_f_32 ); |
| 65 | | ANTIC_RENDERER( antic_mode_f_40 ); |
| 66 | | ANTIC_RENDERER( antic_mode_f_48 ); |
| 67 | | ANTIC_RENDERER( gtia_mode_1_32 ); |
| 68 | | ANTIC_RENDERER( gtia_mode_1_40 ); |
| 69 | | ANTIC_RENDERER( gtia_mode_1_48 ); |
| 70 | | ANTIC_RENDERER( gtia_mode_2_32 ); |
| 71 | | ANTIC_RENDERER( gtia_mode_2_40 ); |
| 72 | | ANTIC_RENDERER( gtia_mode_2_48 ); |
| 73 | | ANTIC_RENDERER( gtia_mode_3_32 ); |
| 74 | | ANTIC_RENDERER( gtia_mode_3_40 ); |
| 75 | | ANTIC_RENDERER( gtia_mode_3_48 ); |
| 25 | static ANTIC_RENDERER( antic_mode_0_xx ); |
| 26 | static ANTIC_RENDERER( antic_mode_2_32 ); |
| 27 | static ANTIC_RENDERER( antic_mode_2_40 ); |
| 28 | static ANTIC_RENDERER( antic_mode_2_48 ); |
| 29 | static ANTIC_RENDERER( antic_mode_3_32 ); |
| 30 | static ANTIC_RENDERER( antic_mode_3_40 ); |
| 31 | static ANTIC_RENDERER( antic_mode_3_48 ); |
| 32 | static ANTIC_RENDERER( antic_mode_4_32 ); |
| 33 | static ANTIC_RENDERER( antic_mode_4_40 ); |
| 34 | static ANTIC_RENDERER( antic_mode_4_48 ); |
| 35 | static ANTIC_RENDERER( antic_mode_5_32 ); |
| 36 | static ANTIC_RENDERER( antic_mode_5_40 ); |
| 37 | static ANTIC_RENDERER( antic_mode_5_48 ); |
| 38 | static ANTIC_RENDERER( antic_mode_6_32 ); |
| 39 | static ANTIC_RENDERER( antic_mode_6_40 ); |
| 40 | static ANTIC_RENDERER( antic_mode_6_48 ); |
| 41 | static ANTIC_RENDERER( antic_mode_7_32 ); |
| 42 | static ANTIC_RENDERER( antic_mode_7_40 ); |
| 43 | static ANTIC_RENDERER( antic_mode_7_48 ); |
| 44 | static ANTIC_RENDERER( antic_mode_8_32 ); |
| 45 | static ANTIC_RENDERER( antic_mode_8_40 ); |
| 46 | static ANTIC_RENDERER( antic_mode_8_48 ); |
| 47 | static ANTIC_RENDERER( antic_mode_9_32 ); |
| 48 | static ANTIC_RENDERER( antic_mode_9_40 ); |
| 49 | static ANTIC_RENDERER( antic_mode_9_48 ); |
| 50 | static ANTIC_RENDERER( antic_mode_a_32 ); |
| 51 | static ANTIC_RENDERER( antic_mode_a_40 ); |
| 52 | static ANTIC_RENDERER( antic_mode_a_48 ); |
| 53 | static ANTIC_RENDERER( antic_mode_b_32 ); |
| 54 | static ANTIC_RENDERER( antic_mode_b_40 ); |
| 55 | static ANTIC_RENDERER( antic_mode_b_48 ); |
| 56 | static ANTIC_RENDERER( antic_mode_c_32 ); |
| 57 | static ANTIC_RENDERER( antic_mode_c_40 ); |
| 58 | static ANTIC_RENDERER( antic_mode_c_48 ); |
| 59 | static ANTIC_RENDERER( antic_mode_d_32 ); |
| 60 | static ANTIC_RENDERER( antic_mode_d_40 ); |
| 61 | static ANTIC_RENDERER( antic_mode_d_48 ); |
| 62 | static ANTIC_RENDERER( antic_mode_e_32 ); |
| 63 | static ANTIC_RENDERER( antic_mode_e_40 ); |
| 64 | static ANTIC_RENDERER( antic_mode_e_48 ); |
| 65 | static ANTIC_RENDERER( antic_mode_f_32 ); |
| 66 | static ANTIC_RENDERER( antic_mode_f_40 ); |
| 67 | static ANTIC_RENDERER( antic_mode_f_48 ); |
| 68 | static ANTIC_RENDERER( gtia_mode_1_32 ); |
| 69 | static ANTIC_RENDERER( gtia_mode_1_40 ); |
| 70 | static ANTIC_RENDERER( gtia_mode_1_48 ); |
| 71 | static ANTIC_RENDERER( gtia_mode_2_32 ); |
| 72 | static ANTIC_RENDERER( gtia_mode_2_40 ); |
| 73 | static ANTIC_RENDERER( gtia_mode_2_48 ); |
| 74 | static ANTIC_RENDERER( gtia_mode_3_32 ); |
| 75 | static ANTIC_RENDERER( gtia_mode_3_40 ); |
| 76 | static ANTIC_RENDERER( gtia_mode_3_48 ); |
| 76 | 77 | |
| 77 | 78 | |
| 78 | 79 | |
| r31991 | r31992 | |
| 1088 | 1089 | /************* ANTIC mode 00: ********************************* |
| 1089 | 1090 | * generate 1-8 empty scanlines |
| 1090 | 1091 | ***************************************************************/ |
| 1091 | | ANTIC_RENDERER( antic_mode_0_xx ) |
| 1092 | static ANTIC_RENDERER( antic_mode_0_xx ) |
| 1092 | 1093 | { |
| 1093 | 1094 | PREPARE(); |
| 1094 | 1095 | memset(dst, PBK, HWIDTH*4); |
| r31991 | r31992 | |
| 1105 | 1106 | ***************************************************************/ |
| 1106 | 1107 | #define MODE2(s) COPY4(dst, antic.pf_21[video->data[s]]) |
| 1107 | 1108 | |
| 1108 | | ANTIC_RENDERER( antic_mode_2_32 ) |
| 1109 | static ANTIC_RENDERER( antic_mode_2_32 ) |
| 1109 | 1110 | { |
| 1110 | 1111 | PREPARE_TXT2(space, 32); |
| 1111 | 1112 | REP32(MODE2); |
| 1112 | 1113 | POST_TXT(32); |
| 1113 | 1114 | } |
| 1114 | | ANTIC_RENDERER( antic_mode_2_40 ) |
| 1115 | static ANTIC_RENDERER( antic_mode_2_40 ) |
| 1115 | 1116 | { |
| 1116 | 1117 | PREPARE_TXT2(space, 40); |
| 1117 | 1118 | REP40(MODE2); |
| 1118 | 1119 | POST_TXT(40); |
| 1119 | 1120 | } |
| 1120 | | ANTIC_RENDERER( antic_mode_2_48 ) |
| 1121 | static ANTIC_RENDERER( antic_mode_2_48 ) |
| 1121 | 1122 | { |
| 1122 | 1123 | PREPARE_TXT2(space, 48); |
| 1123 | 1124 | REP48(MODE2); |
| r31991 | r31992 | |
| 1129 | 1130 | ***************************************************************/ |
| 1130 | 1131 | #define MODE3(s) COPY4(dst, antic.pf_21[video->data[s]]) |
| 1131 | 1132 | |
| 1132 | | ANTIC_RENDERER( antic_mode_3_32 ) |
| 1133 | static ANTIC_RENDERER( antic_mode_3_32 ) |
| 1133 | 1134 | { |
| 1134 | 1135 | PREPARE_TXT3(space, 32); |
| 1135 | 1136 | REP32(MODE3); |
| 1136 | 1137 | POST_TXT(32); |
| 1137 | 1138 | } |
| 1138 | | ANTIC_RENDERER( antic_mode_3_40 ) |
| 1139 | static ANTIC_RENDERER( antic_mode_3_40 ) |
| 1139 | 1140 | { |
| 1140 | 1141 | PREPARE_TXT3(space, 40); |
| 1141 | 1142 | REP40(MODE3); |
| 1142 | 1143 | POST_TXT(40); |
| 1143 | 1144 | } |
| 1144 | | ANTIC_RENDERER( antic_mode_3_48 ) |
| 1145 | static ANTIC_RENDERER( antic_mode_3_48 ) |
| 1145 | 1146 | { |
| 1146 | 1147 | PREPARE_TXT3(space, 48); |
| 1147 | 1148 | REP48(MODE3); |
| r31991 | r31992 | |
| 1153 | 1154 | ***************************************************************/ |
| 1154 | 1155 | #define MODE4(s) COPY4(dst, antic.pf_x10b[video->data[s]]) |
| 1155 | 1156 | |
| 1156 | | ANTIC_RENDERER( antic_mode_4_32 ) |
| 1157 | static ANTIC_RENDERER( antic_mode_4_32 ) |
| 1157 | 1158 | { |
| 1158 | 1159 | PREPARE_TXT45(space, 32,0); |
| 1159 | 1160 | REP32(MODE4); |
| 1160 | 1161 | POST_TXT(32); |
| 1161 | 1162 | } |
| 1162 | | ANTIC_RENDERER( antic_mode_4_40 ) |
| 1163 | static ANTIC_RENDERER( antic_mode_4_40 ) |
| 1163 | 1164 | { |
| 1164 | 1165 | PREPARE_TXT45(space, 40,0); |
| 1165 | 1166 | REP40(MODE4); |
| 1166 | 1167 | POST_TXT(40); |
| 1167 | 1168 | } |
| 1168 | | ANTIC_RENDERER( antic_mode_4_48 ) |
| 1169 | static ANTIC_RENDERER( antic_mode_4_48 ) |
| 1169 | 1170 | { |
| 1170 | 1171 | PREPARE_TXT45(space, 48,0); |
| 1171 | 1172 | REP48(MODE4); |
| r31991 | r31992 | |
| 1177 | 1178 | ***************************************************************/ |
| 1178 | 1179 | #define MODE5(s) COPY4(dst, antic.pf_x10b[video->data[s]]) |
| 1179 | 1180 | |
| 1180 | | ANTIC_RENDERER( antic_mode_5_32 ) |
| 1181 | static ANTIC_RENDERER( antic_mode_5_32 ) |
| 1181 | 1182 | { |
| 1182 | 1183 | PREPARE_TXT45(space, 32,1); |
| 1183 | 1184 | REP32(MODE5); |
| 1184 | 1185 | POST_TXT(32); |
| 1185 | 1186 | } |
| 1186 | | ANTIC_RENDERER( antic_mode_5_40 ) |
| 1187 | static ANTIC_RENDERER( antic_mode_5_40 ) |
| 1187 | 1188 | { |
| 1188 | 1189 | PREPARE_TXT45(space, 40,1); |
| 1189 | 1190 | REP40(MODE5); |
| 1190 | 1191 | POST_TXT(40); |
| 1191 | 1192 | } |
| 1192 | | ANTIC_RENDERER( antic_mode_5_48 ) |
| 1193 | static ANTIC_RENDERER( antic_mode_5_48 ) |
| 1193 | 1194 | { |
| 1194 | 1195 | PREPARE_TXT45(space, 48,1); |
| 1195 | 1196 | REP48(MODE5); |
| r31991 | r31992 | |
| 1201 | 1202 | ***************************************************************/ |
| 1202 | 1203 | #define MODE6(s) COPY8(dst, antic.pf_3210b2[video->data[s]], antic.pf_3210b2[video->data[s]+1]) |
| 1203 | 1204 | |
| 1204 | | ANTIC_RENDERER( antic_mode_6_32 ) |
| 1205 | static ANTIC_RENDERER( antic_mode_6_32 ) |
| 1205 | 1206 | { |
| 1206 | 1207 | PREPARE_TXT67(space, 16,0); |
| 1207 | 1208 | REP16(MODE6); |
| 1208 | 1209 | POST_TXT(16); |
| 1209 | 1210 | } |
| 1210 | | ANTIC_RENDERER( antic_mode_6_40 ) |
| 1211 | static ANTIC_RENDERER( antic_mode_6_40 ) |
| 1211 | 1212 | { |
| 1212 | 1213 | PREPARE_TXT67(space, 20,0); |
| 1213 | 1214 | REP20(MODE6); |
| 1214 | 1215 | POST_TXT(20); |
| 1215 | 1216 | } |
| 1216 | | ANTIC_RENDERER( antic_mode_6_48 ) |
| 1217 | static ANTIC_RENDERER( antic_mode_6_48 ) |
| 1217 | 1218 | { |
| 1218 | 1219 | PREPARE_TXT67(space, 24,0); |
| 1219 | 1220 | REP24(MODE6); |
| r31991 | r31992 | |
| 1225 | 1226 | ***************************************************************/ |
| 1226 | 1227 | #define MODE7(s) COPY8(dst, antic.pf_3210b2[video->data[s]], antic.pf_3210b2[video->data[s]+1]) |
| 1227 | 1228 | |
| 1228 | | ANTIC_RENDERER( antic_mode_7_32 ) |
| 1229 | static ANTIC_RENDERER( antic_mode_7_32 ) |
| 1229 | 1230 | { |
| 1230 | 1231 | PREPARE_TXT67(space, 16,1); |
| 1231 | 1232 | REP16(MODE7); |
| 1232 | 1233 | POST_TXT(16); |
| 1233 | 1234 | } |
| 1234 | | ANTIC_RENDERER( antic_mode_7_40 ) |
| 1235 | static ANTIC_RENDERER( antic_mode_7_40 ) |
| 1235 | 1236 | { |
| 1236 | 1237 | PREPARE_TXT67(space, 20,1); |
| 1237 | 1238 | REP20(MODE7); |
| 1238 | 1239 | POST_TXT(20); |
| 1239 | 1240 | } |
| 1240 | | ANTIC_RENDERER( antic_mode_7_48 ) |
| 1241 | static ANTIC_RENDERER( antic_mode_7_48 ) |
| 1241 | 1242 | { |
| 1242 | 1243 | PREPARE_TXT67(space, 24,1); |
| 1243 | 1244 | REP24(MODE7); |
| r31991 | r31992 | |
| 1249 | 1250 | ***************************************************************/ |
| 1250 | 1251 | #define MODE8(s) COPY16(dst, antic.pf_210b4[video->data[s]],antic.pf_210b4[video->data[s]+1],antic.pf_210b4[video->data[s]+2],antic.pf_210b4[video->data[s]+3]) |
| 1251 | 1252 | |
| 1252 | | ANTIC_RENDERER( antic_mode_8_32 ) |
| 1253 | static ANTIC_RENDERER( antic_mode_8_32 ) |
| 1253 | 1254 | { |
| 1254 | 1255 | PREPARE_GFX8(space, 8); |
| 1255 | 1256 | REP08(MODE8); |
| 1256 | 1257 | POST_GFX(8); |
| 1257 | 1258 | } |
| 1258 | | ANTIC_RENDERER( antic_mode_8_40 ) |
| 1259 | static ANTIC_RENDERER( antic_mode_8_40 ) |
| 1259 | 1260 | { |
| 1260 | 1261 | PREPARE_GFX8(space, 10); |
| 1261 | 1262 | REP10(MODE8); |
| 1262 | 1263 | POST_GFX(10); |
| 1263 | 1264 | } |
| 1264 | | ANTIC_RENDERER( antic_mode_8_48 ) |
| 1265 | static ANTIC_RENDERER( antic_mode_8_48 ) |
| 1265 | 1266 | { |
| 1266 | 1267 | PREPARE_GFX8(space, 12); |
| 1267 | 1268 | REP12(MODE8); |
| r31991 | r31992 | |
| 1273 | 1274 | ***************************************************************/ |
| 1274 | 1275 | #define MODE9(s) COPY8(dst, antic.pf_3210b2[video->data[s]], antic.pf_3210b2[video->data[s]+1]) |
| 1275 | 1276 | |
| 1276 | | ANTIC_RENDERER( antic_mode_9_32 ) |
| 1277 | static ANTIC_RENDERER( antic_mode_9_32 ) |
| 1277 | 1278 | { |
| 1278 | 1279 | PREPARE_GFX9BC(space, 16); |
| 1279 | 1280 | REP16(MODE9); |
| 1280 | 1281 | POST_GFX(16); |
| 1281 | 1282 | } |
| 1282 | | ANTIC_RENDERER( antic_mode_9_40 ) |
| 1283 | static ANTIC_RENDERER( antic_mode_9_40 ) |
| 1283 | 1284 | { |
| 1284 | 1285 | PREPARE_GFX9BC(space, 20); |
| 1285 | 1286 | REP20(MODE9); |
| 1286 | 1287 | POST_GFX(20); |
| 1287 | 1288 | } |
| 1288 | | ANTIC_RENDERER( antic_mode_9_48 ) |
| 1289 | static ANTIC_RENDERER( antic_mode_9_48 ) |
| 1289 | 1290 | { |
| 1290 | 1291 | PREPARE_GFX9BC(space, 24); |
| 1291 | 1292 | REP24(MODE9); |
| r31991 | r31992 | |
| 1297 | 1298 | ***************************************************************/ |
| 1298 | 1299 | #define MODEA(s) COPY8(dst, antic.pf_210b2[video->data[s]], antic.pf_210b2[video->data[s]+1]) |
| 1299 | 1300 | |
| 1300 | | ANTIC_RENDERER( antic_mode_a_32 ) |
| 1301 | static ANTIC_RENDERER( antic_mode_a_32 ) |
| 1301 | 1302 | { |
| 1302 | 1303 | PREPARE_GFXA(space, 16); |
| 1303 | 1304 | REP16(MODEA); |
| 1304 | 1305 | POST_GFX(16); |
| 1305 | 1306 | } |
| 1306 | | ANTIC_RENDERER( antic_mode_a_40 ) |
| 1307 | static ANTIC_RENDERER( antic_mode_a_40 ) |
| 1307 | 1308 | { |
| 1308 | 1309 | PREPARE_GFXA(space, 20); |
| 1309 | 1310 | REP20(MODEA); |
| 1310 | 1311 | POST_GFX(20); |
| 1311 | 1312 | } |
| 1312 | | ANTIC_RENDERER( antic_mode_a_48 ) |
| 1313 | static ANTIC_RENDERER( antic_mode_a_48 ) |
| 1313 | 1314 | { |
| 1314 | 1315 | PREPARE_GFXA(space, 24); |
| 1315 | 1316 | REP24(MODEA); |
| r31991 | r31992 | |
| 1321 | 1322 | ***************************************************************/ |
| 1322 | 1323 | #define MODEB(s) COPY8(dst, antic.pf_3210b2[video->data[s]], antic.pf_3210b2[video->data[s]+1]) |
| 1323 | 1324 | |
| 1324 | | ANTIC_RENDERER( antic_mode_b_32 ) |
| 1325 | static ANTIC_RENDERER( antic_mode_b_32 ) |
| 1325 | 1326 | { |
| 1326 | 1327 | PREPARE_GFX9BC(space, 16); |
| 1327 | 1328 | REP16(MODEB); |
| 1328 | 1329 | POST_GFX(16); |
| 1329 | 1330 | } |
| 1330 | | ANTIC_RENDERER( antic_mode_b_40 ) |
| 1331 | static ANTIC_RENDERER( antic_mode_b_40 ) |
| 1331 | 1332 | { |
| 1332 | 1333 | PREPARE_GFX9BC(space, 20); |
| 1333 | 1334 | REP20(MODEB); |
| 1334 | 1335 | POST_GFX(20); |
| 1335 | 1336 | } |
| 1336 | | ANTIC_RENDERER( antic_mode_b_48 ) |
| 1337 | static ANTIC_RENDERER( antic_mode_b_48 ) |
| 1337 | 1338 | { |
| 1338 | 1339 | PREPARE_GFX9BC(space, 24); |
| 1339 | 1340 | REP24(MODEB); |
| r31991 | r31992 | |
| 1345 | 1346 | ***************************************************************/ |
| 1346 | 1347 | #define MODEC(s) COPY8(dst, antic.pf_3210b2[video->data[s]], antic.pf_3210b2[video->data[s]+1]) |
| 1347 | 1348 | |
| 1348 | | ANTIC_RENDERER( antic_mode_c_32 ) |
| 1349 | static ANTIC_RENDERER( antic_mode_c_32 ) |
| 1349 | 1350 | { |
| 1350 | 1351 | PREPARE_GFX9BC(space, 16); |
| 1351 | 1352 | REP16(MODEC); |
| 1352 | 1353 | POST_GFX(16); |
| 1353 | 1354 | } |
| 1354 | | ANTIC_RENDERER( antic_mode_c_40 ) |
| 1355 | static ANTIC_RENDERER( antic_mode_c_40 ) |
| 1355 | 1356 | { |
| 1356 | 1357 | PREPARE_GFX9BC(space, 20); |
| 1357 | 1358 | REP20(MODEC); |
| 1358 | 1359 | POST_GFX(20); |
| 1359 | 1360 | } |
| 1360 | | ANTIC_RENDERER( antic_mode_c_48 ) |
| 1361 | static ANTIC_RENDERER( antic_mode_c_48 ) |
| 1361 | 1362 | { |
| 1362 | 1363 | PREPARE_GFX9BC(space, 24); |
| 1363 | 1364 | REP24(MODEC); |
| r31991 | r31992 | |
| 1369 | 1370 | ***************************************************************/ |
| 1370 | 1371 | #define MODED(s) COPY4(dst, antic.pf_x10b[video->data[s]]) |
| 1371 | 1372 | |
| 1372 | | ANTIC_RENDERER( antic_mode_d_32 ) |
| 1373 | static ANTIC_RENDERER( antic_mode_d_32 ) |
| 1373 | 1374 | { |
| 1374 | 1375 | PREPARE_GFXDE(space, 32); |
| 1375 | 1376 | REP32(MODED); |
| 1376 | 1377 | POST_GFX(32); |
| 1377 | 1378 | } |
| 1378 | | ANTIC_RENDERER( antic_mode_d_40 ) |
| 1379 | static ANTIC_RENDERER( antic_mode_d_40 ) |
| 1379 | 1380 | { |
| 1380 | 1381 | PREPARE_GFXDE(space, 40); |
| 1381 | 1382 | REP40(MODED); |
| 1382 | 1383 | POST_GFX(40); |
| 1383 | 1384 | } |
| 1384 | | ANTIC_RENDERER( antic_mode_d_48 ) |
| 1385 | static ANTIC_RENDERER( antic_mode_d_48 ) |
| 1385 | 1386 | { |
| 1386 | 1387 | PREPARE_GFXDE(space, 48); |
| 1387 | 1388 | REP48(MODED); |
| r31991 | r31992 | |
| 1393 | 1394 | ***************************************************************/ |
| 1394 | 1395 | #define MODEE(s) COPY4(dst, antic.pf_x10b[video->data[s]]) |
| 1395 | 1396 | |
| 1396 | | ANTIC_RENDERER( antic_mode_e_32 ) |
| 1397 | static ANTIC_RENDERER( antic_mode_e_32 ) |
| 1397 | 1398 | { |
| 1398 | 1399 | PREPARE_GFXDE(space, 32); |
| 1399 | 1400 | REP32(MODEE); |
| 1400 | 1401 | POST_GFX(32); |
| 1401 | 1402 | } |
| 1402 | | ANTIC_RENDERER( antic_mode_e_40 ) |
| 1403 | static ANTIC_RENDERER( antic_mode_e_40 ) |
| 1403 | 1404 | { |
| 1404 | 1405 | PREPARE_GFXDE(space, 40); |
| 1405 | 1406 | REP40(MODEE); |
| 1406 | 1407 | POST_GFX(40); |
| 1407 | 1408 | } |
| 1408 | | ANTIC_RENDERER( antic_mode_e_48 ) |
| 1409 | static ANTIC_RENDERER( antic_mode_e_48 ) |
| 1409 | 1410 | { |
| 1410 | 1411 | PREPARE_GFXDE(space, 48); |
| 1411 | 1412 | REP48(MODEE); |
| r31991 | r31992 | |
| 1417 | 1418 | ***************************************************************/ |
| 1418 | 1419 | #define MODEF(s) COPY4(dst, antic.pf_1b[video->data[s]]) |
| 1419 | 1420 | |
| 1420 | | ANTIC_RENDERER( antic_mode_f_32 ) |
| 1421 | static ANTIC_RENDERER( antic_mode_f_32 ) |
| 1421 | 1422 | { |
| 1422 | 1423 | PREPARE_GFXF(space, 32); |
| 1423 | 1424 | REP32(MODEF); |
| 1424 | 1425 | POST_GFX(32); |
| 1425 | 1426 | } |
| 1426 | | ANTIC_RENDERER( antic_mode_f_40 ) |
| 1427 | static ANTIC_RENDERER( antic_mode_f_40 ) |
| 1427 | 1428 | { |
| 1428 | 1429 | PREPARE_GFXF(space, 40); |
| 1429 | 1430 | REP40(MODEF); |
| 1430 | 1431 | POST_GFX(40); |
| 1431 | 1432 | } |
| 1432 | | ANTIC_RENDERER( antic_mode_f_48 ) |
| 1433 | static ANTIC_RENDERER( antic_mode_f_48 ) |
| 1433 | 1434 | { |
| 1434 | 1435 | PREPARE_GFXF(space, 48); |
| 1435 | 1436 | REP48(MODEF); |
| r31991 | r31992 | |
| 1441 | 1442 | ***************************************************************/ |
| 1442 | 1443 | #define GTIA1(s) COPY4(dst, antic.pf_gtia1[video->data[s]]) |
| 1443 | 1444 | |
| 1444 | | ANTIC_RENDERER( gtia_mode_1_32 ) |
| 1445 | static ANTIC_RENDERER( gtia_mode_1_32 ) |
| 1445 | 1446 | { |
| 1446 | 1447 | PREPARE_GFXG1(space, 32); |
| 1447 | 1448 | REP32(GTIA1); |
| 1448 | 1449 | POST_GFX(32); |
| 1449 | 1450 | } |
| 1450 | | ANTIC_RENDERER( gtia_mode_1_40 ) |
| 1451 | static ANTIC_RENDERER( gtia_mode_1_40 ) |
| 1451 | 1452 | { |
| 1452 | 1453 | PREPARE_GFXG1(space, 40); |
| 1453 | 1454 | REP40(GTIA1); |
| 1454 | 1455 | POST_GFX(40); |
| 1455 | 1456 | } |
| 1456 | | ANTIC_RENDERER( gtia_mode_1_48 ) |
| 1457 | static ANTIC_RENDERER( gtia_mode_1_48 ) |
| 1457 | 1458 | { |
| 1458 | 1459 | PREPARE_GFXG1(space, 48); |
| 1459 | 1460 | REP48(GTIA1); |
| r31991 | r31992 | |
| 1465 | 1466 | ***************************************************************/ |
| 1466 | 1467 | #define GTIA2(s) COPY4(dst, antic.pf_gtia2[video->data[s]]) |
| 1467 | 1468 | |
| 1468 | | ANTIC_RENDERER( gtia_mode_2_32 ) |
| 1469 | static ANTIC_RENDERER( gtia_mode_2_32 ) |
| 1469 | 1470 | { |
| 1470 | 1471 | PREPARE_GFXG2(space, 32); |
| 1471 | 1472 | REP32(GTIA2); |
| 1472 | 1473 | POST_GFX(32); |
| 1473 | 1474 | } |
| 1474 | | ANTIC_RENDERER( gtia_mode_2_40 ) |
| 1475 | static ANTIC_RENDERER( gtia_mode_2_40 ) |
| 1475 | 1476 | { |
| 1476 | 1477 | PREPARE_GFXG2(space, 40); |
| 1477 | 1478 | REP40(GTIA2); |
| 1478 | 1479 | POST_GFX(40); |
| 1479 | 1480 | } |
| 1480 | | ANTIC_RENDERER( gtia_mode_2_48 ) |
| 1481 | static ANTIC_RENDERER( gtia_mode_2_48 ) |
| 1481 | 1482 | { |
| 1482 | 1483 | PREPARE_GFXG2(space, 48); |
| 1483 | 1484 | REP48(GTIA2); |
| r31991 | r31992 | |
| 1489 | 1490 | ***************************************************************/ |
| 1490 | 1491 | #define GTIA3(s) COPY4(dst, antic.pf_gtia3[video->data[s]]) |
| 1491 | 1492 | |
| 1492 | | ANTIC_RENDERER( gtia_mode_3_32 ) |
| 1493 | static ANTIC_RENDERER( gtia_mode_3_32 ) |
| 1493 | 1494 | { |
| 1494 | 1495 | PREPARE_GFXG3(space, 32); |
| 1495 | 1496 | REP32(GTIA3); |
| 1496 | 1497 | POST_GFX(32); |
| 1497 | 1498 | } |
| 1498 | | ANTIC_RENDERER( gtia_mode_3_40 ) |
| 1499 | static ANTIC_RENDERER( gtia_mode_3_40 ) |
| 1499 | 1500 | { |
| 1500 | 1501 | PREPARE_GFXG3(space, 40); |
| 1501 | 1502 | REP40(GTIA3); |
| 1502 | 1503 | POST_GFX(40); |
| 1503 | 1504 | } |
| 1504 | | ANTIC_RENDERER( gtia_mode_3_48 ) |
| 1505 | static ANTIC_RENDERER( gtia_mode_3_48 ) |
| 1505 | 1506 | { |
| 1506 | 1507 | PREPARE_GFXG3(space, 48); |
| 1507 | 1508 | REP48(GTIA3); |
trunk/src/mame/video/antic.h
| r0 | r31992 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Atari 400/800 |
| 4 | |
| 5 | ANTIC video controller |
| 6 | |
| 7 | Juergen Buchmueller, June 1998 |
| 8 | |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | #ifndef __ANTIC_H__ |
| 12 | #define __ANTIC_H__ |
| 13 | |
| 14 | #include "emu.h" |
| 15 | |
| 16 | #define HWIDTH 48 /* total characters per line */ |
| 17 | #define HCHARS 44 /* visible characters per line */ |
| 18 | #define VHEIGHT 32 |
| 19 | #define VCHARS (VDATA_END-VDATA_START+7)/8 |
| 20 | #define BUF_OFFS0 (HWIDTH-HCHARS)/2 |
| 21 | #define MIN_X ((HWIDTH-42)/2)*8 |
| 22 | #define MAX_X MIN_X+42*8-1 |
| 23 | #define MIN_Y VDATA_START |
| 24 | #define MAX_Y VDATA_END-8-1 |
| 25 | |
| 26 | #define PMOFFSET 32 /* # of pixels to adjust p/m hpos */ |
| 27 | |
| 28 | #define VPAGE 0xf000 /* 4K page mask for video data src */ |
| 29 | #define VOFFS 0x0fff /* 4K offset mask for video data src */ |
| 30 | #define DPAGE 0xfc00 /* 1K page mask for display list */ |
| 31 | #define DOFFS 0x03ff /* 1K offset mask for display list */ |
| 32 | |
| 33 | #define DLI_NMI 0x80 /* 10000000b bit mask for display list interrupt */ |
| 34 | #define VBL_NMI 0x40 /* 01000000b bit mask for vertical blank interrupt */ |
| 35 | |
| 36 | #define ANTIC_DLI 0x80 /* 10000000b cmds with display list intr */ |
| 37 | #define ANTIC_LMS 0x40 /* 01000000b cmds with load memory scan */ |
| 38 | #define ANTIC_VSCR 0x20 /* 00100000b cmds with vertical scroll */ |
| 39 | #define ANTIC_HSCR 0x10 /* 00010000b cmds with horizontal scroll */ |
| 40 | #define ANTIC_MODE 0x0f /* 00001111b cmd mode mask */ |
| 41 | |
| 42 | #define DMA_ANTIC 0x20 /* 00100000b ANTIC DMA enable */ |
| 43 | #define DMA_PM_DBLLINE 0x10 /* 00010000b double line player/missile */ |
| 44 | #define DMA_PLAYER 0x08 /* 00001000b player DMA enable */ |
| 45 | #define DMA_MISSILE 0x04 /* 00000100b missile DMA enable */ |
| 46 | |
| 47 | #define OFS_MIS_SINGLE 3*256 /* offset missiles single line DMA */ |
| 48 | #define OFS_PL0_SINGLE 4*256 /* offset player 0 single line DMA */ |
| 49 | #define OFS_PL1_SINGLE 5*256 /* offset player 1 single line DMA */ |
| 50 | #define OFS_PL2_SINGLE 6*256 /* offset player 2 single line DMA */ |
| 51 | #define OFS_PL3_SINGLE 7*256 /* offset player 3 single line DMA */ |
| 52 | |
| 53 | #define OFS_MIS_DOUBLE 3*128 /* offset missiles double line DMA */ |
| 54 | #define OFS_PL0_DOUBLE 4*128 /* offset player 0 double line DMA */ |
| 55 | #define OFS_PL1_DOUBLE 5*128 /* offset player 1 double line DMA */ |
| 56 | #define OFS_PL2_DOUBLE 6*128 /* offset player 2 double line DMA */ |
| 57 | #define OFS_PL3_DOUBLE 7*128 /* offset player 3 double line DMA */ |
| 58 | |
| 59 | #define PFD 0x00 /* 00000000b playfield default color */ |
| 60 | |
| 61 | #define PBK 0x00 /* 00000000b playfield background */ |
| 62 | #define PF0 0x01 /* 00000001b playfield color #0 */ |
| 63 | #define PF1 0x02 /* 00000010b playfield color #1 */ |
| 64 | #define PF2 0x04 /* 00000100b playfield color #2 */ |
| 65 | #define PF3 0x08 /* 00001000b playfield color #3 */ |
| 66 | #define PL0 0x11 /* 00010001b player #0 */ |
| 67 | #define PL1 0x12 /* 00010010b player #1 */ |
| 68 | #define PL2 0x14 /* 00010100b player #2 */ |
| 69 | #define PL3 0x18 /* 00011000b player #3 */ |
| 70 | #define MI0 0x21 /* 00100001b missile #0 */ |
| 71 | #define MI1 0x22 /* 00100010b missile #1 */ |
| 72 | #define MI2 0x24 /* 00100100b missile #2 */ |
| 73 | #define MI3 0x28 /* 00101000b missile #3 */ |
| 74 | #define T00 0x40 /* 01000000b text mode pixels 00 */ |
| 75 | #define P000 0x48 /* 01001000b player #0 pixels 00 */ |
| 76 | #define P100 0x4a /* 01001010b player #1 pixels 00 */ |
| 77 | #define P200 0x4c /* 01001100b player #2 pixels 00 */ |
| 78 | #define P300 0x4e /* 01001110b player #3 pixels 00 */ |
| 79 | #define P400 0x4f /* 01001111b missiles pixels 00 */ |
| 80 | #define T01 0x50 /* 01010000b text mode pixels 01 */ |
| 81 | #define P001 0x58 /* 01011000b player #0 pixels 01 */ |
| 82 | #define P101 0x5a /* 01011010b player #1 pixels 01 */ |
| 83 | #define P201 0x5c /* 01011100b player #2 pixels 01 */ |
| 84 | #define P301 0x5e /* 01011110b player #3 pixels 01 */ |
| 85 | #define P401 0x5f /* 01011111b missiles pixels 01 */ |
| 86 | #define T10 0x60 /* 01100000b text mode pixels 10 */ |
| 87 | #define P010 0x68 /* 01101000b player #0 pixels 10 */ |
| 88 | #define P110 0x6a /* 01101010b player #1 pixels 10 */ |
| 89 | #define P210 0x6c /* 01101100b player #2 pixels 10 */ |
| 90 | #define P310 0x6e /* 01101110b player #3 pixels 10 */ |
| 91 | #define P410 0x6f /* 01101111b missiles pixels 10 */ |
| 92 | #define T11 0x70 /* 01110000b text mode pixels 11 */ |
| 93 | #define P011 0x78 /* 01111000b player #0 pixels 11 */ |
| 94 | #define P111 0x7a /* 01111010b player #1 pixels 11 */ |
| 95 | #define P211 0x7c /* 01111100b player #2 pixels 11 */ |
| 96 | #define P311 0x7e /* 01111110b player #3 pixels 11 */ |
| 97 | #define P411 0x7f /* 01111111b missiles pixels 11 */ |
| 98 | #define G00 0x80 /* 10000000b hires gfx pixels 00 */ |
| 99 | #define G01 0x90 /* 10010000b hires gfx pixels 01 */ |
| 100 | #define G10 0xa0 /* 10100000b hires gfx pixels 10 */ |
| 101 | #define G11 0xb0 /* 10110000b hires gfx pixels 11 */ |
| 102 | #define GT1 0xc0 /* 11000000b gtia mode 1 */ |
| 103 | #define GT2 0xd0 /* 11010000b gtia mode 2 */ |
| 104 | #define GT3 0xe0 /* 11100000b gtia mode 3 */ |
| 105 | #define ILL 0xfe /* 11111110b illegal priority */ |
| 106 | #define EOR 0xff /* 11111111b EOR mode color */ |
| 107 | |
| 108 | #define LUM 0x0f /* 00001111b luminance bits */ |
| 109 | #define HUE 0xf0 /* 11110000b hue bits */ |
| 110 | |
| 111 | #define TRIGGER_VBLANK 64715 |
| 112 | #define TRIGGER_STEAL 64716 |
| 113 | #define TRIGGER_HSYNC 64717 |
| 114 | |
| 115 | |
| 116 | /***************************************************************************** |
| 117 | * If your memcpy does not expand too well if you use it with constant |
| 118 | * size_t field, you might want to define these macros somehow different. |
| 119 | * NOTE: dst is not necessarily UINT32 aligned (because of horz scrolling)! |
| 120 | *****************************************************************************/ |
| 121 | #define COPY4(dst,s1) *dst++ = s1 |
| 122 | #define COPY8(dst,s1,s2) *dst++ = s1; *dst++ = s2 |
| 123 | #define COPY16(dst,s1,s2,s3,s4) *dst++ = s1; *dst++ = s2; *dst++ = s3; *dst++ = s4 |
| 124 | |
| 125 | struct ANTIC_R { |
| 126 | UINT8 antic00; /* 00 nothing */ |
| 127 | UINT8 antic01; /* 01 nothing */ |
| 128 | UINT8 antic02; /* 02 nothing */ |
| 129 | UINT8 antic03; /* 03 nothing */ |
| 130 | UINT8 antic04; /* 04 nothing */ |
| 131 | UINT8 antic05; /* 05 nothing */ |
| 132 | UINT8 antic06; /* 06 nothing */ |
| 133 | UINT8 antic07; /* 07 nothing */ |
| 134 | UINT8 antic08; /* 08 nothing */ |
| 135 | UINT8 antic09; /* 09 nothing */ |
| 136 | UINT8 antic0a; /* 0a nothing */ |
| 137 | UINT8 vcount; /* 0b vertical (scanline) counter */ |
| 138 | UINT8 penh; /* 0c light pen horizontal pos */ |
| 139 | UINT8 penv; /* 0d light pen vertical pos */ |
| 140 | UINT8 antic0e; /* 0e nothing */ |
| 141 | UINT8 nmist; /* 0f NMI status */ |
| 142 | }; /* read registers */ |
| 143 | |
| 144 | struct ANTIC_W { |
| 145 | UINT8 dmactl; /* 00 write DMA control */ |
| 146 | UINT8 chactl; /* 01 write character control */ |
| 147 | UINT8 dlistl; /* 02 display list low */ |
| 148 | UINT8 dlisth; /* 03 display list high */ |
| 149 | UINT8 hscrol; /* 04 horz scroll */ |
| 150 | UINT8 vscrol; /* 05 vert scroll */ |
| 151 | UINT8 pmbasl; /* 06 player/missile base addr low */ |
| 152 | UINT8 pmbash; /* 07 player/missile base addr high */ |
| 153 | UINT8 chbasl; /* 08 character generator base addr low */ |
| 154 | UINT8 chbash; /* 09 character generator base addr high */ |
| 155 | UINT8 wsync; /* 0a wait for hsync */ |
| 156 | UINT8 antic0b; /* 0b nothing */ |
| 157 | UINT8 antic0c; /* 0c nothing */ |
| 158 | UINT8 antic0d; /* 0d nothing */ |
| 159 | UINT8 nmien; /* 0e NMI enable */ |
| 160 | UINT8 nmires; /* 0f NMI reset */ |
| 161 | }; /* write registers */ |
| 162 | |
| 163 | /* per scanline buffer for video data (and optimization variables) */ |
| 164 | struct VIDEO { |
| 165 | UINT32 cmd; /* antic command for this scanline */ |
| 166 | UINT16 data[HWIDTH]; /* graphics data buffer (text through chargen) */ |
| 167 | }; |
| 168 | |
| 169 | typedef void (*atari_renderer_func)(address_space &space, VIDEO *video); |
| 170 | |
| 171 | struct ANTIC { |
| 172 | atari_renderer_func renderer; /* current renderer */ |
| 173 | UINT32 cmd; /* currently executed display list command */ |
| 174 | UINT32 steal_cycles; /* steal how many cpu cycles for this line ? */ |
| 175 | UINT32 vscrol_old; /* old vscrol value */ |
| 176 | UINT32 hscrol_old; /* old hscrol value */ |
| 177 | INT32 modelines; /* number of lines for current ANTIC mode */ |
| 178 | UINT32 chbase; /* character mode source base */ |
| 179 | UINT32 chand; /* character and mask (chactl) */ |
| 180 | UINT32 chxor; /* character xor mask (chactl) */ |
| 181 | UINT32 scanline; /* current scan line */ |
| 182 | UINT32 pfwidth; /* playfield width */ |
| 183 | UINT32 dpage; /* display list address page */ |
| 184 | UINT32 doffs; /* display list offset into page */ |
| 185 | UINT32 vpage; /* video data source page */ |
| 186 | UINT32 voffs; /* video data offset into page */ |
| 187 | UINT32 pmbase_s; /* p/m graphics single line source base */ |
| 188 | UINT32 pmbase_d; /* p/m graphics double line source base */ |
| 189 | ANTIC_R r; /* ANTIC read registers */ |
| 190 | ANTIC_W w; /* ANTIC write registers */ |
| 191 | UINT8 cclock[256+32]; /* color clock buffer filled by ANTIC */ |
| 192 | UINT8 pmbits[256+32]; /* player missile buffer filled by GTIA */ |
| 193 | UINT8 *prio_table[64]; /* player/missile priority tables */ |
| 194 | VIDEO *video[312]; /* video buffer */ |
| 195 | UINT32 *cclk_expand; /* shared buffer for the following: */ |
| 196 | UINT32 *pf_21; /* 1cclk 2 color txt 2,3 */ |
| 197 | UINT32 *pf_x10b; /* 1cclk 4 color txt 4,5, gfx D,E */ |
| 198 | UINT32 *pf_3210b2; /* 1cclk 5 color txt 6,7, gfx 9,B,C */ |
| 199 | UINT32 *pf_210b4; /* 4cclk 4 color gfx 8 */ |
| 200 | UINT32 *pf_210b2; /* 2cclk 4 color gfx A */ |
| 201 | UINT32 *pf_1b; /* 1cclk hires gfx F */ |
| 202 | UINT32 *pf_gtia1; /* 1cclk gtia mode 1 */ |
| 203 | UINT32 *pf_gtia2; /* 1cclk gtia mode 2 */ |
| 204 | UINT32 *pf_gtia3; /* 1cclk gtia mode 3 */ |
| 205 | UINT8 *used_colors; /* shared buffer for the following: */ |
| 206 | UINT8 *uc_21; /* used colors for txt (2,3) */ |
| 207 | UINT8 *uc_x10b; /* used colors for txt 4,5, gfx D,E */ |
| 208 | UINT8 *uc_3210b2; /* used colors for txt 6,7, gfx 9,B,C */ |
| 209 | UINT8 *uc_210b4; /* used colors for gfx 8 */ |
| 210 | UINT8 *uc_210b2; /* used colors for gfx A */ |
| 211 | UINT8 *uc_1b; /* used colors for gfx F */ |
| 212 | UINT8 *uc_g1; /* used colors for gfx GTIA 1 */ |
| 213 | UINT8 *uc_g2; /* used colors for gfx GTIA 2 */ |
| 214 | UINT8 *uc_g3; /* used colors for gfx GTIA 3 */ |
| 215 | bitmap_ind16 *bitmap; |
| 216 | }; |
| 217 | |
| 218 | #define RDANTIC(space) space.read_byte(antic.dpage+antic.doffs) |
| 219 | #define RDVIDEO(space,o) space.read_byte(antic.vpage+((antic.voffs+(o))&VOFFS)) |
| 220 | #define RDCHGEN(space,o) space.read_byte(antic.chbase+(o)) |
| 221 | #define RDPMGFXS(space,o) space.read_byte(antic.pmbase_s+(o)+(antic.scanline>>1)) |
| 222 | #define RDPMGFXD(space,o) space.read_byte(antic.pmbase_d+(o)+antic.scanline) |
| 223 | |
| 224 | #define PREPARE() \ |
| 225 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET] |
| 226 | |
| 227 | #define PREPARE_TXT2(space,width) \ |
| 228 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 229 | for (int i = 0; i < width; i++) \ |
| 230 | { \ |
| 231 | UINT16 ch = RDVIDEO(space,i) << 3; \ |
| 232 | if (ch & 0x400) \ |
| 233 | { \ |
| 234 | ch = RDCHGEN(space,(ch & 0x3f8) + antic.w.chbasl); \ |
| 235 | ch = (ch ^ antic.chxor) & antic.chand; \ |
| 236 | } \ |
| 237 | else \ |
| 238 | { \ |
| 239 | ch = RDCHGEN(space,ch + antic.w.chbasl); \ |
| 240 | } \ |
| 241 | video->data[i] = ch; \ |
| 242 | } |
| 243 | |
| 244 | #define PREPARE_TXT3(space,width) \ |
| 245 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 246 | for (int i = 0; i < width; i++) \ |
| 247 | { \ |
| 248 | UINT16 ch = RDVIDEO(space,i) << 3; \ |
| 249 | if (ch & 0x400) \ |
| 250 | { \ |
| 251 | ch &= 0x3f8; \ |
| 252 | if ((ch & 0x300) == 0x300) \ |
| 253 | { \ |
| 254 | if (antic.w.chbasl < 2) /* first two lines empty */ \ |
| 255 | ch = 0x00; \ |
| 256 | else /* lines 2..7 are standard, 8&9 are 0&1 */ \ |
| 257 | ch = RDCHGEN(space,ch + (antic.w.chbasl & 7));\ |
| 258 | } \ |
| 259 | else \ |
| 260 | { \ |
| 261 | if (antic.w.chbasl > 7) /* last two lines empty */ \ |
| 262 | ch = 0x00; \ |
| 263 | else /* lines 0..7 are standard */ \ |
| 264 | ch = RDCHGEN(space,ch + antic.w.chbasl); \ |
| 265 | } \ |
| 266 | ch = (ch ^ antic.chxor) & antic.chand; \ |
| 267 | } \ |
| 268 | else \ |
| 269 | { \ |
| 270 | if ((ch & 0x300) == 0x300) \ |
| 271 | { \ |
| 272 | if (antic.w.chbasl < 2) /* first two lines empty */ \ |
| 273 | ch = 0x00; \ |
| 274 | else /* lines 2..7 are standard, 8&9 are 0&1 */ \ |
| 275 | ch = RDCHGEN(space,ch + (antic.w.chbasl & 7));\ |
| 276 | } \ |
| 277 | else \ |
| 278 | { \ |
| 279 | if (antic.w.chbasl > 7) /* last two lines empty */ \ |
| 280 | ch = 0x00; \ |
| 281 | else /* lines 0..7 are standard */ \ |
| 282 | ch = RDCHGEN(space,ch + antic.w.chbasl); \ |
| 283 | } \ |
| 284 | } \ |
| 285 | video->data[i] = ch; \ |
| 286 | } |
| 287 | |
| 288 | #define PREPARE_TXT45(space,width,shift) \ |
| 289 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 290 | for (int i = 0; i < width; i++) \ |
| 291 | { \ |
| 292 | UINT16 ch = RDVIDEO(space,i) << 3; \ |
| 293 | ch = ((ch>>2)&0x100)|RDCHGEN(space,(ch&0x3f8)+(antic.w.chbasl>>shift)); \ |
| 294 | video->data[i] = ch; \ |
| 295 | } |
| 296 | |
| 297 | |
| 298 | #define PREPARE_TXT67(space,width,shift) \ |
| 299 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 300 | for (int i = 0; i < width; i++) \ |
| 301 | { \ |
| 302 | UINT16 ch = RDVIDEO(space,i) << 3; \ |
| 303 | ch = (ch&0x600)|(RDCHGEN(space,(ch&0x1f8)+(antic.w.chbasl>>shift))<<1); \ |
| 304 | video->data[i] = ch; \ |
| 305 | } |
| 306 | |
| 307 | #define PREPARE_GFX8(space,width) \ |
| 308 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 309 | for (int i = 0; i < width; i++) \ |
| 310 | video->data[i] = RDVIDEO(space,i) << 2 |
| 311 | |
| 312 | #define PREPARE_GFX9BC(space,width) \ |
| 313 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 314 | for (int i = 0; i < width; i++) \ |
| 315 | video->data[i] = RDVIDEO(space,i) << 1 |
| 316 | |
| 317 | #define PREPARE_GFXA(space,width) \ |
| 318 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 319 | for (int i = 0; i < width; i++) \ |
| 320 | video->data[i] = RDVIDEO(space,i) << 1 |
| 321 | |
| 322 | #define PREPARE_GFXDE(space,width) \ |
| 323 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 324 | for (int i = 0; i < width; i++) \ |
| 325 | video->data[i] = RDVIDEO(space,i) |
| 326 | |
| 327 | #define PREPARE_GFXF(space,width) \ |
| 328 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 329 | for (int i = 0; i < width; i++) \ |
| 330 | video->data[i] = RDVIDEO(space,i) |
| 331 | |
| 332 | #define PREPARE_GFXG1(space,width) \ |
| 333 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 334 | for (int i = 0; i < width; i++) \ |
| 335 | video->data[i] = RDVIDEO(space,i) |
| 336 | |
| 337 | #define PREPARE_GFXG2(space,width) \ |
| 338 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 339 | for (int i = 0; i < width; i++) \ |
| 340 | video->data[i] = RDVIDEO(space,i) |
| 341 | |
| 342 | #define PREPARE_GFXG3(space,width) \ |
| 343 | UINT32 *dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 344 | for (int i = 0; i < width; i++) \ |
| 345 | video->data[i] = RDVIDEO(space,i) |
| 346 | |
| 347 | /****************************************************************** |
| 348 | * common end of a single antic/gtia mode emulation function |
| 349 | ******************************************************************/ |
| 350 | #define POST() \ |
| 351 | --antic.modelines |
| 352 | |
| 353 | #define POST_GFX(width) \ |
| 354 | antic.steal_cycles += width; \ |
| 355 | if (--antic.modelines == 0) \ |
| 356 | antic.voffs = (antic.voffs + width) & VOFFS |
| 357 | |
| 358 | #define POST_TXT(width) \ |
| 359 | antic.steal_cycles += width; \ |
| 360 | if (--antic.modelines == 0) \ |
| 361 | antic.voffs = (antic.voffs + width) & VOFFS; \ |
| 362 | else if (antic.w.chactl & 4) \ |
| 363 | antic.w.chbasl--; \ |
| 364 | else \ |
| 365 | antic.w.chbasl++ |
| 366 | |
| 367 | /* erase a number of color clocks to background color PBK */ |
| 368 | #define ERASE4 { \ |
| 369 | *dst++ = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 370 | *dst++ = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 371 | *dst++ = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 372 | *dst++ = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 373 | } |
| 374 | |
| 375 | #define ZAP48() \ |
| 376 | dst = (UINT32 *)&antic.cclock[PMOFFSET]; \ |
| 377 | dst[ 0] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 378 | dst[ 1] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 379 | dst[ 2] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 380 | dst[45] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 381 | dst[46] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK; \ |
| 382 | dst[47] = (PBK << 24) | (PBK << 16) | (PBK << 8) | PBK |
| 383 | |
| 384 | #define ERASE8 \ |
| 385 | ERASE4; \ |
| 386 | ERASE4 |
| 387 | |
| 388 | #define REP08(FUNC) \ |
| 389 | ERASE8; \ |
| 390 | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 391 | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 392 | ERASE8 |
| 393 | |
| 394 | #define REP10(FUNC) \ |
| 395 | ERASE4; \ |
| 396 | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 397 | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 398 | FUNC( 8); FUNC( 9); \ |
| 399 | ERASE4 |
| 400 | |
| 401 | #define REP12(FUNC) \ |
| 402 | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 403 | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 404 | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11) |
| 405 | |
| 406 | #define REP16(FUNC) \ |
| 407 | ERASE8; \ |
| 408 | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 409 | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 410 | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 411 | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 412 | ERASE8 |
| 413 | |
| 414 | #define REP20(FUNC) \ |
| 415 | ERASE4; \ |
| 416 | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 417 | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 418 | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 419 | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 420 | FUNC(16); FUNC(17); FUNC(18); FUNC(19); \ |
| 421 | ERASE4 |
| 422 | |
| 423 | #define REP24(FUNC) \ |
| 424 | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 425 | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 426 | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 427 | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 428 | FUNC(16); FUNC(17); FUNC(18); FUNC(19); \ |
| 429 | FUNC(20); FUNC(21); FUNC(22); FUNC(23) |
| 430 | |
| 431 | #define REP32(FUNC) \ |
| 432 | ERASE8; \ |
| 433 | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 434 | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 435 | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 436 | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 437 | FUNC(16); FUNC(17); FUNC(18); FUNC(19); \ |
| 438 | FUNC(20); FUNC(21); FUNC(22); FUNC(23); \ |
| 439 | FUNC(24); FUNC(25); FUNC(26); FUNC(27); \ |
| 440 | FUNC(28); FUNC(29); FUNC(30); FUNC(31); \ |
| 441 | ERASE8 |
| 442 | |
| 443 | #define REP40(FUNC) \ |
| 444 | ERASE4; \ |
| 445 | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 446 | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 447 | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 448 | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 449 | FUNC(16); FUNC(17); FUNC(18); FUNC(19); \ |
| 450 | FUNC(20); FUNC(21); FUNC(22); FUNC(23); \ |
| 451 | FUNC(24); FUNC(25); FUNC(26); FUNC(27); \ |
| 452 | FUNC(28); FUNC(29); FUNC(30); FUNC(31); \ |
| 453 | FUNC(32); FUNC(33); FUNC(34); FUNC(35); \ |
| 454 | FUNC(36); FUNC(37); FUNC(38); FUNC(39); \ |
| 455 | ERASE4 |
| 456 | |
| 457 | #define REP48(FUNC) \ |
| 458 | FUNC( 0); FUNC( 1); FUNC( 2); FUNC( 3); \ |
| 459 | FUNC( 4); FUNC( 5); FUNC( 6); FUNC( 7); \ |
| 460 | FUNC( 8); FUNC( 9); FUNC(10); FUNC(11); \ |
| 461 | FUNC(12); FUNC(13); FUNC(14); FUNC(15); \ |
| 462 | FUNC(16); FUNC(17); FUNC(18); FUNC(19); \ |
| 463 | FUNC(20); FUNC(21); FUNC(22); FUNC(23); \ |
| 464 | FUNC(24); FUNC(25); FUNC(26); FUNC(27); \ |
| 465 | FUNC(28); FUNC(29); FUNC(30); FUNC(31); \ |
| 466 | FUNC(32); FUNC(33); FUNC(34); FUNC(35); \ |
| 467 | FUNC(36); FUNC(37); FUNC(38); FUNC(39); \ |
| 468 | FUNC(40); FUNC(41); FUNC(42); FUNC(43); \ |
| 469 | FUNC(44); FUNC(45); FUNC(46); FUNC(47); |
| 470 | |
| 471 | |
| 472 | void antic_start(running_machine &machine); |
| 473 | void antic_vstart(running_machine &machine); |
| 474 | void antic_reset(void); |
| 475 | void antic_render(address_space &space, int param1, int param2, int param3); |
| 476 | |
| 477 | |
| 478 | extern ANTIC antic; |
| 479 | |
| 480 | #endif /* __GTIA_H__ */ |