src/mess/machine/coco.c
| r2097 | r2098 | |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | /*************************************************************************** |
| 586 | Quickloads |
| 587 | ***************************************************************************/ |
| 588 | |
| 589 | QUICKLOAD_LOAD ( coco ) |
| 590 | { |
| 591 | UINT8 preamble; |
| 592 | UINT16 block_length; |
| 593 | UINT16 block_address; |
| 594 | const UINT8 *ptr; |
| 595 | UINT32 length; |
| 596 | UINT32 position = 0; |
| 597 | UINT32 i; |
| 598 | int done = FALSE; |
| 599 | |
| 600 | /* access the pointer and the length */ |
| 601 | ptr = image_ptr(image); |
| 602 | length = image_length(image); |
| 603 | |
| 604 | while(!done && (position + 5 <= length)) |
| 605 | { |
| 606 | /* read this block */ |
| 607 | preamble = ptr[position + 0]; |
| 608 | block_length = ((UINT16) ptr[position + 1]) << 8 | ((UINT16) ptr[position + 2]) << 0; |
| 609 | block_address = ((UINT16) ptr[position + 3]) << 8 | ((UINT16) ptr[position + 4]) << 0; |
| 610 | position += 5; |
| 611 | |
| 612 | if (preamble != 0) |
| 613 | { |
| 614 | /* start address - just set the address and return */ |
| 615 | cpunum_set_reg(0, REG_PC, block_address); |
| 616 | done = TRUE; |
| 617 | } |
| 618 | else |
| 619 | { |
| 620 | /* data block - need to cap the maximum length of the block */ |
| 621 | block_length = MIN(block_length, length - position); |
| 622 | |
| 623 | /* read the block into memory */ |
| 624 | for (i = 0; i < block_length; i++) |
| 625 | { |
| 626 | program_write_byte(block_address + i, ptr[position + i]); |
| 627 | } |
| 628 | |
| 629 | /* and advance */ |
| 630 | position += block_length; |
| 631 | } |
| 632 | } |
| 633 | return INIT_PASS; |
| 634 | } |
| 635 | |
| 636 | /*************************************************************************** |
| 586 | 637 | ROM files |
| 587 | 638 | |
| 588 | 639 | ROM files are simply raw dumps of cartridges. I believe that they should |
src/mess/drivers/coco.c
| r2097 | r2098 | |
| 998 | 998 | |
| 999 | 999 | |
| 1000 | 1000 | |
| 1001 | static void coco_quickload_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 1002 | { |
| 1003 | /* quickload */ |
| 1004 | switch(state) |
| 1005 | { |
| 1006 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1007 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "bin"); break; |
| 1008 | |
| 1009 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 1010 | case MESS_DEVINFO_PTR_QUICKLOAD_LOAD: info->f = (genf *) quickload_load_coco; break; |
| 1011 | |
| 1012 | /* --- the following bits of info are returned as doubles --- */ |
| 1013 | case MESS_DEVINFO_FLOAT_QUICKLOAD_DELAY: info->d = 0.5; break; |
| 1014 | |
| 1015 | default: quickload_device_getinfo(devclass, state, info); break; |
| 1016 | } |
| 1017 | } |
| 1018 | |
| 1019 | |
| 1020 | |
| 1001 | 1021 | static void coco_cartslot_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 1002 | 1022 | { |
| 1003 | 1023 | switch(state) |
| r2097 | r2098 | |
| 1099 | 1119 | CONFIG_DEVICE( coco_bitbanger_getinfo ) |
| 1100 | 1120 | CONFIG_DEVICE( coco_cassette_getinfo ) |
| 1101 | 1121 | CONFIG_DEVICE( coco_floppy_getinfo ) |
| 1122 | CONFIG_DEVICE( coco_quickload_getinfo ) |
| 1102 | 1123 | SYSTEM_CONFIG_END |
| 1103 | 1124 | |
| 1104 | 1125 | SYSTEM_CONFIG_START( generic_coco12 ) |