Module: Badline::Media

Defined in:
lib/badline/media.rb

Constant Summary collapse

AUTOSTART =
%(lO"*",8,1\rrun\r)
BASIC_START =
0x0801
DISK_TYPES =
{
  ".d64" => Storage::D64Image,
  ".d71" => Storage::D71Image,
  ".d81" => Storage::D81Image
}.freeze

Class Method Summary collapse

Class Method Details

.attach(computer, path, autostart: true) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/badline/media.rb', line 15

def attach(computer, path, autostart: true)
  if File.directory?(path)
    computer.mount(Storage::HostDirectory.new(path))
    "Mounted #{path} as device 8"
  elsif File.extname(path).downcase == ".crt"
    attach_cartridge(computer, path)
  elsif (image = DISK_TYPES[File.extname(path).downcase])
    attach_disk(computer, image.new(path), path, autostart:)
  else
    attach_prg(computer, path, autostart:)
  end
end