a creative moment, making up instructions
This commit is contained in:
parent
f77d3ea7eb
commit
e3c3840bc6
13
lib/register/instructions/function_return.rb
Normal file
13
lib/register/instructions/function_return.rb
Normal file
@ -0,0 +1,13 @@
|
||||
module Register
|
||||
|
||||
# return from a function call
|
||||
#register and index specify where the return address is stored
|
||||
|
||||
class FunctionReturn < Instruction
|
||||
def initialize register , index
|
||||
@register = register
|
||||
@index = index
|
||||
end
|
||||
attr_reader :register , :index
|
||||
end
|
||||
end
|
12
lib/register/instructions/register_transfer.rb
Normal file
12
lib/register/instructions/register_transfer.rb
Normal file
@ -0,0 +1,12 @@
|
||||
module Register
|
||||
|
||||
#transfer the constents of one register to another. possibly called move in some cpus
|
||||
|
||||
class RegisterTransfer < Instruction
|
||||
def initialize from , to
|
||||
@from = from
|
||||
@to = to
|
||||
end
|
||||
attr_reader :from, :to
|
||||
end
|
||||
end
|
13
lib/register/instructions/save_return.rb
Normal file
13
lib/register/instructions/save_return.rb
Normal file
@ -0,0 +1,13 @@
|
||||
module Register
|
||||
|
||||
# save the return address of a call
|
||||
# register and index specify where the return address is stored
|
||||
|
||||
class SaveReturn < Instruction
|
||||
def initialize register , index
|
||||
@register = register
|
||||
@index = index
|
||||
end
|
||||
attr_reader :register , :index
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user