mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-11-29 11:51:14 +00:00
Initial DOS 3.3 detection
This commit is contained in:
parent
d3265737ca
commit
74ea705347
52
atrcopy/dos33.py
Normal file
52
atrcopy/dos33.py
Normal file
@ -0,0 +1,52 @@
|
||||
import numpy as np
|
||||
|
||||
from errors import *
|
||||
from diskimages import DiskImageBase
|
||||
from segments import DefaultSegment, EmptySegment, ObjSegment, RawSectorsSegment, SegmentSaver
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Dos33Header(object):
|
||||
file_format = "DOS 3.3"
|
||||
|
||||
def __init__(self):
|
||||
self.header_offset = 0
|
||||
self.image_size = 143360
|
||||
self.max_sectors = 35 * 16
|
||||
self.sector_size = 256
|
||||
|
||||
def __str__(self):
|
||||
return "%s Disk Image (size=%d (%dx%db)" % (self.file_format, self.image_size, self.max_sectors, self.sector_size)
|
||||
|
||||
def __len__(self):
|
||||
return 0
|
||||
|
||||
def to_array(self):
|
||||
raw = np.zeros([0], dtype=np.uint8)
|
||||
return raw
|
||||
|
||||
def check_size(self, size):
|
||||
if size != self.image_size:
|
||||
raise InvalidDiskImage("Incorrect size for DOS 3.3 image")
|
||||
|
||||
def strict_check(self, image):
|
||||
size = len(image)
|
||||
if size in [143360]:
|
||||
return
|
||||
raise InvalidDiskImage("Incorrect size for DOS 3.3 image")
|
||||
|
||||
|
||||
class Dos33DiskImage(DiskImageBase):
|
||||
def __init__(self, rawdata, filename=""):
|
||||
DiskImageBase.__init__(self, rawdata, filename)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.header)
|
||||
|
||||
def read_header(self):
|
||||
self.header = Dos33Header()
|
||||
|
||||
def get_boot_segments(self):
|
||||
return []
|
@ -7,6 +7,7 @@ from ataridos import AtariDosDiskImage, AtariDosFile
|
||||
from spartados import SpartaDosDiskImage
|
||||
from cartridge import AtariCartImage, get_known_carts
|
||||
from mame import MameZipImage
|
||||
from dos33 import Dos33DiskImage
|
||||
from errors import *
|
||||
|
||||
|
||||
@ -90,6 +91,11 @@ class MameZipParser(SegmentParser):
|
||||
image_type = MameZipImage
|
||||
|
||||
|
||||
class Dos33SegmentParser(SegmentParser):
|
||||
menu_name = "DOS 3.3 Disk Image"
|
||||
image_type = Dos33DiskImage
|
||||
|
||||
|
||||
def guess_parser_for_mime(mime, r):
|
||||
parsers = mime_parsers[mime]
|
||||
found = None
|
||||
@ -130,6 +136,9 @@ mime_parsers = {
|
||||
"application/vnd.mame_rom": [
|
||||
MameZipParser,
|
||||
],
|
||||
"application/vnd.apple2.dsk": [
|
||||
Dos33SegmentParser,
|
||||
],
|
||||
}
|
||||
|
||||
mime_parse_order = [
|
||||
@ -137,12 +146,14 @@ mime_parse_order = [
|
||||
"application/vnd.atari8bit.xex",
|
||||
"CARTS", # Will get filled in below
|
||||
"application/vnd.mame_rom",
|
||||
"application/vnd.apple2.dsk",
|
||||
]
|
||||
|
||||
pretty_mime = {
|
||||
"application/vnd.atari8bit.atr": "Atari 8-bit Disk Image",
|
||||
"application/vnd.atari8bit.xex": "Atari 8-bit Executable",
|
||||
"application/vnd.mame_rom": "MAME"
|
||||
"application/vnd.mame_rom": "MAME",
|
||||
"application/vnd.apple2.dsk": "Apple ][ Disk Image",
|
||||
}
|
||||
|
||||
grouped_carts = get_known_carts()
|
||||
|
Loading…
Reference in New Issue
Block a user