Previous 15994 Revisions Next

r5934 Thursday 1st October, 2009 at 10:59:01 UTC by Angelo Salese
[PC6001]: Added 256x192x1 mode (used by The Amazon), implemented color bank for 128x192x2 and added shift + caps lock for the keyboard
[src/mess/drivers]pc6001.c

src/mess/drivers/pc6001.c
r5933r5934
7676irq vector 08: tests ppi port c, puts port A to $fa1d,puts 0x02 to [$fa19] ;tape data ready
7777irq vector 0A: writes 0x00 to [$fa19]
7878irq vector 0C: writes 0x00 to [$fa19]
79irq vector 0E: same as 2, (A = 0x03, B = 0x00)
79irq vector 0E: same as 2, (A = 0x03, B = 0x00) ;? any press has the same effect as two enter pressed, break input?
8080irq vector 10: same as 2, (A = 0x03, B = 0x00)
8181irq vector 12: writes 0x10 to [$fa19] ;end of tape reached
82irq vector 14: same as 2, (A = 0x00, B = 0x01)
82irq vector 14: same as 2, (A = 0x00, B = 0x01) ;kanji lock enabled
8383irq vector 16: tests ppi port c, writes the result to $feca. ;vblank
8484
8585
r5933r5934
9797static UINT8 irq_vector = 0x00;
9898static UINT8 cas_switch,sys_latch;
9999
100#define CAS_LENGTH 0x12e5
100#define CAS_LENGTH 0x3b9c
101101
102102static VIDEO_START( pc6001 )
103103{
r5933r5934
123123
124124   attr = pc6001_video_ram[0];
125125
126   if(attr & 0x80) // 128x192 4 colors mode
126   if(attr & 0x80) // gfx mode
127127   {
128      int shrink_x = 2*4;
129      int shrink_y = (attr & 8) ? 1 : 2;
130      int w = (shrink_x == 8) ? 32 : 16;
128      if(attr & 0x10) // 256x192x1 mode (FIXME: might be a different trigger)
129      {
130         for(y=0;y<192;y++)
131         {
132            for(x=0;x<32;x++)
133            {
134               tile = pc6001_video_ram[(x+(y*32))+0x200];
131135
132      for(y=0;y<(192/shrink_y);y++)
136               for(xi=0;xi<8;xi++)
137               {
138                  color = ((tile)>>(7-xi) & 1) ? 7 : 0;
139
140                  *BITMAP_ADDR16(bitmap, (y+24), (x*8+xi)+32) = screen->machine->pens[color];
141               }
142            }
143         }
144      }
145      else // 128x192x2 mode
133146      {
134         for(x=0;x<w;x++)
147         int shrink_x = 2*4;
148         int shrink_y = (attr & 8) ? 1 : 2;
149         int w = (shrink_x == 8) ? 32 : 16;
150         int col_bank = ((attr & 2)<<1);
151
152         for(y=0;y<(192/shrink_y);y++)
135153         {
136            tile = pc6001_video_ram[(x+(y*32))+0x200];
154            for(x=0;x<w;x++)
155            {
156               tile = pc6001_video_ram[(x+(y*32))+0x200];
137157
138            for(yi=0;yi<shrink_y;yi++)
139            {
140               for(xi=0;xi<shrink_x;xi++)
158               for(yi=0;yi<shrink_y;yi++)
141159               {
142                  int i;
143                  i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1;
144                  color = ((tile >> i) & 3)+8;
160                  for(xi=0;xi<shrink_x;xi++)
161                  {
162                     int i;
163                     i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1;
164                     color = ((tile >> i) & 3)+8;
165                     color+= col_bank;
145166
146                  *BITMAP_ADDR16(bitmap, ((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = screen->machine->pens[color];
167                     *BITMAP_ADDR16(bitmap, ((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = screen->machine->pens[color];
168                  }
147169               }
148170            }
149171         }
r5933r5934
318340   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
319341   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
320342   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
321   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
322   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
323   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
343   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
344   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
345   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
324346   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
325347
326348   PORT_START("P2")
r5933r5934
328350   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
329351   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
330352   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
331   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
332   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
333   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
353   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
354   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
355   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
334356   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
335357
336358   PORT_START("key1") //0x00-0x1f
r5933r5934
436458   PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']')
437459   PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^')
438460   PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_")
461
462   PORT_START("key_modifiers")
463   PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL)
464   PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT)
465   PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) PORT_TOGGLE
466   PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE
467   PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT)
439468INPUT_PORTS_END
440469
441470static INTERRUPT_GEN( pc6001_interrupt )
r5933r5934
515544{
516545   const char* portnames[3] = { "key1","key2","key3" };
517546   int i,port_i,scancode;
547   UINT8 shift_pressed,caps_lock;
518548   scancode = 0;
519549
550   shift_pressed = (input_port_read(machine,"key_modifiers") & 2)>>1;
551   caps_lock = (input_port_read(machine,"key_modifiers") & 8)>>3;
552
520553   for(port_i=0;port_i<3;port_i++)
521554   {
522555      for(i=0;i<32;i++)
523556      {
524557         if((input_port_read(machine,portnames[port_i])>>i) & 1)
525558         {
559            if((shift_pressed != caps_lock) && scancode >= 0x41 && scancode <= 0x5f)
560               scancode+=0x20;
561
562            if(shift_pressed && scancode >= 0x31 && scancode <= 0x39)
563               scancode-=0x10;
564
526565            return scancode;
527566         }
528567         scancode++;
r5933r5934
673712
674713   ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF )
675714   /* Load here your tape for now (and change the cas length macro according to what MESS returns) */
676//   ROM_LOAD( "block.cas", 0x0000, CAS_LENGTH, CRC(1) SHA1(1) )
715//   ROM_LOAD( "the amazon.cas", 0x0000, CAS_LENGTH, CRC(1) SHA1(1) )
677716ROM_END
678717
679718ROM_START( pc6001a )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team