src/mess/includes/stic.h
| r0 | r12079 | |
| 1 | /***************************************************************************** |
| 2 | * |
| 3 | * includes/stic.h |
| 4 | * |
| 5 | ****************************************************************************/ |
| 6 | |
| 7 | #ifndef STIC_H_ |
| 8 | #define STIC_H_ |
| 9 | |
| 10 | // GROM/GRAM cards are 8x8 |
| 11 | #define STIC_CARD_WIDTH 8 |
| 12 | #define STIC_CARD_HEIGHT 8 |
| 13 | |
| 14 | // Intellivision resolution is 20x12 BACKTAB CARDs, minus the rightmost column, |
| 15 | // for an effective resolution of (19 * 8 + 1 * 7) x (12 * 8) == 159x96. |
| 16 | // |
| 17 | // MOB scanline height can be half of a card scanline height, so y-coordinates |
| 18 | // are scaled by 2. |
| 19 | #define STIC_X_SCALE 1 |
| 20 | #define STIC_Y_SCALE 2 |
| 21 | |
| 22 | // the Intellivision emulation scales to match the output format at the last |
| 23 | // step. The Intellivision keyboard component appears to be 320x96, but can |
| 24 | // also run Intellivision carts, so x-coordinates are conditionally scaled |
| 25 | // by 2. |
| 26 | #define INTV_X_SCALE 1 |
| 27 | #define INTV_Y_SCALE 1 |
| 28 | #define INTVKBD_X_SCALE 2 |
| 29 | #define INTVKBD_Y_SCALE INTV_Y_SCALE |
| 30 | |
| 31 | // overscan sizes in intv pixels |
| 32 | // these values are approximate. |
| 33 | #define STIC_OVERSCAN_LEFT_WIDTH 13 |
| 34 | #define STIC_OVERSCAN_RIGHT_WIDTH 17 |
| 35 | #define STIC_OVERSCAN_TOP_HEIGHT 12 |
| 36 | #define STIC_OVERSCAN_BOTTOM_HEIGHT 12 |
| 37 | |
| 38 | /*** STIC registers *********************************************************/ |
| 39 | |
| 40 | // number of STIC registers |
| 41 | #define STIC_REGISTERS 0x33 |
| 42 | |
| 43 | // STIC MOBs (Moveable OBjects) |
| 44 | enum |
| 45 | { |
| 46 | STIC_MOB0, |
| 47 | STIC_MOB1, |
| 48 | STIC_MOB2, |
| 49 | STIC_MOB3, |
| 50 | STIC_MOB4, |
| 51 | STIC_MOB5, |
| 52 | STIC_MOB6, |
| 53 | STIC_MOB7, |
| 54 | |
| 55 | STIC_MOBS |
| 56 | }; |
| 57 | |
| 58 | // STIC Color Stack |
| 59 | enum |
| 60 | { |
| 61 | STIC_CSR0, |
| 62 | STIC_CSR1, |
| 63 | STIC_CSR2, |
| 64 | STIC_CSR3, |
| 65 | |
| 66 | STIC_CSRS |
| 67 | }; |
| 68 | |
| 69 | /**************************************************************************** |
| 70 | * * |
| 71 | * MXR 0000[..0007] MOB X REGISTER RW * |
| 72 | * * |
| 73 | * (MSB) (LSB) * |
| 74 | * +-+-+-+-+-+-----+---+---+--+--+--+--+--+--+--+--+ * |
| 75 | * | | | | | |XSIZE|VIS|COL|X7|X6|X5|X4|X3|X2|X1|X0| * |
| 76 | * +-+-+-+-+-+-----+---+---+--+--+--+--+--+--+--+--+ * |
| 77 | * * |
| 78 | * Xn x-position [0..255] * |
| 79 | * COL collision detection [1=enable] * |
| 80 | * VIS visibility [1=visible] * |
| 81 | * XSIZE double width [1=double] * |
| 82 | * * |
| 83 | **************************************************************************** |
| 84 | * * |
| 85 | * NOTES * |
| 86 | * * |
| 87 | * 1. If X=0, the sprite is not visible and does not register collisions. * |
| 88 | * 2. The horizontal handle is 8 pixels from the left of the sprite, * |
| 89 | * regardless of width. * |
| 90 | * * |
| 91 | ****************************************************************************/ |
| 92 | #define STIC_MXR 0x0000 |
| 93 | |
| 94 | #define STIC_MXR_XSIZE 0x0400 |
| 95 | #define STIC_MXR_VIS 0x0200 |
| 96 | #define STIC_MXR_COL 0x0100 |
| 97 | #define STIC_MXR_X 0x00FF |
| 98 | |
| 99 | /**************************************************************************** |
| 100 | * * |
| 101 | * MYR 0008[..000F] MOB Y REGISTER RW * |
| 102 | * * |
| 103 | * (MSB) (LSB) * |
| 104 | * +-+-+-+-+-----+-----+-----+-----+----+--+--+--+--+--+--+--+ * |
| 105 | * | | | | |YFLIP|XFLIP|YSIZE|YFULL|YRES|Y6|Y5|Y4|Y3|Y2|Y1|Y0| * |
| 106 | * +-+-+-+-+-----+-----+-----+-----+----+--+--+--+--+--+--+--+ * |
| 107 | * * |
| 108 | * Yn y-position [0..127] * |
| 109 | * YRES y-resolution [0=8 scanlines,1=16 scanlines] * |
| 110 | * YFULL double scanline height [1=double] * |
| 111 | * YSIZE quadruple scanline height [1=quadruple] * |
| 112 | * XFLIP horizontally flip image [1=flip] * |
| 113 | * YFLIP vertically flip image [1=flip] * |
| 114 | * * |
| 115 | **************************************************************************** |
| 116 | * * |
| 117 | * NOTES * |
| 118 | * * |
| 119 | * 1. A sprite with YRES=1 will display two cards. * |
| 120 | * 2. A sprite with YFULL=0 and YSIZE=0 will have scanlines half the * |
| 121 | * height of a background card. * |
| 122 | * 3, The minimum size of a sprite is 8x8 (XSIZE=YRES=YSIZE=YFULL=0). * |
| 123 | * 4. The maximum size of a sprite is 16x128 (XSIZE=YRES=YSIZE=YFULL=1). * |
| 124 | * 5. The Y-position is measured in double height scanlines. * |
| 125 | * 6. The vertical handle is 8 double height scanlines from the top of the * |
| 126 | * sprite, regardless of height. * |
| 127 | * * |
| 128 | ****************************************************************************/ |
| 129 | #define STIC_MYR 0x0008 |
| 130 | |
| 131 | #define STIC_MYR_YFLIP 0x0800 |
| 132 | #define STIC_MYR_XFLIP 0x0400 |
| 133 | #define STIC_MYR_YSIZE 0x0200 |
| 134 | #define STIC_MYR_YFULL 0x0100 |
| 135 | #define STIC_MYR_YRES 0x0080 |
| 136 | #define STIC_MYR_Y 0x007F |
| 137 | |
| 138 | /**************************************************************************** |
| 139 | * * |
| 140 | * SAR 0010[..0017] MOB ATTRIBUTE REGISTER RW * |
| 141 | * * |
| 142 | * (MSB) (LSB) * |
| 143 | * +-+-+---+---+---+-+-+--+--+--+--+--+--+---+---+---+ * |
| 144 | * | | |PRI|FG3|SEL| | |C5|C4|C3|C2|C1|C0|FG2|FG1|FG0| * |
| 145 | * +-+-+---+---+---+-+-+--+--+--+--+--+--+---+---+---+ * |
| 146 | * * |
| 147 | * FGn foreground color [0..15] * |
| 148 | * Cn card # [0..63] * |
| 149 | * SEL card memory select [0=GROM, 1=GRAM] * |
| 150 | * PRI sprite priority [1=behind set background bit] * |
| 151 | * * |
| 152 | ****************************************************************************/ |
| 153 | #define STIC_MAR 0x0010 |
| 154 | |
| 155 | #define STIC_MAR_PRI 0x2000 |
| 156 | #define STIC_MAR_FG3 0x1000 |
| 157 | #define STIC_MAR_SEL 0x0800 |
| 158 | #define STIC_MAR_C 0x07F8 |
| 159 | #define STIC_MAR_FG20 0x0007 |
| 160 | |
| 161 | /**************************************************************************** |
| 162 | * * |
| 163 | * SCR 0018[..001F] MOB COLLISION REGISTER RW * |
| 164 | * * |
| 165 | * (MSB) (LSB) * |
| 166 | * +-+-+-+-+-+-+----+----+----+----+----+----+----+----+----+----+ * |
| 167 | * | | | | | | |BRDR|BKGD|SPR7|SPR6|SPR5|SPR4|SPR3|SPR2|SPR1|SPR0| * |
| 168 | * +-+-+-+-+-+-+----+----+----+----+----+----+----+----+----+----+ * |
| 169 | * * |
| 170 | * SPRn 1=collision with sprite #n * |
| 171 | * BKGD 1=collsion with set background bit * |
| 172 | * BRDR 1=collision with screen border * |
| 173 | * * |
| 174 | **************************************************************************** |
| 175 | * * |
| 176 | * NOTES * |
| 177 | * * |
| 178 | * 1. All collisions are latched. Successive reads read from the latch. * |
| 179 | * A write will reset the latch. * |
| 180 | * 2. Sprites with VIS=0 register collisions. * |
| 181 | * 3. Sprites with X=0 do not register collisions. * |
| 182 | * 4. Two overlapping sprites with different priorities, one completely * |
| 183 | * hidden behind the background, still register a collision. * |
| 184 | * * |
| 185 | ****************************************************************************/ |
| 186 | #define STIC_MCR 0x0018 |
| 187 | |
| 188 | #define STIC_MCR_BRDR 0x0200 |
| 189 | #define STIC_MCR_BKGD 0x0100 |
| 190 | #define STIC_MCR_SPR7 0x0080 |
| 191 | #define STIC_MCR_SPR6 0x0040 |
| 192 | #define STIC_MCR_SPR5 0x0020 |
| 193 | #define STIC_MCR_SPR4 0x0010 |
| 194 | #define STIC_MCR_SPR3 0x0008 |
| 195 | #define STIC_MCR_SPR2 0x0004 |
| 196 | #define STIC_MCR_SPR1 0x0002 |
| 197 | #define STIC_MCR_SPR0 0x0001 |
| 198 | |
| 199 | /**************************************************************************** |
| 200 | * * |
| 201 | * DER 0021 DISPLAY ENABLE REGISTER W * |
| 202 | * * |
| 203 | * (MSB) (LSB) * |
| 204 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |
| 205 | * | | | | | | | | | | | | | | | | | * |
| 206 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |
| 207 | * * |
| 208 | **************************************************************************** |
| 209 | * * |
| 210 | * NOTES * |
| 211 | * * |
| 212 | * 1. Any write during VBLANK enables STIC output. * |
| 213 | * * |
| 214 | ****************************************************************************/ |
| 215 | #define STIC_DER 0x0020 |
| 216 | |
| 217 | /**************************************************************************** |
| 218 | * * |
| 219 | * GMR 0021 GRAPHICS MODE REGISTER RW * |
| 220 | * * |
| 221 | * (MSB) (LSB) * |
| 222 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |
| 223 | * | | | | | | | | | | | | | | | | | * |
| 224 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |
| 225 | * * |
| 226 | **************************************************************************** |
| 227 | * * |
| 228 | * NOTES * |
| 229 | * * |
| 230 | * 1. Any write during VBLANK enables FOREGROUND/BACKGROUND mode. * |
| 231 | * 2. Any read during VBLANK enables COLOR STACK/COLORED SQUARES mode. * |
| 232 | * * |
| 233 | ****************************************************************************/ |
| 234 | #define STIC_GMR 0x0021 |
| 235 | |
| 236 | /**************************************************************************** |
| 237 | * * |
| 238 | * CSR 0028 COLOR STACK REGISTER RW * |
| 239 | * * |
| 240 | * (MSB) (LSB) * |
| 241 | * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * |
| 242 | * | | | | | | | | | | | | |BG3|BG2|BG1|BG0| * |
| 243 | * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * |
| 244 | * * |
| 245 | * BGn background color [0..15] * |
| 246 | * * |
| 247 | ****************************************************************************/ |
| 248 | #define STIC_CSR 0x0028 |
| 249 | |
| 250 | #define STIC_CSR_BG 0x000F |
| 251 | |
| 252 | /**************************************************************************** |
| 253 | * * |
| 254 | * BCR 002C BORDER COLOR REGISTER RW * |
| 255 | * * |
| 256 | * (MSB) (LSB) * |
| 257 | * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * |
| 258 | * | | | | | | | | | | | | |BC3|BC2|BC1|BC0| * |
| 259 | * +-+-+-+-+-+-+-+-+-+-+-+-+---+---+---+---+ * |
| 260 | * * |
| 261 | * BCn border color [0..15] * |
| 262 | * * |
| 263 | **************************************************************************** |
| 264 | * * |
| 265 | * NOTES * |
| 266 | * * |
| 267 | * 1. Affects overscan, and column and row blockouts. * |
| 268 | * * |
| 269 | ****************************************************************************/ |
| 270 | #define STIC_BCR 0x002C |
| 271 | |
| 272 | #define STIC_BCR_BC 0x000F |
| 273 | |
| 274 | /**************************************************************************** |
| 275 | * * |
| 276 | * HDR 0030 HORIZONTAL DELAY REGISTER RW * |
| 277 | * * |
| 278 | * (MSB) (LSB) * |
| 279 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * |
| 280 | * | | | | | | | | | | | | | |DEL2|DEL1|DEL0| * |
| 281 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * |
| 282 | * * |
| 283 | * DELn horizontal delay [0..7] * |
| 284 | * * |
| 285 | **************************************************************************** |
| 286 | * * |
| 287 | * NOTES * |
| 288 | * * |
| 289 | * 1. Affects both BACKTAB and MOBs. * |
| 290 | * * |
| 291 | ****************************************************************************/ |
| 292 | #define STIC_HDR 0x0030 |
| 293 | |
| 294 | #define STIC_HDR_DEL 0x0007 |
| 295 | |
| 296 | /**************************************************************************** |
| 297 | * * |
| 298 | * STIC_VDR 0030 VERTICAL DELAY REGISTER RW * |
| 299 | * * |
| 300 | * (MSB) (LSB) * |
| 301 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * |
| 302 | * | | | | | | | | | | | | | |DEL2|DEL1|DEL0| * |
| 303 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+----+----+----+ * |
| 304 | * * |
| 305 | * DELn vertical delay [0..7] * |
| 306 | * * |
| 307 | **************************************************************************** |
| 308 | * * |
| 309 | * NOTES * |
| 310 | * * |
| 311 | * 1. Affects both BACKTAB and MOBs. * |
| 312 | * * |
| 313 | ****************************************************************************/ |
| 314 | #define STIC_VDR 0x0031 |
| 315 | |
| 316 | #define STIC_VDR_DEL 0x0007 |
| 317 | |
| 318 | /**************************************************************************** |
| 319 | * * |
| 320 | * STIC_CBR 0032 CARD BLOCKOUT REGISTER RW * |
| 321 | * * |
| 322 | * (MSB) (LSB) * |
| 323 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+---+---+ * |
| 324 | * | | | | | | | | | | | | | | |ROW|COL| * |
| 325 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+---+---+ * |
| 326 | * * |
| 327 | * COL blockout first card column [1=blockout] * |
| 328 | * ROW blockout first card row [1=blockout] * |
| 329 | * * |
| 330 | **************************************************************************** |
| 331 | * * |
| 332 | * NOTES * |
| 333 | * * |
| 334 | * 1. Generally used in conjunction with HDR and VDR registers, to achieve * |
| 335 | * smooth scrolling. * |
| 336 | * * |
| 337 | ****************************************************************************/ |
| 338 | #define STIC_CBR 0x0032 |
| 339 | |
| 340 | #define STIC_CBR_ROW 0x0002 |
| 341 | #define STIC_CBR_COL 0x0001 |
| 342 | |
| 343 | /*** BACKTAB ****************************************************************/ |
| 344 | |
| 345 | // BACKTAB is made up of 20x12 cards |
| 346 | // (the first 19 columns are 8x8, the 20th column is 7x8) |
| 347 | #define STIC_BACKTAB_WIDTH 20 |
| 348 | #define STIC_BACKTAB_HEIGHT 12 |
| 349 | |
| 350 | /**************************************************************************** |
| 351 | * * |
| 352 | * FOREGROUND/BACKGROUND MODE * |
| 353 | * * |
| 354 | * (MSB) (LSB) * |
| 355 | * +-+-+---+---+---+---+---+--+--+--+--+--+--+---+---+---+ * |
| 356 | * | | |BG2|BG3|SEL|BG1|BG0|C5|C4|C3|C2|C1|C0|FG2|FG1|FG0| * |
| 357 | * +-+-+---+---+---+---+---+--+--+--+--+--+--+---+---+---+ * |
| 358 | * * |
| 359 | * FGn foreground color [0..7] * |
| 360 | * Cn card # [0..63] * |
| 361 | * SEL card memory select [0=GROM, 1=GRAM] * |
| 362 | * BGn background color [0..15] * |
| 363 | * * |
| 364 | ****************************************************************************/ |
| 365 | #define STIC_FBM_BG2 0x2000 |
| 366 | #define STIC_FBM_BG310 0x1600 |
| 367 | #define STIC_FBM_SEL 0x0800 |
| 368 | #define STIC_FBM_C 0x01F8 |
| 369 | #define STIC_FBM_FG 0x0007 |
| 370 | |
| 371 | /**************************************************************************** |
| 372 | * * |
| 373 | * COLOR STACK MODE * |
| 374 | * * |
| 375 | * (MSB) (LSB) * |
| 376 | * +-+-+---+---+---+--+--+--+--+--+--+--+--+---+---+---+ * |
| 377 | * | | |ADV|FG3|SEL|C7|C6|C5|C4|C3|C2|C1|C0|FG2|FG1|FG0| * |
| 378 | * +-+-+---+---+---+--+--+--+--+--+--+--+--+---+---+---+ * |
| 379 | * * |
| 380 | * FGn foreground color [0..15] * |
| 381 | * Cn card # [GROM=0..212, GRAM=0..63] * |
| 382 | * SEL card memory select [0=GROM, 1=GRAM] * |
| 383 | * ADV advance color stack index [1=advance] * |
| 384 | * * |
| 385 | **************************************************************************** |
| 386 | * * |
| 387 | * NOTES: * |
| 388 | * * |
| 389 | * 1. When FG3=1 and SEL=0, COLORED SQUARES MODE is enabled. * |
| 390 | * 2. When SEL=1, C7 and C6 can be used as user-defined flags. * |
| 391 | * * |
| 392 | ****************************************************************************/ |
| 393 | #define STIC_CSTM_ADV 0x2000 |
| 394 | #define STIC_CSTM_FG3 0x1000 |
| 395 | #define STIC_CSTM_SEL 0x0800 |
| 396 | #define STIC_CSTM_C7 0x0400 |
| 397 | #define STIC_CSTM_C6 0x0200 |
| 398 | #define STIC_CSTM_C50 0x01F8 |
| 399 | #define STIC_CSTM_FG20 0x0007 |
| 400 | |
| 401 | #define STIC_CSTM_C (STIC_CSTM_C7|STIC_CSTM_C6|STIC_CSTM_C50) |
| 402 | |
| 403 | /**************************************************************************** |
| 404 | * * |
| 405 | * COLORED SQUARES MODE * |
| 406 | * * |
| 407 | * (MSB) (LSB) * |
| 408 | * +-+-+--+-+-+--+--+--+--+--+--+--+--+--+--+--+ * |
| 409 | * | | |D2|1|0|D1|D0|C2|C1|C0|B2|B1|B0|A2|A1|A0| * |
| 410 | * +-+-+--+-+-+--+--+--+--+--+--+--+--+--+--+--+ * |
| 411 | * * |
| 412 | * An color a [0..7] * |
| 413 | * Bn color b [0..7] * |
| 414 | * Cn color c [0..7] * |
| 415 | * Dn color d [0..7] * |
| 416 | * * |
| 417 | **************************************************************************** |
| 418 | * * |
| 419 | * NOTES: * |
| 420 | * * |
| 421 | * 1. Each color corresponds to one of the following 4 x 4 squares: * |
| 422 | * * |
| 423 | * +---+---+ * |
| 424 | * | a | b | * |
| 425 | * +---+---+ * |
| 426 | * | c | d | * |
| 427 | * +---+---+ * |
| 428 | * * |
| 429 | * 2. When color 7 is specified, the color is taken from the color stack. * |
| 430 | * * |
| 431 | ****************************************************************************/ |
| 432 | #define STIC_CSQM_D2 0x2000 |
| 433 | #define STIC_CSQM_D10 0x0600 |
| 434 | #define STIC_CSQM_C 0x01C0 |
| 435 | #define STIC_CSQM_B 0x0038 |
| 436 | #define STIC_CSQM_A 0x0007 |
| 437 | |
| 438 | #define STIC_CSQM_WIDTH (STIC_CARD_WIDTH / 2) |
| 439 | #define STIC_CSQM_HEIGHT (STIC_CARD_HEIGHT / 2) |
| 440 | |
| 441 | #endif /* STIC_H_ */ |
| 442 | |
src/mess/video/stic.c
| r12078 | r12079 | |
| 1 | 1 | #include "emu.h" |
| 2 | #include "includes/stic.h" |
| 2 | 3 | #include "includes/intv.h" |
| 3 | 4 | |
| 4 | | |
| 5 | 5 | /* STIC variables */ |
| 6 | 6 | |
| 7 | 7 | READ16_HANDLER( intv_stic_r ) |
| r12078 | r12079 | |
| 10 | 10 | //logerror("%x = stic_r(%x)\n",0,offset); |
| 11 | 11 | switch (offset) |
| 12 | 12 | { |
| 13 | | case 0x00: |
| 14 | | case 0x01: |
| 15 | | case 0x02: |
| 16 | | case 0x03: |
| 17 | | case 0x04: |
| 18 | | case 0x05: |
| 19 | | case 0x06: |
| 20 | | case 0x07: |
| 21 | | return 0x3800 | state->m_x_registers[offset & 0x07]; |
| 22 | | case 0x08: |
| 23 | | case 0x09: |
| 24 | | case 0x0a: |
| 25 | | case 0x0b: |
| 26 | | case 0x0c: |
| 27 | | case 0x0d: |
| 28 | | case 0x0e: |
| 29 | | case 0x0f: |
| 30 | | return 0x3000 | state->m_y_registers[offset & 0x07]; |
| 31 | | case 0x10: |
| 32 | | case 0x11: |
| 33 | | case 0x12: |
| 34 | | case 0x13: |
| 35 | | case 0x14: |
| 36 | | case 0x15: |
| 37 | | case 0x16: |
| 38 | | case 0x17: |
| 39 | | return state->m_a_registers[offset & 0x07]; |
| 40 | | case 0x18: |
| 41 | | case 0x19: |
| 42 | | case 0x1a: |
| 43 | | case 0x1b: |
| 44 | | case 0x1c: |
| 45 | | case 0x1d: |
| 46 | | case 0x1e: |
| 47 | | case 0x1f: |
| 48 | | return 0x3C00 | state->m_collision_registers[offset & 0x07]; |
| 49 | | case 0x20: |
| 50 | | return 0; |
| 51 | | case 0x21: |
| 13 | case STIC_MXR + STIC_MOB0: |
| 14 | case STIC_MXR + STIC_MOB1: |
| 15 | case STIC_MXR + STIC_MOB2: |
| 16 | case STIC_MXR + STIC_MOB3: |
| 17 | case STIC_MXR + STIC_MOB4: |
| 18 | case STIC_MXR + STIC_MOB5: |
| 19 | case STIC_MXR + STIC_MOB6: |
| 20 | case STIC_MXR + STIC_MOB7: |
| 21 | return 0x3800 | (state->m_stic_registers[offset] & 0x07FF); |
| 22 | case STIC_MYR + STIC_MOB0: |
| 23 | case STIC_MYR + STIC_MOB1: |
| 24 | case STIC_MYR + STIC_MOB2: |
| 25 | case STIC_MYR + STIC_MOB3: |
| 26 | case STIC_MYR + STIC_MOB4: |
| 27 | case STIC_MYR + STIC_MOB5: |
| 28 | case STIC_MYR + STIC_MOB6: |
| 29 | case STIC_MYR + STIC_MOB7: |
| 30 | return 0x3000 | (state->m_stic_registers[offset] & 0x0FFF); |
| 31 | case STIC_MAR + STIC_MOB0: |
| 32 | case STIC_MAR + STIC_MOB1: |
| 33 | case STIC_MAR + STIC_MOB2: |
| 34 | case STIC_MAR + STIC_MOB3: |
| 35 | case STIC_MAR + STIC_MOB4: |
| 36 | case STIC_MAR + STIC_MOB5: |
| 37 | case STIC_MAR + STIC_MOB6: |
| 38 | case STIC_MAR + STIC_MOB7: |
| 39 | return state->m_stic_registers[offset] & 0x3FFF; |
| 40 | case STIC_MCR + STIC_MOB0: |
| 41 | case STIC_MCR + STIC_MOB1: |
| 42 | case STIC_MCR + STIC_MOB2: |
| 43 | case STIC_MCR + STIC_MOB3: |
| 44 | case STIC_MCR + STIC_MOB4: |
| 45 | case STIC_MCR + STIC_MOB5: |
| 46 | case STIC_MCR + STIC_MOB6: |
| 47 | case STIC_MCR + STIC_MOB7: |
| 48 | return 0x3C00 | (state->m_stic_registers[offset] & 0x03FF); |
| 49 | case STIC_GMR: |
| 52 | 50 | state->m_color_stack_mode = 1; |
| 53 | 51 | //logerror("Setting color stack mode\n"); |
| 52 | /*** fall through ***/ |
| 53 | case STIC_DER: |
| 54 | return 0x3FFF; |
| 54 | 55 | break; |
| 55 | | case 0x28: |
| 56 | | case 0x29: |
| 57 | | case 0x2A: |
| 58 | | case 0x2B: |
| 59 | | return 0x3FF0 | state->m_color_stack[offset&0x3]; |
| 60 | | case 0x2C: |
| 61 | | return 0x3FF0 | state->m_border_color; |
| 62 | | case 0x30: |
| 63 | | return 0x3FF8 | state->m_col_delay; |
| 64 | | case 0x31: |
| 65 | | return 0x3FF8 | state->m_row_delay; |
| 66 | | case 0x32: |
| 67 | | return 0x3FFC | state->m_top_edge_inhibit<<1 | state->m_left_edge_inhibit; |
| 56 | case STIC_CSR + STIC_CSR0: |
| 57 | case STIC_CSR + STIC_CSR1: |
| 58 | case STIC_CSR + STIC_CSR2: |
| 59 | case STIC_CSR + STIC_CSR3: |
| 60 | case STIC_BCR: |
| 61 | return 0x3FF0 | (state->m_stic_registers[offset] & 0x000F); |
| 62 | case STIC_HDR: |
| 63 | case STIC_VDR: |
| 64 | return 0x3FF8 | (state->m_stic_registers[offset] & 0x0007); |
| 65 | case STIC_CBR: |
| 66 | return 0x3FFC | (state->m_stic_registers[offset] & 0x0003); |
| 67 | default: |
| 68 | //logerror("unmapped read from STIC register %02X\n", offset); |
| 69 | return 0x3FFF; |
| 68 | 70 | } |
| 69 | | return 0; |
| 70 | 71 | } |
| 71 | 72 | |
| 72 | 73 | WRITE16_HANDLER( intv_stic_w ) |
| r12078 | r12079 | |
| 78 | 79 | switch (offset) |
| 79 | 80 | { |
| 80 | 81 | /* X Positions */ |
| 81 | | case 0x00: |
| 82 | | case 0x01: |
| 83 | | case 0x02: |
| 84 | | case 0x03: |
| 85 | | case 0x04: |
| 86 | | case 0x05: |
| 87 | | case 0x06: |
| 88 | | case 0x07: |
| 89 | | s = &state->m_sprite[offset & 0x07]; |
| 90 | | s->doublex = !!(data & 0x0400); |
| 91 | | s->visible = !!(data & 0x0200); |
| 92 | | s->coll = !!(data & 0x0100); |
| 93 | | s->xpos = (data & 0xFF); |
| 94 | | state->m_x_registers[offset & 0x07] = data & 0x07FF; |
| 82 | case STIC_MXR + STIC_MOB0: |
| 83 | case STIC_MXR + STIC_MOB1: |
| 84 | case STIC_MXR + STIC_MOB2: |
| 85 | case STIC_MXR + STIC_MOB3: |
| 86 | case STIC_MXR + STIC_MOB4: |
| 87 | case STIC_MXR + STIC_MOB5: |
| 88 | case STIC_MXR + STIC_MOB6: |
| 89 | case STIC_MXR + STIC_MOB7: |
| 90 | s = &state->m_sprite[offset & (STIC_MOBS - 1)]; |
| 91 | s->doublex = !!(data & STIC_MXR_XSIZE); |
| 92 | s->visible = !!(data & STIC_MXR_VIS); |
| 93 | s->coll = !!(data & STIC_MXR_COL); |
| 94 | s->xpos = (data & STIC_MXR_X); |
| 95 | 95 | break; |
| 96 | 96 | /* Y Positions */ |
| 97 | | case 0x08: |
| 98 | | case 0x09: |
| 99 | | case 0x0a: |
| 100 | | case 0x0b: |
| 101 | | case 0x0c: |
| 102 | | case 0x0d: |
| 103 | | case 0x0e: |
| 104 | | case 0x0f: |
| 105 | | s = &state->m_sprite[offset & 0x07]; |
| 106 | | s->yflip = !!(data & 0x0800); |
| 107 | | s->xflip = !!(data & 0x0400); |
| 108 | | s->quady = !!(data & 0x0200); |
| 109 | | s->doubley = !!(data & 0x0100); |
| 110 | | s->doubleyres = !!(data & 0x0080); |
| 111 | | s->ypos = (data & 0x7F); |
| 112 | | state->m_y_registers[offset & 0x07] = data & 0x0FFF; |
| 97 | case STIC_MYR + STIC_MOB0: |
| 98 | case STIC_MYR + STIC_MOB1: |
| 99 | case STIC_MYR + STIC_MOB2: |
| 100 | case STIC_MYR + STIC_MOB3: |
| 101 | case STIC_MYR + STIC_MOB4: |
| 102 | case STIC_MYR + STIC_MOB5: |
| 103 | case STIC_MYR + STIC_MOB6: |
| 104 | case STIC_MYR + STIC_MOB7: |
| 105 | s = &state->m_sprite[offset & (STIC_MOBS - 1)]; |
| 106 | s->yflip = !!(data & STIC_MYR_YFLIP); |
| 107 | s->xflip = !!(data & STIC_MYR_XFLIP); |
| 108 | s->quady = !!(data & STIC_MYR_YSIZE); |
| 109 | s->doubley = !!(data & STIC_MYR_YFULL); |
| 110 | s->doubleyres = !!(data & STIC_MYR_YRES); |
| 111 | s->ypos = (data & STIC_MYR_Y); |
| 113 | 112 | break; |
| 114 | 113 | /* Attributes */ |
| 115 | | case 0x10: |
| 116 | | case 0x11: |
| 117 | | case 0x12: |
| 118 | | case 0x13: |
| 119 | | case 0x14: |
| 120 | | case 0x15: |
| 121 | | case 0x16: |
| 122 | | case 0x17: |
| 123 | | s = &state->m_sprite[offset & 0x07]; |
| 124 | | s->behind_foreground = !!(data & 0x2000); |
| 125 | | s->grom = !(data & 0x0800); |
| 126 | | s->card = ((data >> 3) & 0xFF); |
| 127 | | s->color = ((data >> 9) & 0x08) | (data & 0x7); |
| 128 | | state->m_a_registers[offset & 0x07] = data&0x3FFF; |
| 114 | case STIC_MAR + STIC_MOB0: |
| 115 | case STIC_MAR + STIC_MOB1: |
| 116 | case STIC_MAR + STIC_MOB2: |
| 117 | case STIC_MAR + STIC_MOB3: |
| 118 | case STIC_MAR + STIC_MOB4: |
| 119 | case STIC_MAR + STIC_MOB5: |
| 120 | case STIC_MAR + STIC_MOB6: |
| 121 | case STIC_MAR + STIC_MOB7: |
| 122 | s = &state->m_sprite[offset & (STIC_MOBS - 1)]; |
| 123 | s->behind_foreground = !!(data & STIC_MAR_PRI); |
| 124 | s->grom = !(data & STIC_MAR_SEL); |
| 125 | s->card = ((data & STIC_MAR_C) >> 3); |
| 126 | s->color = ((data & STIC_MAR_FG3) >> 9) | (data & STIC_MAR_FG20); |
| 129 | 127 | break; |
| 130 | 128 | /* Collision Detection - TBD */ |
| 131 | | case 0x18: |
| 132 | | case 0x19: |
| 133 | | case 0x1a: |
| 134 | | case 0x1b: |
| 135 | | case 0x1c: |
| 136 | | case 0x1d: |
| 137 | | case 0x1e: |
| 138 | | case 0x1f: |
| 139 | | //a MOB's own collision bit is *always* zero, even if a |
| 140 | | //one is poked into it |
| 141 | | data &= (~(1 << (offset & 0x07))) & 0x03FF; |
| 142 | | state->m_collision_registers[offset & 0x07] = data; |
| 129 | case STIC_MCR + STIC_MOB0: |
| 130 | case STIC_MCR + STIC_MOB1: |
| 131 | case STIC_MCR + STIC_MOB2: |
| 132 | case STIC_MCR + STIC_MOB3: |
| 133 | case STIC_MCR + STIC_MOB4: |
| 134 | case STIC_MCR + STIC_MOB5: |
| 135 | case STIC_MCR + STIC_MOB6: |
| 136 | case STIC_MCR + STIC_MOB7: |
| 137 | // a MOB's own collision bit is *always* zero, even if a |
| 138 | // one is poked into it |
| 139 | data &= ~(1 << (offset & (STIC_MOBS - 1))); |
| 143 | 140 | break; |
| 144 | 141 | /* Display enable */ |
| 145 | | case 0x20: |
| 142 | case STIC_DER: |
| 146 | 143 | //logerror("***Writing a %x to the STIC handshake\n",data); |
| 147 | 144 | state->m_stic_handshake = 1; |
| 148 | 145 | break; |
| 149 | 146 | /* Graphics Mode */ |
| 150 | | case 0x21: |
| 147 | case STIC_GMR: |
| 151 | 148 | state->m_color_stack_mode = 0; |
| 152 | 149 | break; |
| 153 | 150 | /* Color Stack */ |
| 154 | | case 0x28: |
| 155 | | case 0x29: |
| 156 | | case 0x2a: |
| 157 | | case 0x2b: |
| 158 | | logerror("Setting color_stack[%x] = %x (%x)\n",offset&0x3,data&0xf,cpu_get_pc(&space->device())); |
| 159 | | state->m_color_stack[offset&0x3] = data&0xf; |
| 151 | case STIC_CSR + STIC_CSR0: |
| 152 | case STIC_CSR + STIC_CSR1: |
| 153 | case STIC_CSR + STIC_CSR2: |
| 154 | case STIC_CSR + STIC_CSR3: |
| 155 | logerror("Setting color_stack[%x] = %x (%x)\n", offset & (STIC_CSRS - 1),data & STIC_CSR_BG, cpu_get_pc(&space->device())); |
| 160 | 156 | break; |
| 161 | 157 | /* Border Color */ |
| 162 | | case 0x2c: |
| 158 | case STIC_BCR: |
| 163 | 159 | //logerror("***Writing a %x to the border color\n",data); |
| 164 | | state->m_border_color = data & 0xf; |
| 160 | state->m_border_color = data & STIC_BCR_BC; |
| 165 | 161 | break; |
| 166 | 162 | /* Framing */ |
| 167 | | case 0x30: |
| 168 | | state->m_col_delay = data & 0x7; |
| 163 | case STIC_HDR: |
| 164 | state->m_col_delay = data & STIC_HDR_DEL; |
| 169 | 165 | break; |
| 170 | | case 0x31: |
| 171 | | state->m_row_delay = data & 0x7; |
| 166 | case STIC_VDR: |
| 167 | state->m_row_delay = data & STIC_VDR_DEL; |
| 172 | 168 | break; |
| 173 | | case 0x32: |
| 174 | | state->m_left_edge_inhibit = (data & 0x01); |
| 175 | | state->m_top_edge_inhibit = (data & 0x02)>>1; |
| 169 | case STIC_CBR: |
| 170 | state->m_left_edge_inhibit = (data & STIC_CBR_COL); |
| 171 | state->m_top_edge_inhibit = (data & STIC_CBR_ROW) >> 1; |
| 176 | 172 | break; |
| 173 | default: |
| 174 | //logerror("unmapped write to STIC register %02X: %04X\n", offset, data); |
| 175 | break; |
| 177 | 176 | } |
| 177 | |
| 178 | if (offset < sizeof(state->m_stic_registers) / sizeof(state->m_stic_registers[0])) |
| 179 | state->m_stic_registers[offset] = data; |
| 178 | 180 | } |
src/mess/video/intv.c
| r12078 | r12079 | |
| 1 | 1 | #include "emu.h" |
| 2 | #include "includes/stic.h" |
| 2 | 3 | #include "includes/intv.h" |
| 3 | 4 | |
| 4 | 5 | #define FOREGROUND_BIT 0x0010 |
| 5 | 6 | |
| 7 | // conversion from Intellivision color to internal representation |
| 8 | #define SET_COLOR(c) ((c * 2) + 1) |
| 9 | #define GET_COLOR(c) ((c - 1) / 2) |
| 10 | |
| 6 | 11 | /* initialized to non-zero, because we divide by it */ |
| 7 | 12 | |
| 8 | | INLINE void intv_plot_pixel(bitmap_t *bitmap, int x, int y, UINT32 color) |
| 13 | INLINE void intv_set_pixel(intv_state *state, bitmap_t *bitmap, int x, int y, UINT32 color) |
| 9 | 14 | { |
| 10 | | *BITMAP_ADDR16(bitmap, y, x) = (color<<1)+1; |
| 15 | int w, h; |
| 16 | |
| 17 | // output scaling |
| 18 | x *= state->m_x_scale; |
| 19 | y *= state->m_y_scale; |
| 20 | color = SET_COLOR(color); |
| 21 | |
| 22 | for (h = 0; h < state->m_y_scale; h++) |
| 23 | for (w = 0; w < state->m_x_scale; w++) |
| 24 | *BITMAP_ADDR16(bitmap, y + h, x + w) = color; |
| 11 | 25 | } |
| 12 | 26 | |
| 27 | INLINE UINT32 intv_get_pixel(intv_state *state, bitmap_t *bitmap, int x, int y) |
| 28 | { |
| 29 | return GET_COLOR(*BITMAP_ADDR16(bitmap, y * state->m_y_scale, x * state->m_x_scale)); |
| 30 | } |
| 31 | |
| 32 | INLINE void intv_plot_box(intv_state *state, bitmap_t *bm, int x, int y, int w, int h, int color) |
| 33 | { |
| 34 | plot_box(bm, x * state->m_x_scale, y * state->m_y_scale, w * state->m_x_scale, h * state->m_y_scale, SET_COLOR(color)); |
| 35 | } |
| 36 | |
| 13 | 37 | VIDEO_START( intv ) |
| 14 | 38 | { |
| 15 | 39 | intv_state *state = machine.driver_data<intv_state>(); |
| r12078 | r12079 | |
| 19 | 43 | VIDEO_START_CALL(generic_bitmapped); |
| 20 | 44 | |
| 21 | 45 | #if 0 |
| 22 | | for (i = 0; i < 8; i++) { |
| 23 | | intv_sprite_type* s = &state->m_sprite[i]; |
| 24 | | s->visible = 0; |
| 25 | | s->xpos = 0; |
| 26 | | s->ypos = 0; |
| 27 | | s->coll = 0; |
| 28 | | s->collision = 0; |
| 29 | | s->doublex = 0; |
| 30 | | s->doubley = 0; |
| 31 | | s->quady = 0; |
| 32 | | s->xflip = 0; |
| 33 | | s->yflip = 0; |
| 34 | | s->behind_foreground = 0; |
| 35 | | s->grom = 0; |
| 36 | | s->card = 0; |
| 37 | | s->color = 0; |
| 38 | | s->doubleyres = 0; |
| 39 | | s->dirty = 1; |
| 40 | | for (j = 0; j < 16; j++) { |
| 41 | | for (k = 0; k < 128; k++) { |
| 42 | | state->m_sprite_buffers[i][j][k] = 0; |
| 43 | | } |
| 44 | | } |
| 45 | | state->m_collision_registers[i] = 0; |
| 46 | | } |
| 47 | | for(i = 0; i < 4; i++) { |
| 48 | | state->m_color_stack[i] = 0; |
| 49 | | } |
| 50 | | state->m_color_stack_mode = 0; |
| 51 | | state->m_color_stack_offset = 0; |
| 52 | | state->m_stic_handshake = 0; |
| 53 | | state->m_border_color = 0; |
| 54 | | state->m_col_delay = 0; |
| 55 | | state->m_row_delay = 0; |
| 56 | | state->m_left_edge_inhibit = 0; |
| 57 | | state->m_top_edge_inhibit = 0; |
| 46 | for (i = 0; i < STIC_MOBS; i++) |
| 47 | { |
| 48 | intv_sprite_type* s = &state->m_sprite[i]; |
| 49 | s->visible = 0; |
| 50 | s->xpos = 0; |
| 51 | s->ypos = 0; |
| 52 | s->coll = 0; |
| 53 | s->collision = 0; |
| 54 | s->doublex = 0; |
| 55 | s->doubley = 0; |
| 56 | s->quady = 0; |
| 57 | s->xflip = 0; |
| 58 | s->yflip = 0; |
| 59 | s->behind_foreground = 0; |
| 60 | s->grom = 0; |
| 61 | s->card = 0; |
| 62 | s->color = 0; |
| 63 | s->doubleyres = 0; |
| 64 | s->dirty = 1; |
| 65 | for (j = 0; j < 16; j++) |
| 66 | { |
| 67 | for (k = 0; k < 128; k++) |
| 68 | { |
| 69 | state->m_sprite_buffers[i][j][k] = 0; |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | for(i = 0; i < STIC_REGISTERS; i++) |
| 74 | { |
| 75 | state->m_stic_registers[i] = 0; |
| 76 | } |
| 77 | state->m_color_stack_mode = 0; |
| 78 | state->m_color_stack_offset = 0; |
| 79 | state->m_stic_handshake = 0; |
| 80 | state->m_border_color = 0; |
| 81 | state->m_col_delay = 0; |
| 82 | state->m_row_delay = 0; |
| 83 | state->m_left_edge_inhibit = 0; |
| 84 | state->m_top_edge_inhibit = 0; |
| 58 | 85 | |
| 59 | | state->m_gramdirty = 1; |
| 60 | | for(i=0;i<64;i++) { |
| 61 | | state->m_gram[i] = 0; |
| 62 | | state->m_gramdirtybytes[i] = 1; |
| 63 | | } |
| 86 | state->m_gramdirty = 1; |
| 87 | for(i=0;i<64;i++) |
| 88 | { |
| 89 | state->m_gram[i] = 0; |
| 90 | state->m_gramdirtybytes[i] = 1; |
| 91 | } |
| 64 | 92 | #endif |
| 65 | 93 | } |
| 66 | 94 | |
| 67 | 95 | |
| 68 | | static int sprites_collide(intv_state *state, int spriteNum0, int spriteNum1) { |
| 69 | | INT16 x1, x2, y1, y2, w1, w2, h1, h2, x0, y0, r0y, r1y, |
| 70 | | width, height, x, y, x_offset,y_offset; |
| 96 | static int sprites_collide(intv_state *state, int spriteNum1, int spriteNum2) |
| 97 | { |
| 98 | INT16 x0, y0, w0, h0, x1, y1, w1, h1, x2, y2, w2, h2; |
| 71 | 99 | |
| 72 | | intv_sprite_type* s1 = &state->m_sprite[spriteNum0]; |
| 73 | | intv_sprite_type* s2 = &state->m_sprite[spriteNum1]; |
| 100 | intv_sprite_type* s1 = &state->m_sprite[spriteNum1]; |
| 101 | intv_sprite_type* s2 = &state->m_sprite[spriteNum2]; |
| 74 | 102 | |
| 75 | | x_offset = state->m_col_delay - 8; |
| 76 | | y_offset = state->m_row_delay - 8; |
| 77 | | x1 = s1->xpos+x_offset; x2 = s2->xpos+x_offset; |
| 78 | | y1 = (s1->ypos+y_offset)<<1; y2 = (s2->ypos+y_offset)<<1; |
| 79 | | w1 = (s1->doublex ? 2 : 1)<<3; |
| 80 | | w2 = (s2->doublex ? 2 : 1)<<3; |
| 81 | | h1 = (s1->quady ? 4 : 1) * (s1->doubley ? 2 : 1) * (s1->doubleyres ? 2 : 1)<<3; |
| 82 | | h2 = (s2->quady ? 4 : 1) * (s2->doubley ? 2 : 1) * (s2->doubleyres ? 2 : 1)<<3; |
| 103 | x0 = STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay - STIC_CARD_WIDTH; |
| 104 | y0 = STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay - STIC_CARD_HEIGHT; |
| 105 | x1 = (s1->xpos + x0) * STIC_X_SCALE; y1 = (s1->ypos + y0) * STIC_Y_SCALE; |
| 106 | x2 = (s2->xpos + x0) * STIC_X_SCALE; y2 = (s2->ypos + y0) * STIC_Y_SCALE; |
| 107 | w1 = (s1->doublex ? 2 : 1) * STIC_CARD_WIDTH; |
| 108 | w2 = (s2->doublex ? 2 : 1) * STIC_CARD_WIDTH; |
| 109 | h1 = (s1->quady ? 4 : 1) * (s1->doubley ? 2 : 1) * (s1->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; |
| 110 | h2 = (s2->quady ? 4 : 1) * (s2->doubley ? 2 : 1) * (s2->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; |
| 83 | 111 | |
| 84 | | if ((x1 + w1 <= x2) || (y1 + h1 <= y2) || |
| 85 | | (x1 >= x2 + w2) || (y1 >= y2 + h2)) |
| 86 | | return FALSE; |
| 112 | if ((x1 >= x2 + w2) || (y1 >= y2 + h2) || |
| 113 | (x2 >= x1 + w1) || (y2 >= y1 + h1)) |
| 114 | return FALSE; |
| 87 | 115 | |
| 88 | | //iterate over the intersecting bits to see if any touch |
| 89 | | x0 = MAX(x1, x2); |
| 90 | | y0 = MAX(y1, y2); |
| 91 | | r0y = y0-y1; |
| 92 | | r1y = y0-y2; |
| 93 | | width = MIN(x1+w1, x2+w2) - x0; |
| 94 | | height = MIN(y1+h1, y2+h2) - y0; |
| 95 | | for (x = 0; x < width; x++) { |
| 96 | | for (y = 0; y < height; y++) { |
| 97 | | if (state->m_sprite_buffers[spriteNum0][x0-x1+x][r0y+y] && |
| 98 | | state->m_sprite_buffers[spriteNum1][x0-x2+x][r1y+y]) |
| 99 | | return TRUE; |
| 100 | | } |
| 101 | | } |
| 116 | // iterate over the intersecting bits to see if any touch |
| 117 | x0 = MAX(x1, x2); |
| 118 | y0 = MAX(y1, y2); |
| 119 | w0 = MIN(x1 + w1, x2 + w2) - x0; |
| 120 | h0 = MIN(y1 + h1, y2 + h2) - y0; |
| 121 | x1 = x0 - x1; |
| 122 | y1 = y0 - y1; |
| 123 | x2 = x0 - x2; |
| 124 | y2 = y0 - y2; |
| 125 | for (x0 = 0; x0 < w0; x0++) |
| 126 | { |
| 127 | for (y0 = 0; y0 < h0; y0++) |
| 128 | { |
| 129 | if (state->m_sprite_buffers[spriteNum1][x0 + x1][y0 + y1] && |
| 130 | state->m_sprite_buffers[spriteNum2][x0 + x2][y0 + y2]) |
| 131 | return TRUE; |
| 132 | } |
| 133 | } |
| 102 | 134 | |
| 103 | | return FALSE; |
| 135 | return FALSE; |
| 104 | 136 | } |
| 105 | 137 | |
| 106 | 138 | static void determine_sprite_collisions(intv_state *state) |
| 107 | 139 | { |
| 108 | | //check sprite to sprite collisions |
| 109 | | int i, j; |
| 110 | | for (i = 0; i < 7; i++) { |
| 111 | | intv_sprite_type* s1 = &state->m_sprite[i]; |
| 112 | | if (s1->xpos == 0 || !s1->coll) |
| 113 | | continue; |
| 140 | // check sprite to sprite collisions |
| 141 | int i, j; |
| 142 | for (i = 0; i < STIC_MOBS - 1; i++) |
| 143 | { |
| 144 | intv_sprite_type* s1 = &state->m_sprite[i]; |
| 145 | if (s1->xpos == 0 || !s1->coll) |
| 146 | continue; |
| 114 | 147 | |
| 115 | | for (j = i+1; j < 8; j++) { |
| 116 | | intv_sprite_type* s2 = &state->m_sprite[j]; |
| 117 | | if (s2->xpos == 0 || !s2->coll) |
| 118 | | continue; |
| 148 | for (j = i + 1; j < STIC_MOBS; j++) |
| 149 | { |
| 150 | intv_sprite_type* s2 = &state->m_sprite[j]; |
| 151 | if (s2->xpos == 0 || !s2->coll) |
| 152 | continue; |
| 119 | 153 | |
| 120 | | if (sprites_collide(state, i, j)) { |
| 121 | | s1->collision |= (1 << j); |
| 122 | | s2->collision |= (1 << i); |
| 123 | | } |
| 124 | | } |
| 125 | | } |
| 154 | if (sprites_collide(state, i, j)) |
| 155 | { |
| 156 | s1->collision |= (1 << j); |
| 157 | s2->collision |= (1 << i); |
| 158 | } |
| 159 | } |
| 160 | } |
| 126 | 161 | } |
| 127 | 162 | |
| 128 | 163 | static void render_sprites(running_machine &machine) |
| 129 | 164 | { |
| 130 | 165 | intv_state *state = machine.driver_data<intv_state>(); |
| 131 | | INT32 cardMemoryLocation, pixelSize; |
| 132 | | INT32 spritePixelHeight; |
| 133 | | INT32 nextMemoryLocation; |
| 134 | | INT32 nextData; |
| 135 | | INT32 nextX; |
| 136 | | INT32 nextY; |
| 137 | | INT32 xInc; |
| 138 | | INT32 i, j, k; |
| 166 | INT32 cardMemoryLocation, pixelSize; |
| 167 | INT32 spritePixelHeight; |
| 168 | INT32 nextMemoryLocation; |
| 169 | INT32 nextData; |
| 170 | INT32 nextX; |
| 171 | INT32 nextY; |
| 172 | INT32 xInc; |
| 173 | INT32 i, j, k; |
| 139 | 174 | |
| 140 | | UINT8* memory = machine.region("maincpu")->base(); |
| 175 | UINT8* memory = machine.region("maincpu")->base(); |
| 141 | 176 | |
| 142 | | for (i = 0; i < 8; i++) { |
| 177 | for (i = 0; i < STIC_MOBS; i++) |
| 178 | { |
| 143 | 179 | intv_sprite_type* s = &state->m_sprite[i]; |
| 144 | 180 | |
| 145 | | if (s->grom) |
| 146 | | cardMemoryLocation = (s->card << 3); |
| 147 | | else |
| 148 | | cardMemoryLocation = ((s->card & 0x003F) << 3); |
| 181 | if (s->grom) |
| 182 | cardMemoryLocation = (s->card * STIC_CARD_HEIGHT); |
| 183 | else |
| 184 | cardMemoryLocation = ((s->card & 0x003F) * STIC_CARD_HEIGHT); |
| 149 | 185 | |
| 150 | | pixelSize = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1); |
| 151 | | spritePixelHeight = 8 * pixelSize * (s->doubleyres ? 2 : 1); |
| 186 | pixelSize = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1); |
| 187 | spritePixelHeight = pixelSize * (s->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; |
| 152 | 188 | |
| 153 | | for (j = 0; j < spritePixelHeight; j++) { |
| 154 | | nextMemoryLocation = (cardMemoryLocation + (j/pixelSize)); |
| 155 | | if (s->grom) |
| 156 | | nextData = memory[(0x3000+nextMemoryLocation)<<1]; |
| 157 | | else if (nextMemoryLocation < 0x200) |
| 158 | | nextData = state->m_gram[nextMemoryLocation]; |
| 159 | | else |
| 160 | | nextData = 0xFFFF; |
| 161 | | nextX = (s->xflip ? (s->doublex ? 15 : 7) : 0); |
| 162 | | nextY = (s->yflip ? (spritePixelHeight - j - 1) : j); |
| 163 | | xInc = (s->xflip ? -1: 1); |
| 164 | | |
| 165 | | for (k=0;k < 8*(1+s->doublex);k++) |
| 166 | | { |
| 167 | | state->m_sprite_buffers[i][nextX + k*xInc][nextY] = (nextData & (1<<(7 - k/(1 + s->doublex)))) != 0; |
| 168 | | } |
| 169 | | } |
| 189 | for (j = 0; j < spritePixelHeight; j++) |
| 190 | { |
| 191 | nextMemoryLocation = (cardMemoryLocation + (j/pixelSize)); |
| 192 | if (s->grom) |
| 193 | nextData = memory[(0x3000+nextMemoryLocation)<<1]; |
| 194 | else if (nextMemoryLocation < 0x200) |
| 195 | nextData = state->m_gram[nextMemoryLocation]; |
| 196 | else |
| 197 | nextData = 0xFFFF; |
| 198 | nextX = (s->xflip ? ((s->doublex ? 2 : 1) * STIC_CARD_WIDTH - 1) : 0); |
| 199 | nextY = (s->yflip ? (spritePixelHeight - j - 1) : j); |
| 200 | xInc = (s->xflip ? -1: 1); |
| 170 | 201 | |
| 171 | | } |
| 202 | for (k = 0; k < STIC_CARD_WIDTH * (1 + s->doublex); k++) |
| 203 | { |
| 204 | state->m_sprite_buffers[i][nextX + k * xInc][nextY] = (nextData & (1 << ((STIC_CARD_WIDTH - 1) - k / (1 + s->doublex)))) != 0; |
| 205 | } |
| 206 | } |
| 207 | } |
| 172 | 208 | } |
| 173 | 209 | |
| 174 | 210 | static void render_line(running_machine &machine, bitmap_t *bitmap, |
| 175 | 211 | UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor) |
| 176 | 212 | { |
| 177 | | UINT32 color; |
| 178 | | UINT8 i; |
| 179 | | for (i=0; i<8; i++) |
| 180 | | { |
| 181 | | color = (nextByte & (1<<(7-i)) ? fgcolor : bgcolor); |
| 182 | | intv_plot_pixel(bitmap, x+2*i, y, color); |
| 183 | | intv_plot_pixel(bitmap, x+2*i+1, y, color); |
| 184 | | intv_plot_pixel(bitmap, x+2*i, y+1, color); |
| 185 | | intv_plot_pixel(bitmap, x+2*i+1, y+1, color); |
| 186 | | } |
| 213 | intv_state *state = machine.driver_data<intv_state>(); |
| 214 | UINT32 color; |
| 215 | UINT8 i; |
| 216 | |
| 217 | for (i = 0; i < STIC_CARD_WIDTH; i++) |
| 218 | { |
| 219 | color = (nextByte & (1 << ((STIC_CARD_WIDTH - 1) - i)) ? fgcolor : bgcolor); |
| 220 | intv_set_pixel(state, bitmap, x+i, y, color); |
| 221 | intv_set_pixel(state, bitmap, x+i, y+1, color); |
| 222 | } |
| 187 | 223 | } |
| 188 | 224 | |
| 189 | 225 | static void render_colored_squares(running_machine &machine, bitmap_t *bitmap, |
| 190 | 226 | UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3) |
| 191 | 227 | { |
| 192 | | plot_box(bitmap, x, y, 8, 8, (color0<<1)+1); |
| 193 | | plot_box(bitmap, x+8, y, 8, 8, (color1<<1)+1); |
| 194 | | plot_box(bitmap, x, y+8, 8, 8, (color2<<1)+1); |
| 195 | | plot_box(bitmap, x+8, y+8, 8, 8, (color3<<1)+1); |
| 228 | intv_state *state = machine.driver_data<intv_state>(); |
| 229 | |
| 230 | intv_plot_box(state, bitmap, x, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color0); |
| 231 | intv_plot_box(state, bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color1); |
| 232 | intv_plot_box(state, bitmap, x, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color2); |
| 233 | intv_plot_box(state, bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color3); |
| 196 | 234 | } |
| 197 | 235 | |
| 198 | 236 | static void render_color_stack_mode(running_machine &machine, bitmap_t *bitmap) |
| 199 | 237 | { |
| 200 | 238 | intv_state *state = machine.driver_data<intv_state>(); |
| 201 | | UINT8 h, csPtr = 0, nexty = 2*state->m_row_delay; |
| 202 | | UINT16 nextCard, nextx = 2*state->m_col_delay; |
| 203 | | UINT8 *ram = machine.region("maincpu")->base(); |
| 239 | INT16 w, h, nextx, nexty; |
| 240 | UINT8 csPtr = 0; |
| 241 | UINT16 nextCard; |
| 242 | UINT8 *ram = machine.region("maincpu")->base(); |
| 204 | 243 | |
| 205 | | for (h = 0; h < 240; h++) { |
| 206 | | nextCard = state->m_ram16[h]; |
| 244 | for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE; |
| 245 | h < STIC_BACKTAB_HEIGHT; |
| 246 | h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) |
| 247 | { |
| 248 | for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay) * STIC_X_SCALE; |
| 249 | w < STIC_BACKTAB_WIDTH; |
| 250 | w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) |
| 251 | { |
| 252 | nextCard = state->m_ram16[w + h * STIC_BACKTAB_WIDTH]; |
| 207 | 253 | |
| 208 | | //colored squares mode |
| 209 | | if ((nextCard & 0x1800) == 0x1000) { |
| 210 | | UINT8 csColor = state->m_color_stack[csPtr]; |
| 211 | | UINT8 color0 = nextCard & 0x0007; |
| 212 | | UINT8 color1 = (nextCard & 0x0038) >> 3; |
| 213 | | UINT8 color2 = (nextCard & 0x01C0) >> 6; |
| 214 | | UINT8 color3 = ((nextCard & 0x2000) >> 11) | |
| 215 | | ((nextCard & 0x0600) >> 9); |
| 216 | | render_colored_squares(machine, bitmap, nextx, nexty, |
| 217 | | (color0 == 7 ? csColor : (color0 | FOREGROUND_BIT)), |
| 218 | | (color1 == 7 ? csColor : (color1 | FOREGROUND_BIT)), |
| 219 | | (color2 == 7 ? csColor : (color2 | FOREGROUND_BIT)), |
| 220 | | (color3 == 7 ? csColor : (color3 | FOREGROUND_BIT))); |
| 221 | | } |
| 222 | | //color stack mode |
| 223 | | else { |
| 224 | | UINT8 isGrom, j; |
| 225 | | UINT16 memoryLocation, fgcolor, bgcolor; |
| 226 | | UINT8* memory; |
| 254 | // colored squares mode |
| 255 | if ((nextCard & (STIC_CSTM_FG3|STIC_CSTM_SEL)) == STIC_CSTM_FG3) |
| 256 | { |
| 257 | UINT8 csColor = state->m_stic_registers[STIC_CSR + csPtr]; |
| 258 | UINT8 color0 = nextCard & STIC_CSQM_A; |
| 259 | UINT8 color1 = (nextCard & STIC_CSQM_B) >> 3; |
| 260 | UINT8 color2 = (nextCard & STIC_CSQM_C) >> 6; |
| 261 | UINT8 color3 = ((nextCard & STIC_CSQM_D2) >> 11) | |
| 262 | ((nextCard & (STIC_CSQM_D10)) >> 9); |
| 263 | render_colored_squares(machine, bitmap, nextx, nexty, |
| 264 | (color0 == 7 ? csColor : (color0 | FOREGROUND_BIT)), |
| 265 | (color1 == 7 ? csColor : (color1 | FOREGROUND_BIT)), |
| 266 | (color2 == 7 ? csColor : (color2 | FOREGROUND_BIT)), |
| 267 | (color3 == 7 ? csColor : (color3 | FOREGROUND_BIT))); |
| 268 | } |
| 269 | //color stack mode |
| 270 | else |
| 271 | { |
| 272 | UINT8 isGrom, j; |
| 273 | UINT16 memoryLocation, fgcolor, bgcolor; |
| 274 | UINT8* memory; |
| 227 | 275 | |
| 228 | | //advance the color pointer, if necessary |
| 229 | | if (nextCard & 0x2000) |
| 230 | | csPtr = (csPtr+1) & 0x03; |
| 276 | //advance the color pointer, if necessary |
| 277 | if (nextCard & STIC_CSTM_ADV) |
| 278 | csPtr = (csPtr+1) & (STIC_CSRS - 1); |
| 231 | 279 | |
| 232 | | fgcolor = ((nextCard & 0x1000) >> 9) | |
| 233 | | (nextCard & 0x0007) | FOREGROUND_BIT; |
| 234 | | bgcolor = state->m_color_stack[csPtr] & 0x0F; |
| 280 | fgcolor = ((nextCard & STIC_CSTM_FG3) >> 9) | |
| 281 | (nextCard & (STIC_CSTM_FG20)) | FOREGROUND_BIT; |
| 282 | bgcolor = state->m_stic_registers[STIC_CSR + csPtr] & STIC_CSR_BG; |
| 235 | 283 | |
| 236 | | isGrom = !(nextCard & 0x0800); |
| 237 | | if (isGrom) { |
| 238 | | memoryLocation = 0x3000 + (nextCard & 0x07F8); |
| 239 | | memory = ram; |
| 240 | | for (j = 0; j < 16; j+=2) |
| 241 | | render_line(machine, bitmap, memory[(memoryLocation<<1)+j], |
| 242 | | nextx, nexty+j, fgcolor, bgcolor); |
| 243 | | } |
| 244 | | else { |
| 245 | | memoryLocation = (nextCard & 0x01F8); |
| 246 | | memory = state->m_gram; |
| 247 | | for (j = 0; j < 16; j+=2) |
| 248 | | render_line(machine, bitmap, memory[memoryLocation+(j>>1)], |
| 249 | | nextx, nexty+j, fgcolor, bgcolor); |
| 250 | | } |
| 251 | | } |
| 252 | | nextx += 16; |
| 253 | | if (nextx >= 320) { |
| 254 | | nextx = 2*state->m_col_delay; |
| 255 | | nexty += 16; |
| 256 | | } |
| 257 | | } |
| 284 | isGrom = !(nextCard & STIC_CSTM_SEL); |
| 285 | if (isGrom) |
| 286 | { |
| 287 | memoryLocation = 0x3000 + (nextCard & STIC_CSTM_C); |
| 288 | memory = ram; |
| 289 | for (j = 0; j < STIC_CARD_HEIGHT; j++) |
| 290 | render_line(machine, bitmap, memory[(memoryLocation + j) * 2], |
| 291 | nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); |
| 292 | } |
| 293 | else |
| 294 | { |
| 295 | memoryLocation = (nextCard & STIC_CSTM_C50); |
| 296 | memory = state->m_gram; |
| 297 | for (j = 0; j < STIC_CARD_HEIGHT; j++) |
| 298 | render_line(machine, bitmap, memory[memoryLocation + j], |
| 299 | nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | } |
| 258 | 304 | } |
| 259 | 305 | |
| 260 | 306 | static void render_fg_bg_mode(running_machine &machine, bitmap_t *bitmap) |
| 261 | 307 | { |
| 262 | 308 | intv_state *state = machine.driver_data<intv_state>(); |
| 263 | | UINT8 i, j, isGrom, fgcolor, bgcolor, nexty = 2*state->m_row_delay; |
| 264 | | UINT16 nextCard, memoryLocation, nextx = 2*state->m_col_delay; |
| 265 | | UINT8* memory; |
| 266 | | UINT8* ram = machine.region("maincpu")->base(); |
| 309 | INT16 w, h, nextx, nexty; |
| 310 | UINT8 j, isGrom, fgcolor, bgcolor; |
| 311 | UINT16 nextCard, memoryLocation; |
| 312 | UINT8* memory; |
| 313 | UINT8* ram = machine.region("maincpu")->base(); |
| 267 | 314 | |
| 268 | | for (i = 0; i < 240; i++) { |
| 269 | | nextCard = state->m_ram16[i]; |
| 270 | | fgcolor = (nextCard & 0x0007) | FOREGROUND_BIT; |
| 271 | | bgcolor = ((nextCard & 0x2000) >> 11) | |
| 272 | | ((nextCard & 0x1600) >> 9); |
| 315 | for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE; |
| 316 | h < STIC_BACKTAB_HEIGHT; |
| 317 | h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) |
| 318 | { |
| 319 | for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay) * STIC_X_SCALE; |
| 320 | w < STIC_BACKTAB_WIDTH; |
| 321 | w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) |
| 322 | { |
| 323 | nextCard = state->m_ram16[w + h * STIC_BACKTAB_WIDTH]; |
| 324 | fgcolor = (nextCard & STIC_FBM_FG) | FOREGROUND_BIT; |
| 325 | bgcolor = ((nextCard & STIC_FBM_BG2) >> 11) | |
| 326 | ((nextCard & STIC_FBM_BG310) >> 9); |
| 273 | 327 | |
| 274 | | isGrom = !(nextCard & 0x0800); |
| 275 | | if (isGrom) { |
| 276 | | memoryLocation = 0x3000 + (nextCard & 0x01F8); |
| 277 | | memory = ram; |
| 278 | | for (j = 0; j < 16; j+=2) |
| 279 | | render_line(machine, bitmap, memory[(memoryLocation<<1)+j], |
| 280 | | nextx, nexty+j, fgcolor, bgcolor); |
| 281 | | } |
| 282 | | else { |
| 283 | | memoryLocation = (nextCard & 0x01F8); |
| 284 | | memory = state->m_gram; |
| 285 | | for (j = 0; j < 16; j+=2) |
| 286 | | render_line(machine, bitmap, memory[memoryLocation+(j>>1)], |
| 287 | | nextx, nexty+j, fgcolor, bgcolor); |
| 288 | | } |
| 289 | | |
| 290 | | nextx += 16; |
| 291 | | if (nextx >= 320) { |
| 292 | | nextx = 2*state->m_col_delay; |
| 293 | | nexty += 16; |
| 294 | | } |
| 295 | | } |
| 328 | isGrom = !(nextCard & STIC_FBM_SEL); |
| 329 | if (isGrom) |
| 330 | { |
| 331 | memoryLocation = 0x3000 + (nextCard & STIC_FBM_C); |
| 332 | memory = ram; |
| 333 | for (j = 0; j < STIC_CARD_HEIGHT; j++) |
| 334 | render_line(machine, bitmap, memory[(memoryLocation + j) * 2], |
| 335 | nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); |
| 336 | } |
| 337 | else |
| 338 | { |
| 339 | memoryLocation = (nextCard & STIC_FBM_C); |
| 340 | memory = state->m_gram; |
| 341 | for (j = 0; j < STIC_CARD_HEIGHT; j++) |
| 342 | render_line(machine, bitmap, memory[memoryLocation + j], |
| 343 | nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor); |
| 344 | } |
| 345 | } |
| 346 | } |
| 296 | 347 | } |
| 297 | 348 | |
| 298 | 349 | static void copy_sprites_to_background(running_machine &machine, bitmap_t *bitmap) |
| 299 | 350 | { |
| 300 | 351 | intv_state *state = machine.driver_data<intv_state>(); |
| 301 | | UINT8 width, currentPixel; |
| 302 | | UINT8 borderCollision, foregroundCollision; |
| 303 | | UINT8 spritePixelHeight, x, y; |
| 304 | | INT16 leftX, nextY, i; |
| 305 | | INT32 nextX; |
| 352 | UINT8 width, currentPixel; |
| 353 | UINT8 borderCollision, foregroundCollision; |
| 354 | UINT8 spritePixelHeight, x, y; |
| 355 | INT16 leftX, nextY, i; |
| 356 | INT16 leftBorder, rightBorder, topBorder, bottomBorder; |
| 357 | INT32 nextX; |
| 306 | 358 | |
| 307 | | for (i = 7; i >= 0; i--) { |
| 359 | for (i = STIC_MOBS - 1; i >= 0; i--) |
| 360 | { |
| 308 | 361 | intv_sprite_type *s = &state->m_sprite[i]; |
| 309 | | if (s->xpos == 0 || |
| 310 | | (!s->coll && !s->visible)) |
| 311 | | continue; |
| 362 | if (s->xpos == 0 || (!s->coll && !s->visible)) |
| 363 | continue; |
| 312 | 364 | |
| 313 | | borderCollision = FALSE; |
| 314 | | foregroundCollision = FALSE; |
| 365 | borderCollision = FALSE; |
| 366 | foregroundCollision = FALSE; |
| 315 | 367 | |
| 316 | | spritePixelHeight = (s->quady ? 4 : 1) * |
| 317 | | (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1)<<3; |
| 318 | | width = (s->doublex ? 2 : 1)<<3; |
| 368 | spritePixelHeight = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; |
| 369 | width = (s->doublex ? 2 : 1) * STIC_CARD_WIDTH; |
| 319 | 370 | |
| 320 | | leftX = (s->xpos-8+state->m_col_delay)<<1; |
| 321 | | nextY = (s->ypos-8+state->m_row_delay)<<1; |
| 371 | leftX = (s->xpos - STIC_CARD_WIDTH + STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay) * STIC_X_SCALE; |
| 372 | nextY = (s->ypos - STIC_CARD_HEIGHT + STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE; |
| 322 | 373 | |
| 323 | | for (y = 0; y < spritePixelHeight; y++) { |
| 324 | | for (x = 0; x < width; x++) { |
| 325 | | //if this sprite pixel is not on, then don't paint it |
| 326 | | if (!state->m_sprite_buffers[i][x][y]) |
| 327 | | continue; |
| 374 | leftBorder = (STIC_OVERSCAN_LEFT_WIDTH + (state->m_left_edge_inhibit ? STIC_CARD_WIDTH : 0)) * STIC_X_SCALE; |
| 375 | rightBorder = (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 - 1) * STIC_X_SCALE; |
| 376 | topBorder = (STIC_OVERSCAN_TOP_HEIGHT + (state->m_top_edge_inhibit ? STIC_CARD_HEIGHT : 0)) * STIC_Y_SCALE; |
| 377 | bottomBorder = (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE - 1; |
| 328 | 378 | |
| 329 | | nextX = leftX + (x<<1); |
| 330 | | //if the next pixel location is on the border, then we |
| 331 | | //have a border collision and we can ignore painting it |
| 332 | | if (nextX < (state->m_left_edge_inhibit ? 16 : 0) || nextX > 317 || |
| 333 | | nextY < (state->m_top_edge_inhibit ? 16: 0) || nextY > 191) |
| 334 | | { |
| 335 | | borderCollision = TRUE; |
| 336 | | continue; |
| 337 | | } |
| 379 | for (y = 0; y < spritePixelHeight; y++) |
| 380 | { |
| 381 | for (x = 0; x < width; x++) |
| 382 | { |
| 383 | //if this sprite pixel is not on, then don't paint it |
| 384 | if (!state->m_sprite_buffers[i][x][y]) |
| 385 | continue; |
| 338 | 386 | |
| 339 | | currentPixel = (*BITMAP_ADDR16(bitmap, nextY, nextX) -1) >> 1; |
| 387 | nextX = leftX + x; |
| 388 | //if the next pixel location is on the border, then we |
| 389 | //have a border collision and we can ignore painting it |
| 390 | if ((nextX < leftBorder) || (nextX > rightBorder) || |
| 391 | (nextY < topBorder) || (nextY > bottomBorder)) |
| 392 | { |
| 393 | borderCollision = TRUE; |
| 394 | continue; |
| 395 | } |
| 340 | 396 | |
| 341 | | //check for foreground collision |
| 342 | | if (currentPixel & FOREGROUND_BIT) { |
| 343 | | foregroundCollision = TRUE; |
| 344 | | if (s->behind_foreground) |
| 345 | | continue; |
| 346 | | } |
| 397 | currentPixel = intv_get_pixel(state, bitmap, nextX, nextY); |
| 347 | 398 | |
| 348 | | if (s->visible) { |
| 349 | | intv_plot_pixel(bitmap, nextX, nextY, s->color | (currentPixel & FOREGROUND_BIT)); |
| 350 | | intv_plot_pixel(bitmap, nextX+1, nextY, s->color | (currentPixel & FOREGROUND_BIT)); |
| 351 | | } |
| 352 | | } |
| 353 | | nextY++; |
| 354 | | } |
| 399 | //check for foreground collision |
| 400 | if (currentPixel & FOREGROUND_BIT) |
| 401 | { |
| 402 | foregroundCollision = TRUE; |
| 403 | if (s->behind_foreground) |
| 404 | continue; |
| 405 | } |
| 355 | 406 | |
| 356 | | //update the collision bits |
| 357 | | if (s->coll) { |
| 358 | | if (foregroundCollision) |
| 359 | | s->collision |= 0x0100; |
| 360 | | if (borderCollision) |
| 361 | | s->collision |= 0x0200; |
| 362 | | } |
| 363 | | } |
| 407 | if (s->visible) |
| 408 | { |
| 409 | intv_set_pixel(state, bitmap, nextX, nextY, s->color | (currentPixel & FOREGROUND_BIT)); |
| 410 | } |
| 411 | } |
| 412 | nextY++; |
| 413 | } |
| 414 | |
| 415 | //update the collision bits |
| 416 | if (s->coll) |
| 417 | { |
| 418 | if (foregroundCollision) |
| 419 | s->collision |= STIC_MCR_BKGD; |
| 420 | if (borderCollision) |
| 421 | s->collision |= STIC_MCR_BRDR; |
| 422 | } |
| 423 | } |
| 364 | 424 | } |
| 365 | 425 | |
| 366 | 426 | static void render_background(running_machine &machine, bitmap_t *bitmap) |
| 367 | 427 | { |
| 368 | 428 | intv_state *state = machine.driver_data<intv_state>(); |
| 369 | 429 | if (state->m_color_stack_mode) |
| 370 | | render_color_stack_mode(machine, bitmap); |
| 371 | | else |
| 372 | | render_fg_bg_mode(machine, bitmap); |
| 430 | render_color_stack_mode(machine, bitmap); |
| 431 | else |
| 432 | render_fg_bg_mode(machine, bitmap); |
| 373 | 433 | } |
| 374 | 434 | |
| 375 | 435 | #ifdef UNUSED_CODE |
| r12078 | r12079 | |
| 391 | 451 | |
| 392 | 452 | int j; |
| 393 | 453 | |
| 454 | int x0 = STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay; |
| 455 | int y0 = STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay; |
| 456 | |
| 394 | 457 | if (state->m_color_stack_mode == 1) |
| 395 | 458 | { |
| 396 | 459 | state->m_color_stack_offset = 0; |
| 397 | | for(row = 0; row < 12; row++) |
| 460 | for(row = 0; row < STIC_BACKTAB_HEIGHT; row++) |
| 398 | 461 | { |
| 399 | | for(col = 0; col < 20; col++) |
| 462 | for(col = 0; col < STIC_BACKTAB_WIDTH; col++) |
| 400 | 463 | { |
| 401 | 464 | value = state->m_ram16[offs]; |
| 402 | 465 | |
| 403 | | n_bit = value & 0x2000; |
| 404 | | p_bit = value & 0x1000; |
| 405 | | g_bit = value & 0x0800; |
| 466 | n_bit = value & STIC_CSTM_ADV; |
| 467 | p_bit = value & STIC_CSTM_FG3; |
| 468 | g_bit = value & STIC_CSTM_SEL; |
| 406 | 469 | |
| 407 | 470 | if (p_bit && (!g_bit)) // colored squares mode |
| 408 | 471 | { |
| 409 | | colora = value&0x7; |
| 410 | | colorb = (value>>3)&0x7; |
| 411 | | colorc = (value>>6)&0x7; |
| 412 | | colord = ((n_bit>>11)&0x4) + ((value>>9)&0x3); |
| 472 | colora = value & STIC_CSQM_A; |
| 473 | colorb = (value & STIC_CSQM_B) >> 3; |
| 474 | colorc = (value & STIC_CSQM_C) >> 6; |
| 475 | colord = ((n_bit & STIC_CSQM_D2) >> 11) + ((value & STIC_CSQM_D10) >> 9); |
| 413 | 476 | // color 7 if the top of the color stack in this mode |
| 414 | | if (colora == 7) colora = state->m_color_stack[3]; |
| 415 | | if (colorb == 7) colorb = state->m_color_stack[3]; |
| 416 | | if (colorc == 7) colorc = state->m_color_stack[3]; |
| 417 | | if (colord == 7) colord = state->m_color_stack[3]; |
| 418 | | plot_box(bitmap,col*16,row*16,8,8,(colora<<1)+1); |
| 419 | | plot_box(bitmap,col*16+8,row*16,8,8,(colorb<<1)+1); |
| 420 | | plot_box(bitmap,col*16,row*16+8,8,8,(colorc<<1)+1); |
| 421 | | plot_box(bitmap,col*16+8,row*16+8,8,8,(colord<<1)+1); |
| 477 | if (colora == 7) colora = state->m_stic_registers[STIC_CSR + STIC_CSR3]; |
| 478 | if (colorb == 7) colorb = state->m_stic_registers[STIC_CSR + STIC_CSR3]; |
| 479 | if (colorc == 7) colorc = state->m_stic_registers[STIC_CSR + STIC_CSR3]; |
| 480 | if (colord == 7) colord = state->m_stic_registers[STIC_CSR + STIC_CSR3]; |
| 481 | intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colora); |
| 482 | intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH)) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorb); |
| 483 | intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorc); |
| 484 | intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colord); |
| 422 | 485 | } |
| 423 | 486 | else // normal color stack mode |
| 424 | 487 | { |
| 425 | 488 | if (n_bit) // next color |
| 426 | 489 | { |
| 427 | 490 | state->m_color_stack_offset += 1; |
| 428 | | state->m_color_stack_offset &= 3; |
| 491 | state->m_color_stack_offset &= (STIC_CSRS - 1); |
| 429 | 492 | } |
| 430 | 493 | |
| 431 | 494 | if (p_bit) // pastel color set |
| 432 | | fgcolor = (value&0x7) + 8; |
| 495 | fgcolor = (value & STIC_CSTM_FG20) + 8; |
| 433 | 496 | else |
| 434 | | fgcolor = value&0x7; |
| 497 | fgcolor = value & STIC_CSTM_FG20; |
| 435 | 498 | |
| 436 | | bgcolor = state->m_color_stack[state->m_color_stack_offset]; |
| 437 | | code = (value>>3)&0xff; |
| 499 | bgcolor = state->m_stic_registers[STIC_CSR + state->m_color_stack_offset]; |
| 500 | code = (value & STIC_CSTM_C)>>3; |
| 438 | 501 | |
| 439 | 502 | if (g_bit) // read from gram |
| 440 | 503 | { |
| 441 | | code %= 64; // keep from going outside the array |
| 504 | code &= (STIC_CSTM_C50 >> 3); // keep from going outside the array |
| 442 | 505 | //if (state->m_gramdirtybytes[code] == 1) |
| 443 | 506 | { |
| 444 | 507 | decodechar(machine.gfx[1], |
| 445 | | code, |
| 446 | | state->m_gram, |
| 447 | | machine.config()->gfxdecodeinfo[1].gfxlayout); |
| 508 | code, |
| 509 | state->m_gram, |
| 510 | machine.config()->gfxdecodeinfo[1].gfxlayout); |
| 448 | 511 | state->m_gramdirtybytes[code] = 0; |
| 449 | 512 | } |
| 450 | 513 | // Draw GRAM char |
| 451 | 514 | drawgfx(bitmap,machine.gfx[1], |
| 452 | 515 | code, |
| 453 | 516 | bgcolor*16+fgcolor, |
| 454 | | 0,0,col*16,row*16, |
| 517 | 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, |
| 455 | 518 | 0,transparency,bgcolor); |
| 456 | 519 | |
| 457 | 520 | for(j=0;j<8;j++) |
| 458 | 521 | { |
| 459 | | //intv_plot_pixel(bitmap, col*16+j*2, row*16+7*2+1, 1); |
| 460 | | //intv_plot_pixel(bitmap, col*16+j*2+1, row*16+7*2+1, 1); |
| 522 | //intv_set_pixel(state, bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 1); |
| 461 | 523 | } |
| 462 | 524 | |
| 463 | 525 | } |
| r12078 | r12079 | |
| 466 | 528 | drawgfx(bitmap,machine.gfx[0], |
| 467 | 529 | code, |
| 468 | 530 | bgcolor*16+fgcolor, |
| 469 | | 0,0,col*16,row*16, |
| 531 | 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, |
| 470 | 532 | 0,transparency,bgcolor); |
| 471 | 533 | |
| 472 | 534 | for(j=0;j<8;j++) |
| 473 | 535 | { |
| 474 | | //intv_plot_pixel(bitmap, col*16+j*2, row*16+7*2+1, 2); |
| 475 | | //intv_plot_pixel(bitmap, col*16+j*2+1, row*16+7*2+1, 2); |
| 536 | //intv_set_pixel(state, bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 2); |
| 476 | 537 | } |
| 477 | 538 | } |
| 478 | 539 | } |
| r12078 | r12079 | |
| 483 | 544 | else |
| 484 | 545 | { |
| 485 | 546 | // fg/bg mode goes here |
| 486 | | for(row = 0; row < 12; row++) |
| 547 | for(row = 0; row < STIC_BACKTAB_HEIGHT; row++) |
| 487 | 548 | { |
| 488 | | for(col = 0; col < 20; col++) |
| 549 | for(col = 0; col < STIC_BACKTAB_WIDTH; col++) |
| 489 | 550 | { |
| 490 | 551 | value = state->m_ram16[offs]; |
| 491 | | fgcolor = value & 0x07; |
| 492 | | bgcolor = ((value & 0x2000)>>11)+((value & 0x1600)>>9); |
| 493 | | code = (value & 0x01f8)>>3; |
| 552 | fgcolor = value & STIC_FBM_FG; |
| 553 | bgcolor = ((value & STIC_FBM_BG2) >> 11) + ((value & STIC_FBM_BG310) >> 9); |
| 554 | code = (value & STIC_FBM_C) >> 3; |
| 494 | 555 | |
| 495 | | if (value & 0x0800) // read for GRAM |
| 556 | if (value & STIC_FBM_SEL) // read for GRAM |
| 496 | 557 | { |
| 497 | 558 | //if (state->m_gramdirtybytes[code] == 1) |
| 498 | 559 | { |
| 499 | 560 | decodechar(machine.gfx[1], |
| 500 | | code, |
| 501 | | state->m_gram, |
| 502 | | machine.config()->gfxdecodeinfo[1].gfxlayout); |
| 561 | code, |
| 562 | state->m_gram, |
| 563 | machine.config()->gfxdecodeinfo[1].gfxlayout); |
| 503 | 564 | state->m_gramdirtybytes[code] = 0; |
| 504 | 565 | } |
| 505 | 566 | // Draw GRAM char |
| 506 | 567 | drawgfx(bitmap,machine.gfx[1], |
| 507 | 568 | code, |
| 508 | 569 | bgcolor*16+fgcolor, |
| 509 | | 0,0,col*16,row*16, |
| 570 | 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, |
| 510 | 571 | 0,transparency,bgcolor); |
| 511 | 572 | } |
| 512 | 573 | else // read from GROM |
| r12078 | r12079 | |
| 514 | 575 | drawgfx(bitmap,machine.gfx[0], |
| 515 | 576 | code, |
| 516 | 577 | bgcolor*16+fgcolor, |
| 517 | | 0,0,col*16,row*16, |
| 578 | 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, |
| 518 | 579 | 0,transparency,bgcolor); |
| 519 | 580 | } |
| 520 | 581 | offs++; |
| r12078 | r12079 | |
| 529 | 590 | static void draw_sprites(running_machine &machine, bitmap_t *bitmap, int behind_foreground) |
| 530 | 591 | { |
| 531 | 592 | intv_state *state = machine.driver_data<intv_state>(); |
| 532 | | int i; |
| 533 | | int code; |
| 593 | int i; |
| 594 | int code; |
| 595 | int x0 = STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay - STIC_CARD_WIDTH; |
| 596 | int y0 = STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay - STIC_CARD_HEIGHT; |
| 534 | 597 | |
| 535 | | for(i=7;i>=0;--i) |
| 536 | | { |
| 537 | | intv_sprite_type *s = &state->m_sprite[i]; |
| 538 | | if (s->visible && (s->behind_foreground == behind_foreground)) |
| 539 | | { |
| 540 | | code = s->card; |
| 541 | | if (!s->grom) |
| 542 | | { |
| 543 | | code %= 64; // keep from going outside the array |
| 544 | | if (s->yres == 1) |
| 545 | | { |
| 546 | | //if (state->m_gramdirtybytes[code] == 1) |
| 547 | | { |
| 548 | | decodechar(machine.gfx[1], |
| 549 | | code, |
| 550 | | state->m_gram, |
| 551 | | machine.config()->gfxdecodeinfo[1].gfxlayout); |
| 552 | | state->m_gramdirtybytes[code] = 0; |
| 553 | | } |
| 554 | | // Draw GRAM char |
| 555 | | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1], |
| 556 | | code, |
| 557 | | s->color, |
| 558 | | s->xflip,s->yflip, |
| 559 | | s->xpos*2-16,s->ypos*2-16, |
| 560 | | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 561 | | } |
| 562 | | else |
| 563 | | { |
| 564 | | //if ((state->m_gramdirtybytes[code] == 1) || (state->m_gramdirtybytes[code+1] == 1)) |
| 565 | | { |
| 566 | | decodechar(machine.gfx[1], |
| 567 | | code, |
| 568 | | state->m_gram, |
| 569 | | machine.config()->gfxdecodeinfo[1].gfxlayout); |
| 570 | | decodechar(machine.gfx[1], |
| 571 | | code+1, |
| 572 | | state->m_gram, |
| 573 | | machine.config()->gfxdecodeinfo[1].gfxlayout); |
| 574 | | state->m_gramdirtybytes[code] = 0; |
| 575 | | state->m_gramdirtybytes[code+1] = 0; |
| 576 | | } |
| 577 | | // Draw GRAM char |
| 578 | | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1], |
| 579 | | code, |
| 580 | | s->color, |
| 581 | | s->xflip,s->yflip, |
| 582 | | s->xpos*2-16,s->ypos*2-16+(s->yflip)*s->ysize*8, |
| 583 | | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 584 | | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1], |
| 585 | | code+1, |
| 586 | | s->color, |
| 587 | | s->xflip,s->yflip, |
| 588 | | s->xpos*2-16,s->ypos*2-16+(1-s->yflip)*s->ysize*8, |
| 589 | | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 590 | | } |
| 591 | | } |
| 592 | | else |
| 593 | | { |
| 594 | | if (s->yres == 1) |
| 595 | | { |
| 596 | | // Draw GROM char |
| 597 | | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0], |
| 598 | | code, |
| 599 | | s->color, |
| 600 | | s->xflip,s->yflip, |
| 601 | | s->xpos*2-16,s->ypos*2-16, |
| 602 | | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 603 | | } |
| 604 | | else |
| 605 | | { |
| 606 | | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0], |
| 607 | | code, |
| 608 | | s->color, |
| 609 | | s->xflip,s->yflip, |
| 610 | | s->xpos*2-16,s->ypos*2-16+(s->yflip)*s->ysize*8, |
| 611 | | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 612 | | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0], |
| 613 | | code+1, |
| 614 | | s->color, |
| 615 | | s->xflip,s->yflip, |
| 616 | | s->xpos*2-16,s->ypos*2-16+(1-s->yflip)*s->ysize*8, |
| 617 | | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 618 | | } |
| 619 | | } |
| 620 | | } |
| 621 | | } |
| 598 | for(i = STIC_MOBS - 1; i >= 0; --i) |
| 599 | { |
| 600 | intv_sprite_type *s = &state->m_sprite[i]; |
| 601 | if (s->visible && (s->behind_foreground == behind_foreground)) |
| 602 | { |
| 603 | code = s->card; |
| 604 | if (!s->grom) |
| 605 | { |
| 606 | code %= 64; // keep from going outside the array |
| 607 | if (s->yres == 1) |
| 608 | { |
| 609 | //if (state->m_gramdirtybytes[code] == 1) |
| 610 | { |
| 611 | decodechar(machine.gfx[1], |
| 612 | code, |
| 613 | state->m_gram, |
| 614 | machine.config()->gfxdecodeinfo[1].gfxlayout); |
| 615 | state->m_gramdirtybytes[code] = 0; |
| 616 | } |
| 617 | // Draw GRAM char |
| 618 | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1], |
| 619 | code, |
| 620 | s->color, |
| 621 | s->xflip,s->yflip, |
| 622 | (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE, |
| 623 | 0x8000 * s->xsize, 0x8000 * s->ysize,0); |
| 624 | } |
| 625 | else |
| 626 | { |
| 627 | //if ((state->m_gramdirtybytes[code] == 1) || (state->m_gramdirtybytes[code+1] == 1)) |
| 628 | { |
| 629 | decodechar(machine.gfx[1], |
| 630 | code, |
| 631 | state->m_gram, |
| 632 | machine.config()->gfxdecodeinfo[1].gfxlayout); |
| 633 | decodechar(machine.gfx[1], |
| 634 | code+1, |
| 635 | state->m_gram, |
| 636 | machine.config()->gfxdecodeinfo[1].gfxlayout); |
| 637 | state->m_gramdirtybytes[code] = 0; |
| 638 | state->m_gramdirtybytes[code+1] = 0; |
| 639 | } |
| 640 | // Draw GRAM char |
| 641 | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1], |
| 642 | code, |
| 643 | s->color, |
| 644 | s->xflip,s->yflip, |
| 645 | (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, |
| 646 | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 647 | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1], |
| 648 | code+1, |
| 649 | s->color, |
| 650 | s->xflip,s->yflip, |
| 651 | (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + (1 - s->yflip) * s->ysize * STIC_CARD_HEIGHT, |
| 652 | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 653 | } |
| 654 | } |
| 655 | else |
| 656 | { |
| 657 | if (s->yres == 1) |
| 658 | { |
| 659 | // Draw GROM char |
| 660 | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0], |
| 661 | code, |
| 662 | s->color, |
| 663 | s->xflip,s->yflip, |
| 664 | (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE, |
| 665 | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 666 | } |
| 667 | else |
| 668 | { |
| 669 | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0], |
| 670 | code, |
| 671 | s->color, |
| 672 | s->xflip,s->yflip, |
| 673 | (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, |
| 674 | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 675 | drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0], |
| 676 | code+1, |
| 677 | s->color, |
| 678 | s->xflip,s->yflip, |
| 679 | (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + (1 - s->yflip) * s->ysize * STIC_CARD_HEIGHT, |
| 680 | 0x8000*s->xsize, 0x8000*s->ysize,0); |
| 681 | } |
| 682 | } |
| 683 | } |
| 684 | } |
| 622 | 685 | } |
| 623 | 686 | #endif |
| 624 | 687 | |
| 625 | 688 | static void draw_borders(running_machine &machine, bitmap_t *bm) |
| 626 | 689 | { |
| 627 | 690 | intv_state *state = machine.driver_data<intv_state>(); |
| 628 | | if (state->m_left_edge_inhibit) |
| 629 | | plot_box(bm, 0, 0, 16, 16*12, (state->m_border_color<<1)+1); |
| 630 | | else if (state->m_col_delay) |
| 631 | | plot_box(bm, 0, 0, state->m_col_delay*2, 16*12, (state->m_border_color<<1)+1); |
| 632 | 691 | |
| 633 | | if (state->m_top_edge_inhibit) |
| 634 | | plot_box(bm, 0, 0, 16*20, 16, (state->m_border_color<<1)+1); |
| 635 | | else if (state->m_row_delay) |
| 636 | | plot_box(bm, 0, 0, 16*20, state->m_row_delay*2, (state->m_border_color<<1)+1); |
| 692 | intv_plot_box(state, bm, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + (state->m_left_edge_inhibit ? STIC_CARD_WIDTH : state->m_col_delay)) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, state->m_border_color); |
| 693 | intv_plot_box(state, bm, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1) * STIC_X_SCALE, 0, STIC_OVERSCAN_RIGHT_WIDTH, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, state->m_border_color); |
| 694 | |
| 695 | intv_plot_box(state, bm, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + (state->m_top_edge_inhibit ? STIC_CARD_HEIGHT : state->m_row_delay)) * STIC_Y_SCALE, state->m_border_color); |
| 696 | intv_plot_box(state, bm, 0, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, STIC_OVERSCAN_BOTTOM_HEIGHT * STIC_Y_SCALE, state->m_border_color); |
| 637 | 697 | } |
| 638 | 698 | |
| 639 | 699 | void intv_stic_screenrefresh(running_machine &machine) |
| r12078 | r12079 | |
| 648 | 708 | render_background(machine, machine.generic.tmpbitmap); |
| 649 | 709 | // Render the sprites into their buffers |
| 650 | 710 | render_sprites(machine); |
| 651 | | for (i = 0; i < 8; i++) state->m_sprite[i].collision = 0; |
| 711 | for (i = 0; i < STIC_MOBS; i++) state->m_sprite[i].collision = 0; |
| 652 | 712 | // Copy the sprites to the background |
| 653 | 713 | copy_sprites_to_background(machine, machine.generic.tmpbitmap); |
| 654 | 714 | determine_sprite_collisions(state); |
| 655 | | for (i = 0; i < 8; i++) state->m_collision_registers[i] |= state->m_sprite[i].collision; |
| 715 | for (i = 0; i < STIC_MOBS; i++) state->m_stic_registers[STIC_MCR + i] |= state->m_sprite[i].collision; |
| 656 | 716 | /* draw the screen borders if enabled */ |
| 657 | 717 | draw_borders(machine, machine.generic.tmpbitmap); |
| 658 | 718 | } |
| 659 | 719 | else |
| 660 | 720 | { |
| 661 | 721 | /* STIC disabled, just fill with border color */ |
| 662 | | bitmap_fill(machine.generic.tmpbitmap, NULL, (state->m_border_color<<1)+1); |
| 722 | bitmap_fill(machine.generic.tmpbitmap, NULL, SET_COLOR(state->m_border_color)); |
| 663 | 723 | } |
| 664 | 724 | } |
| 665 | 725 | |
| r12078 | r12079 | |
| 720 | 780 | UINT8 *videoram = state->m_videoram; |
| 721 | 781 | int x,y,offs; |
| 722 | 782 | int current_row; |
| 723 | | // char c; |
| 783 | // char c; |
| 724 | 784 | |
| 725 | 785 | /* Draw the underlying INTV screen first */ |
| 726 | 786 | SCREEN_UPDATE_CALL(generic_bitmapped); |