Previous 15994 Revisions Next

r5911 Monday 28th September, 2009 at 22:39:14 UTC by Angelo Salese
[PC6001]: Basic understanding about how cassette device works, cassette program uploading actually works too but needs a stable way for handling .cas format (they are A/D converted images)
[src/mess/drivers]pc6001.c

src/mess/drivers/pc6001.c
r5910r5911
5959===
6060
6161irq vector 00: writes 0x00 to [$fa19]
62irq vector 02: (A = 0, B = 0) tests ppi port c, does something with ay ports (plus more?)
62irq vector 02: (A = 0, B = 0) tests ppi port c, does something with ay ports (plus more?) ;keyboard data ready, no kanji lock, no caps lock
6363irq vector 04: uart irq
6464irq vector 06: operates with $fa28, $fa2e, $fd1b
65irq vector 08: tests ppi port c, puts port A to $fa1d,puts 0x02 to [$fa19]
65irq vector 08: tests ppi port c, puts port A to $fa1d,puts 0x02 to [$fa19] ;tape data ready
6666irq vector 0A: writes 0x00 to [$fa19]
6767irq vector 0C: writes 0x00 to [$fa19]
6868irq vector 0E: same as 2, (A = 0x03, B = 0x00)
6969irq vector 10: same as 2, (A = 0x03, B = 0x00)
70irq vector 12: writes 0x10 to [$fa19]
70irq vector 12: writes 0x10 to [$fa19] ;end of tape reached
7171irq vector 14: same as 2, (A = 0x00, B = 0x01)
72irq vector 16: tests ppi port c, writes the result to $feca.
72irq vector 16: tests ppi port c, writes the result to $feca. ;vblank
7373
7474
7575****************************************************************************/
r5910r5911
8383
8484static UINT8 *pc6001_ram;
8585static UINT8 *pc6001_video_ram;
86static UINT8 irq_vector = 0x00;
87static UINT8 cas_switch,sys_latch;
8688
8789static WRITE8_HANDLER ( pc6001_system_latch_w )
8890{
8991   UINT16 startaddr[] = {0xC000, 0xE000, 0x8000, 0xA000 };
9092
9193   pc6001_video_ram =  pc6001_ram + startaddr[(data >> 1) & 0x03] - 0x8000;
94
95   if((!(sys_latch & 8)) && data & 0x8)
96      cas_switch = 1;
97
98   sys_latch = data;
9299}
93100
94101
r5910r5911
96103{
97104   UINT8 result = 0x00;
98105   UINT8 val = pc6001_video_ram [(scanline / 12) * 0x20 + pos];
106
99107   if (val & 0x01) {
100108      result |= M6847_INV;
101109   }
110   if (!(val & 0x20))
111      result |= M6847_AG | M6847_GM1; //TODO
112
102113   result |= M6847_INTEXT; // always use external ROM
103114   return result;
104115}
r5910r5911
276287   PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_")
277288INPUT_PORTS_END
278289
279static UINT8 irq_vector = 0x00;
280
281290static INTERRUPT_GEN( pc6001_interrupt )
282291{
283292   irq_vector = 0x16;
r5910r5911
307316{
308317   return 0;
309318}
319
310320static WRITE8_DEVICE_HANDLER (pc6001_8255_porta_w )
311321{
312//   logerror("pc6001_8255_porta_w %02x\n",data);
322   if(data != 0x06)
323      printf("pc6001_8255_porta_w %02x\n",data);
313324}
314325
315326static READ8_DEVICE_HANDLER (pc6001_8255_portb_r )
316327{
317328   return 0;
318329}
330
319331static WRITE8_DEVICE_HANDLER (pc6001_8255_portb_w )
320332{
321333   //logerror("pc6001_8255_portb_w %02x\n",data);
r5910r5911
379391   return 0;
380392}
381393
394static TIMER_CALLBACK(cassette_callback)
395{
396   UINT8 *gfx_data = memory_region(machine, "cas");
397   static int i;
398
399   if(cas_switch == 1)
400   {
401      cur_keycode = gfx_data[i++];
402      //popmessage("%04x",i);
403      if(i >= 1)
404      {
405         i = 0;
406         cas_switch = 0;
407         irq_vector = 0x12;
408         cputag_set_input_line(machine,"maincpu", 0, ASSERT_LINE);
409      }
410      else
411      {
412         irq_vector = 0x08;
413         cputag_set_input_line(machine,"maincpu", 0, ASSERT_LINE);
414      }
415   }
416}
417
382418static TIMER_CALLBACK(keyboard_callback)
383419{
384420   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5910r5911
387423   UINT32 key3 = input_port_read(machine,"key3");
388424   static UINT32 old_key1,old_key2,old_key3;
389425
390   if((key1 != old_key1) || (key2 != old_key2) || (key3 != old_key3))
426   if(cas_switch == 0)
391427   {
392      cur_keycode = check_keyboard_press(space->machine);
393      irq_vector = 0x02;
394      cputag_set_input_line(machine,"maincpu", 0, ASSERT_LINE);
395      old_key1 = key1;
396      old_key2 = key2;
397      old_key3 = key3;
428      if((key1 != old_key1) || (key2 != old_key2) || (key3 != old_key3))
429      {
430         cur_keycode = check_keyboard_press(space->machine);
431         irq_vector = 0x02;
432         cputag_set_input_line(machine,"maincpu", 0, ASSERT_LINE);
433         old_key1 = key1;
434         old_key2 = key2;
435         old_key3 = key3;
436      }
398437   }
399438}
400439
r5910r5911
405444
406445   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"),pc6001_irq_callback);
407446   timer_pulse(machine, ATTOTIME_IN_HZ(240), NULL, 0, keyboard_callback);
447   timer_pulse(machine, ATTOTIME_IN_HZ(100), NULL, 0, cassette_callback);
448   cas_switch = 0;
408449}
409450
410451
r5910r5911
452493
453494   ROM_REGION( 0x1000, "gfx1", 0 )
454495   ROM_LOAD( "cgrom60.60", 0x0000, 0x1000, CRC(b0142d32) SHA1(9570495b10af5b1785802681be94b0ea216a1e26) )
496
497   ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF )
498//   ROM_LOAD( "ax7 demo.cas", 0x0000, 0x2ef1, CRC(1) SHA1(1) )
455499ROM_END
456500
457501ROM_START( pc6001a )
r5910r5911
460504
461505   ROM_REGION( 0x1000, "gfx1", 0 )
462506   ROM_LOAD( "cgrom60.60a", 0x0000, 0x1000, CRC(49c21d08) SHA1(9454d6e2066abcbd051bad9a29a5ca27b12ec897) )
507
508   ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF )
463509ROM_END
464510
465511ROM_START( pc6001m2 )
r5910r5911
472518   ROM_LOAD( "cgrom60.62",  0x0000, 0x2000, CRC(81eb5d95) SHA1(53d8ae9599306ff23bf95208d2f6cc8fed3fc39f) )
473519   ROM_LOAD( "cgrom60m.62", 0x2000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) )
474520   ROM_LOAD( "kanjirom.62", 0x4000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) )
521
522   ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF )
475523ROM_END
476524
477525ROM_START( pc6001sr )
r5910r5911
482530
483531   ROM_REGION( 0x4000, "gfx1", 0 )
484532   ROM_LOAD( "cgrom68.64", 0x0000, 0x4000, CRC(73bc3256) SHA1(5f80d62a95331dc39b2fb448a380fd10083947eb) )
533
534   ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF )
485535ROM_END
486536
487537ROM_START( pc6600 )   /* Variant of pc6001m2 */
r5910r5911
493543   ROM_LOAD( "cgrom60.66",  0x0000, 0x2000, CRC(d2434f29) SHA1(a56d76f5cbdbcdb8759abe601eab68f01b0a8fe8) )
494544   ROM_LOAD( "cgrom66.66",  0x2000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) )
495545   ROM_LOAD( "kanjirom.66", 0x4000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) )
546
547   ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF )
496548ROM_END
497549
498550/* There exists an alternative (incomplete?) dump, consisting of more .68 pieces, but it's been probably created for emulators:
r5910r5911
507559
508560   ROM_REGION( 0x4000, "gfx1", 0 )
509561   ROM_LOAD( "cgrom68.68", 0x0000, 0x4000, CRC(73bc3256) SHA1(5f80d62a95331dc39b2fb448a380fd10083947eb) )
562
563   ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF )
510564ROM_END
511565
512566/*    YEAR  NAME      PARENT   COMPAT MACHINE   INPUT     INIT    CONFIG     COMPANY  FULLNAME          FLAGS */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team