trunk/src/mess/machine/thomson.c
| r24083 | r24084 | |
| 1854 | 1854 | DEVICE_IMAGE_LOAD_MEMBER( thomson_state, mo5_cartridge ) |
| 1855 | 1855 | { |
| 1856 | 1856 | UINT8* pos = memregion("maincpu")->base() + 0x10000; |
| 1857 | | UINT64 size; |
| 1858 | | int i,j; |
| 1857 | UINT64 size, i; |
| 1858 | int j; |
| 1859 | 1859 | char name[129]; |
| 1860 | 1860 | |
| 1861 | 1861 | if (image.software_entry() == NULL) |
| r24083 | r24084 | |
| 1899 | 1899 | name[j] = 0; |
| 1900 | 1900 | |
| 1901 | 1901 | /* sanitize name */ |
| 1902 | | for ( i = 0; name[i]; i++) |
| 1902 | for ( j = 0; name[j]; j++) |
| 1903 | 1903 | { |
| 1904 | | if ( name[i] < ' ' || name[i] >= 127 ) name[i] = '?'; |
| 1904 | if ( name[j] < ' ' || name[j] >= 127 ) name[j] = '?'; |
| 1905 | 1905 | } |
| 1906 | 1906 | |
| 1907 | 1907 | PRINT (( "mo5_cartridge_load: cartridge \"%s\" banks=%i, size=%u\n", name, m_thom_cart_nb_banks, (unsigned) size )); |
trunk/src/mess/machine/kc.c
| r24083 | r24084 | |
| 28 | 28 | { |
| 29 | 29 | UINT8 *data; |
| 30 | 30 | struct kcc_header *header; |
| 31 | | int addr; |
| 32 | | int datasize; |
| 33 | | int execution_address; |
| 34 | | int i; |
| 31 | UINT16 addr; |
| 32 | UINT16 datasize; |
| 33 | UINT16 execution_address; |
| 34 | UINT16 i; |
| 35 | 35 | |
| 36 | 36 | /* get file size */ |
| 37 | | datasize = image.length(); |
| 37 | UINT64 size = image.length(); |
| 38 | 38 | |
| 39 | | if (datasize != 0) |
| 39 | if (size != 0) |
| 40 | 40 | { |
| 41 | 41 | /* malloc memory for this data */ |
| 42 | | data = (UINT8 *)auto_alloc_array(machine(), UINT8, datasize); |
| 42 | data = (UINT8 *)auto_alloc_array(machine(), UINT8, size); |
| 43 | 43 | |
| 44 | 44 | if (data != NULL) |
| 45 | | image.fread( data, datasize); |
| 45 | image.fread( data, size); |
| 46 | 46 | } |
| 47 | 47 | else |
| 48 | 48 | { |
| r24083 | r24084 | |
| 54 | 54 | datasize = ((header->end_address_l & 0x0ff) | ((header->end_address_h & 0x0ff)<<8)) - addr; |
| 55 | 55 | execution_address = (header->execution_address_l & 0x0ff) | ((header->execution_address_h & 0x0ff)<<8); |
| 56 | 56 | |
| 57 | | if (datasize + 128 > image.length()) |
| 57 | if (datasize > size - 128) |
| 58 | 58 | { |
| 59 | | mame_printf_info("Invalid snapshot size: expected 0x%04x, found 0x%04x\n", datasize, (UINT32)image.length() - 128); |
| 60 | | datasize = image.length() - 128; |
| 59 | mame_printf_info("Invalid snapshot size: expected 0x%04x, found 0x%04x\n", datasize, (UINT32)size - 128); |
| 60 | datasize = size - 128; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | address_space &space = m_maincpu->space( AS_PROGRAM ); |