Class: Atari800

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

Constant Summary collapse

UNICODE_EXCEPTIONS =

mapping of ATASCII to unicode funktor.org/dist/ucstable/atascii.txt

{
	0x00=>0x2665,
	0x01=>0x251C,
	0x03=>0x2518,
	0x04=>0x2524,
	0x05=>0x2510,
	0x06=>0x2571,
	0x07=>0x2572,
	0x08=>0x25E2,
	0x09=>0x2597,
	0x0A=>0x25E3,
	0x0B=>0x259D,
	0x0C=>0x2598,
	0x0F=>0x2596,
	0x10=>0x2663,
	0x11=>0x250C,
	0x12=>0x2500,
	0x13=>0x253C,
	0x14=>0x25CF,
	0x15=>0x2584,
	0x17=>0x252C,
	0x18=>0x2534,
	0x19=>0x258C,
	0x1A=>0x2514,
	0x1C=>0x2191,
	0x1D=>0x2193,
	0x1E=>0x2190,
	0x1F=>0x2192,
	0x7B=>0x2660,
	0x7D=>0x21B0,
	0x7E=>0x25C0,
	0x7F=>0x25B6

}
@@annotations =
nil

Constants inherited from HostSystem

HostSystem::MAX_SCREENDUMP_LINES

Class Method Summary collapse

Methods inherited from HostSystem

all_host_systems, font_data, hex_dump, pixels_between_characters, possible_file_systems, s_to_ascii, start_track, to_screendump

Methods included from SubclassTracking

extended

Class Method Details

.annotationsObject



89
90
91
# File 'lib/host_systems/Atari800.rb', line 89

def self.annotations
  @@annotations=YAML::load(File.open(File.dirname(__FILE__)+"/atari_800_symbols.yaml")) if @@annotations.nil?
end

.atascii_to_unicode(b) ⇒ Object



79
80
81
82
83
84
85
86
# File 'lib/host_systems/Atari800.rb', line 79

def self.atascii_to_unicode(b)
	u=UNICODE_EXCEPTIONS[b]
	if  (u.nil?) then
		return b
	else
		u
	end
end

.char_to_screen_code(char) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/host_systems/Atari800.rb', line 35

def self.char_to_screen_code(char)
	b=char[0]
	case b
		when 0..31 then return b+64
		when 32..95 then return b-32
		else return b
	end
end

.default_background_colourObject



131
132
133
# File 'lib/host_systems/Atari800.rb', line 131

def self.default_background_colour
PNG::Color.new(0x00,0x51,0x84,0xFF)	
end

.default_foreground_colourObject



127
128
129
# File 'lib/host_systems/Atari800.rb', line 127

def self.default_foreground_colour  
   PNG::Color.new(0x63,0xB6,0xE7,0xFF)	
end

.default_screen_widthObject



110
111
112
# File 'lib/host_systems/Atari800.rb', line 110

def self.default_screen_width
  40
end

.disassemble(buffer, start_address = 0) ⇒ Object



93
94
95
96
# File 'lib/host_systems/Atari800.rb', line 93

def self.disassemble(buffer,start_address=0)
  require 'D65'
  D65.disassemble(buffer,start_address,annotations)  
end

.font_data_filenameObject



98
99
100
# File 'lib/host_systems/Atari800.rb', line 98

def self.font_data_filename
File.dirname(__FILE__) +"/atari-800-font.bin"
end

.font_heightObject



122
123
124
# File 'lib/host_systems/Atari800.rb', line 122

def self.font_height
  8
end

.font_widthObject



118
119
120
# File 'lib/host_systems/Atari800.rb', line 118

def self.font_width
  8
end

.full_nameObject



12
13
14
# File 'lib/host_systems/Atari800.rb', line 12

def self.full_name
    "Atari 400/800"
end

.line_break_charsObject



106
107
108
# File 'lib/host_systems/Atari800.rb', line 106

def self.line_break_chars
  [0x9b]
end

.max_screen_widthObject



114
115
116
# File 'lib/host_systems/Atari800.rb', line 114

def self.max_screen_width
  40
end

.paletteObject



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/host_systems/Atari800.rb', line 135

def self.palette
	if @palette.nil? then
		@palette=Array.new(256)
		256.times do |val|
			cr = (val >> 4) & 15
			lm = val & 15
			crlv = (cr!=0 ? 50.0 : 0.0)
		  
			phase = ((cr-1)*25.0 - 58.0) * (2.0 * Math::PI / 360.0)
		
			y = 255.0*(lm+1.0)/16.0
			i = crlv*Math.cos(phase)
			q = crlv*Math.sin(phase)
		
			r = (y + 0.956*i + 0.621*q).to_i
			g = (y - 0.272*i - 0.647*q).to_i
			b = (y - 1.107*i + 1.704*q).to_i
			
			r=0 if r<0
			g=0 if g<0
			b=0 if b<0
			r=255 if r>255
			g=255 if g>255
			b=255 if b>255
			
			
#			puts "#{val},#{r},#{g},#{b}"
			@palette[val]=PNG::Color.new(r,g,b,0xFF)
		end
	end
	@palette
end

.screen_code_to_atascii(b) ⇒ Object

mapping of internal (screen) codes to ATASCII www.atariarchives.org/mapping/appendix10.php



27
28
29
30
31
32
33
# File 'lib/host_systems/Atari800.rb', line 27

def self.screen_code_to_atascii(b)
	case b
		when 0..63 then return b+32
		when 64..95 then return b-64
		else return b		
	end
end

.screen_rowsObject



102
103
104
# File 'lib/host_systems/Atari800.rb', line 102

def self.screen_rows
  24
end

.to_ascii(b) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/host_systems/Atari800.rb', line 16

def self.to_ascii(b)
  if b==0x9b then
    "\n"
  else
    b.chr
  end

end