mirror of
https://github.com/holub/mame
synced 2025-04-19 15:11:37 +03:00
trs80: removed magic number in quickload, better crash protection.
This commit is contained in:
parent
fb08f0bb4e
commit
9b09093f1b
@ -421,12 +421,12 @@ QUICKLOAD_LOAD_MEMBER(meritum_state::quickload_cb)
|
||||
image.fread( &addr, 2);
|
||||
u16 address = (addr[1] << 8) | addr[0];
|
||||
logerror("/CMD object code block: address %04x length %u\n", address, block_length);
|
||||
if (address < 0x3c00)
|
||||
ptr = program.get_write_ptr(address);
|
||||
if (!ptr)
|
||||
{
|
||||
image.message("Attempting to write outside of RAM");
|
||||
return image_init_result::FAIL;
|
||||
}
|
||||
ptr = program.get_write_ptr(address);
|
||||
image.fread( ptr, block_length);
|
||||
}
|
||||
break;
|
||||
|
@ -396,12 +396,12 @@ QUICKLOAD_LOAD_MEMBER(trs80_state::quickload_cb)
|
||||
image.fread( &addr, 2);
|
||||
u16 address = (addr[1] << 8) | addr[0];
|
||||
if (LOG) logerror("/CMD object code block: address %04x length %u\n", address, block_length);
|
||||
if (address < 0x3c00)
|
||||
ptr = program.get_write_ptr(address);
|
||||
if (!ptr)
|
||||
{
|
||||
image.message("Attempting to write outside of RAM");
|
||||
return image_init_result::FAIL;
|
||||
}
|
||||
ptr = program.get_write_ptr(address);
|
||||
image.fread( ptr, block_length);
|
||||
}
|
||||
break;
|
||||
|
@ -675,13 +675,12 @@ QUICKLOAD_LOAD_MEMBER(trs80m3_state::quickload_cb)
|
||||
image.fread( &addr, 2);
|
||||
u16 address = (addr[1] << 8) | addr[0];
|
||||
if (LOG) logerror("/CMD object code block: address %04x length %u\n", address, block_length);
|
||||
// Todo: the below only applies for non-ram
|
||||
if (address < 0x3c00)
|
||||
ptr = program.get_write_ptr(address);
|
||||
if (!ptr)
|
||||
{
|
||||
image.message("Attempting to write outside of RAM");
|
||||
return image_init_result::FAIL;
|
||||
}
|
||||
ptr = program.get_write_ptr(address);
|
||||
image.fread( ptr, block_length);
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user