src/mess/drivers/saturn.c
| r6313 | r6314 | |
| 441 | 441 | #define SMPC_CONTROL_MODE_PORT_1 IOSEL1 = 0 |
| 442 | 442 | #define SMPC_CONTROL_MODE_PORT_2 IOSEL2 = 0 |
| 443 | 443 | |
| 444 | | static int DectoBCD(int num) |
| 445 | | { |
| 446 | | int i, cnt = 0, tmp, res = 0; |
| 447 | 444 | |
| 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 | | |
| 462 | 445 | static void system_reset() |
| 463 | 446 | { |
| 464 | 447 | /*Only backup ram and SMPC ram are retained after that this command is issued.*/ |
| r6313 | r6314 | |
| 698 | 681 | if(LOG_SMPC) logerror ("SMPC: Status Acquire (IntBack)\n"); |
| 699 | 682 | smpc_ram[0x5f]=0x10; |
| 700 | 683 | 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); |
| 703 | 686 | 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); |
| 708 | 691 | |
| 709 | 692 | smpc_ram[0x31]=0x00; //? |
| 710 | 693 | |
| r6313 | r6314 | |
| 2206 | 2189 | stv_scu = auto_alloc_array(machine, UINT32, 0x100/4); |
| 2207 | 2190 | scsp_regs = auto_alloc_array(machine, UINT16, 0x1000/2); |
| 2208 | 2191 | |
| 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); |
| 2211 | 2194 | 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); |
| 2216 | 2199 | smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??) |
| 2217 | 2200 | // smpc_ram[0x33] = input_port_read(machine, "???"); |
| 2218 | 2201 | smpc_ram[0x5f] = 0x10; |