// license:BSD-3-Clause // copyright-holders:Olivier Galibert /********************************************************************* formats/oric_dsk.c Oric disk images *********************************************************************/ #include "emu.h" #include "formats/oric_dsk.h" oric_dsk_format::oric_dsk_format() { } const char *oric_dsk_format::name() const { return "oric_dsk"; } const char *oric_dsk_format::description() const { return "Oric disk image"; } const char *oric_dsk_format::extensions() const { return "dsk"; } bool oric_dsk_format::supports_save() const { return true; } int oric_dsk_format::identify(io_generic *io, UINT32 form_factor) { UINT8 h[256]; io_generic_read(io, h, 0, 256); if(memcmp(h, "MFM_DISK", 8)) return 0; int sides = (h[11] << 24) | (h[10] << 16) | (h[ 9] << 8) | h[ 8]; int tracks = (h[15] << 24) | (h[14] << 16) | (h[13] << 8) | h[12]; int geom = (h[19] << 24) | (h[18] << 16) | (h[17] << 8) | h[16]; int size = io_generic_size(io); if(sides < 0 || sides > 2 || geom != 1 || size != 256+6400*sides*tracks) return 0; return 100; } bool oric_dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) { UINT8 h[256]; UINT8 t[6250+3]; UINT32 stream[100000]; t[6250] = t[6251] = t[6252] = 0; io_generic_read(io, h, 0, 256); int sides = (h[11] << 24) | (h[10] << 16) | (h[ 9] << 8) | h[ 8]; int tracks = (h[15] << 24) | (h[14] << 16) | (h[13] << 8) | h[12]; for(int side=0; side;