diff --git a/plugins/cheat/init.lua b/plugins/cheat/init.lua index e2d44150e22..303ffad6ffd 100644 --- a/plugins/cheat/init.lua +++ b/plugins/cheat/init.lua @@ -71,7 +71,6 @@ function cheat.startplugin() local function load_cheats() local filename = emu.romname() - local json = require("json") local newcheats = {} local file = emu.file(manager:machine():options().entries.cheatpath:value():gsub("([^;]+)", "%1;%1/cheat") , 1) if emu.softname() ~= "" then @@ -81,7 +80,7 @@ function cheat.startplugin() end end end - function add(addcheats) + local function add(addcheats) if not next(newcheats) then newcheats = addcheats else @@ -90,6 +89,7 @@ function cheat.startplugin() end end end + local json = require("json") local ret = file:open(filename .. ".json") while not ret do add(json.parse(file:read(file:size()))) @@ -101,6 +101,12 @@ function cheat.startplugin() add(xml.conv_cheat(file:read(file:size()))) ret = file:open_next() end + local simp = require("cheat/simple_conv") + ret = file:open("cheat.simple") + while not ret do + add(simp.conv_cheat(filename, file:read(file:size()))) + ret = file:open_next() + end return newcheats end diff --git a/plugins/cheat/simple_conv.lua b/plugins/cheat/simple_conv.lua new file mode 100644 index 00000000000..1fad3d7dfea --- /dev/null +++ b/plugins/cheat/simple_conv.lua @@ -0,0 +1,23 @@ +local simple = {} + +-- converter for simple cheats +-- simple cheats are single address every frame ram cheats in one file called cheat.simple +-- format: ,,,, +-- only program address space is supported, comments are prepended with ; +function simple.conv_cheat(romset, data) + local cheats = {} + for line in data:gmatch('([^\n;]+)') do + local set, cputag, offset, val, name = line:match('([^,]+),([^,]+),([^,]+),([^,]+),(.+)') + if set == romset then + local cheat = {} + cheat.desc = name + cheat.space = { cpup = { tag = cputag, type = "program" } } + cheat.script = { run = "cpup:write_u8(0x" .. offset .. ",0x" .. val .. ", true)" } + cheats[#cheats + 1] = cheat + end + end + return cheats +end + +return simple + diff --git a/src/mame/drivers/vt240.cpp b/src/mame/drivers/vt240.cpp index e8fe578f5bb..74ba3497b71 100644 --- a/src/mame/drivers/vt240.cpp +++ b/src/mame/drivers/vt240.cpp @@ -20,7 +20,7 @@ #include "machine/x2212.h" #include "video/upd7220.h" -#define VERBOSE_DBG 1 /* general debug messages */ +#define VERBOSE_DBG 0 /* general debug messages */ #define DBG_LOG(N,M,A) \ do { \ @@ -386,45 +386,46 @@ WRITE16_MEMBER(vt240_state::vram_w) if(ps == 0) i++; UINT8 mem = video_ram[(offset & 0x7fff) + (0x8000 * i)]; + UINT8 out = 0, ifore = BIT(m_lu, (i ? 5 : 4)), iback = BIT(m_lu, (i ? 3 : 2)); + for(int j = 0; j < 8; j++) + out |= BIT(chr, j) ? (ifore << j) : (iback << j); switch(m_lu >> 6) { case 0: break; case 1: - chr |= mem; + out |= mem; break; case 2: logerror("invalid logic unit mode 2\n"); break; case 3: - chr ^= mem; + out ^= ~mem; break; } - UINT8 out = 0, ifore = BIT(m_lu, (i ? 5 : 4)), iback = BIT(m_lu, (i ? 3 : 2)); - for(int j = 0; j < 8; j++) - out |= BIT(chr, j) ? (ifore << j) : (iback << j); if(!BIT(m_reg0, 3)) out = (out & ~m_mask) | (mem & m_mask); else out = (out & data) | (mem & ~data); if(BIT(m_reg1, 3)) { + UINT8 out2 = out; if(BIT(m_reg1, 2)) { - out = mem; - video_ram[((m_scrl << 1) | (offset & 1)) + (0x8000 * i)] = out; + out = video_ram[((offset & 0x7ffe) | 0) + (0x8000 * i)]; + out2 = video_ram[((offset & 0x7ffe) | 1) + (0x8000 * i)]; } - else - { - video_ram[((m_scrl << 1) | 0) + (0x8000 * i)] = out; - video_ram[((m_scrl << 1) | 1) + (0x8000 * i)] = out; - } - m_scrl += BIT(m_reg1, 1) ? -1 : 1; - m_scrl &= 0x3fff; + video_ram[((m_scrl << 1) | 0) + (0x8000 * i)] = out; + video_ram[((m_scrl << 1) | 1) + (0x8000 * i)] = out2; } else video_ram[(offset & 0x7fff) + (0x8000 * i)] = out; } + if(BIT(m_reg1, 3)) + { + m_scrl += BIT(m_reg1, 1) ? -1 : 1; + m_scrl &= 0x3fff; + } return; } if(!BIT(m_reg0, 3)) @@ -433,16 +434,14 @@ WRITE16_MEMBER(vt240_state::vram_w) data = (chr & data) | (video_ram[offset] & ~data); if(BIT(m_reg1, 3)) { + UINT8 data2 = data; if(BIT(m_reg1, 2)) { - data = video_ram[offset]; - video_ram[(m_scrl << 1) | (offset & 1)] = data; - } - else - { - video_ram[(m_scrl << 1) | 0] = data; - video_ram[(m_scrl << 1) | 1] = data; + data = video_ram[(offset & ~1) | 0]; + data2 = video_ram[(offset & ~1) | 1]; } + video_ram[(offset & 0x8000) | (m_scrl << 1) | 0] = data; + video_ram[(offset & 0x8000) | (m_scrl << 1) | 1] = data2; m_scrl += BIT(m_reg1, 1) ? -1 : 1; m_scrl &= 0x3fff; } @@ -731,7 +730,7 @@ ROM_START( vt240 ) ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, vt240, 0, 0, vt240, vt240, driver_device, 0, "Digital Equipment Corporation", "VT240", MACHINE_NOT_WORKING ) +COMP( 1983, vt240, 0, 0, vt240, vt240, driver_device, 0, "Digital Equipment Corporation", "VT240", MACHINE_IMPERFECT_GRAPHICS ) //COMP( 1983, vt241, 0, 0, vt220, vt220, driver_device, 0, "Digital Equipment Corporation", "VT241", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) // NOTE: the only difference between VT240 and VT241 is the latter comes with a VR241 Color monitor, while the former comes with a mono display; the ROMs and operation are identical. COMP( 1983, mc7105, 0, 0, mc7105, vt240, driver_device, 0, "Elektronika", "MC7105", MACHINE_NOT_WORKING )