create return address as own class to hold return addresses
to distinguish from integer, which does not need adjusting
This commit is contained in:
@@ -20,6 +20,7 @@ module Risc
|
||||
@booted = false
|
||||
@risc_init = nil
|
||||
@constants = []
|
||||
@next_address = nil
|
||||
end
|
||||
attr_reader :constants , :cpu_init
|
||||
attr_reader :booted , :translated
|
||||
@@ -61,6 +62,17 @@ module Risc
|
||||
@constants << const
|
||||
end
|
||||
|
||||
# hand out a return address for use as constant the address is added
|
||||
def get_address
|
||||
10.times do # 10 for whole pages
|
||||
@next_address = Parfait::ReturnAddress.new(0,@next_address)
|
||||
add_constant( @next_address )
|
||||
end unless @next_address
|
||||
addr = @next_address
|
||||
@next_address = @next_address.next_integer
|
||||
addr
|
||||
end
|
||||
|
||||
# To create binaries, objects (and labels) need to have a position
|
||||
# (so objects can be loaded and branches know where to jump)
|
||||
#
|
||||
|
Reference in New Issue
Block a user