emailler/client/clients/fix_cart.rb
jonnosan 3d4ee4ecf2 print size of unmodified bin file
git-svn-id: http://svn.code.sf.net/p/netboot65/code@63 93682198-c243-4bdb-bd91-e943c89aac3b
2009-03-27 13:16:58 +00:00

20 lines
594 B
Ruby

#
# Vice will treat a cartridge bin file that is of an even length as if the first 2 bytes in the file are a load address to be skipped over
# so we want to make sure the bin file is an odd length - specifically 8193 bytes
#
FILE_LENGTH=8193
PAD_BYTE=0xff.chr
filename=ARGV[0]
if filename.nil? then
puts "no filename specified"
exit
end
infile=File.open(filename,"rb").read
puts "fixing length of #{filename} from #{infile.length} to #{FILE_LENGTH} bytes"
outfile=File.open(filename,"wb")
outfile<<infile
outfile<<PAD_BYTE*(FILE_LENGTH-infile.length)
outfile.close