Previous 199869 Revisions Next

r29239 Friday 4th April, 2014 at 06:34:23 UTC by Fabio Priuli
(MESS) modernized x07 nvram. nw.
[src/mess/drivers]x07.c
[src/mess/includes]x07.h

trunk/src/mess/includes/x07.h
r29238r29239
99#include "emu.h"
1010#include "cpu/z80/z80.h"
1111#include "sound/beep.h"
12#include "machine/nvram.h"
1213#include "machine/ram.h"
1314#include "sound/wave.h"
1415#include "imagedev/cartslot.h"
r29238r29239
164165         m_printer(*this, "printer"),
165166         m_beep(*this, "beeper"),
166167         m_ram(*this, RAM_TAG),
167         m_cassette(*this, "cassette")
168         m_nvram1(*this, "nvram1"),
169         m_nvram2(*this, "nvram2"),
170         m_cassette(*this, "cassette"),
171         m_warm_start(1)
168172   { }
169173
170174   required_device<cpu_device> m_maincpu;
171175   required_device<printer_image_device> m_printer;
172176   required_device<beep_device> m_beep;
173177   required_device<ram_device> m_ram;
178   required_device<nvram_device> m_nvram1;
179   required_device<nvram_device> m_nvram2;
174180   required_device<cassette_image_device> m_cassette;
175181
176182   void machine_start();
r29238r29239
184190   DECLARE_INPUT_CHANGED_MEMBER( kb_break );
185191   DECLARE_INPUT_CHANGED_MEMBER( kb_update_udk );
186192
193   DECLARE_DRIVER_INIT(x07);
194   void nvram_init(nvram_device &nvram, void *data, size_t size);
195
187196   void t6834_cmd(UINT8 cmd);
188197   void t6834_r();
189198   void t6834_w();
trunk/src/mess/drivers/x07.c
r29238r29239
2828
2929****************************************************************************/
3030
31
3231#include "includes/x07.h"
33#include "mcfglgcy.h"
3432
3533/***************************************************************************
3634    T6834 IMPLEMENTATION
r29238r29239
13241322INPUT_PORTS_END
13251323
13261324
1327static NVRAM_HANDLER( x07 )
1325void x07_state::nvram_init(nvram_device &nvram, void *data, size_t size)
13281326{
1329   x07_state *state = machine.driver_data<x07_state>();
1330
1331   if (read_or_write)
1332   {
1333      file->write(state->m_t6834_ram, sizeof(state->m_t6834_ram));
1334      file->write(state->m_ram->pointer(), state->m_ram->size());
1335   }
1336   else
1337   {
1338      if (file)
1339      {
1340         file->read(state->m_t6834_ram, sizeof(state->m_t6834_ram));
1341         file->read(state->m_ram->pointer(), state->m_ram->size());
1342         state->m_warm_start = 1;
1343      }
1344      else
1345      {
1346         memset(state->m_t6834_ram, 0, sizeof(state->m_t6834_ram));
1347         memset(state->m_ram->pointer(), 0, state->m_ram->size());
1348
1349         for(int i = 0; i < 12; i++)
1350            strcpy((char*)state->m_t6834_ram + udk_offset[i], udk_ini[i]);
1351
1352         //copy default chars in the UDC
1353         memcpy(state->m_t6834_ram + 0x200, (UINT8*)machine.root_device().memregion("gfx1")->base() + 0x400, 0x100);
1354         memcpy(state->m_t6834_ram + 0x300, (UINT8*)machine.root_device().memregion("gfx1")->base() + 0x700, 0x100);
1355         state->m_warm_start = 0;
1356      }
1357   }
1327   memcpy(data, memregion("default")->base(), size);
1328   m_warm_start = 0;
13581329}
13591330
13601331TIMER_DEVICE_CALLBACK_MEMBER(x07_state::blink_timer)
r29238r29239
14031374   m_cass_poll = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_poll),this));
14041375   m_cass_tick = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_tick),this));
14051376
1377   m_nvram1->set_base(&m_t6834_ram, 0x800);
1378   m_nvram2->set_base(m_ram->pointer(), m_ram->size());
1379
14061380   /* Save State */
14071381   save_item(NAME(m_sleep));
14081382   save_item(NAME(m_warm_start));
r29238r29239
15251499
15261500   MCFG_TIMER_DRIVER_ADD_PERIODIC("blink_timer", x07_state, blink_timer, attotime::from_msec(300))
15271501
1528   MCFG_NVRAM_HANDLER( x07 )
1502   MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram1", x07_state, nvram_init)   // t6834 RAM
1503   MCFG_NVRAM_ADD_0FILL("nvram2") // RAM banks
15291504
15301505   /* internal ram */
15311506   MCFG_RAM_ADD(RAM_TAG)
r29238r29239
15611536
15621537   ROM_REGION( 0x0800, "gfx1", 0 )
15631538   ROM_LOAD( "charset.rom", 0x0000, 0x0800, BAD_DUMP CRC(b1e59a6e) SHA1(b0c06315a2d5c940a8f288fb6a3428d738696e69) )
1539
1540   ROM_REGION( 0x0800, "default", ROMREGION_ERASE00 )
15641541ROM_END
15651542
1543DRIVER_INIT_MEMBER(x07_state, x07) 
1544{
1545   UINT8 *RAM = memregion("default")->base();
1546   UINT8 *GFX = memregion("gfx1")->base();
1547   
1548   for (int i = 0; i < 12; i++)
1549      strcpy((char *)RAM + udk_offset[i], udk_ini[i]);
1550   
1551   //copy default chars in the UDC
1552   memcpy(RAM + 0x200, GFX + 0x400, 0x100);
1553   memcpy(RAM + 0x300, GFX + 0x700, 0x100);
1554}
1555
1556
15661557/* Driver */
15671558
1568/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY   FULLNAME    FLAGS */
1569COMP( 1983, x07,    0,      0,       x07,       x07, driver_device,     0,      "Canon",  "X-07",     GAME_SUPPORTS_SAVE)
1559/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT                COMPANY   FULLNAME    FLAGS */
1560COMP( 1983, x07,    0,      0,       x07,       x07,     x07_state,   x07,   "Canon",  "X-07",     GAME_SUPPORTS_SAVE)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team