Previous 15994 Revisions Next

r6314 Friday 6th November, 2009 at 13:27:21 UTC by Dirk Best
[SATURN] Use dec_2_bcd() from core
[src/mess/drivers]saturn.c

src/mess/drivers/saturn.c
r6313r6314
441441#define SMPC_CONTROL_MODE_PORT_1 IOSEL1 = 0
442442#define SMPC_CONTROL_MODE_PORT_2 IOSEL2 = 0
443443
444static int DectoBCD(int num)
445{
446   int i, cnt = 0, tmp, res = 0;
447444
448   while (num > 0)
449   {
450      tmp = num;
451      while (tmp >= 10) tmp %= 10;
452      for (i=0; i<cnt; i++)
453         tmp *= 16;
454      res += tmp;
455      cnt++;
456      num /= 10;
457   }
458
459   return res;
460}
461
462445static void system_reset()
463446{
464447   /*Only backup ram and SMPC ram are retained after that this command is issued.*/
r6313r6314
698681                      if(LOG_SMPC) logerror ("SMPC: Status Acquire (IntBack)\n");
699682            smpc_ram[0x5f]=0x10;
700683            smpc_ram[0x21] = (0x80) | ((NMI_reset & 1) << 6);
701              smpc_ram[0x23] = DectoBCD(systime.local_time.year / 100);
702                smpc_ram[0x25] = DectoBCD(systime.local_time.year % 100);
684              smpc_ram[0x23] = dec_2_bcd(systime.local_time.year / 100);
685                smpc_ram[0x25] = dec_2_bcd(systime.local_time.year % 100);
703686                smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month + 1);
704                smpc_ram[0x29] = DectoBCD(systime.local_time.mday);
705                smpc_ram[0x2b] = DectoBCD(systime.local_time.hour);
706                smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
707                smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
687                smpc_ram[0x29] = dec_2_bcd(systime.local_time.mday);
688                smpc_ram[0x2b] = dec_2_bcd(systime.local_time.hour);
689                smpc_ram[0x2d] = dec_2_bcd(systime.local_time.minute);
690                smpc_ram[0x2f] = dec_2_bcd(systime.local_time.second);
708691
709692            smpc_ram[0x31]=0x00;  //?
710693
r6313r6314
22062189   stv_scu = auto_alloc_array(machine, UINT32, 0x100/4);
22072190   scsp_regs = auto_alloc_array(machine, UINT16, 0x1000/2);
22082191
2209   smpc_ram[0x23] = DectoBCD(systime.local_time.year / 100);
2210   smpc_ram[0x25] = DectoBCD(systime.local_time.year % 100);
2192   smpc_ram[0x23] = dec_2_bcd(systime.local_time.year / 100);
2193   smpc_ram[0x25] = dec_2_bcd(systime.local_time.year % 100);
22112194   smpc_ram[0x27] = (systime.local_time.weekday << 4) | (systime.local_time.month + 1);
2212   smpc_ram[0x29] = DectoBCD(systime.local_time.mday);
2213   smpc_ram[0x2b] = DectoBCD(systime.local_time.hour);
2214   smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
2215   smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
2195   smpc_ram[0x29] = dec_2_bcd(systime.local_time.mday);
2196   smpc_ram[0x2b] = dec_2_bcd(systime.local_time.hour);
2197   smpc_ram[0x2d] = dec_2_bcd(systime.local_time.minute);
2198   smpc_ram[0x2f] = dec_2_bcd(systime.local_time.second);
22162199   smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??)
22172200//  smpc_ram[0x33] = input_port_read(machine, "???");
22182201    smpc_ram[0x5f] = 0x10;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team