src/mess/video/arcadia.c
| r14119 | r14120 | |
| 2 | 2 | Consolidation and enhancment of documentation by Manfred Schneider based on previous work from |
| 3 | 3 | PeT mess@utanet.at and Paul Robson (autismuk@aol.com) |
| 4 | 4 | |
| 5 | | Schematics, manuals and anything you can desire for at http://amigan.classicgaming.gamespy.com/ |
| 5 | Schematics, manuals and anything you can desire for at http://amigan.1emu.net/ |
| 6 | 6 | |
| 7 | 7 | TODO: find a dump of the charactyer ROM |
| 8 | 8 | convert the drawing code to tilemap |
| r14119 | r14120 | |
| 219 | 219 | 02D0 - 02FF RAM (not used by UVI, can be used by CPU) |
| 220 | 220 | */ |
| 221 | 221 | |
| 222 | | #include "emu.h" |
| 222 | |
| 223 | 223 | #include "includes/arcadia.h" |
| 224 | 224 | |
| 225 | 225 | static const UINT8 chars[0x40][8]={ |
| 226 | | // read from the screen generated from a palladium |
| 227 | | { 0,0,0,0,0,0,0,0 }, // 00 (space) |
| 228 | | { 1,2,4,8,16,32,64,128 }, // ; 01 (\) |
| 229 | | { 128,64,32,16,8,4,2,1 }, // ; 02 (/) |
| 230 | | { 255,255,255,255,255,255,255,255 }, //; 03 (solid block) |
| 231 | | { 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00 },// 04 (?) |
| 232 | | { 3,3,3,3,3,3,3,3 }, // ; 05 (half square right on) |
| 233 | | { 0,0,0,0,0,0,255,255 }, // ; 06 (horz lower line) |
| 234 | | { 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 },// 07 (half square left on) |
| 235 | | { 0xff,0xff,3,3,3,3,3,3 }, // 08 (?) |
| 236 | | { 0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 },// 09 (?) |
| 237 | | { 192,192,192,192,192,192,255,255 }, //; 0A (!_) |
| 238 | | { 3,3,3,3,3,3,255,255 }, // ; 0B (_!) |
| 239 | | { 1,3,7,15,31,63,127,255 }, // ; 0C (diagonal block) |
| 240 | | { 128,192,224,240,248,252,254,255 }, //; 0D (diagonal block) |
| 241 | | { 255,254,252,248,240,224,192,128 }, //; 0E (diagonal block) |
| 242 | | { 255,127,63,31,15,7,3,1 }, // ; 0F (diagonal block) |
| 243 | | { 0x00,0x1c,0x22,0x26,0x2a,0x32,0x22,0x1c },// 10 0 |
| 244 | | { 0x00,0x08,0x18,0x08,0x08,0x08,0x08,0x1c },// 11 1 |
| 245 | | { 0x00,0x1c,0x22,0x02,0x0c,0x10,0x20,0x3e },// 12 2 |
| 246 | | { 0x00,0x3e,0x02,0x04,0x0c,0x02,0x22,0x1c },// 13 3 |
| 247 | | { 0x00,0x04,0x0c,0x14,0x24,0x3e,0x04,0x04 },// 14 4 |
| 248 | | { 0x00,0x3e,0x20,0x3c,0x02,0x02,0x22,0x1c },// 15 5 |
| 249 | | { 0x00,0x0c,0x10,0x20,0x3c,0x22,0x22,0x1c },// 16 6 |
| 250 | | { 0x00,0x7c,0x02,0x04,0x08,0x10,0x10,0x10 },// 17 7 |
| 251 | | { 0x00,0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c },// 18 8 |
| 252 | | { 0x00,0x1c,0x22,0x22,0x3e,0x02,0x04,0x18 },// 19 9 |
| 253 | | { 0x00,0x08,0x14,0x22,0x22,0x3e,0x22,0x22 },// 1A A |
| 254 | | { 0x00,0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c },// 1B B |
| 255 | | { 0x00,0x1c,0x22,0x20,0x20,0x20,0x22,0x1c },// 1C C |
| 256 | | { 0x00,0x3c,0x22,0x22,0x22,0x22,0x22,0x3c },// 1D D |
| 257 | | { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e },// 1E E |
| 258 | | { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x20 },// 1F F |
| 259 | | { 0x00,0x1e,0x20,0x20,0x20,0x26,0x22,0x1e },// 20 G |
| 260 | | { 0x00,0x22,0x22,0x22,0x3e,0x22,0x22,0x22 },// 21 H |
| 261 | | { 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x1c },// 22 I |
| 262 | | { 0x00,0x02,0x02,0x02,0x02,0x02,0x22,0x1c },// 23 J |
| 263 | | { 0x00,0x22,0x24,0x28,0x30,0x28,0x24,0x22 },// 24 K |
| 264 | | { 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x3e },// 25 L |
| 265 | | { 0x00,0x22,0x36,0x2a,0x2a,0x22,0x22,0x22 },// 26 M |
| 266 | | { 0x00,0x22,0x22,0x32,0x2a,0x26,0x22,0x22 },// 27 N |
| 267 | | { 0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c },// 28 O |
| 268 | | { 0x00,0x3c,0x22,0x22,0x3c,0x20,0x20,0x20 },// 29 P |
| 269 | | { 0x00,0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a },// 2A Q |
| 270 | | { 0x00,0x3c,0x22,0x22,0x3c,0x28,0x24,0x22 },// 2B R |
| 271 | | { 0x00,0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c },// 2C S |
| 272 | | { 0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08 },// 2D T |
| 273 | | { 0x00,0x22,0x22,0x22,0x22,0x22,0x22,0x1c },// 2E U |
| 274 | | { 0x00,0x22,0x22,0x22,0x22,0x22,0x14,0x08 },// 2F V |
| 275 | | { 0x00,0x22,0x22,0x22,0x2a,0x2a,0x36,0x22 },// 30 W |
| 276 | | { 0x00,0x22,0x22,0x14,0x08,0x14,0x22,0x22 },// 31 X |
| 277 | | { 0x00,0x22,0x22,0x14,0x08,0x08,0x08,0x08 },// 32 Y |
| 278 | | { 0x00,0x3e,0x02,0x04,0x08,0x10,0x20,0x3e },// 33 Z |
| 279 | | { 0,0,0,0,0,0,0,8 }, // 34 . |
| 280 | | { 0,0,0,0,0,8,8,0x10 }, // 35 , |
| 281 | | { 0,0,8,8,0x3e,8,8,0 }, // 36 + |
| 282 | | { 0,8,0x1e,0x28,0x1c,0xa,0x3c,8 }, // 37 $ |
| 283 | | // 8x user defined |
| 226 | // read from the screen generated from a palladium |
| 227 | { 0,0,0,0,0,0,0,0 }, // 00 (space) |
| 228 | { 1,2,4,8,16,32,64,128 }, // 01 (\) |
| 229 | { 128,64,32,16,8,4,2,1 }, // 02 (/) |
| 230 | { 255,255,255,255,255,255,255,255 }, // 03 (solid block) |
| 231 | { 0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00 },// 04 (?) |
| 232 | { 3,3,3,3,3,3,3,3 }, // 05 (half square right on) |
| 233 | { 0,0,0,0,0,0,255,255 }, // 06 (horz lower line) |
| 234 | { 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 },// 07 (half square left on) |
| 235 | { 0xff,0xff,3,3,3,3,3,3 }, // 08 (?) |
| 236 | { 0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 },// 09 (?) |
| 237 | { 192,192,192,192,192,192,255,255 }, // 0A (!_) |
| 238 | { 3,3,3,3,3,3,255,255 }, // 0B (_!) |
| 239 | { 1,3,7,15,31,63,127,255 }, // 0C (diagonal block) |
| 240 | { 128,192,224,240,248,252,254,255 }, // 0D (diagonal block) |
| 241 | { 255,254,252,248,240,224,192,128 }, // 0E (diagonal block) |
| 242 | { 255,127,63,31,15,7,3,1 }, // 0F (diagonal block) |
| 243 | { 0x00,0x1c,0x22,0x26,0x2a,0x32,0x22,0x1c },// 10 0 |
| 244 | { 0x00,0x08,0x18,0x08,0x08,0x08,0x08,0x1c },// 11 1 |
| 245 | { 0x00,0x1c,0x22,0x02,0x0c,0x10,0x20,0x3e },// 12 2 |
| 246 | { 0x00,0x3e,0x02,0x04,0x0c,0x02,0x22,0x1c },// 13 3 |
| 247 | { 0x00,0x04,0x0c,0x14,0x24,0x3e,0x04,0x04 },// 14 4 |
| 248 | { 0x00,0x3e,0x20,0x3c,0x02,0x02,0x22,0x1c },// 15 5 |
| 249 | { 0x00,0x0c,0x10,0x20,0x3c,0x22,0x22,0x1c },// 16 6 |
| 250 | { 0x00,0x7c,0x02,0x04,0x08,0x10,0x10,0x10 },// 17 7 |
| 251 | { 0x00,0x1c,0x22,0x22,0x1c,0x22,0x22,0x1c },// 18 8 |
| 252 | { 0x00,0x1c,0x22,0x22,0x3e,0x02,0x04,0x18 },// 19 9 |
| 253 | { 0x00,0x08,0x14,0x22,0x22,0x3e,0x22,0x22 },// 1A A |
| 254 | { 0x00,0x3c,0x22,0x22,0x3c,0x22,0x22,0x3c },// 1B B |
| 255 | { 0x00,0x1c,0x22,0x20,0x20,0x20,0x22,0x1c },// 1C C |
| 256 | { 0x00,0x3c,0x22,0x22,0x22,0x22,0x22,0x3c },// 1D D |
| 257 | { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x3e },// 1E E |
| 258 | { 0x00,0x3e,0x20,0x20,0x3c,0x20,0x20,0x20 },// 1F F |
| 259 | { 0x00,0x1e,0x20,0x20,0x20,0x26,0x22,0x1e },// 20 G |
| 260 | { 0x00,0x22,0x22,0x22,0x3e,0x22,0x22,0x22 },// 21 H |
| 261 | { 0x00,0x1c,0x08,0x08,0x08,0x08,0x08,0x1c },// 22 I |
| 262 | { 0x00,0x02,0x02,0x02,0x02,0x02,0x22,0x1c },// 23 J |
| 263 | { 0x00,0x22,0x24,0x28,0x30,0x28,0x24,0x22 },// 24 K |
| 264 | { 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x3e },// 25 L |
| 265 | { 0x00,0x22,0x36,0x2a,0x2a,0x22,0x22,0x22 },// 26 M |
| 266 | { 0x00,0x22,0x22,0x32,0x2a,0x26,0x22,0x22 },// 27 N |
| 267 | { 0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c },// 28 O |
| 268 | { 0x00,0x3c,0x22,0x22,0x3c,0x20,0x20,0x20 },// 29 P |
| 269 | { 0x00,0x1c,0x22,0x22,0x22,0x2a,0x24,0x1a },// 2A Q |
| 270 | { 0x00,0x3c,0x22,0x22,0x3c,0x28,0x24,0x22 },// 2B R |
| 271 | { 0x00,0x1c,0x22,0x20,0x1c,0x02,0x22,0x1c },// 2C S |
| 272 | { 0x00,0x3e,0x08,0x08,0x08,0x08,0x08,0x08 },// 2D T |
| 273 | { 0x00,0x22,0x22,0x22,0x22,0x22,0x22,0x1c },// 2E U |
| 274 | { 0x00,0x22,0x22,0x22,0x22,0x22,0x14,0x08 },// 2F V |
| 275 | { 0x00,0x22,0x22,0x22,0x2a,0x2a,0x36,0x22 },// 30 W |
| 276 | { 0x00,0x22,0x22,0x14,0x08,0x14,0x22,0x22 },// 31 X |
| 277 | { 0x00,0x22,0x22,0x14,0x08,0x08,0x08,0x08 },// 32 Y |
| 278 | { 0x00,0x3e,0x02,0x04,0x08,0x10,0x20,0x3e },// 33 Z |
| 279 | { 0,0,0,0,0,0,0,8 }, // 34 . |
| 280 | { 0,0,0,0,0,8,8,0x10 }, // 35 , |
| 281 | { 0,0,8,8,0x3e,8,8,0 }, // 36 + |
| 282 | { 0,8,0x1e,0x28,0x1c,0xa,0x3c,8 }, // 37 $ |
| 283 | // 8x user defined |
| 284 | 284 | }; |
| 285 | 285 | |
| 286 | 286 | VIDEO_START( arcadia ) |
| r14119 | r14120 | |
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | | READ8_HANDLER(arcadia_video_r) |
| 313 | READ8_MEMBER( arcadia_state::arcadia_video_r ) |
| 314 | 314 | { |
| 315 | | arcadia_state *state = space->machine().driver_data<arcadia_state>(); |
| 316 | | UINT8 data=0; |
| 317 | | switch (offset) { |
| 318 | | case 0xff: data=state->m_charline|0xf0;break; |
| 319 | | case 0x100: data=input_port_read(space->machine(), "controller1_col1");break; |
| 320 | | case 0x101: data=input_port_read(space->machine(), "controller1_col2");break; |
| 321 | | case 0x102: data=input_port_read(space->machine(), "controller1_col3");break; |
| 322 | | case 0x103: data=input_port_read(space->machine(), "controller1_extra");break; |
| 323 | | case 0x104: data=input_port_read(space->machine(), "controller2_col1");break; |
| 324 | | case 0x105: data=input_port_read(space->machine(), "controller2_col2");break; |
| 325 | | case 0x106: data=input_port_read(space->machine(), "controller2_col3");break; |
| 326 | | case 0x107: data=input_port_read(space->machine(), "controller2_extra");break; |
| 327 | | case 0x108: data=input_port_read(space->machine(), "panel");break; |
| 315 | UINT8 data=0; |
| 316 | switch (offset) |
| 317 | { |
| 318 | case 0xff: data=m_charline|0xf0;break; |
| 319 | case 0x100: data=input_port_read(machine(), "controller1_col1");break; |
| 320 | case 0x101: data=input_port_read(machine(), "controller1_col2");break; |
| 321 | case 0x102: data=input_port_read(machine(), "controller1_col3");break; |
| 322 | case 0x103: data=input_port_read(machine(), "controller1_extra");break; |
| 323 | case 0x104: data=input_port_read(machine(), "controller2_col1");break; |
| 324 | case 0x105: data=input_port_read(machine(), "controller2_col2");break; |
| 325 | case 0x106: data=input_port_read(machine(), "controller2_col3");break; |
| 326 | case 0x107: data=input_port_read(machine(), "controller2_extra");break; |
| 327 | case 0x108: data=input_port_read(machine(), "panel");break; |
| 328 | 328 | #if 0 |
| 329 | | case 0x1fe: |
| 330 | | if (state->m_ad_select) |
| 331 | | data=input_port_read(space->machine(), "controller1_joy_y")<<3; |
| 332 | | else |
| 333 | | data=input_port_read(space->machine(), "controller1_joy_x")<<3; |
| 334 | | break; |
| 335 | | case 0x1ff: |
| 336 | | if (state->m_ad_select) |
| 337 | | data=input_port_read(space->machine(), "controller2_joy_y")<<3; |
| 338 | | else |
| 339 | | data=input_port_read(space->machine(), "controller2_joy_x")<<3; |
| 340 | | break; |
| 329 | case 0x1fe: |
| 330 | if (m_ad_select) |
| 331 | data=input_port_read(machine(), "controller1_joy_y")<<3; |
| 332 | else |
| 333 | data=input_port_read(machine(), "controller1_joy_x")<<3; |
| 334 | break; |
| 335 | case 0x1ff: |
| 336 | if (m_ad_select) |
| 337 | data=input_port_read(machine(), "controller2_joy_y")<<3; |
| 338 | else |
| 339 | data=input_port_read(machine(), "controller2_joy_x")<<3; |
| 340 | break; |
| 341 | 341 | #else |
| 342 | | case 0x1fe: |
| 343 | | data = 0x80; |
| 344 | | if (state->m_ad_select) { |
| 345 | | if (input_port_read(space->machine(), "joysticks")&0x10) data=0; |
| 346 | | if (input_port_read(space->machine(), "joysticks")&0x20) data=0xff; |
| 347 | | } else { |
| 348 | | if (input_port_read(space->machine(), "joysticks")&0x40) data=0xff; |
| 349 | | if (input_port_read(space->machine(), "joysticks")&0x80) data=0; |
| 342 | case 0x1fe: |
| 343 | data = 0x80; |
| 344 | if (m_ad_select) |
| 345 | { |
| 346 | if (input_port_read(machine(), "joysticks")&0x10) data=0; |
| 347 | if (input_port_read(machine(), "joysticks")&0x20) data=0xff; |
| 348 | } |
| 349 | else |
| 350 | { |
| 351 | if (input_port_read(machine(), "joysticks")&0x40) data=0xff; |
| 352 | if (input_port_read(machine(), "joysticks")&0x80) data=0; |
| 353 | } |
| 354 | break; |
| 355 | case 0x1ff: |
| 356 | data = 0x6f; // 0x7f too big for alien invaders (move right) |
| 357 | if (m_ad_select) |
| 358 | { |
| 359 | if (input_port_read(machine(), "joysticks")&0x1) data=0; |
| 360 | if (input_port_read(machine(), "joysticks")&0x2) data=0xff; |
| 361 | } |
| 362 | else |
| 363 | { |
| 364 | if (input_port_read(machine(), "joysticks")&0x4) data=0xff; |
| 365 | if (input_port_read(machine(), "joysticks")&0x8) data=0; |
| 366 | } |
| 367 | break; |
| 368 | #endif |
| 369 | default: |
| 370 | data = m_reg.data[offset]; |
| 350 | 371 | } |
| 351 | | break; |
| 352 | | case 0x1ff: |
| 353 | | data = 0x6f; // 0x7f too big for alien invaders (movs right) |
| 354 | | if (state->m_ad_select) { |
| 355 | | if (input_port_read(space->machine(), "joysticks")&0x1) data=0; |
| 356 | | if (input_port_read(space->machine(), "joysticks")&0x2) data=0xff; |
| 357 | | } else { |
| 358 | | if (input_port_read(space->machine(), "joysticks")&0x4) data=0xff; |
| 359 | | if (input_port_read(space->machine(), "joysticks")&0x8) data=0; |
| 360 | | } |
| 361 | | break; |
| 362 | | #endif |
| 363 | | default: |
| 364 | | data=state->m_reg.data[offset]; |
| 365 | | } |
| 366 | | return data; |
| 372 | return data; |
| 367 | 373 | } |
| 368 | 374 | |
| 369 | | WRITE8_HANDLER(arcadia_video_w) |
| 375 | WRITE8_MEMBER( arcadia_state::arcadia_video_w ) |
| 370 | 376 | { |
| 371 | | arcadia_state *state = space->machine().driver_data<arcadia_state>(); |
| 372 | | state->m_reg.data[offset]=data; |
| 377 | m_reg.data[offset]=data; |
| 373 | 378 | switch (offset) |
| 374 | 379 | { |
| 375 | 380 | case 0xfc: |
| 376 | | state->m_ypos=255-data+YPOS; |
| 381 | m_ypos=255-data+YPOS; |
| 377 | 382 | break; |
| 378 | 383 | case 0xfd: |
| 379 | | arcadia_soundport_w(space->machine().device("custom"), offset&3, data); |
| 380 | | state->m_multicolor=data&0x80; |
| 384 | arcadia_soundport_w(machine().device("custom"), offset&3, data); |
| 385 | m_multicolor = data & 0x80; |
| 381 | 386 | break; |
| 382 | 387 | case 0xfe: |
| 383 | | arcadia_soundport_w(space->machine().device("custom"), offset&3, data); |
| 384 | | state->m_shift=(data>>5); |
| 388 | arcadia_soundport_w(machine().device("custom"), offset&3, data); |
| 389 | m_shift = (data>>5); |
| 385 | 390 | break; |
| 386 | | case 0xf0: case 0xf2: case 0xf4: case 0xf6: |
| 387 | | state->m_pos[(offset>>1)&3].y=(data^0xff)+1; |
| 391 | case 0xf0: |
| 392 | case 0xf2: |
| 393 | case 0xf4: |
| 394 | case 0xf6: |
| 395 | m_pos[(offset>>1)&3].y = (data^0xff)+1; |
| 388 | 396 | break; |
| 389 | | case 0xf1: case 0xf3: case 0xf5: case 0xf7: |
| 390 | | state->m_pos[(offset>>1)&3].x=data-43; |
| 397 | case 0xf1: |
| 398 | case 0xf3: |
| 399 | case 0xf5: |
| 400 | case 0xf7: |
| 401 | m_pos[(offset>>1)&3].x = data-43; |
| 391 | 402 | break; |
| 392 | 403 | case 0x180: case 0x181: case 0x182: case 0x183: case 0x184: case 0x185: case 0x186: case 0x187: |
| 393 | 404 | case 0x188: case 0x189: case 0x18a: case 0x18b: case 0x18c: case 0x18d: case 0x18e: case 0x18f: |
| r14119 | r14120 | |
| 397 | 408 | case 0x1a8: case 0x1a9: case 0x1aa: case 0x1ab: case 0x1ac: case 0x1ad: case 0x1ae: case 0x1af: |
| 398 | 409 | case 0x1b0: case 0x1b1: case 0x1b2: case 0x1b3: case 0x1b4: case 0x1b5: case 0x1b6: case 0x1b7: |
| 399 | 410 | case 0x1b8: case 0x1b9: case 0x1ba: case 0x1bb: case 0x1bc: case 0x1bd: case 0x1be: case 0x1bf: |
| 400 | | state->m_chars[0x38|((offset>>3)&7)][offset&7]=data; |
| 411 | m_chars[0x38|((offset>>3)&7)][offset&7] = data; |
| 401 | 412 | break; |
| 402 | 413 | case 0x1f8: |
| 403 | | state->m_lines26=data&0x40; |
| 404 | | state->m_graphics=data&0x80; |
| 414 | m_lines26 = data & 0x40; |
| 415 | m_graphics = data & 0x80; |
| 405 | 416 | break; |
| 406 | 417 | case 0x1f9: |
| 407 | | state->m_doublescan=!(data&0x80); |
| 408 | | state->m_ad_delay=10; |
| 418 | m_doublescan =! (data&0x80); |
| 419 | m_ad_delay = 10; |
| 409 | 420 | break; |
| 410 | 421 | } |
| 411 | 422 | } |
| 412 | 423 | |
| 413 | | INLINE void arcadia_draw_char(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *ch, int charcode, |
| 414 | | int y, int x) |
| 424 | INLINE void arcadia_draw_char(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *ch, int charcode, int y, int x) |
| 415 | 425 | { |
| 416 | 426 | arcadia_state *state = machine.driver_data<arcadia_state>(); |
| 417 | | int k,b,cc,sc, colour; |
| 418 | | if (state->m_multicolor) |
| 427 | int k,b,cc,sc, colour; |
| 428 | if (state->m_multicolor) |
| 419 | 429 | { |
| 420 | 430 | if (charcode&0x40) |
| 421 | 431 | cc=((state->m_reg.d.pal[1]>>3)&7); |
| r14119 | r14120 | |
| 426 | 436 | sc=(state->m_reg.d.pal[1]&7); |
| 427 | 437 | else |
| 428 | 438 | sc=(state->m_reg.d.pal[0]&7); |
| 429 | | |
| 430 | | } |
| 439 | } |
| 431 | 440 | else |
| 432 | 441 | { |
| 433 | | cc=((state->m_reg.d.pal[1]>>3)&1)|((charcode>>5)&6); |
| 434 | | sc=(state->m_reg.d.pal[1]&7); |
| 435 | | } |
| 442 | cc=((state->m_reg.d.pal[1]>>3)&1)|((charcode>>5)&6); |
| 443 | sc=(state->m_reg.d.pal[1]&7); |
| 444 | } |
| 436 | 445 | colour = (((sc << 3) | cc) + 4); |
| 437 | 446 | |
| 438 | | if (state->m_doublescan) |
| 447 | if (state->m_doublescan) |
| 439 | 448 | { |
| 440 | | for (k=0; (k<8)&&(y<bitmap.height()); k++, y+=2) |
| 449 | for (k=0; (k<8)&&(y<bitmap.height()); k++, y+=2) |
| 441 | 450 | { |
| 442 | | b=ch[k]; |
| 443 | | state->m_bg[y][x>>3]|=b>>(x&7); |
| 444 | | state->m_bg[y][(x>>3)+1]|=b<<(8-(x&7)); |
| 451 | b=ch[k]; |
| 452 | state->m_bg[y][x>>3]|=b>>(x&7); |
| 453 | state->m_bg[y][(x>>3)+1]|=b<<(8-(x&7)); |
| 445 | 454 | |
| 446 | | if (y+1<bitmap.height()) { |
| 447 | | state->m_bg[y+1][x>>3]|=b>>(x&7); |
| 448 | | state->m_bg[y+1][(x>>3)+1]|=b<<(8-(x&7)); |
| 449 | | drawgfx_opaque(bitmap, bitmap.cliprect(), machine.gfx[0], b,colour, |
| 450 | | 0,0,x,y); |
| 451 | | drawgfx_opaque(bitmap, bitmap.cliprect(), machine.gfx[0], b,colour, |
| 452 | | 0,0,x,y+1); |
| 453 | | } |
| 455 | if (y+1<bitmap.height()) |
| 456 | { |
| 457 | state->m_bg[y+1][x>>3]|=b>>(x&7); |
| 458 | state->m_bg[y+1][(x>>3)+1]|=b<<(8-(x&7)); |
| 459 | drawgfx_opaque(bitmap, bitmap.cliprect(), machine.gfx[0], b,colour, 0,0,x,y); |
| 460 | drawgfx_opaque(bitmap, bitmap.cliprect(), machine.gfx[0], b,colour, 0,0,x,y+1); |
| 461 | } |
| 454 | 462 | } |
| 455 | | } |
| 463 | } |
| 456 | 464 | else |
| 457 | 465 | { |
| 458 | | for (k=0; (k<8)&&(y<bitmap.height()); k++, y++) |
| 466 | for (k=0; (k<8)&&(y<bitmap.height()); k++, y++) |
| 459 | 467 | { |
| 460 | | b=ch[k]; |
| 461 | | state->m_bg[y][x>>3]|=b>>(x&7); |
| 462 | | state->m_bg[y][(x>>3)+1]|=b<<(8-(x&7)); |
| 468 | b=ch[k]; |
| 469 | state->m_bg[y][x>>3]|=b>>(x&7); |
| 470 | state->m_bg[y][(x>>3)+1]|=b<<(8-(x&7)); |
| 463 | 471 | |
| 464 | | drawgfx_opaque(bitmap, bitmap.cliprect(), machine.gfx[0], b,colour, |
| 465 | | 0,0,x,y); |
| 472 | drawgfx_opaque(bitmap, bitmap.cliprect(), machine.gfx[0], b,colour, 0,0,x,y); |
| 466 | 473 | } |
| 467 | | } |
| 474 | } |
| 468 | 475 | } |
| 469 | 476 | |
| 470 | | INLINE void arcadia_vh_draw_line(running_machine &machine, bitmap_ind16 &bitmap, |
| 471 | | int y, UINT8 chars1[16]) |
| 477 | INLINE void arcadia_vh_draw_line(running_machine &machine, bitmap_ind16 &bitmap, int y, UINT8 chars1[16]) |
| 472 | 478 | { |
| 473 | 479 | arcadia_state *state = machine.driver_data<arcadia_state>(); |
| 474 | | int x, ch, j, h; |
| 475 | | int graphics=state->m_graphics; |
| 476 | | h=state->m_doublescan?16:8; |
| 480 | int x, ch, j, h; |
| 481 | int graphics=state->m_graphics; |
| 482 | h=state->m_doublescan ? 16 : 8 ; |
| 477 | 483 | |
| 478 | | if (bitmap.height()-state->m_line<h) |
| 484 | if (bitmap.height()-state->m_line<h) |
| 479 | 485 | h=bitmap.height()-state->m_line; |
| 480 | 486 | |
| 481 | 487 | bitmap.plot_box(0, y, bitmap.width(), h, (state->m_reg.d.pal[1]&7)); |
| 482 | | memset(state->m_bg[y], 0, sizeof(state->m_bg[0])*h); |
| 488 | memset(state->m_bg[y], 0, sizeof(state->m_bg[0])*h); |
| 483 | 489 | |
| 484 | 490 | for (x=XPOS+state->m_shift, j=0; j<16;j++,x+=8) |
| 485 | 491 | { |
| r14119 | r14120 | |
| 488 | 494 | // alien invaders shield lines start with 0xc0 |
| 489 | 495 | if ((ch&0x3f)==0) |
| 490 | 496 | { |
| 491 | | switch (ch) { |
| 492 | | case 0xc0: graphics=TRUE;break; |
| 493 | | case 0x40: graphics=FALSE;break; |
| 494 | | // case 0x80: |
| 495 | | // alien invaders shields are empty 0x80 |
| 496 | | // popmessage(5, "graphics code 0x80 used"); |
| 497 | switch (ch) |
| 498 | { |
| 499 | case 0xc0: graphics=TRUE;break; |
| 500 | case 0x40: graphics=FALSE;break; |
| 501 | // case 0x80: |
| 502 | // alien invaders shields are empty 0x80 |
| 503 | // popmessage(5, "graphics code 0x80 used"); |
| 497 | 504 | } |
| 498 | 505 | } |
| 499 | 506 | if (graphics) |
| 500 | 507 | arcadia_draw_char(machine, bitmap, state->m_rectangle[ch&0x3f], ch, y, x); |
| 501 | 508 | else |
| 502 | 509 | arcadia_draw_char(machine, bitmap, state->m_chars[ch&0x3f], ch, y, x); |
| 503 | | } |
| 510 | } |
| 504 | 511 | } |
| 505 | 512 | |
| 506 | 513 | static int arcadia_sprite_collision(arcadia_state *state, int n1, int n2) |
| 507 | 514 | { |
| 508 | | int k, b1, b2, x; |
| 509 | | if (state->m_pos[n1].x+8<=state->m_pos[n2].x) return FALSE; |
| 510 | | if (state->m_pos[n1].x>=state->m_pos[n2].x+8) return FALSE; |
| 511 | | for (k=0; k<8; k++) { |
| 512 | | if (state->m_pos[n1].y+k<state->m_pos[n2].y) continue; |
| 513 | | if (state->m_pos[n1].y+k>=state->m_pos[n2].y+8) break; |
| 514 | | x=state->m_pos[n1].x-state->m_pos[n2].x; |
| 515 | | b1=state->m_reg.d.chars[n1][k]; |
| 516 | | b2=state->m_reg.d.chars[n2][state->m_pos[n1].y+k-state->m_pos[n2].y]; |
| 517 | | if (x<0) b2>>=-x; |
| 518 | | if (x>0) b1>>=x; |
| 519 | | if (b1&b2) return TRUE; |
| 520 | | } |
| 521 | | return FALSE; |
| 515 | int k, b1, b2, x; |
| 516 | if (state->m_pos[n1].x+8<=state->m_pos[n2].x) |
| 517 | return FALSE; |
| 518 | if (state->m_pos[n1].x>=state->m_pos[n2].x+8) |
| 519 | return FALSE; |
| 520 | |
| 521 | for (k=0; k<8; k++) |
| 522 | { |
| 523 | if (state->m_pos[n1].y+k<state->m_pos[n2].y) |
| 524 | continue; |
| 525 | if (state->m_pos[n1].y+k>=state->m_pos[n2].y+8) |
| 526 | break; |
| 527 | x=state->m_pos[n1].x-state->m_pos[n2].x; |
| 528 | b1=state->m_reg.d.chars[n1][k]; |
| 529 | b2=state->m_reg.d.chars[n2][state->m_pos[n1].y+k-state->m_pos[n2].y]; |
| 530 | if (x<0) |
| 531 | b2>>=-x; |
| 532 | if (x>0) |
| 533 | b1>>=x; |
| 534 | if (b1&b2) |
| 535 | return TRUE; |
| 536 | } |
| 537 | return FALSE; |
| 522 | 538 | } |
| 523 | 539 | |
| 524 | 540 | static void arcadia_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap) |
| 525 | 541 | { |
| 526 | 542 | arcadia_state *state = machine.driver_data<arcadia_state>(); |
| 527 | | int i, k, x, y, color=0; |
| 528 | | UINT8 b; |
| 543 | int i, k, x, y, color=0; |
| 544 | UINT8 b; |
| 529 | 545 | |
| 530 | | state->m_reg.d.collision_bg|=0xf; |
| 531 | | state->m_reg.d.collision_sprite|=0x3f; |
| 532 | | for (i=0; i<4; i++) |
| 546 | state->m_reg.d.collision_bg|=0xf; |
| 547 | state->m_reg.d.collision_sprite|=0x3f; |
| 548 | for (i=0; i<4; i++) |
| 533 | 549 | { |
| 534 | | int doublescan = FALSE; |
| 535 | | if (state->m_pos[i].y<=-YPOS) continue; |
| 536 | | if (state->m_pos[i].y>=bitmap.height()-YPOS-8) continue; |
| 537 | | if (state->m_pos[i].x<=-XPOS) continue; |
| 538 | | if (state->m_pos[i].x>=128+XPOS-8) continue; |
| 550 | int doublescan = FALSE; |
| 551 | if (state->m_pos[i].y<=-YPOS) continue; |
| 552 | if (state->m_pos[i].y>=bitmap.height()-YPOS-8) continue; |
| 553 | if (state->m_pos[i].x<=-XPOS) continue; |
| 554 | if (state->m_pos[i].x>=128+XPOS-8) continue; |
| 539 | 555 | |
| 540 | | switch (i) |
| 541 | | { |
| 542 | | case 0: |
| 543 | | color=(state->m_reg.d.pal[3]>>3)&7; |
| 544 | | doublescan=state->m_reg.d.pal[3]&0x80?FALSE:TRUE; |
| 545 | | break; |
| 546 | | case 1: |
| 547 | | color=state->m_reg.d.pal[3]&7; |
| 548 | | doublescan=state->m_reg.d.pal[3]&0x40?FALSE:TRUE; |
| 549 | | break; |
| 550 | | case 2: |
| 551 | | color=(state->m_reg.d.pal[2]>>3)&7; |
| 552 | | doublescan=state->m_reg.d.pal[2]&0x80?FALSE:TRUE; |
| 553 | | break; |
| 554 | | case 3: |
| 555 | | color=state->m_reg.d.pal[2]&7; |
| 556 | | doublescan=state->m_reg.d.pal[2]&0x40?FALSE:TRUE; |
| 557 | | break; |
| 558 | | } |
| 559 | | for (k=0; k<8; k++) |
| 560 | | { |
| 561 | | int j, m; |
| 562 | | b=state->m_reg.d.chars[i][k]; |
| 563 | | x=state->m_pos[i].x+XPOS; |
| 564 | | if (!doublescan) |
| 556 | switch (i) |
| 565 | 557 | { |
| 566 | | y=state->m_pos[i].y+YPOS+k; |
| 567 | | for (j=0,m=0x80; j<8; j++, m>>=1) |
| 558 | case 0: |
| 559 | color=(state->m_reg.d.pal[3]>>3)&7; |
| 560 | doublescan=state->m_reg.d.pal[3]&0x80?FALSE:TRUE; |
| 561 | break; |
| 562 | case 1: |
| 563 | color=state->m_reg.d.pal[3]&7; |
| 564 | doublescan=state->m_reg.d.pal[3]&0x40?FALSE:TRUE; |
| 565 | break; |
| 566 | case 2: |
| 567 | color=(state->m_reg.d.pal[2]>>3)&7; |
| 568 | doublescan=state->m_reg.d.pal[2]&0x80?FALSE:TRUE; |
| 569 | break; |
| 570 | case 3: |
| 571 | color=state->m_reg.d.pal[2]&7; |
| 572 | doublescan=state->m_reg.d.pal[2]&0x40?FALSE:TRUE; |
| 573 | break; |
| 574 | } |
| 575 | for (k=0; k<8; k++) |
| 568 | 576 | { |
| 569 | | if (b & m) |
| 577 | int j, m; |
| 578 | b=state->m_reg.d.chars[i][k]; |
| 579 | x=state->m_pos[i].x+XPOS; |
| 580 | if (!doublescan) |
| 570 | 581 | { |
| 571 | | bitmap.pix16(y, x + j) = color; |
| 582 | y=state->m_pos[i].y+YPOS+k; |
| 583 | for (j=0,m=0x80; j<8; j++, m>>=1) |
| 584 | { |
| 585 | if (b & m) |
| 586 | bitmap.pix16(y, x + j) = color; |
| 587 | } |
| 572 | 588 | } |
| 573 | | } |
| 574 | | } |
| 575 | | else |
| 576 | | { |
| 577 | | y=state->m_pos[i].y+YPOS+k*2; |
| 578 | | for (j=0,m=0x80; j<8; j++, m>>=1) |
| 579 | | { |
| 580 | | if (b & m) |
| 589 | else |
| 581 | 590 | { |
| 582 | | bitmap.pix16(y, x + j) = color; |
| 583 | | bitmap.pix16(y+1, x + j) = color; |
| 591 | y=state->m_pos[i].y+YPOS+k*2; |
| 592 | for (j=0,m=0x80; j<8; j++, m>>=1) |
| 593 | { |
| 594 | if (b & m) |
| 595 | { |
| 596 | bitmap.pix16(y, x + j) = color; |
| 597 | bitmap.pix16(y+1, x + j) = color; |
| 598 | } |
| 599 | } |
| 584 | 600 | } |
| 601 | if (state->m_reg.d.collision_bg&(1<<i)) |
| 602 | { |
| 603 | if ( (b<<(8-(x&7))) & ((state->m_bg[y][x>>3]<<8) | state->m_bg[y][(x>>3)+1]) ) |
| 604 | state->m_reg.d.collision_bg&=~(1<<i); |
| 605 | } |
| 585 | 606 | } |
| 586 | | } |
| 587 | | if (state->m_reg.d.collision_bg&(1<<i)) |
| 588 | | { |
| 589 | | if ( (b<<(8-(x&7))) & ((state->m_bg[y][x>>3]<<8) |
| 590 | | |state->m_bg[y][(x>>3)+1]) ) |
| 591 | | state->m_reg.d.collision_bg&=~(1<<i); |
| 592 | | } |
| 593 | 607 | } |
| 594 | | } |
| 595 | | if (arcadia_sprite_collision(state,0,1)) state->m_reg.d.collision_sprite&=~1; |
| 596 | | if (arcadia_sprite_collision(state,0,2)) state->m_reg.d.collision_sprite&=~2; |
| 597 | | if (arcadia_sprite_collision(state,0,3)) state->m_reg.d.collision_sprite&=~4; |
| 598 | | if (arcadia_sprite_collision(state,1,2)) state->m_reg.d.collision_sprite&=~8; |
| 599 | | if (arcadia_sprite_collision(state,1,3)) state->m_reg.d.collision_sprite&=~0x10; //guess |
| 600 | | if (arcadia_sprite_collision(state,2,3)) state->m_reg.d.collision_sprite&=~0x20; //guess |
| 608 | if (arcadia_sprite_collision(state,0,1)) state->m_reg.d.collision_sprite&=~1; |
| 609 | if (arcadia_sprite_collision(state,0,2)) state->m_reg.d.collision_sprite&=~2; |
| 610 | if (arcadia_sprite_collision(state,0,3)) state->m_reg.d.collision_sprite&=~4; |
| 611 | if (arcadia_sprite_collision(state,1,2)) state->m_reg.d.collision_sprite&=~8; |
| 612 | if (arcadia_sprite_collision(state,1,3)) state->m_reg.d.collision_sprite&=~0x10; //guess |
| 613 | if (arcadia_sprite_collision(state,2,3)) state->m_reg.d.collision_sprite&=~0x20; //guess |
| 601 | 614 | } |
| 602 | 615 | |
| 603 | 616 | INTERRUPT_GEN( arcadia_video_line ) |
| r14119 | r14120 | |
| 635 | 648 | } |
| 636 | 649 | } |
| 637 | 650 | else |
| 638 | | if (state->m_lines26 && (state->m_charline<26)) |
| 651 | if (state->m_lines26 && (state->m_charline<26)) |
| 652 | { |
| 653 | if (((state->m_line-state->m_ypos)&(h-1))==0) |
| 639 | 654 | { |
| 640 | | if (((state->m_line-state->m_ypos)&(h-1))==0) |
| 641 | | { |
| 642 | | arcadia_vh_draw_line(device->machine(), *state->m_bitmap, state->m_charline*h+state->m_ypos, |
| 643 | | state->m_reg.d.chars2[state->m_charline-13]); |
| 644 | | } |
| 645 | | state->m_charline-=13; |
| 655 | arcadia_vh_draw_line(device->machine(), *state->m_bitmap, state->m_charline*h+state->m_ypos, |
| 656 | state->m_reg.d.chars2[state->m_charline-13]); |
| 646 | 657 | } |
| 647 | | else |
| 648 | | { |
| 658 | state->m_charline-=13; |
| 659 | } |
| 660 | else |
| 661 | { |
| 649 | 662 | state->m_charline=0xd; |
| 650 | 663 | state->m_bitmap->plot_box(0, state->m_line, width, 1, (state->m_reg.d.pal[1])&7); |
| 651 | 664 | memset(state->m_bg[state->m_line], 0, sizeof(state->m_bg[0])); |
| 652 | | } |
| 665 | } |
| 653 | 666 | } |
| 654 | 667 | if (state->m_line==261) |
| 655 | 668 | arcadia_draw_sprites(device->machine(), *state->m_bitmap); |
| 656 | 669 | } |
| 657 | 670 | |
| 658 | | READ8_HANDLER(arcadia_vsync_r) |
| 671 | READ8_MEMBER( arcadia_state::arcadia_vsync_r ) |
| 659 | 672 | { |
| 660 | | arcadia_state *state = space->machine().driver_data<arcadia_state>(); |
| 661 | | return state->m_line>=216?0x80:0; |
| 673 | return m_line>=216 ? 0x80 : 0 ; |
| 662 | 674 | } |
| 663 | 675 | |
| 664 | 676 | SCREEN_UPDATE_IND16( arcadia ) |