Previous 15994 Revisions Next

r10082 Tuesday 18th January, 2011 at 00:42:50 UTC by Angelo Salese
[PC-8801]: Fully implemented GVRAM ALU support, Grobda and American Success do look a lot better now
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r10081r10082
2323   - 177: gameplay is too fast;
2424   - Acro Jet: hangs waiting for an irq;
2525   - Aggress: crashes after that it shows the title screen;
26   - American Success: uses some ALU characteristics, might be a good test case;
2726   - American Success: reads the light pen?
2827   - Alphos: test case for text VRAM attributes;
2928   - Alphos: text VRAM garbage during gameplay;
3029   - Alphos: background is supposed to be blue?
3130   - Bokosuka Wars: doesn't boot, floppy issue;
31   - Grobda: palette is ugly;
3232   - Xevious: game is too fast
3333
3434   Notes:
r10081r10082
189189#define N88BASIC_BASE 0x88000
190190#define WRAM_BASE 0x00000
191191#define GRAM_BASE 0xc0000
192#define ALU_BASE 0xa0000
192193
193194static VIDEO_START( pc8801 )
194195{
r10081r10082
357358   ram[offset + bankw[2]] = data;
358359}
359360
361static UINT8 alu_r(running_machine *machine, UINT16 ram_addr)
362{
363   int i;
364   UINT8 *gvram = machine->region("maincpu")->base();
365   UINT8 b,r,g;
366
367   /* store data to ALU regs */
368   for(i=0;i<3;i++)
369   {
370      gvram[ALU_BASE + i] = gvram[GRAM_BASE + i*0x4000 + ram_addr];
371   }
372
373   b = gvram[GRAM_BASE + ram_addr + 0x0000];
374   r = gvram[GRAM_BASE + ram_addr + 0x4000];
375   g = gvram[GRAM_BASE + ram_addr + 0x8000];
376   if(!(alu_ctrl2 & 1)) { b^=0xff; }
377   if(!(alu_ctrl2 & 2)) { r^=0xff; }
378   if(!(alu_ctrl2 & 4)) { g^=0xff; }
379
380   return b & r & g;
381}
382
383static void alu_w(running_machine *machine, UINT16 ram_addr,UINT8 data)
384{
385   int i;
386   UINT8 *gvram = machine->region("maincpu")->base();
387
388   switch(alu_ctrl2 & 0x30) // alu write mode
389   {
390      case 0x00: //logic operation
391      {
392         UINT8 logic_op;
393
394         for(i=0;i<3;i++)
395         {
396            logic_op = (alu_ctrl1 & (0x11 << i)) >> i;
397
398            switch(logic_op)
399            {
400               case 0x00: { gvram[GRAM_BASE + i*0x4000 + ram_addr] &= ~data; } break;
401               case 0x01: { gvram[GRAM_BASE + i*0x4000 + ram_addr] |= data; } break;
402               case 0x10: { gvram[GRAM_BASE + i*0x4000 + ram_addr] ^= data; } break;
403               case 0x11: break; // NOP
404            }
405         }
406      }
407      break;
408
409      case 0x10: // restore data from ALU regs
410      {
411         for(i=0;i<3;i++)
412            gvram[GRAM_BASE + i*0x4000 + ram_addr] = gvram[ALU_BASE + i];
413      }
414      break;
415
416      case 0x20: // swap ALU reg 1 into R GVRAM
417         gvram[GRAM_BASE + 0x0000 + ram_addr] = gvram[ALU_BASE + 1];
418         break;
419
420      case 0x30: // swap ALU reg 0 into B GVRAM
421         gvram[GRAM_BASE + 0x4000 + ram_addr] = gvram[ALU_BASE + 0];
422         break;
423   }
424}
425
360426static READ8_HANDLER( pc8801_mem_3_r )
361427{
362428   UINT8 *ram = space->machine->region("maincpu")->base();
363429
430   if(bankr[3] == 0xa0000)
431      return alu_r(space->machine,(offset + bankr[3]) & 0x3fff);
432
364433   return ram[offset + bankr[3]];
365434}
366435
r10081r10082
368437{
369438   UINT8 *ram = space->machine->region("maincpu")->base();
370439
371   ram[offset + bankw[3]] = data;
440   if(bankw[3] == 0xa0000)
441      alu_w(space->machine,(offset + bankw[3]) & 0x3fff,data);
442   else
443      ram[offset + bankw[3]] = data;
372444}
373445
374446static READ8_HANDLER( pc8801_mem_4_r )
375447{
376448   UINT8 *ram = space->machine->region("maincpu")->base();
377449
450   if(bankr[4] == 0xa3000)
451      return alu_r(space->machine,(offset + bankr[4]) & 0x3fff);
452
378453   return ram[offset + bankr[4]];
379454}
380455
r10081r10082
382457{
383458   UINT8 *ram = space->machine->region("maincpu")->base();
384459
385   ram[offset + bankw[4]] = data;
460   if(bankw[4] == 0xa3000)
461      alu_w(space->machine,(offset + bankw[4]) & 0x3fff,data);
462   else
463      ram[offset + bankw[4]] = data;
386464}
387465
388466static UINT32 pc8801_bankswitch_0_r(running_machine *machine)
r10081r10082
454532   {
455533      vram_sel = 3;
456534      if(alu_ctrl2 & 0x80)
457         return 0xa0000; // TODO: ALU hook-up
535         return ALU_BASE;
458536   }
459537
460538   if(vram_sel == 3)
r10081r10082
469547   {
470548      vram_sel = 3;
471549      if(alu_ctrl2 & 0x80)
472         return 0xa0000; // TODO: ALU hook-up
550         return ALU_BASE;
473551   }
474552
475553   if(vram_sel == 3)
r10081r10082
484562   {
485563      vram_sel = 3;
486564      if(alu_ctrl2 & 0x80)
487         return 0xa0000; // TODO: ALU hook-up
565         return ALU_BASE + 0x3000;
488566   }
489567
490568   if(vram_sel == 3)
r10081r10082
504582   {
505583      vram_sel = 3;
506584      if(alu_ctrl2 & 0x80)
507         return 0xa0000; // TODO: ALU hook-up
585         return ALU_BASE + 0x3000;
508586   }
509587
510588   if(vram_sel == 3)
r10081r10082
821899static WRITE8_HANDLER( pc8801_alu_ctrl1_w )
822900{
823901   alu_ctrl1 = data;
902   bankr[3] = pc8801_bankswitch_3_r(space->machine);
903   bankr[4] = pc8801_bankswitch_4_r(space->machine);
904   bankw[3] = pc8801_bankswitch_3_w(space->machine);
905   bankw[4] = pc8801_bankswitch_4_w(space->machine);
824906}
825907
826908static WRITE8_HANDLER( pc8801_alu_ctrl2_w )
r10081r10082
13901472   cpu_set_input_line_vector(machine->device("fdccpu"), 0, 0);
13911473
13921474   {
1393      UINT8 *gvram = machine->region("maincpu")->base() + GRAM_BASE;
1475      UINT8 *gvram = machine->region("maincpu")->base();
13941476      int i;
13951477
13961478      for(i=0;i<0x10000;i++)
1397         gvram[i] = 0x00;
1479         gvram[GRAM_BASE + i] = 0x00;
1480
1481      for(i=0;i<3;i++)
1482         gvram[ALU_BASE + i] = 0x00;
13981483   }
13991484
14001485   {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team