
Originally Posted by
sukasa
Ah. Well, I look at them and see a great way to make location-independant code without having to mess with using CS or LS or any sort of 'you are here' register. If everything's relative, then it makes maintaining code just that much easier.
You should mess with CS/LS registers, they are "you are here" registers. That's why they exist.
This code will properly run independantly on it's location:
Code:
myloop:
inc CS:#nice_variable; //offset relative to current code execution base
jmp myloop; //offset relative to current code execution base
alloc nice_variable;
To call this code from address 123456 in RAM you do this:
To return from that code you do:
Bookmarks