Can someone please explain how to use argument registers??
and why I would use it over a normal register?
Can someone please explain how to use argument registers??
and why I would use it over a normal register?
Never mind, I see how they work.
Questions though.
Can you only have 1 argument per program?
Argument registers work only one layer deep. So for calling a program you can do the follow
;Call programname(1,5)
This puts a 1 in argument register 1 and 5 in argument register 2
inside the program "programname" you can use this to control jump labels or what you desire to use it to do. For instance.
;if (AR(1)=2) jump 1
;if (AR(2)=5) jump 3
;lbl [1]
;"task"
;jmp lbl [999]
;lbl [3]
;'task'
;jmp lbl [999]
;lbl [999]
So in summary an argument register works as a normal register but when you either finish the program or call a different program the register is cleared.
Never mind, I see how they work.
Questions though.
Can you only have 1 argument per program?
you can have multiple I am not sure out to how many though. just if it calls another program or leaves the current program that you are in it will clear the argument registers
I just made a quick program on a R30iB tested out to 30 argument registers. then it would not let me add anymore
Great, thanks for replies. Only problem now is the RJ3 controller can't do "If (...)"
But you can do JUMP LBL[AR[1]]
Could also (I would think) at the top of your program use R[?]=AR[?] then use the R[?] inside the if statement. that would allow you also to not have to worry about losing the argument register if you go another layer deep inside your programs. I would have a House Keeping program that resents the registers in your main program though. like at the beginning and end. Just incase someone tries to run through a sub program it won't have something already in the register.
You need to be a member in order to leave a comment