hash/crvision.xml
| r7949 | r7950 | |
| 2 | 2 | <!DOCTYPE softwarelist SYSTEM "softwarelist.dtd"> |
| 3 | 3 | |
| 4 | 4 | <!-- Many thanks to Luca Antignano for the help with this software list --> |
| 5 | <!-- |
| 6 | A couple of comments about the 6k/8k images: |
| 7 | - game code occupies 6k, but there can be different chips inside the actual carts: |
| 8 | 1x8k eprom, 2x4k eproms or 1x2k + 1x4k eproms. In the 1x8k case, the console |
| 9 | actually accesses only the first 2k and the final 4k. |
| 10 | There have been found carts where the remaining part is empty, and carts where the lower |
| 11 | 2k are repeated (see the Alt dumps below), but the dumps are basically the same and |
| 12 | a Creativision would not see the difference between them. |
| 13 | |
| 14 | TODO: split the content of the various chips |
| 15 | --> |
| 16 | |
| 17 | <!-- Creativision carts were universal (Japanese NTSC dumps turned out to be the same as worldwide PAL ones). --> |
| 5 | 18 | <softwarelist name="crvision" description="V-Tech Creativision cartridges"> |
| 6 | 19 | <!-- Id: 8008 --> |
| 7 | 20 | <software name="airsea"> |
| r7949 | r7950 | |
| 27 | 40 | </part> |
| 28 | 41 | </software> |
| 29 | 42 | |
| 43 | <!-- astrop1 differs from astropin only in the 1st byte. |
| 44 | This image came from FunnyMu < 0.43, and it might be |
| 45 | a bad dump (astropin has been confirmed good) --> |
| 30 | 46 | <software name="astropin1" cloneof="astropin"> |
| 31 | 47 | <description>Astro Pinball (Bad?)</description> |
| 32 | 48 | <year>1982</year> |
| r7949 | r7950 | |
| 373 | 389 | </part> |
| 374 | 390 | </software> |
| 375 | 391 | |
| 376 | | <!-- This was an hombrew cart sold back in the 80s --> |
| 392 | <!-- hapmon is a homebrew hex editor created in the 80s and perfectly working |
| 393 | on the real machine. It was dumped and released to the public in ~2002, |
| 394 | when FunnyMu emulator (written by Paul Hayter) was released --> |
| 377 | 395 | <software name="hapmon"> |
| 378 | 396 | <description>Hapmon</description> |
| 379 | | <year>19??</year> |
| 397 | <year>198?</year> |
| 380 | 398 | <publisher>Richard Hayter</publisher> |
| 381 | 399 | <part name="cart" interface="crvision_cart"> |
| 382 | 400 | <dataarea name="rom" size="4096"> |
src/mess/machine/amstrad.c
| r7949 | r7950 | |
| 3489 | 3489 | // 'cb01' represent Cartridge block 1, and is loaded to &4000-&7fff |
| 3490 | 3490 | // ... and so on. |
| 3491 | 3491 | |
| 3492 | | unsigned char header[12]; // RIFF chunk |
| 3493 | | char chunkid[4]; // chunk ID (4 character code - cb00, cb01, cb02... upto cb31 (max 512kB), other chunks are ignored) |
| 3494 | | char chunklen[4]; // chunk length (always little-endian) |
| 3495 | | int chunksize; // chunk length, calcaulated from the above |
| 3496 | | int ramblock; // 16k RAM block chunk is to be loaded in to |
| 3497 | | int result; |
| 3498 | | unsigned int bytes_to_read; // total bytes to read, as mame_feof doesn't react to EOF without trying to go past it. |
| 3492 | UINT32 size, offset = 0; |
| 3493 | UINT8 *temp_copy; |
| 3494 | unsigned char header[12]; // RIFF chunk |
| 3495 | char chunkid[4]; // chunk ID (4 character code - cb00, cb01, cb02... upto cb31 (max 512kB), other chunks are ignored) |
| 3496 | char chunklen[4]; // chunk length (always little-endian) |
| 3497 | int chunksize; // chunk length, calcaulated from the above |
| 3498 | int ramblock; // 16k RAM block chunk is to be loaded in to |
| 3499 | unsigned int bytes_to_read; // total bytes to read, as mame_feof doesn't react to EOF without trying to go past it. |
| 3499 | 3500 | unsigned char* mem = memory_region(image->machine, "maincpu"); |
| 3500 | 3501 | |
| 3502 | if (image_software_entry(image) == NULL) |
| 3503 | { |
| 3504 | size = image_length(image); |
| 3505 | temp_copy = auto_alloc_array(image->machine, UINT8, size); |
| 3506 | if (image_fread(image, temp_copy, size) != size) |
| 3507 | { |
| 3508 | logerror("IMG: failed to read from cart image\n"); |
| 3509 | auto_free(image->machine, temp_copy); |
| 3510 | return INIT_FAIL; |
| 3511 | } |
| 3512 | } |
| 3513 | else |
| 3514 | { |
| 3515 | size= image_get_software_region_length(image, "rom"); |
| 3516 | temp_copy = auto_alloc_array(image->machine, UINT8, size); |
| 3517 | memcpy(temp_copy, image_get_software_region(image, "rom"), size); |
| 3518 | } |
| 3519 | |
| 3501 | 3520 | logerror("IMG: loading CPC+ cartridge file\n"); |
| 3502 | 3521 | // load RIFF chunk |
| 3503 | | result = image_fread(image,header,12); |
| 3504 | | if(result != 12) |
| 3522 | memcpy(header, temp_copy, 12); |
| 3523 | offset += 12; |
| 3524 | |
| 3525 | if (strncmp((char *)header, "RIFF", 4) != 0) |
| 3505 | 3526 | { |
| 3506 | | logerror("IMG: failed to read from cart image\n"); |
| 3507 | | return INIT_FAIL; |
| 3508 | | } |
| 3509 | | if(strncmp((char *)header,"RIFF",4) != 0) |
| 3510 | | { |
| 3527 | logerror("IMG: raw CPC+ cartridge file\n"); |
| 3528 | offset -= 12; // no header, so we go back to the start of the file |
| 3529 | |
| 3511 | 3530 | // not an RIFF format file, assume raw binary (*.bin) |
| 3512 | | image_fseek(image,0,SEEK_SET); |
| 3513 | | ramblock = 0; |
| 3514 | | while(!image_feof(image)) |
| 3531 | while (offset < size) |
| 3515 | 3532 | { |
| 3516 | | result = image_fread(image,mem+(0x4000*ramblock),0x4000); |
| 3517 | | if(result < 0x4000) |
| 3533 | memcpy(mem + offset, temp_copy + offset, 0x4000); |
| 3534 | |
| 3535 | if ((size - offset) < 0x4000) |
| 3518 | 3536 | { |
| 3519 | | logerror("BIN: block %i loaded is smaller than 16kB in size\n",ramblock); |
| 3537 | logerror("BIN: block %i loaded is smaller than 16kB in size\n", offset / 0x4000); |
| 3538 | auto_free(image->machine, temp_copy); |
| 3520 | 3539 | return INIT_FAIL; |
| 3521 | 3540 | } |
| 3522 | | ramblock++; |
| 3541 | offset += 0x4000; |
| 3523 | 3542 | } |
| 3524 | 3543 | } |
| 3525 | | else |
| 3544 | else if (image_software_entry(image) == NULL) // we have no CPR carts in our gx4000 softlist |
| 3526 | 3545 | { |
| 3527 | 3546 | // Is RIFF format (*.cpr) |
| 3528 | | if(strncmp((char*)(header+8),"AMS!",4) != 0) |
| 3547 | if (strncmp((char*)(header + 8), "AMS!", 4) != 0) |
| 3529 | 3548 | { |
| 3530 | 3549 | logerror("CPR: not an Amstrad CPC cartridge image\n"); |
| 3550 | auto_free(image->machine, temp_copy); |
| 3531 | 3551 | return INIT_FAIL; |
| 3532 | 3552 | } |
| 3533 | 3553 | |
| 3534 | 3554 | bytes_to_read = header[4] + (header[5] << 8) + (header[6] << 16)+ (header[7] << 24); |
| 3535 | 3555 | bytes_to_read -= 4; // account for AMS! header |
| 3536 | | logerror("CPR: Data to read: %i bytes\n",bytes_to_read); |
| 3556 | logerror("CPR: Data to read: %i bytes\n", bytes_to_read); |
| 3537 | 3557 | // read some chunks |
| 3538 | | while(bytes_to_read > 0) |
| 3558 | while (bytes_to_read > 0) |
| 3539 | 3559 | { |
| 3540 | | result = image_fread(image,chunkid,4); |
| 3541 | | if(result != 4) |
| 3542 | | { |
| 3543 | | logerror("CPR: failed to read from cart image\n"); |
| 3544 | | return INIT_FAIL; |
| 3545 | | } |
| 3546 | | bytes_to_read -= result; |
| 3547 | | result = image_fread(image,chunklen,4); |
| 3548 | | if(result != 4) |
| 3549 | | { |
| 3550 | | logerror("CPR: failed to read from cart image\n"); |
| 3551 | | return INIT_FAIL; |
| 3552 | | } |
| 3553 | | bytes_to_read -= result; |
| 3560 | memcpy(chunkid, temp_copy + offset, 4); |
| 3561 | bytes_to_read -= 4; |
| 3562 | offset += 4; |
| 3563 | |
| 3564 | memcpy(chunklen, temp_copy + offset, 4); |
| 3565 | bytes_to_read -= 4; |
| 3566 | offset += 4; |
| 3567 | |
| 3554 | 3568 | // calculate little-endian value, just to be sure |
| 3555 | 3569 | chunksize = chunklen[0] + (chunklen[1] << 8) + (chunklen[2] << 16) + (chunklen[3] << 24); |
| 3556 | | |
| 3557 | | if(strncmp(chunkid,"cb",2) == 0) |
| 3570 | |
| 3571 | if (strncmp(chunkid, "cb", 2) == 0) |
| 3558 | 3572 | { |
| 3559 | 3573 | // load chunk into RAM |
| 3560 | 3574 | // find out what block this is |
| 3561 | 3575 | ramblock = (chunkid[2] - 0x30) * 10; |
| 3562 | 3576 | ramblock += chunkid[3] - 0x30; |
| 3563 | | logerror("CPR: Loading chunk into RAM block %i ['%4s']\n",ramblock,chunkid); |
| 3577 | logerror("CPR: Loading chunk into RAM block %i ['%4s']\n", ramblock, chunkid); |
| 3578 | |
| 3564 | 3579 | if(ramblock >= 0 && ramblock < 32) |
| 3565 | 3580 | { |
| 3566 | 3581 | // clear RAM block |
| 3567 | | memset(mem+(0x4000*ramblock),0,0x4000); |
| 3568 | | |
| 3582 | memset(mem + 0x4000 * ramblock, 0, 0x4000); |
| 3583 | |
| 3569 | 3584 | // load block into ROM area |
| 3570 | | if(chunksize > 16384) |
| 3585 | if (chunksize > 16384) |
| 3571 | 3586 | chunksize = 16384; |
| 3572 | | result = image_fread(image,mem+(0x4000*ramblock),chunksize); |
| 3573 | | if(result != chunksize) |
| 3574 | | { |
| 3575 | | logerror("CPR: Read %i-byte chunk, expected %i bytes\n",result,chunksize); |
| 3576 | | return INIT_FAIL; |
| 3577 | | } |
| 3587 | |
| 3588 | memcpy(mem + 0x4000 * ramblock, temp_copy + offset, chunksize); |
| 3578 | 3589 | bytes_to_read -= chunksize; |
| 3579 | | logerror("CPR: Loaded %i-byte chunk into RAM block %i\n",result,ramblock); |
| 3590 | offset += chunksize; |
| 3591 | logerror("CPR: Loaded %i-byte chunk into RAM block %i\n", chunksize, ramblock); |
| 3580 | 3592 | } |
| 3581 | 3593 | } |
| 3582 | 3594 | else |
| 3583 | 3595 | { |
| 3584 | | logerror("CPR: Unknown chunk '%4s', skipping %i bytes\n",chunkid,chunksize); |
| 3585 | | if(chunksize != 0) |
| 3596 | logerror("CPR: Unknown chunk '%4s', skipping %i bytes\n", chunkid, chunksize); |
| 3597 | if (chunksize != 0) |
| 3586 | 3598 | { |
| 3587 | | image_fseek(image,chunksize,SEEK_CUR); |
| 3588 | 3599 | bytes_to_read -= chunksize; |
| 3600 | offset += chunksize; |
| 3589 | 3601 | } |
| 3590 | 3602 | } |
| 3591 | 3603 | } |
| 3592 | 3604 | } |
| 3605 | else // CPR carts in our softlist |
| 3606 | { |
| 3607 | logerror("Gamelist cart in RIFF format\n"); |
| 3608 | auto_free(image->machine, temp_copy); |
| 3609 | return INIT_FAIL; |
| 3610 | } |
| 3593 | 3611 | |
| 3594 | | |
| 3612 | auto_free(image->machine, temp_copy); |
| 3595 | 3613 | return INIT_PASS; |
| 3596 | 3614 | } |
| 3597 | 3615 | |