Merge branch 'master' into 'master'
Fixed off-by-one error with unrom banktables Closes #31 and #14 See merge request InfiniteNesLives/INL-retro-progdump!33
This commit is contained in:
commit
b08603a27b
|
|
@ -48,7 +48,6 @@ function main ()
|
||||||
local erase = require "scripts.app.erase"
|
local erase = require "scripts.app.erase"
|
||||||
local flash = require "scripts.app.flash"
|
local flash = require "scripts.app.flash"
|
||||||
local swim = require "scripts.app.swim"
|
local swim = require "scripts.app.swim"
|
||||||
local jtag = require "scripts.app.jtag"
|
|
||||||
local ciccom = require "scripts.app.ciccom"
|
local ciccom = require "scripts.app.ciccom"
|
||||||
local fwupdate = require "scripts.app.fwupdate"
|
local fwupdate = require "scripts.app.fwupdate"
|
||||||
local files = require "scripts.app.files"
|
local files = require "scripts.app.files"
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,10 @@ local buffers = require "scripts.app.buffers"
|
||||||
-- file constants & variables
|
-- file constants & variables
|
||||||
local mapname = "UxROM"
|
local mapname = "UxROM"
|
||||||
|
|
||||||
--local banktable_base = nil
|
local banktable_base = nil
|
||||||
local banktable_base = 0xE473
|
-- banktable detection should work now,
|
||||||
|
-- these curated addresses are probably no longer needed.
|
||||||
|
--local banktable_base = 0xE473
|
||||||
--Nomolos' bank table is at $CC84
|
--Nomolos' bank table is at $CC84
|
||||||
--wr_bank_table(0xCC84, 32)
|
--wr_bank_table(0xCC84, 32)
|
||||||
--Owlia bank table
|
--Owlia bank table
|
||||||
|
|
@ -112,13 +114,14 @@ 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 )
|
||||||
|
|
||||||
local KB_per_read = 16
|
local KB_per_read = 16
|
||||||
local num_reads = rom_size_KB / KB_per_read
|
local num_reads = rom_size_KB / KB_per_read
|
||||||
local read_count = 0
|
local read_count = 0
|
||||||
local addr_base = 0x08 -- $8000
|
local addr_base = 0x08 -- $8000
|
||||||
|
local fixed_bank_base = 0x0C -- search in $C000-$F000, the fixed bank
|
||||||
|
|
||||||
while ( read_count < num_reads ) do
|
-- Dump all banks except last/fixed bank.
|
||||||
|
while ( read_count < num_reads - 1) do
|
||||||
|
|
||||||
if debug then print( "dump PRG part ", read_count, " of ", num_reads) end
|
if debug then print( "dump PRG part ", read_count, " of ", num_reads) end
|
||||||
|
|
||||||
|
|
@ -130,6 +133,10 @@ local function dump_prgrom( file, rom_size_KB, debug )
|
||||||
read_count = read_count + 1
|
read_count = read_count + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Write fixed bank
|
||||||
|
if debug then print( "dump PRG part ", read_count, " of ", num_reads) end
|
||||||
|
dump.dumptofile( file, KB_per_read, fixed_bank_base, "NESCPU_4KB", false )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -331,7 +338,9 @@ local function process(process_opts, console_opts)
|
||||||
--find bank table to avoid bus conflicts
|
--find bank table to avoid bus conflicts
|
||||||
if ( banktable_base == nil ) then
|
if ( banktable_base == nil ) then
|
||||||
local KB_per_bank = 16
|
local KB_per_bank = 16
|
||||||
banktable_base = find_banktable( prg_size / KB_per_bank )
|
-- Size is one byte smaller because table doesn't need fixed bank.
|
||||||
|
local banktable_size = prg_size / KB_per_bank - 1
|
||||||
|
banktable_base = find_banktable(banktable_size)
|
||||||
if ( banktable_base == nil ) then
|
if ( banktable_base == nil ) then
|
||||||
print( "BANKTABLE NOT FOUND" )
|
print( "BANKTABLE NOT FOUND" )
|
||||||
return
|
return
|
||||||
|
|
@ -344,7 +353,6 @@ local function process(process_opts, console_opts)
|
||||||
create_header(file, prg_size, chr_size)
|
create_header(file, prg_size, chr_size)
|
||||||
|
|
||||||
--dump cart into file
|
--dump cart into file
|
||||||
--dump.dumptofile( file, prg_size, "UxROM", "PRGROM", true )
|
|
||||||
dump_prgrom(file, prg_size, false)
|
dump_prgrom(file, prg_size, false)
|
||||||
|
|
||||||
--close file
|
--close file
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue