From eb7a055bfaad3cc80a0c310eb5c995f3910aa1f1 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Sun, 26 Mar 2023 09:57:21 +0300 Subject: abc80x: Fix sector dump floppy image loading. [Curt Coder] --- src/lib/formats/abc800_dsk.cpp | 21 ++++++++++++++++++++- src/lib/formats/abc800_dsk.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/lib/formats/abc800_dsk.cpp b/src/lib/formats/abc800_dsk.cpp index 9fc66db187f..6498aa7f357 100644 --- a/src/lib/formats/abc800_dsk.cpp +++ b/src/lib/formats/abc800_dsk.cpp @@ -26,7 +26,7 @@ const char *abc800_format::description() const const char *abc800_format::extensions() const { - return "dsk"; + return "dsk,img"; } const abc800_format::format abc800_format::formats[] = { @@ -163,3 +163,22 @@ void abc800_format::build_sector_description(const format &f, uint8_t *sectdata, } } } + +int abc800_format::get_image_offset(const format &f, int head, int track) const +{ + int offset = 0; + + if(head) { + for(int trk=0; trk < f.track_count; trk++) { + const format &tf = get_track_format(f, 0, trk); + offset += compute_track_size(tf); + } + } + + for(int trk=0; trk < track; trk++) { + const format &tf = get_track_format(f, head, trk); + offset += compute_track_size(tf); + } + + return offset; +} diff --git a/src/lib/formats/abc800_dsk.h b/src/lib/formats/abc800_dsk.h index c75def822f4..dc6f8911fa7 100644 --- a/src/lib/formats/abc800_dsk.h +++ b/src/lib/formats/abc800_dsk.h @@ -25,6 +25,7 @@ public: protected: virtual void build_sector_description(const format &d, uint8_t *sectdata, desc_s *sectors, int track, int head) const override; + virtual int get_image_offset(const format &f, int head, int track) const override; private: static const format formats[]; -- cgit v1.2.3