mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-11-25 16:32:07 +00:00
Added create_emulator_boot_segment to disk images and files
* prepare a segment that can be written to disk and booted by an emulator
This commit is contained in:
parent
3cac86deba
commit
c57c35eeec
@ -1,7 +1,7 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from . import errors
|
from . import errors
|
||||||
from .diskimages import DiskImageBase, BaseHeader
|
from .diskimages import DiskImageBase, BaseHeader, Bootable
|
||||||
from .segments import SegmentData, EmptySegment, ObjSegment, RawSectorsSegment, DefaultSegment, SegmentedFileSegment, SegmentSaver, get_style_bits
|
from .segments import SegmentData, EmptySegment, ObjSegment, RawSectorsSegment, DefaultSegment, SegmentedFileSegment, SegmentSaver, get_style_bits
|
||||||
from .utils import *
|
from .utils import *
|
||||||
from .executables import get_xex
|
from .executables import get_xex
|
||||||
@ -267,7 +267,7 @@ class RunAddressSegment(ObjSegment):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AtariDosFile:
|
class AtariDosFile(Bootable):
|
||||||
"""Parse a binary chunk into segments according to the Atari DOS object
|
"""Parse a binary chunk into segments according to the Atari DOS object
|
||||||
file format.
|
file format.
|
||||||
|
|
||||||
|
@ -303,4 +303,11 @@ class RomImage(DiskImageBase):
|
|||||||
def parse_segments(self):
|
def parse_segments(self):
|
||||||
r = self.rawdata
|
r = self.rawdata
|
||||||
s = ObjSegment(r, 0, 0, self.header.main_origin, name="Main Bank")
|
s = ObjSegment(r, 0, 0, self.header.main_origin, name="Main Bank")
|
||||||
return [s]
|
self.segments = [s]
|
||||||
|
|
||||||
|
def create_emulator_boot_segment(self):
|
||||||
|
print(self.segments)
|
||||||
|
s = self.segments[0]
|
||||||
|
if s.origin == 0:
|
||||||
|
return None
|
||||||
|
return s
|
||||||
|
@ -92,7 +92,12 @@ class BaseHeader:
|
|||||||
return self.sector_class(self.sector_size, data)
|
return self.sector_class(self.sector_size, data)
|
||||||
|
|
||||||
|
|
||||||
class DiskImageBase:
|
class Bootable:
|
||||||
|
def create_emulator_boot_segment(self):
|
||||||
|
return ObjSegment(self.rawdata, 0, 0, 0)
|
||||||
|
|
||||||
|
|
||||||
|
class DiskImageBase(Bootable):
|
||||||
default_executable_extension = None
|
default_executable_extension = None
|
||||||
|
|
||||||
def __init__(self, rawdata, filename="", create=False):
|
def __init__(self, rawdata, filename="", create=False):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from . import errors
|
from . import errors
|
||||||
from .diskimages import BaseHeader, DiskImageBase
|
from .diskimages import BaseHeader, DiskImageBase, Bootable
|
||||||
from .utils import Directory, VTOC, WriteableSector, BaseSectorList, Dirent
|
from .utils import Directory, VTOC, WriteableSector, BaseSectorList, Dirent
|
||||||
from .segments import DefaultSegment, EmptySegment, ObjSegment, RawTrackSectorSegment, SegmentSaver, get_style_bits, SegmentData
|
from .segments import DefaultSegment, EmptySegment, ObjSegment, RawTrackSectorSegment, SegmentSaver, get_style_bits, SegmentData
|
||||||
from .executables import get_bsave
|
from .executables import get_bsave
|
||||||
@ -594,7 +594,7 @@ class Dos33DiskImage(DiskImageBase):
|
|||||||
return segment
|
return segment
|
||||||
|
|
||||||
|
|
||||||
class Dos33BinFile:
|
class Dos33BinFile(Bootable):
|
||||||
"""Parse a binary chunk into segments according to the DOS 3.3 binary
|
"""Parse a binary chunk into segments according to the DOS 3.3 binary
|
||||||
dump format
|
dump format
|
||||||
"""
|
"""
|
||||||
@ -637,6 +637,9 @@ class Dos33BinFile:
|
|||||||
else:
|
else:
|
||||||
raise errors.InvalidBinaryFile(f"Invalid BSAVE header")
|
raise errors.InvalidBinaryFile(f"Invalid BSAVE header")
|
||||||
|
|
||||||
|
def create_emulator_boot_segment(self):
|
||||||
|
return self.segments[0]
|
||||||
|
|
||||||
|
|
||||||
class ProdosHeader(Dos33Header):
|
class ProdosHeader(Dos33Header):
|
||||||
file_format = "ProDOS"
|
file_format = "ProDOS"
|
||||||
|
Loading…
Reference in New Issue
Block a user