$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) $:.unshift(File.dirname(__FILE__+"\\..")) unless $:.include?(File.dirname(__FILE__+"\\..")) || $:.include?(File.expand_path(File.dirname(__FILE__+"\\.."))) require 'ImageFormat' #TRS80 DSK in JV1 format - http://tim-mann.org/trs80/dskspec.html class Trs80Jv1Dsk < ImageFormat def self.possible_extensions ['.dsk'] end #JV1 format has no header, and a variable number of tracks, each with 10 sectors, each with 256 bytes. #for the moment, we only handle SSSD 80 track images (204800 bytes) is_valid_image_if lambda { file_system_image.file_bytes.length==204800 } def self.host_system Trs80 end def sectors_in_track(track_no) (0..0x09).collect end # how many tracks could be interpreted by this image format? def track_count file_bytes.length/(2560) end def get_sector(track,sector) start_byte=track*10*256+sector*256 file_bytes[start_byte,256] end end # == Author # Jonno Downes (jonno@jamtronix.com) # # == Copyright # Copyright (c) 2007 Jonno Downes (jonno@jamtronix.com) # #Permission is hereby granted, free of charge, to any person obtaining #a copy of this software and associated documentation files (the #"Software"), to deal in the Software without restriction, including #without limitation the rights to use, copy, modify, merge, publish, #distribute, sublicense, and/or sell copies of the Software, and to #permit persons to whom the Software is furnished to do so, subject to #the following conditions: # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.