trunk/src/lib/formats/pc98fdi_dsk.c
| r19311 | r19312 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | Copyright Olivier Galibert |
| 4 | All rights reserved. |
| 5 | |
| 6 | Redistribution and use in source and binary forms, with or without |
| 7 | modification, are permitted provided that the following conditions are |
| 8 | met: |
| 9 | |
| 10 | * Redistributions of source code must retain the above copyright |
| 11 | notice, this list of conditions and the following disclaimer. |
| 12 | * Redistributions in binary form must reproduce the above copyright |
| 13 | notice, this list of conditions and the following disclaimer in |
| 14 | the documentation and/or other materials provided with the |
| 15 | distribution. |
| 16 | * Neither the name 'MAME' nor the names of its contributors may be |
| 17 | used to endorse or promote products derived from this software |
| 18 | without specific prior written permission. |
| 19 | |
| 20 | THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR |
| 21 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 23 | DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT, |
| 24 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 27 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 28 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 29 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | POSSIBILITY OF SUCH DAMAGE. |
| 31 | |
| 32 | ****************************************************************************/ |
| 33 | |
| 34 | /********************************************************************* |
| 35 | |
| 36 | formats/pc98fdi_dsk.h |
| 37 | |
| 38 | PC98FDI disk images |
| 39 | |
| 40 | *********************************************************************/ |
| 41 | |
| 42 | #include "emu.h" |
| 43 | #include "pc98fdi_dsk.h" |
| 44 | |
| 45 | pc98fdi_format::pc98fdi_format() |
| 46 | { |
| 47 | } |
| 48 | |
| 49 | const char *pc98fdi_format::name() const |
| 50 | { |
| 51 | return "pc98-fdi"; |
| 52 | } |
| 53 | |
| 54 | const char *pc98fdi_format::description() const |
| 55 | { |
| 56 | return "PC98 FDI disk image"; |
| 57 | } |
| 58 | |
| 59 | const char *pc98fdi_format::extensions() const |
| 60 | { |
| 61 | return "fdi"; |
| 62 | } |
| 63 | |
| 64 | int pc98fdi_format::identify(io_generic *io, UINT32 form_factor) |
| 65 | { |
| 66 | int size = io_generic_size(io); |
| 67 | UINT8 h[32]; |
| 68 | |
| 69 | io_generic_read(io, h, 0, 32); |
| 70 | int hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8)); |
| 71 | int psize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0xc)); |
| 72 | int ssize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10)); |
| 73 | int scnt = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14)); |
| 74 | int sides = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18)); |
| 75 | int ntrk = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)); |
| 76 | if(size == hsize + psize && psize == ssize*scnt*sides*ntrk) |
| 77 | return 100; |
| 78 | |
| 79 | return 0; |
| 80 | } |
| 81 | |
| 82 | bool pc98fdi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) |
| 83 | { |
| 84 | UINT8 h[32]; |
| 85 | |
| 86 | io_generic_read(io, h, 0, 32); |
| 87 | |
| 88 | int hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8)); |
| 89 | int sector_size = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10)); |
| 90 | int sector_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14)); |
| 91 | int head_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18)); |
| 92 | int track_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)); |
| 93 | |
| 94 | int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666; |
| 95 | |
| 96 | int ssize; |
| 97 | for(ssize=0; (128 << ssize) < sector_size; ssize++); |
| 98 | |
| 99 | desc_pc_sector sects[256]; |
| 100 | UINT8 sect_data[65536]; |
| 101 | |
| 102 | for(int track=0; track < track_count; track++) |
| 103 | for(int head=0; head < head_count; head++) { |
| 104 | io_generic_read(io, sect_data, hsize + sector_size*sector_count*(track*head_count + head), sector_size*sector_count); |
| 105 | |
| 106 | for(int i=0; i<sector_count; i++) { |
| 107 | sects[i].track = track; |
| 108 | sects[i].head = head; |
| 109 | sects[i].sector = i+1; |
| 110 | sects[i].size = ssize; |
| 111 | sects[i].actual_size = sector_size; |
| 112 | sects[i].deleted = false; |
| 113 | sects[i].bad_crc = false; |
| 114 | sects[i].data = sect_data + i*sector_size; |
| 115 | } |
| 116 | |
| 117 | build_pc_track_mfm(track, head, image, cell_count, sector_count, sects, calc_default_pc_gap3_size(form_factor, sector_size)); |
| 118 | } |
| 119 | |
| 120 | return true; |
| 121 | } |
| 122 | |
| 123 | bool pc98fdi_format::supports_save() const |
| 124 | { |
| 125 | return false; |
| 126 | } |
| 127 | |
| 128 | const floppy_format_type FLOPPY_PC98FDI_FORMAT = &floppy_image_format_creator<pc98fdi_format>; |
trunk/src/mess/drivers/pc9801.c
| r19311 | r19312 | |
| 271 | 271 | #include "machine/ram.h" |
| 272 | 272 | #include "formats/mfi_dsk.h" |
| 273 | 273 | #include "formats/d88_dsk.h" |
| 274 | #include "formats/pc98fdi_dsk.h" |
| 274 | 275 | |
| 275 | 276 | #define UPD1990A_TAG "upd1990a" |
| 276 | 277 | #define UPD8251_TAG "upd8251" |
| r19311 | r19312 | |
| 470 | 471 | DECLARE_WRITE8_MEMBER(pc9821_window_bank_w); |
| 471 | 472 | DECLARE_READ32_MEMBER(pc9821_timestamp_r); |
| 472 | 473 | |
| 474 | DECLARE_FLOPPY_FORMATS( floppy_formats ); |
| 475 | |
| 473 | 476 | void fdc_2hd_irq(bool state); |
| 474 | 477 | void fdc_2hd_drq(bool state); |
| 475 | 478 | void fdc_2dd_irq(bool state); |
| r19311 | r19312 | |
| 3089 | 3092 | DEVCB_LINE(pc9801_sound_irq) |
| 3090 | 3093 | }; |
| 3091 | 3094 | |
| 3095 | FLOPPY_FORMATS_MEMBER( pc9801_state::floppy_formats ) |
| 3096 | FLOPPY_PC98FDI_FORMAT |
| 3097 | FLOPPY_FORMATS_END |
| 3098 | |
| 3092 | 3099 | static MACHINE_CONFIG_START( pc9801, pc9801_state ) |
| 3093 | 3100 | MCFG_CPU_ADD("maincpu", I8086, 5000000) //unknown clock |
| 3094 | 3101 | MCFG_CPU_PROGRAM_MAP(pc9801_map) |
| r19311 | r19312 | |
| 3111 | 3118 | |
| 3112 | 3119 | MCFG_UPD765A_ADD("upd765_2hd", false, true) |
| 3113 | 3120 | MCFG_UPD765A_ADD("upd765_2dd", false, true) |
| 3114 | | MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", 0, floppy_image_device::default_floppy_formats) |
| 3115 | | MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", 0, floppy_image_device::default_floppy_formats) |
| 3116 | | MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:0", pc9801_floppies, "525hd", 0, floppy_image_device::default_floppy_formats) |
| 3117 | | MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:1", pc9801_floppies, "525hd", 0, floppy_image_device::default_floppy_formats) |
| 3121 | MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats) |
| 3122 | MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats) |
| 3123 | MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:0", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats) |
| 3124 | MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:1", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats) |
| 3118 | 3125 | |
| 3119 | 3126 | MCFG_SOFTWARE_LIST_ADD("disk_list","pc98") |
| 3120 | 3127 | |