src/mess/drivers/gp32.c
| r6545 | r6546 | |
| 234 | 234 | const int mux_shift[] = { 0, 4, 8, 12, 16}; |
| 235 | 235 | if (ctrl_bits & 1) // timer start? |
| 236 | 236 | { |
| 237 | | UINT32 prescaler, mux, freq, cnt, cmp; |
| 238 | | double hz; |
| 237 | UINT32 prescaler, mux, cnt, cmp; |
| 238 | double freq, hz; |
| 239 | 239 | logerror( "starting timer %d\n", timer); |
| 240 | 240 | prescaler = (s3c240x_timer_regs[0] >> prescaler_shift[timer]) & 0xFF; |
| 241 | 241 | mux = (s3c240x_timer_regs[1] >> mux_shift[timer]) & 0x0F; |
| r6545 | r6546 | |
| 245 | 245 | cmp = s3c240x_timer_regs[count_reg+1] & 0xFFFF; |
| 246 | 246 | else |
| 247 | 247 | cmp = 0; |
| 248 | | hz = (double)((prescaler + 1) * mux_table[mux]) / (cnt - cmp + 1); |
| 249 | | // logerror( "TIMER %d - FCLK=%d HCLK=%d PCLK=%d prescaler=%d div=%d freq=%d cnt=%d cmp=%d hz=%f\n", timer, s3c240x_get_fclk( MPLLCON), s3c240x_get_hclk( MPLLCON), s3c240x_get_pclk( MPLLCON), prescaler, mux_table[mux], freq, cnt, cmp, hz); |
| 248 | //hz = (double)((prescaler + 1) * mux_table[mux]) / (cnt - cmp + 1); |
| 249 | hz = freq / (cnt - cmp + 1); |
| 250 | // logerror( "TIMER %d - FCLK=%d HCLK=%d PCLK=%d prescaler=%d div=%d freq=%f cnt=%d cmp=%d hz=%f\n", timer, s3c240x_get_fclk( MPLLCON), s3c240x_get_hclk( MPLLCON), s3c240x_get_pclk( MPLLCON), prescaler, mux_table[mux], freq, cnt, cmp, hz); |
| 250 | 251 | if (ctrl_bits & 8) // auto reload |
| 251 | 252 | { |
| 252 | 253 | timer_adjust_periodic( s3c240x_timers[timer], ATTOTIME_IN_HZ( hz), timer, ATTOTIME_IN_HZ( hz)); |
| r6545 | r6546 | |
| 272 | 273 | { |
| 273 | 274 | if ((data & 1) != (old_value & 1)) // timer 0 status change |
| 274 | 275 | { |
| 275 | | s3c240x_timer_recalc(space->machine, 0, data&0xf, 0xc); |
| 276 | s3c240x_timer_recalc(space->machine, 0, data&0xf, 0xc / 4); |
| 276 | 277 | } |
| 277 | 278 | if ((data & 0x100) != (old_value & 0x100)) // timer 1 status change |
| 278 | 279 | { |
| 279 | | s3c240x_timer_recalc(space->machine, 1, (data>>8)&0xf, 0x18); |
| 280 | s3c240x_timer_recalc(space->machine, 1, (data>>8)&0xf, 0x18 / 4); |
| 280 | 281 | } |
| 281 | 282 | if ((data & 0x1000) != (old_value & 0x1000)) // timer 2 status change |
| 282 | 283 | { |
| 283 | | s3c240x_timer_recalc(space->machine, 2, (data>>12)&0xf, 0x24); |
| 284 | s3c240x_timer_recalc(space->machine, 2, (data>>12)&0xf, 0x24 / 4); |
| 284 | 285 | } |
| 285 | 286 | if ((data & 0x10000) != (old_value & 0x10000)) // timer 3 status change |
| 286 | 287 | { |
| 287 | | s3c240x_timer_recalc(space->machine, 3, (data>>16)&0xf, 0x30); |
| 288 | s3c240x_timer_recalc(space->machine, 3, (data>>16)&0xf, 0x30 / 4); |
| 288 | 289 | } |
| 289 | 290 | if ((data & 0x100000) != (old_value & 0x100000)) // timer 4 status change |
| 290 | 291 | { |
| 291 | | s3c240x_timer_recalc(space->machine, 4, (data>>20)&0xf, 0x3c); |
| 292 | s3c240x_timer_recalc(space->machine, 4, (data>>20)&0xf, 0x3c / 4); |
| 292 | 293 | } |
| 293 | 294 | } |
| 294 | 295 | } |
| r6545 | r6546 | |
| 832 | 833 | MDRV_SMARTMEDIA_ADD("smartmedia") |
| 833 | 834 | MACHINE_DRIVER_END |
| 834 | 835 | |
| 835 | | ROM_START(gp32) |
| 836 | ROM_START( gp32 ) |
| 836 | 837 | ROM_REGION( 0x80000, "maincpu", 0 ) |
| 837 | 838 | ROM_SYSTEM_BIOS( 0, "157e", "GP32 Firmware 1.57 (English)" ) |
| 838 | 839 | ROMX_LOAD( "gp32157e.bin", 0x000000, 0x080000, CRC(b1e35643) SHA1(1566bc2a27980602e9eb501cf8b2d62939bfd1e5), ROM_BIOS(1) ) |