Merge branch 'master' of https://gitlab.com/InfiniteNesLives/INL-retro-progdump
This commit is contained in:
commit
5a1c87f020
|
|
@ -23,4 +23,4 @@ host/source/lua/liblua.a
|
||||||
host/inlretro
|
host/inlretro
|
||||||
|
|
||||||
# OS X Metadata
|
# OS X Metadata
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ local snes = require "scripts.app.snes"
|
||||||
-- file constants
|
-- file constants
|
||||||
|
|
||||||
-- local functions
|
-- local functions
|
||||||
local function dumptofile( file, sizeKB, map, mem, debug )
|
local function dumptocallback( callback, sizeKB, map, mem, debug )
|
||||||
|
|
||||||
local buff0 = 0
|
local buff0 = 0
|
||||||
local buff1 = 1
|
local buff1 = 1
|
||||||
|
|
@ -94,7 +94,7 @@ local function dumptofile( file, sizeKB, map, mem, debug )
|
||||||
--need to setup buffer manager to nak anytime something like this happens
|
--need to setup buffer manager to nak anytime something like this happens
|
||||||
--the following setup slows down everything due to status waits..
|
--the following setup slows down everything due to status waits..
|
||||||
-- buffers.status_wait({buff0}, {"DUMPED"})
|
-- buffers.status_wait({buff0}, {"DUMPED"})
|
||||||
-- file:write( dict.buffer_payload_in( buff_size ))
|
-- callback( dict.buffer_payload_in( buff_size ))
|
||||||
-- buffers.status_wait({buff1}, {"DUMPED"})
|
-- buffers.status_wait({buff1}, {"DUMPED"})
|
||||||
|
|
||||||
--stm adapter having issues with race situation..
|
--stm adapter having issues with race situation..
|
||||||
|
|
@ -106,7 +106,7 @@ local function dumptofile( file, sizeKB, map, mem, debug )
|
||||||
--print(nak, "cur_buff->status: ", cur_buff_status)
|
--print(nak, "cur_buff->status: ", cur_buff_status)
|
||||||
cur_buff_status = dict.buffer("GET_CUR_BUFF_STATUS")
|
cur_buff_status = dict.buffer("GET_CUR_BUFF_STATUS")
|
||||||
end
|
end
|
||||||
file:write( dict.buffer_payload_in( buff_size ))
|
callback( dict.buffer_payload_in( buff_size ))
|
||||||
-- print("dumped page:", i)
|
-- print("dumped page:", i)
|
||||||
|
|
||||||
--if ( (i % (1024*1024/buff_size/16)) == 0) then
|
--if ( (i % (1024*1024/buff_size/16)) == 0) then
|
||||||
|
|
@ -143,6 +143,15 @@ local function dumptofile( file, sizeKB, map, mem, debug )
|
||||||
dict.buffer("RAW_BUFFER_RESET")
|
dict.buffer("RAW_BUFFER_RESET")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function dumptofile( file, sizeKB, map, mem, debug )
|
||||||
|
dumptocallback(
|
||||||
|
function (data)
|
||||||
|
file:write(data)
|
||||||
|
end,
|
||||||
|
sizeKB, map, mem, debug
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--//main collected as much data about cart as possible without reading roms
|
--//main collected as much data about cart as possible without reading roms
|
||||||
--//now it's time to start running CRC's to try and finalize mapper/config
|
--//now it's time to start running CRC's to try and finalize mapper/config
|
||||||
|
|
@ -507,6 +516,7 @@ end
|
||||||
dump.dump_nes = dump_nes
|
dump.dump_nes = dump_nes
|
||||||
dump.dump_snes = dump_snes
|
dump.dump_snes = dump_snes
|
||||||
dump.dumptofile = dumptofile
|
dump.dumptofile = dumptofile
|
||||||
|
dump.dumptocallback = dumptocallback
|
||||||
|
|
||||||
-- return the module's table
|
-- return the module's table
|
||||||
return dump
|
return dump
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ function nes_exec(mapper, dump_filename, flash_filename, verify_filename)
|
||||||
local mappers = {
|
local mappers = {
|
||||||
mmc1 = require "scripts.nes.mmc1",
|
mmc1 = require "scripts.nes.mmc1",
|
||||||
mmc3 = require "scripts.nes.mmc3",
|
mmc3 = require "scripts.nes.mmc3",
|
||||||
nrom = require "scripts.nes.nrom"
|
nrom = require "scripts.nes.nrom",
|
||||||
|
unrom = require "scripts.nes.unrom"
|
||||||
}
|
}
|
||||||
|
|
||||||
dict.io("IO_RESET")
|
dict.io("IO_RESET")
|
||||||
|
|
@ -72,4 +73,4 @@ function main()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Don't do this. Next iteration will call a function, not the whole script.
|
-- Don't do this. Next iteration will call a function, not the whole script.
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ local flash = require "scripts.app.flash"
|
||||||
|
|
||||||
-- file constants & variables
|
-- file constants & variables
|
||||||
local mapname = "UxROM"
|
local mapname = "UxROM"
|
||||||
local banktable_base = 0xCC84 --Nomolos
|
local banktable_base = nil
|
||||||
--Nomolos' bank table is at $CC84 so hard code that for now
|
--Nomolos' bank table is at $CC84
|
||||||
--wr_bank_table(0xCC84, 32)
|
--wr_bank_table(0xCC84, 32)
|
||||||
--Owlia bank table
|
--Owlia bank table
|
||||||
--wr_bank_table(0xE473, 32)
|
--wr_bank_table(0xE473, 32)
|
||||||
|
|
@ -67,6 +67,35 @@ local function prgrom_manf_id( debug )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--find a viable banktable location
|
||||||
|
local function find_banktable( banktable_size )
|
||||||
|
local search_base = 0x0C -- search in $C000-$F000, the fixed bank
|
||||||
|
local KB_search_space = 16
|
||||||
|
|
||||||
|
--get the fixed bank's content
|
||||||
|
local search_data = ""
|
||||||
|
dump.dumptocallback(
|
||||||
|
function (data)
|
||||||
|
search_data = search_data .. data
|
||||||
|
end,
|
||||||
|
KB_search_space, search_base, "NESCPU_4KB", false
|
||||||
|
)
|
||||||
|
|
||||||
|
--construct the byte sequence that we need
|
||||||
|
local searched_sequence = ""
|
||||||
|
while ( searched_sequence:len() < banktable_size ) do
|
||||||
|
searched_sequence = searched_sequence .. string.char(searched_sequence:len())
|
||||||
|
end
|
||||||
|
|
||||||
|
--search for the banktable in the fixed bank
|
||||||
|
position_in_fixed_bank = string.find( search_data, searched_sequence, 1, true )
|
||||||
|
if ( position_in_fixed_bank == nil ) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--compute the cpu offset of this data
|
||||||
|
return 0xC000 + position_in_fixed_bank - 1
|
||||||
|
end
|
||||||
|
|
||||||
--dump the PRG ROM
|
--dump the PRG ROM
|
||||||
local function dump_prgrom( file, rom_size_KB, debug )
|
local function dump_prgrom( file, rom_size_KB, debug )
|
||||||
|
|
@ -279,7 +308,18 @@ local function process( test, read, erase, program, verify, dumpfile, flashfile,
|
||||||
print("\nDumping PRG-ROM...")
|
print("\nDumping PRG-ROM...")
|
||||||
file = assert(io.open(dumpfile, "wb"))
|
file = assert(io.open(dumpfile, "wb"))
|
||||||
|
|
||||||
--TODO find bank table to avoid bus conflicts!
|
--find bank table to avoid bus conflicts
|
||||||
|
if ( banktable_base == nil ) then
|
||||||
|
local KB_per_bank = 16
|
||||||
|
banktable_base = find_banktable( prg_size / KB_per_bank )
|
||||||
|
if ( banktable_base == nil ) then
|
||||||
|
print( "BANKTABLE NOT FOUND" )
|
||||||
|
return
|
||||||
|
else
|
||||||
|
print( "found banktable addr = " .. banktable_base )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--dump cart into file
|
--dump cart into file
|
||||||
--dump.dumptofile( file, prg_size, "UxROM", "PRGROM", true )
|
--dump.dumptofile( file, prg_size, "UxROM", "PRGROM", true )
|
||||||
dump_prgrom(file, prg_size, false)
|
dump_prgrom(file, prg_size, false)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue