src/mess/formats/comx35_dsk.c
| r7874 | r7875 | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| 9 | | #include <string.h> |
| 10 | | |
| 11 | 9 | #include "formats/comx35_dsk.h" |
| 12 | 10 | #include "formats/basicdsk.h" |
| 13 | 11 | |
| 14 | | static FLOPPY_IDENTIFY(comx35_dsk_identify) |
| 12 | /*************************************************************************** |
| 13 | IMPLEMENTATION |
| 14 | ***************************************************************************/ |
| 15 | |
| 16 | /*------------------------------------------------- |
| 17 | FLOPPY_IDENTIFY( comx35_dsk_identify ) |
| 18 | -------------------------------------------------*/ |
| 19 | |
| 20 | static FLOPPY_IDENTIFY( comx35_dsk_identify ) |
| 15 | 21 | { |
| 16 | 22 | *vote = ((floppy_image_size(floppy) == (35*1*16*128)) || (floppy_image_size(floppy) == (35*2*16*128))) ? 100 : 0; |
| 23 | |
| 17 | 24 | return FLOPPY_ERROR_SUCCESS; |
| 18 | 25 | } |
| 19 | 26 | |
| 20 | | static FLOPPY_CONSTRUCT(comx35_dsk_construct) |
| 27 | /*------------------------------------------------- |
| 28 | FLOPPY_CONSTRUCT( comx35_dsk_construct ) |
| 29 | -------------------------------------------------*/ |
| 30 | |
| 31 | static FLOPPY_CONSTRUCT( comx35_dsk_construct ) |
| 21 | 32 | { |
| 22 | | struct basicdsk_geometry geometry; |
| 23 | 33 | UINT8 header[1]; |
| 24 | | int heads =1; |
| 25 | | int cylinders =35; |
| 34 | int heads = 1; |
| 35 | int cylinders = 35; |
| 26 | 36 | |
| 27 | | switch(floppy_image_size(floppy)) { |
| 28 | | case 35*1*16*128: |
| 37 | switch (floppy_image_size(floppy)) |
| 38 | { |
| 39 | case 35*1*16*128: |
| 40 | heads = 1; |
| 41 | cylinders = 35; |
| 42 | break; |
| 43 | |
| 44 | case 35*2*16*128: |
| 45 | floppy_image_read(floppy, header, 0x12, 1); |
| 46 | |
| 47 | if (header[0] == 0x01) |
| 48 | { |
| 29 | 49 | heads = 1; |
| 50 | cylinders = 70; |
| 51 | } |
| 52 | else |
| 53 | { |
| 54 | heads = 2; |
| 30 | 55 | cylinders = 35; |
| 31 | | break; |
| 32 | | |
| 33 | | case 35*2*16*128: |
| 34 | | floppy_image_read( floppy, header, 0x12 , 1 ); |
| 35 | | if (header[0] == 0x01) |
| 36 | | { |
| 37 | | heads = 1; |
| 38 | | cylinders = 70; |
| 39 | | } |
| 40 | | else |
| 41 | | { |
| 42 | | heads = 2; |
| 43 | | cylinders = 35; |
| 44 | | } |
| 45 | | break; |
| 56 | } |
| 57 | break; |
| 46 | 58 | } |
| 47 | 59 | |
| 60 | struct basicdsk_geometry geometry; |
| 48 | 61 | memset(&geometry, 0, sizeof(geometry)); |
| 62 | |
| 49 | 63 | geometry.heads = heads; |
| 50 | 64 | geometry.first_sector_id = 0; |
| 51 | 65 | geometry.sector_length = 128; |
| 52 | 66 | geometry.tracks = cylinders; |
| 53 | 67 | geometry.sectors = 16; |
| 68 | |
| 54 | 69 | return basicdsk_construct(floppy, &geometry); |
| 55 | 70 | } |
| 56 | 71 | |
| 57 | | /* ----------------------------------------------------------------------- */ |
| 72 | /*------------------------------------------------- |
| 73 | FLOPPY_OPTIONS( comx35 ) |
| 74 | -------------------------------------------------*/ |
| 58 | 75 | |
| 59 | 76 | FLOPPY_OPTIONS_START( comx35 ) |
| 60 | | FLOPPY_OPTION( comx35, "img", "COMX35 floppy disk image", comx35_dsk_identify, comx35_dsk_construct, NULL) |
| 77 | FLOPPY_OPTION( comx35, "img", "COMX35 floppy disk image", comx35_dsk_identify, comx35_dsk_construct, NULL ) |
| 61 | 78 | FLOPPY_OPTIONS_END |
| 62 | | |
src/mess/formats/atom_atm.c
| r7874 | r7875 | |
| 8 | 8 | |
| 9 | 9 | #include "emu.h" |
| 10 | 10 | #include "formats/atom_atm.h" |
| 11 | | #include "cpu/cdp1802/cdp1802.h" |
| 12 | | #include "devices/messram.h" |
| 13 | 11 | |
| 14 | 12 | /*************************************************************************** |
| 15 | 13 | PARAMETERS |
| r7874 | r7875 | |
| 21 | 19 | IMPLEMENTATION |
| 22 | 20 | ***************************************************************************/ |
| 23 | 21 | |
| 24 | | /* |
| 22 | /*------------------------------------------------- |
| 23 | image_fread_memory - read image to memory |
| 24 | -------------------------------------------------*/ |
| 25 | 25 | |
| 26 | | The format for the .ATM files is as follows: |
| 27 | | |
| 28 | | Offset Size Description |
| 29 | | ------ -------- ----------------------------------------------------------- |
| 30 | | 0000h 16 BYTEs ATOM filename (if less than 16 BYTEs, rest is 00h bytes) |
| 31 | | 0010h WORD Start address for load |
| 32 | | 0012h WORD Execution address |
| 33 | | 0014h WORD Size of data in BYTEs |
| 34 | | 0016h Size Data |
| 35 | | |
| 36 | | */ |
| 37 | | |
| 38 | 26 | static void image_fread_memory(running_device *image, UINT16 addr, UINT32 count) |
| 39 | 27 | { |
| 40 | 28 | void *ptr = memory_get_write_ptr(cpu_get_address_space(image->machine->firstcpu, ADDRESS_SPACE_PROGRAM), addr); |
| r7874 | r7875 | |
| 42 | 30 | image_fread(image, ptr, count); |
| 43 | 31 | } |
| 44 | 32 | |
| 33 | /*------------------------------------------------- |
| 34 | QUICKLOAD_LOAD( atom_atm ) |
| 35 | -------------------------------------------------*/ |
| 36 | |
| 45 | 37 | QUICKLOAD_LOAD( atom_atm ) |
| 46 | 38 | { |
| 39 | /* |
| 40 | |
| 41 | The format for the .ATM files is as follows: |
| 42 | |
| 43 | Offset Size Description |
| 44 | ------ -------- ----------------------------------------------------------- |
| 45 | 0000h 16 BYTEs ATOM filename (if less than 16 BYTEs, rest is 00h bytes) |
| 46 | 0010h WORD Start address for load |
| 47 | 0012h WORD Execution address |
| 48 | 0014h WORD Size of data in BYTEs |
| 49 | 0016h Size Data |
| 50 | |
| 51 | */ |
| 52 | |
| 47 | 53 | UINT8 header[0x16] = { 0 }; |
| 48 | 54 | |
| 49 | 55 | image_fread(image, header, 0x16); |
src/mess/formats/atarist_dsk.c
| r7874 | r7875 | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| 9 | | #include <string.h> |
| 10 | | |
| 11 | 9 | #include "formats/atarist_dsk.h" |
| 12 | 10 | #include "formats/basicdsk.h" |
| 13 | 11 | |
| 14 | | static FLOPPY_IDENTIFY(atarist_dsk_identify) |
| 12 | /* |
| 13 | |
| 14 | TODO: |
| 15 | |
| 16 | - MSA format |
| 17 | - STT format |
| 18 | - DIM format |
| 19 | |
| 20 | */ |
| 21 | |
| 22 | /*************************************************************************** |
| 23 | IMPLEMENTATION |
| 24 | ***************************************************************************/ |
| 25 | |
| 26 | /*------------------------------------------------- |
| 27 | FLOPPY_IDENTIFY( atarist_st_identify ) |
| 28 | -------------------------------------------------*/ |
| 29 | |
| 30 | static FLOPPY_IDENTIFY( atarist_st_identify ) |
| 15 | 31 | { |
| 16 | 32 | *vote = 100; |
| 33 | |
| 17 | 34 | return FLOPPY_ERROR_SUCCESS; |
| 18 | 35 | } |
| 19 | 36 | |
| 20 | | static FLOPPY_CONSTRUCT(atarist_dsk_construct) |
| 37 | /*------------------------------------------------- |
| 38 | FLOPPY_CONSTRUCT( atarist_st_construct ) |
| 39 | -------------------------------------------------*/ |
| 40 | |
| 41 | static FLOPPY_CONSTRUCT( atarist_st_construct ) |
| 21 | 42 | { |
| 22 | | struct basicdsk_geometry geometry; |
| 23 | 43 | int heads = 0; |
| 24 | 44 | int tracks = 0; |
| 25 | 45 | int sectors = 0; |
| r7874 | r7875 | |
| 30 | 50 | heads = bootsector[0x1a]; |
| 31 | 51 | tracks = (bootsector[0x13] | (bootsector[0x14] << 8)) / sectors / heads; |
| 32 | 52 | |
| 53 | struct basicdsk_geometry geometry; |
| 33 | 54 | memset(&geometry, 0, sizeof(geometry)); |
| 55 | |
| 34 | 56 | geometry.heads = heads; |
| 35 | 57 | geometry.first_sector_id = 1; |
| 36 | 58 | geometry.sector_length = 512; |
| 37 | 59 | geometry.tracks = tracks; |
| 38 | 60 | geometry.sectors = sectors; |
| 61 | |
| 39 | 62 | return basicdsk_construct(floppy, &geometry); |
| 40 | 63 | } |
| 41 | 64 | |
| 42 | | /* ----------------------------------------------------------------------- */ |
| 65 | /*------------------------------------------------- |
| 66 | FLOPPY_CONSTRUCT(atarist_dsk_construct) |
| 67 | -------------------------------------------------*/ |
| 43 | 68 | |
| 44 | 69 | FLOPPY_OPTIONS_START( atarist ) |
| 45 | | FLOPPY_OPTION( atarist, "st", "Atari ST floppy disk image", atarist_dsk_identify, atarist_dsk_construct, NULL) |
| 70 | FLOPPY_OPTION( atarist, "st", "Atari ST floppy disk image", atarist_st_identify, atarist_st_construct, NULL ) |
| 71 | /* FLOPPY_OPTION( atarist, "stt", "Atari ST floppy disk image", atarist_stt_identify, atarist_stt_construct, NULL ) |
| 72 | FLOPPY_OPTION( atarist, "msa", "Atari ST floppy disk image", atarist_msa_identify, atarist_msa_construct, NULL ) |
| 73 | FLOPPY_OPTION( atarist, "dim", "Atari ST floppy disk image", atarist_dim_identify, atarist_dim_construct, NULL )*/ |
| 46 | 74 | FLOPPY_OPTIONS_END |
| 47 | | |
src/mess/formats/comx35_comx.c
| r7874 | r7875 | |
| 30 | 30 | IMPLEMENTATION |
| 31 | 31 | ***************************************************************************/ |
| 32 | 32 | |
| 33 | /*------------------------------------------------- |
| 34 | image_fread_memory - read image to memory |
| 35 | -------------------------------------------------*/ |
| 36 | |
| 33 | 37 | static void image_fread_memory(running_device *image, UINT16 addr, UINT32 count) |
| 34 | 38 | { |
| 35 | 39 | void *ptr = memory_get_write_ptr(cpu_get_address_space(image->machine->firstcpu, ADDRESS_SPACE_PROGRAM), addr); |
| r7874 | r7875 | |
| 37 | 41 | image_fread(image, ptr, count); |
| 38 | 42 | } |
| 39 | 43 | |
| 44 | /*------------------------------------------------- |
| 45 | QUICKLOAD_LOAD( comx35_comx ) |
| 46 | -------------------------------------------------*/ |
| 47 | |
| 40 | 48 | QUICKLOAD_LOAD( comx35_comx ) |
| 41 | 49 | { |
| 42 | 50 | const address_space *program = cpu_get_address_space(image->machine->firstcpu, ADDRESS_SPACE_PROGRAM); |