Class: C64

Inherits:
HostSystem show all
Defined in:
lib/host_systems/C64.rb

Constant Summary collapse

@@symbols =
nil

Class Method Summary collapse

Methods inherited from HostSystem

all_host_systems, hex_dump, possible_file_systems

Methods included from SubclassTracking

extended

Class Method Details

.disassemble(buffer, start_address = 0) ⇒ Object



51
52
53
54
# File 'lib/host_systems/C64.rb', line 51

def C64.disassemble(buffer,start_address=0)
  require 'D65'
  D65.disassemble(buffer,start_address,symbols)  
end

.s_to_ascii(s) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/host_systems/C64.rb', line 37

def C64.s_to_ascii(s)
  r=""
  s.each_byte do |b|
    r+=to_ascii(b)
  end
  r
end

.start_trackObject

C64 disks start at track # 1



14
15
16
# File 'lib/host_systems/C64.rb', line 14

def C64.start_track
    1
end

.symbolsObject



46
47
48
49
# File 'lib/host_systems/C64.rb', line 46

def C64.symbols
  @@symbols=YAML::load(File.open(File.dirname(__FILE__)+"/c64_symbols.yaml")) if @@symbols.nil?
  @@symbols
end

.to_ascii(b) ⇒ Object

convert PETSCII to ASCII algorithm taken from VICE www.viceteam.org/



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/host_systems/C64.rb', line 20

def C64.to_ascii(b)  
  if (b==0xa) || (b==0x0d)
    return "\n"
  elsif (b==0x40) || (b==0x60)
    return b.chr
  elsif (b==0xA0) || (b==0xE0) #shifted space

    return " "
  else 
    case (b & 0XE0)
      when 0x40,0x60 then return (b^0x20).chr
      when 0xc0 then return (b^0x80).chr
      else
        return (b.chr)
    end
  end
end