# File lib/wilson.rb, line 89
89: def self.commands
90: self.default.commands
91: end
# File lib/wilson.rb, line 81
81: def self.default
82: @@default ||= self.new.parse
83: end
# File lib/wilson.rb, line 85
85: def self.default= o
86: @@default = o
87: end
# File lib/wilson.rb, line 141
141: def add_command command
142: return self.add_conditional_commands(command) if command.opcode =~ /cc$/
143: self.commands << command
144: self.expand_parameters command
145: end
# File lib/wilson.rb, line 119
119: def add_conditional_commands prototype
120: prototype.opcode = prototype.opcode[0..3]
121:
122: self.conditionals.each do |conditional, value|
123: command = prototype.dup
124: command.opcode += conditional
125:
126: command.opcodes.each_with_index do |op, index|
127: command.opcodes[index] = ($1.hex+value).to_s(16) if op =~ /(.*)\+cc$/
128: end
129:
130: self.add_command command
131: end
132: end
# File lib/wilson.rb, line 147
147: def conditionals
148: @conditionals ||= {
149: 'O' => 0, 'NO' => 1, 'B' => 2, 'C' => 2, 'NAE' => 2,
150: 'AE' => 3, 'NB' => 3, 'NC' => 3, 'E' => 4, 'Z' => 4,
151: 'NE' => 5, 'NZ' => 5, 'BE' => 6, 'NA' => 6, 'A' => 7,
152: 'NBE' => 7, 'S' => 8, 'NS' => 9, 'P' => 10, 'PE' => 10,
153: 'NP' => 11, 'PO' => 11, 'L' => 12, 'NGE' => 12, 'GE' => 13,
154: 'NL' => 13, 'LE' => 14, 'NG' => 14, 'G' => 15, 'NLE' => 15,
155: }
156: end
# File lib/wilson.rb, line 101
101: def expand_parameters command
102: command.parameters.each_with_index do |parameter, index|
103: if String === parameter && parameter =~ /^r\/m(\d+)/ then
104: bits = $1.to_i
105: newCommand = command.dup
106: commands << newCommand
107: case bits
108: when 8, 16, 32 then
109: command.parameters[index] = MemoryRegister.new bits
110: newCommand.parameters[index] = Address.new false, bits
111: when 64 then
112: command.parameters[index] = MMXRegister.new bits
113: newCommand.parameters[index] = Address.new false, bits
114: end
115: end
116: end
117: end
# File lib/wilson.rb, line 8 8: def no!; false end
# File lib/wilson.rb, line 175
175: def parse
176: (self.class.nasm + self.class.nasm_fixes).each_line do |line|
177: self.process_line line.strip.sub(/^# /, '')
178: end
179:
180: self
181: end
# File lib/wilson.rb, line 158
158: def parse_command line
159: if line =~ /^(\w+)\s+([^;]*)\s+;\s+([^\[]+)\s+\[([\w,]+)\]/ then
160: name, params, ops, procs = $1, $2, $3, $4
161:
162: command = Command.new
163: command.opcode = name
164: command.opcodes = ops.split
165: command.processors = procs.split(/,/)
166:
167: command.initialize_parameters params.strip
168:
169: self.add_command command
170: else
171: raise "unparsed: #{line}"
172: end
173: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.