trunk/src/mess/machine/gb.c
| r30931 | r30932 | |
| 173 | 173 | save_gb_base(); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | | MACHINE_START_MEMBER(gb_state,gbpocket) |
| 177 | | { |
| 178 | | /* Allocate the serial timer, and disable it */ |
| 179 | | m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); |
| 180 | | m_gb_serial_timer->enable( 0 ); |
| 181 | | |
| 182 | | save_gb_base(); |
| 183 | | } |
| 184 | | |
| 185 | 176 | MACHINE_START_MEMBER(gb_state,gbc) |
| 186 | 177 | { |
| 187 | 178 | /* Allocate the serial timer, and disable it */ |
| r30931 | r30932 | |
| 222 | 213 | m_divcount = 0x0004; |
| 223 | 214 | } |
| 224 | 215 | |
| 225 | | MACHINE_RESET_MEMBER(gb_state,gbpocket) |
| 226 | | { |
| 227 | | gb_init(); |
| 228 | | |
| 229 | | gb_init_regs(); |
| 230 | | |
| 231 | | m_bios_disable = 1; |
| 232 | | |
| 233 | | /* Initialize the Sound registers */ |
| 234 | | m_custom->sound_w(generic_space(), 0x16, 0x80); |
| 235 | | m_custom->sound_w(generic_space(), 0x15, 0xF3); |
| 236 | | m_custom->sound_w(generic_space(), 0x14, 0x77); |
| 237 | | |
| 238 | | m_divcount = 0xABC8; |
| 239 | | } |
| 240 | | |
| 241 | 216 | MACHINE_RESET_MEMBER(gb_state,gbc) |
| 242 | 217 | { |
| 243 | 218 | gb_init(); |
trunk/src/mess/video/gb_lcd.c
| r30931 | r30932 | |
| 318 | 318 | save_pointer(NAME(m_vram), 0x2000); |
| 319 | 319 | |
| 320 | 320 | memcpy(m_oam, mgb_oam_fingerprint, 0x100); |
| 321 | | |
| 322 | | /* Initialize part of VRAM. This code must be deleted when we have added the bios dump */ |
| 323 | | for (int i = 1; i < 0x0d; i++) |
| 324 | | { |
| 325 | | m_vram[0x1903 + i] = i; |
| 326 | | m_vram[0x1923 + i] = i + 0x0C; |
| 327 | | } |
| 328 | | m_vram[0x1910] = 0x19; |
| 329 | 321 | } |
| 330 | 322 | |
| 331 | 323 | void sgb_lcd_device::device_start() |
| r30931 | r30932 | |
| 369 | 361 | |
| 370 | 362 | memcpy(m_oam, cgb_oam_fingerprint, 0x100); |
| 371 | 363 | |
| 372 | | |
| 373 | 364 | /* Background is initialised as white */ |
| 374 | 365 | for (int i = 0; i < 32; i++) |
| 375 | 366 | m_cgb_bpal[i] = 32767; |
| r30931 | r30932 | |
| 449 | 440 | m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(456)); |
| 450 | 441 | } |
| 451 | 442 | |
| 452 | | void mgb_lcd_device::device_reset() |
| 453 | | { |
| 454 | | address_space &space = m_maincpu->space(AS_PROGRAM); |
| 455 | | common_reset(); |
| 456 | | |
| 457 | | /* Make sure the VBlank interrupt is set when the first instruction gets executed */ |
| 458 | | machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(1), timer_expired_delegate(FUNC(mgb_lcd_device::video_init_vbl),this)); |
| 459 | | |
| 460 | | /* Initialize some video registers */ |
| 461 | | video_w(space, 0x0, 0x91); /* LCDCONT */ |
| 462 | | video_w(space, 0x7, 0xFC); /* BGRDPAL */ |
| 463 | | video_w(space, 0x8, 0xFC); /* SPR0PAL */ |
| 464 | | video_w(space, 0x9, 0xFC); /* SPR1PAL */ |
| 465 | | |
| 466 | | CURLINE = m_current_line = 0; |
| 467 | | LCDSTAT = (LCDSTAT & 0xF8) | 0x05; |
| 468 | | m_mode = 1; |
| 469 | | |
| 470 | | m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(60), GB_LCD_STATE_LY00_M0); |
| 471 | | } |
| 472 | | |
| 473 | 443 | void sgb_lcd_device::device_reset() |
| 474 | 444 | { |
| 475 | 445 | common_reset(); |
| r30931 | r30932 | |
| 495 | 465 | m_hdma_possible = 0; |
| 496 | 466 | |
| 497 | 467 | m_gbc_mode = 1; |
| 498 | | |
| 499 | 468 | } |
| 500 | 469 | |
| 501 | 470 | |
trunk/src/mess/drivers/gb.c
| r30931 | r30932 | |
| 806 | 806 | |
| 807 | 807 | static MACHINE_CONFIG_DERIVED( gbpocket, gameboy ) |
| 808 | 808 | |
| 809 | | /* basic machine hardware */ |
| 810 | | MCFG_CPU_MODIFY("maincpu") |
| 811 | | MCFG_LR35902_TIMER_CB( WRITE8( gb_state, gb_timer_callback ) ) |
| 812 | | MCFG_LR35902_HALT_BUG |
| 813 | | |
| 814 | | MCFG_MACHINE_START_OVERRIDE(gb_state, gbpocket) |
| 815 | | MCFG_MACHINE_RESET_OVERRIDE(gb_state, gbpocket) |
| 816 | | |
| 817 | 809 | /* video hardware */ |
| 818 | 810 | MCFG_PALETTE_MODIFY("palette") |
| 819 | 811 | MCFG_PALETTE_INIT_OWNER(gb_state,gbp) |