Committing host version that works with all hardware versions that

shipped to NESmaker Kickstarter backers.

inlretro.exe -s scripts\inlretro2.lua -c NES -m mapper30v2 -x 512 -p
romname.nes
This commit is contained in:
Paul XPS 2019-02-07 23:16:28 -06:00
parent ca604c08b6
commit 20cf2a81e5
4 changed files with 49 additions and 9 deletions

View File

@ -249,7 +249,7 @@ local function io( opcode, operand, misc, data )
end
-- external call for nes dictionary
local function nes( opcode, operand, misc, data )
local function nes( opcode, operand, misc, data, test_opcode )
assert ( op_nes[opcode] , "\nERROR undefined opcode: " .. opcode .. " must be defined in shared_dict_nes.h")
@ -277,6 +277,16 @@ local function nes( opcode, operand, misc, data )
end
--print("error:", error_code, "data_len:", data_len)
--hack to test if running old firmware version for NESmaker legacy compatability
if test_opcode then
--just want to report if opcode succeeded or not
if error_code == err_codes["SUCCESS"] then
return true
else
return false
end
end
assert ( (error_code == err_codes["SUCCESS"]), "\n ERROR!!! problem with opcode: " .. opcode .. " operand: " .. operand .. " misc: " .. misc .. " device error code: " .. error_code)
if data_len and data_len ~= (wLength - RETURN_LEN_IDX) then

View File

@ -73,6 +73,7 @@ function nes_exec(process_opts, console_opts)
easynsf = require "scripts.nes.easyNSF",
fme7 = require "scripts.nes.fme7",
mapper30 = require "scripts.nes.mapper30",
mapper30v2 = require "scripts.nes.mapper30v2",
mmc1 = require "scripts.nes.mmc1",
mmc3 = require "scripts.nes.mmc3",
mmc4 = require "scripts.nes.mmc4",

View File

@ -7,6 +7,7 @@ local dict = require "scripts.app.dict"
local nes = require "scripts.app.nes"
local dump = require "scripts.app.dump"
local flash = require "scripts.app.flash"
local time = require "scripts.app.time"
-- file constants
@ -61,8 +62,8 @@ local function process(process_opts, console_opts)
local file
-- TODO: Cleanup needed here, support chrrom, make this look more like other mapper scripts.
local size = console_opts["prg_rom_size_kb"]
--local filetype = "nes"
local filetype = "bin"
local filetype = "nes"
--local filetype = "bin"
--initialize device i/o for NES
dict.io("IO_RESET")
@ -203,7 +204,10 @@ local function process(process_opts, console_opts)
--flash cart
flash.write_file( file, size, "MAP30", "PRGROM", true )
print("\nFLASHING the PRG-ROM, will take ~20sec please wait...")
time.start()
flash.write_file( file, size, "MAP30", "PRGROM", false )
time.report(size)
--close file
assert(file:close())

View File

@ -12,6 +12,7 @@ local files = require "scripts.app.files"
local ciccom = require "scripts.app.ciccom"
local time = require "scripts.app.time"
local swim = require "scripts.app.swim"
local mapper30_legacy = require "scripts.nes.mapper30"
-- file constants & variables
local mapname = "MAP30"
@ -390,6 +391,24 @@ local function flash_prgrom(file, rom_size_KB, debug)
end
local function is_old_firmware( debug )
if debug then print("checking for old firmware") end
--check if CIRAM_A10_MIRRORING opcode is present
--this was cut from later versions
local rv
rv = dict.nes("CIRAM_A10_MIRROR", nil, nil, nil, true)
if debug then
if rv then print("old firmware sensed, running legacy mode")
else print("later firmware sensed, running default scripts")
end
end
return rv
end
--Cart should be in reset state upon calling this function
--this function processes all user requests for this specific board/mapper
@ -408,8 +427,15 @@ local function process(process_opts, console_opts)
-- TODO: Cleanup needed here, support chrrom, make this look more like other mapper scripts.
local prg_size = console_opts["prg_rom_size_kb"]
--local filetype = "nes"
local filetype = "bin"
local filetype = "nes"
--local filetype = "bin"
if is_old_firmware(true) then
--call legacy mapper30 script
--local mapper30_legacy = require "scripts.nes.mapper30"
mapper30_legacy.process(process_opts, console_opts)
return
end
--initialize device i/o for NES
dict.io("IO_RESET")
@ -437,8 +463,8 @@ local function process(process_opts, console_opts)
if not rv then return end
--test software mirroring switch
rv = test_soft_mir_switch()
if not rv then return end
--rv = test_soft_mir_switch()
--if not rv then return end
end
@ -532,7 +558,6 @@ local function process(process_opts, console_opts)
--verify flashfile is on the cart
if verify then
--for now let's just dump the file and verify manually
file = assert(io.open(verifyfile, "wb"))