Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Virtual machine(assembler) for CC:TWEAKED minecraft
- --Created Mangro(HexWorld,JustMangro) not copy!
- --If you wanna upgrade it or recreate, in start type
- --Mangro creator, (your username) upgraded
- tArgs = {}
- tick = 0.005 -- Operation per second, 0.01
- byte = 255 -- Count of one byte
- processor = {}
- processor.ax = 50
- processor.bx = 0
- processor.cx = 0
- processor.pc = 0
- processor.cc = 1
- flags = {}
- flags.left = false
- flags.right = false
- flags.reset = false
- function runTime() while not flags.reset do
- sleep(tick)
- print(processor.ax .. " " .. processor.bx .. " " .. processor.cx .. " " .. processor.cc)
- for i=1,#processor do
- if processor[i] > byte then
- error("Processor register is very big")
- end end
- --FLAGS
- if flags.right then
- if processor.cc == 1 then
- processor.ax = processor.ax / 2
- elseif processor.cc == 2 then
- processor.bx = processor.bx / 2
- elseif processor.cc == 3 then
- processor.cx = processor.cx / 2
- else
- runTime()
- end
- flags.right = false
- runTime()
- elseif flags.left then
- if processor.cc == 1 then
- processor.ax = processor.ax * 2
- elseif processor.cc == 2 then
- processor.bx = processor.bx * 2
- elseif processor.cc == 3 then
- processor.cx = processor.cx * 2
- else
- runTime()
- end
- flags.left = false
- runTime()
- end
- end
- return
- end
- runTime()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement