Merge branch 'master' into 'master'

Added SRAM 256 Kb (32 KB) to ram_size_tbl, fixed header checks so they pass with other sizes and allowed ROM ubond to be detected

See merge request InfiniteNesLives/INL-retro-progdump!28
This commit is contained in:
Paul Molloy 2019-08-02 15:23:41 +00:00
commit 4e9223fa19
1 changed files with 30 additions and 27 deletions

View File

@ -64,6 +64,7 @@ local ram_size_tbl = {
[0x01] = "16 kilobits",
[0x02] = "32 kilobits",
[0x03] = "64 kilobits",
[0x05] = "256 kilobits"
}
-- Translates ram size in header to KBytes.
@ -72,6 +73,7 @@ local ram_size_kb_tbl = {
[0x01] = 2,
[0x02] = 4,
[0x03] = 8,
[0x05] = 32
}
local destination_code = {
@ -368,10 +370,8 @@ function isvalidheader(internal_header)
-- Spot check a few fields.
-- TODO: Check more/all fields, look for printable name?
local valid_rom_type = hardware_type[internal_header["rom_type"]]
local valid_rom_size = rom_ubound[internal_header["rom_size"]]
local valid_sram_size = ram_size_tbl[internal_header["sram_size"]]
local valid_destination_code = destination_code[internal_header["destination_code"]]
return valid_rom_type and valid_rom_size and valid_sram_size and valid_destination_code
return valid_rom_type and internal_header["rom_size"] and internal_header["sram_size"] and valid_destination_code
end
function test()
@ -536,6 +536,7 @@ local function dump_ram( file, start_bank, ram_size_KB, mapping, debug )
local num_banks
--determine how much ram to read per bank
if ram_size_KB == nil then ram_size_KB = 0 end
if (ram_size_KB < KB_per_bank) then
num_banks = 1
KB_per_bank = ram_size_KB
@ -868,13 +869,15 @@ local function process(process_opts, console_opts)
end
end
if ram_size == 0 then
if (ram_size == 0) or (ram_size == nil) then
ram_size = ram_size_kb_tbl[internal_header["sram_size"]]
print("RAM Size not provided, " .. ram_size_tbl[internal_header["sram_size"]] .. " detected.")
assert(ram_size, "SRAM Size unknown and not provided, please add ram size to console_opts")
print("SRAM Size not provided, " .. ram_size_tbl[internal_header["sram_size"]] .. " detected.")
end
if rom_size == 0 then
if (rom_size == 0) or (rom_size == nil) then
rom_size = rom_size_kb_tbl[internal_header["rom_size"]]
assert(rom_size, "ROM Size unknown and not provided, please add rom size to console_opts")
print("ROM Size not provided, " .. rom_ubound[internal_header["rom_size"]] .. " detected.")
end