Previous 199869 Revisions Next

r30932 Tuesday 10th June, 2014 at 23:23:57 UTC by hap
(MESS) gb.c: Added GameBoy Pocket Boot ROM. [BennVenn]
[src/mess/drivers]gb.c
[src/mess/includes]gb.h
[src/mess/machine]gb.c
[src/mess/video]gb_lcd.c gb_lcd.h

trunk/src/mess/machine/gb.c
r30931r30932
173173   save_gb_base();
174174}
175175
176MACHINE_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
185176MACHINE_START_MEMBER(gb_state,gbc)
186177{
187178   /* Allocate the serial timer, and disable it */
r30931r30932
222213   m_divcount = 0x0004;
223214}
224215
225MACHINE_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
241216MACHINE_RESET_MEMBER(gb_state,gbc)
242217{
243218   gb_init();
trunk/src/mess/includes/gb.h
r30931r30932
9797   DECLARE_MACHINE_START(sgb);
9898   DECLARE_MACHINE_RESET(sgb);
9999   DECLARE_PALETTE_INIT(sgb);
100   DECLARE_MACHINE_START(gbpocket);
101   DECLARE_MACHINE_RESET(gbpocket);
102100   DECLARE_PALETTE_INIT(gbp);
103101   DECLARE_MACHINE_START(gbc);
104102   DECLARE_MACHINE_RESET(gbc);
trunk/src/mess/video/gb_lcd.c
r30931r30932
318318   save_pointer(NAME(m_vram), 0x2000);
319319
320320   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;
329321}
330322
331323void sgb_lcd_device::device_start()
r30931r30932
369361
370362   memcpy(m_oam, cgb_oam_fingerprint, 0x100);
371363
372
373364   /* Background is initialised as white */
374365   for (int i = 0; i < 32; i++)
375366      m_cgb_bpal[i] = 32767;
r30931r30932
449440   m_lcd_timer->adjust(m_maincpu->cycles_to_attotime(456));
450441}
451442
452void 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
473443void sgb_lcd_device::device_reset()
474444{
475445   common_reset();
r30931r30932
495465   m_hdma_possible = 0;
496466
497467   m_gbc_mode = 1;
498
499468}
500469
501470
trunk/src/mess/video/gb_lcd.h
r30931r30932
146146
147147   // device-level overrides
148148   virtual void device_start();
149   virtual void device_reset();
150149};
151150
152151
r30931r30932
211210      MCFG_DEVICE_ADD( _tag, GB_LCD_CGB, 0 )
212211
213212
214#endif /* GB_H_ */
213#endif /* GB_LCD_H_ */
trunk/src/mess/drivers/gb.c
r30931r30932
806806
807807static MACHINE_CONFIG_DERIVED( gbpocket, gameboy )
808808
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
817809   /* video hardware */
818810   MCFG_PALETTE_MODIFY("palette")
819811   MCFG_PALETTE_INIT_OWNER(gb_state,gbp)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team