Downsized memory

This commit is contained in:
Dominic Grimm 2022-06-17 18:55:46 +02:00
parent 258a6a4bd3
commit 9e49d228ed

View file

@ -79,7 +79,7 @@ module Hence
@reg_inp = 0_u16, @reg_inp = 0_u16,
@reg_out = 0_u16, @reg_out = 0_u16,
@stack = Slice(UInt16).new({{ 8 * 1024 }}), @stack = Slice(UInt16).new({{ 8 * 1024 }}),
@memory = Slice(UInt16).new({{ 24 * 1024 }}) @memory = Slice(UInt16).new({{ 16 * 1024 }})
) )
end end
@ -226,8 +226,10 @@ module Hence
@program[address].to_u16 @program[address].to_u16
elsif address < {{ 40 * 1024 }} elsif address < {{ 40 * 1024 }}
@stack[address - {{ 32 * 1024 }}] @stack[address - {{ 32 * 1024 }}]
else elsif address < {{ 56 * 1024 }}
@memory[address - {{ 40 * 1024 }}] @memory[address - {{ 40 * 1024 }}]
else
0_u16
end end
end end
@ -238,8 +240,10 @@ module Hence
@stack[address - {{ 32 * 1024 }}] = value @stack[address - {{ 32 * 1024 }}] = value
value value
else elsif address < {{ 56 * 1024 }}
@memory[address - {{ 40 * 1024 }}] = value @memory[address - {{ 40 * 1024 }}] = value
else
0_u16
end end
end end
end end