lib/image_formats/D64.rb in ripxplore-0.7.2 vs lib/image_formats/D64.rb in ripxplore-0.8.0
- old
+ new
@@ -58,15 +58,23 @@
return nil unless sector_no.between?(0,@@sectors_in_track[track_no]-1)
start_byte=@@offset_of_track[track_no]+(D64_BYTES_PER_SECTOR*(sector_no))
file_bytes[start_byte,D64_BYTES_PER_SECTOR]
end
+def set_sector(track_no,sector_no,sector_contents)
+ raise "invalid track number #{track_no}" if @@sectors_in_track[track_no].nil?
+ raise "invalid sector number #{sector_no}" unless sector_no.between?(0,@@sectors_in_track[track_no]-1)
+ padded_sector_contents=(sector_contents+("\000"*D64_BYTES_PER_SECTOR))[0,D64_BYTES_PER_SECTOR]
+ start_byte=@@offset_of_track[track_no]+(D64_BYTES_PER_SECTOR*(sector_no))
+ file_bytes[start_byte,D64_BYTES_PER_SECTOR]=padded_sector_contents
end
+
+end
# == Author
# Jonno Downes (jonno@jamtronix.com)
#
# == Copyright
-# Copyright (c) 2008 Jonno Downes (jonno@jamtronix.com)
+# Copyright (c) 2008,2009 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,