diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/formats/jvc_dsk.cpp | 18 | ||||
-rw-r--r-- | src/lib/formats/pc_dsk.cpp | 4 | ||||
-rw-r--r-- | src/lib/util/disasmintf.cpp | 47 | ||||
-rw-r--r-- | src/lib/util/disasmintf.h | 69 |
4 files changed, 131 insertions, 7 deletions
diff --git a/src/lib/formats/jvc_dsk.cpp b/src/lib/formats/jvc_dsk.cpp index 3c230eed3cd..d2e7e503d3b 100644 --- a/src/lib/formats/jvc_dsk.cpp +++ b/src/lib/formats/jvc_dsk.cpp @@ -84,16 +84,20 @@ bool jvc_format::parse_header(io_generic *io, int &header_size, int &tracks, int int os9_total_sectors = pick_integer_be(os9_header, 0x00, 3); int os9_heads = BIT(os9_header[0x10], 0) ? 2 : 1; int os9_sectors = pick_integer_be(os9_header, 0x11, 2); - int os9_tracks = os9_total_sectors / os9_sectors / os9_heads; - // now let's see if we have valid info - if ((os9_tracks * os9_heads * os9_sectors * 256) == size) + if (os9_total_sectors > 0 && os9_heads > 0 && os9_sectors > 0) { - tracks = os9_tracks; - heads = os9_heads; - sectors = os9_sectors; + int os9_tracks = os9_total_sectors / os9_sectors / os9_heads; - osd_printf_verbose("OS-9 format disk image detected.\n"); + // now let's see if we have valid info + if ((os9_tracks * os9_heads * os9_sectors * 256) == size) + { + tracks = os9_tracks; + heads = os9_heads; + sectors = os9_sectors; + + osd_printf_verbose("OS-9 format disk image detected.\n"); + } } } diff --git a/src/lib/formats/pc_dsk.cpp b/src/lib/formats/pc_dsk.cpp index fa8f72f67d2..e4d7e02f47d 100644 --- a/src/lib/formats/pc_dsk.cpp +++ b/src/lib/formats/pc_dsk.cpp @@ -193,6 +193,10 @@ const pc_format::format pc_format::formats[] = { floppy_image::FF_525, floppy_image::DSDD, floppy_image::MFM, 2000, 9, 40, 2, 512, {}, 1, {}, 80, 50, 22, 80 }, + { /* 360K 5 1/4 inch double density, 41 tracks */ + floppy_image::FF_525, floppy_image::DSDD, floppy_image::MFM, + 2000, 9, 41, 2, 512, {}, 1, {}, 80, 50, 22, 80 + }, { /* 360K 5 1/4 inch double density, 42 tracks */ floppy_image::FF_525, floppy_image::DSDD, floppy_image::MFM, 2000, 9, 42, 2, 512, {}, 1, {}, 80, 50, 22, 80 diff --git a/src/lib/util/disasmintf.cpp b/src/lib/util/disasmintf.cpp new file mode 100644 index 00000000000..9699f68e823 --- /dev/null +++ b/src/lib/util/disasmintf.cpp @@ -0,0 +1,47 @@ +#include "disasmintf.h" + +util::u32 util::disasm_interface::interface_flags() const +{ + return 0; +} + +util::u32 util::disasm_interface::page_address_bits() const +{ + throw ("unimplemented page_address_bits called"); +} + +util::u32 util::disasm_interface::page2_address_bits() const +{ + throw ("unimplemented page2_address_bits called"); +} + +util::disasm_interface::offs_t util::disasm_interface::pc_linear_to_real(offs_t pc) const +{ + throw ("unimplemented pc_linear_to_real called"); +} + +util::disasm_interface::offs_t util::disasm_interface::pc_real_to_linear(offs_t pc) const +{ + throw ("unimplemented pc_real_to_linear called"); +} + +util::u8 util::disasm_interface::decrypt8(u8 value, offs_t pc, bool opcode) const +{ + throw ("unimplemented decrypt8 called"); +} + +util::u16 util::disasm_interface::decrypt16(u16 value, offs_t pc, bool opcode) const +{ + throw ("unimplemented decrypt16 called"); +} + +util::u32 util::disasm_interface::decrypt32(u32 value, offs_t pc, bool opcode) const +{ + throw ("unimplemented decrypt32 called"); +} + +util::u64 util::disasm_interface::decrypt64(u64 value, offs_t pc, bool opcode) const +{ + throw ("unimplemented decrypt64 called"); +} + diff --git a/src/lib/util/disasmintf.h b/src/lib/util/disasmintf.h new file mode 100644 index 00000000000..908bd762bdb --- /dev/null +++ b/src/lib/util/disasmintf.h @@ -0,0 +1,69 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/*************************************************************************** + + disasmintf.h + + Generic disassembler interface. + +***************************************************************************/ + +#pragma once + +#ifndef MAME_UTIL_DISASMINTF_H +#define MAME_UTIL_DISASMINTF_H + +#include "coretmpl.h" + +namespace util { +// class implementing a disassembler +class disasm_interface +{ +public: + using offs_t = u32; + + // Disassembler constants for the return value + static constexpr u32 SUPPORTED = 0x80000000; // are disassembly flags supported? + static constexpr u32 STEP_OUT = 0x40000000; // this instruction should be the end of a step out sequence + static constexpr u32 STEP_OVER = 0x20000000; // this instruction should be stepped over by setting a breakpoint afterwards + static constexpr u32 OVERINSTMASK = 0x18000000; // number of extra instructions to skip when stepping over + static constexpr u32 OVERINSTSHIFT = 27; // bits to shift after masking to get the value + static constexpr u32 LENGTHMASK = 0x0000ffff; // the low 16-bits contain the actual length + + static inline u32 step_over_extra(u32 x) { + return x << OVERINSTSHIFT; + } + + class data_buffer { + public: + virtual ~data_buffer() = default; + virtual u8 r8 (offs_t pc) const = 0; + virtual u16 r16(offs_t pc) const = 0; + virtual u32 r32(offs_t pc) const = 0; + virtual u64 r64(offs_t pc) const = 0; + }; + + enum { + NONLINEAR_PC = 0x00000001, + PAGED = 0x00000002, + PAGED2LEVEL = 0x00000006, + INTERNAL_DECRYPTION = 0x00000008, + SPLIT_DECRYPTION = 0x00000018 + }; + + virtual u32 interface_flags() const; + virtual u32 page_address_bits() const; + virtual u32 page2_address_bits() const; + virtual offs_t pc_linear_to_real(offs_t pc) const; + virtual offs_t pc_real_to_linear(offs_t pc) const; + virtual u8 decrypt8 (u8 value, offs_t pc, bool opcode) const; + virtual u16 decrypt16(u16 value, offs_t pc, bool opcode) const; + virtual u32 decrypt32(u32 value, offs_t pc, bool opcode) const; + virtual u64 decrypt64(u64 value, offs_t pc, bool opcode) const; + + virtual u32 opcode_alignment() const = 0; + virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) = 0; +}; +} + +#endif |