Previous 15994 Revisions Next

r14120 Sunday 22nd January, 2012 at 11:07:35 UTC by Robbbert
Arcadia: modernised.
[src/mess/audio]arcadia.c
[src/mess/drivers]arcadia.c
[src/mess/includes]arcadia.h vc4000.h
[src/mess/video]arcadia.c

src/mess/audio/arcadia.c
r14119r14120
99  PAL  UVI sound clock: 15625Hz (Soundic MPT-03 - owned by plgDavid)
1010***************************************************************************/
1111
12#include "emu.h"
12
1313#include "includes/arcadia.h"
1414
1515//known UVI audio clocks
src/mess/video/arcadia.c
r14119r14120
22Consolidation and enhancment of documentation by Manfred Schneider based on previous work from
33 PeT mess@utanet.at and Paul Robson (autismuk@aol.com)
44
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/
66
77 TODO: find a dump of the charactyer ROM
88             convert the drawing code to tilemap
r14119r14120
219219    02D0 - 02FF RAM (not used by UVI, can be used by CPU)
220220*/
221221
222#include "emu.h"
222
223223#include "includes/arcadia.h"
224224
225225static 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
284284};
285285
286286VIDEO_START( arcadia )
r14119r14120
310310   }
311311}
312312
313READ8_HANDLER(arcadia_video_r)
313READ8_MEMBER( arcadia_state::arcadia_video_r )
314314{
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;
328328#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;
341341#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];
350371   }
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;
367373}
368374
369WRITE8_HANDLER(arcadia_video_w)
375WRITE8_MEMBER( arcadia_state::arcadia_video_w )
370376{
371   arcadia_state *state = space->machine().driver_data<arcadia_state>();
372   state->m_reg.data[offset]=data;
377   m_reg.data[offset]=data;
373378   switch (offset)
374379   {
375380      case 0xfc:
376         state->m_ypos=255-data+YPOS;
381         m_ypos=255-data+YPOS;
377382         break;
378383      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;
381386         break;
382387      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);
385390         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;
388396         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;
391402         break;
392403      case 0x180: case 0x181: case 0x182: case 0x183: case 0x184: case 0x185: case 0x186: case 0x187:
393404      case 0x188: case 0x189: case 0x18a: case 0x18b: case 0x18c: case 0x18d: case 0x18e: case 0x18f:
r14119r14120
397408      case 0x1a8: case 0x1a9: case 0x1aa: case 0x1ab: case 0x1ac: case 0x1ad: case 0x1ae: case 0x1af:
398409      case 0x1b0: case 0x1b1: case 0x1b2: case 0x1b3: case 0x1b4: case 0x1b5: case 0x1b6: case 0x1b7:
399410      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;
401412         break;
402413      case 0x1f8:
403         state->m_lines26=data&0x40;
404         state->m_graphics=data&0x80;
414         m_lines26 = data & 0x40;
415         m_graphics = data & 0x80;
405416         break;
406417      case 0x1f9:
407         state->m_doublescan=!(data&0x80);
408         state->m_ad_delay=10;
418         m_doublescan =! (data&0x80);
419         m_ad_delay = 10;
409420         break;
410421   }
411422}
412423
413INLINE void arcadia_draw_char(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *ch, int charcode,
414               int y, int x)
424INLINE void arcadia_draw_char(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *ch, int charcode, int y, int x)
415425{
416426   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)
419429   {
420430      if (charcode&0x40)
421431         cc=((state->m_reg.d.pal[1]>>3)&7);
r14119r14120
426436         sc=(state->m_reg.d.pal[1]&7);
427437      else
428438         sc=(state->m_reg.d.pal[0]&7);
429
430    }
439   }
431440   else
432441   {
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   }
436445   colour = (((sc << 3) | cc) + 4);
437446
438    if (state->m_doublescan)
447   if (state->m_doublescan)
439448   {
440   for (k=0; (k<8)&&(y<bitmap.height()); k++, y+=2)
449      for (k=0; (k<8)&&(y<bitmap.height()); k++, y+=2)
441450      {
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));
445454
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         }
454462      }
455    }
463   }
456464   else
457465   {
458   for (k=0; (k<8)&&(y<bitmap.height()); k++, y++)
466      for (k=0; (k<8)&&(y<bitmap.height()); k++, y++)
459467      {
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));
463471
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);
466473      }
467    }
474   }
468475}
469476
470INLINE void arcadia_vh_draw_line(running_machine &machine, bitmap_ind16 &bitmap,
471             int y, UINT8 chars1[16])
477INLINE void arcadia_vh_draw_line(running_machine &machine, bitmap_ind16 &bitmap, int y, UINT8 chars1[16])
472478{
473479   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 ;
477483
478    if (bitmap.height()-state->m_line<h)
484   if (bitmap.height()-state->m_line<h)
479485      h=bitmap.height()-state->m_line;
480486
481487   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);
483489
484490   for (x=XPOS+state->m_shift, j=0; j<16;j++,x+=8)
485491   {
r14119r14120
488494// alien invaders shield lines start with 0xc0
489495      if ((ch&0x3f)==0)
490496      {
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");
497504         }
498505      }
499506      if (graphics)
500507         arcadia_draw_char(machine, bitmap, state->m_rectangle[ch&0x3f], ch, y, x);
501508      else
502509         arcadia_draw_char(machine, bitmap, state->m_chars[ch&0x3f], ch, y, x);
503    }
510   }
504511}
505512
506513static int arcadia_sprite_collision(arcadia_state *state, int n1, int n2)
507514{
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;
522538}
523539
524540static void arcadia_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap)
525541{
526542   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;
529545
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++)
533549   {
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;
539555
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)
565557      {
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++)
568576      {
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)
570581         {
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            }
572588         }
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
581590         {
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            }
584600         }
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         }
585606      }
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       }
593607   }
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
601614}
602615
603616INTERRUPT_GEN( arcadia_video_line )
r14119r14120
635648         }
636649      }
637650      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)
639654         {
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]);
646657         }
647         else
648         {
658      state->m_charline-=13;
659      }
660      else
661      {
649662         state->m_charline=0xd;
650663         state->m_bitmap->plot_box(0, state->m_line, width, 1, (state->m_reg.d.pal[1])&7);
651664         memset(state->m_bg[state->m_line], 0, sizeof(state->m_bg[0]));
652         }
665      }
653666   }
654667   if (state->m_line==261)
655668      arcadia_draw_sprites(device->machine(), *state->m_bitmap);
656669}
657670
658READ8_HANDLER(arcadia_vsync_r)
671READ8_MEMBER( arcadia_state::arcadia_vsync_r )
659672{
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 ;
662674}
663675
664676SCREEN_UPDATE_IND16( arcadia )
src/mess/includes/arcadia.h
r14119r14120
77#ifndef ARCADIA_H_
88#define ARCADIA_H_
99
10#include "emu.h"
11#include "cpu/s2650/s2650.h"
12#include "imagedev/cartslot.h"
1013
14
1115// space vultures sprites above
1216// combat below and invisible
1317#define YPOS 0
r14119r14120
2226{
2327public:
2428   arcadia_state(const machine_config &mconfig, device_type type, const char *tag)
25      : driver_device(mconfig, type, tag) { }
29      : driver_device(mconfig, type, tag)
30   { }
2631
27    int m_line;
28    int m_charline;
29    int m_shift;
30    int m_ad_delay;
31    int m_ad_select;
32    int m_ypos;
33    int m_graphics;
34    int m_doublescan;
35    int m_lines26;
36    int m_multicolor;
37    struct { int x, y; } m_pos[4];
38    UINT8 m_bg[262][16+2*XPOS/8];
39    UINT8 m_rectangle[0x40][8];
40    UINT8 m_chars[0x40][8];
41    int m_breaker;
42    union {
43   UINT8 data[0x400];
44   struct   {
32   DECLARE_READ8_MEMBER(arcadia_vsync_r);
33   DECLARE_READ8_MEMBER(arcadia_video_r);
34   DECLARE_WRITE8_MEMBER(arcadia_video_w);
35   int m_line;
36   int m_charline;
37   int m_shift;
38   int m_ad_delay;
39   int m_ad_select;
40   int m_ypos;
41   int m_graphics;
42   int m_doublescan;
43   int m_lines26;
44   int m_multicolor;
45   struct { int x, y; } m_pos[4];
46   UINT8 m_bg[262][16+2*XPOS/8];
47   UINT8 m_rectangle[0x40][8];
48   UINT8 m_chars[0x40][8];
49   int m_breaker;
50   union
51   {
52      UINT8 data[0x400];
53      struct
54      {
4555         // 0x1800
4656         UINT8 chars1[13][16];
4757         UINT8 ram1[2][16];
48         struct   {
49            UINT8 y,x;
50         } pos[4];
58         struct   { UINT8 y,x; } pos[4];
5159         UINT8 ram2[4];
5260         UINT8 vpos;
5361         UINT8 sound1, sound2;
r14119r14120
6573         // 0x1a00
6674         UINT8 chars2[13][16];
6775         UINT8 ram3[3][16];
68   } d;
69    } m_reg;
70    bitmap_ind16 *m_bitmap;
76      } d;
77   } m_reg;
78   bitmap_ind16 *m_bitmap;
7179};
7280
7381
7482/*----------- defined in video/arcadia.c -----------*/
7583
7684extern INTERRUPT_GEN( arcadia_video_line );
77READ8_HANDLER(arcadia_vsync_r);
78
79READ8_HANDLER(arcadia_video_r);
80WRITE8_HANDLER(arcadia_video_w);
81
8285extern VIDEO_START( arcadia );
8386extern SCREEN_UPDATE_IND16( arcadia );
8487
src/mess/includes/vc4000.h
r14119r14120
9494/*----------- defined in video/vc4000.c -----------*/
9595
9696extern INTERRUPT_GEN( vc4000_video_line );
97extern  READ8_HANDLER(vc4000_vsync_r);
98
99extern  READ8_HANDLER(vc4000_video_r);
100extern WRITE8_HANDLER(vc4000_video_w);
101
10297extern VIDEO_START( vc4000 );
10398extern SCREEN_UPDATE_IND16( vc4000 );
10499
src/mess/drivers/arcadia.c
r14119r14120
115115The Read/Write 2650 CPU Port-Commands do not appear to be connected to
116116anything in hardware. No cartridge has been found which uses them.
117117
118 ******************************************************************************/
118******************************************************************************/
119#define ADDRESS_MAP_MODERN
119120
120#include <assert.h>
121#include "emu.h"
122#include "cpu/s2650/s2650.h"
123121#include "includes/arcadia.h"
124#include "imagedev/cartslot.h"
125122
126static ADDRESS_MAP_START( arcadia_mem, AS_PROGRAM, 8)
123static ADDRESS_MAP_START( arcadia_mem, AS_PROGRAM, 8, arcadia_state )
127124   AM_RANGE( 0x0000, 0x0fff) AM_ROM
128125   AM_RANGE( 0x1800, 0x1aff) AM_READWRITE( arcadia_video_r, arcadia_video_w )
129126   AM_RANGE( 0x2000, 0x2fff) AM_ROM
130127ADDRESS_MAP_END
131128
132static ADDRESS_MAP_START( arcadia_io, AS_IO, 8)
133//{ S2650_CTRL_PORT,S2650_CTRL_PORT, },
134//{ S2650_DATA_PORT,S2650_DATA_PORT, },
129static ADDRESS_MAP_START( arcadia_io, AS_IO, 8, arcadia_state )
135130   AM_RANGE( S2650_SENSE_PORT,S2650_SENSE_PORT) AM_READ( arcadia_vsync_r)
136131ADDRESS_MAP_END
137132

Previous 15994 Revisions Next


© 1998-2018 The MESS Team