1. the best method of left shifting is multiplication, so: -a+a (shift left by one byte) -a+a+a (shift left by two byte) etc
shifting 8, 16, 24, 32, 40 to left/rifht, etc is trivial, becouse you just read a byte forward-backward 2. right shift has to do with algorythm (i divide with pow(2, i)). 3. and/or/xor has to do with algorithm (i shift with one and check where the values will be negative and create the new bitfield as result and shifting that too).
the solution for 2 and 3 is my invention, but maybe alreday invented by someone else too, and maybe more optimal methods also invented previously.
also, more optimal methods should be exist (like having precalculated byte-tables) but i used algorithmic solutions to keep binary size smaller. i wrote the algorithmical solutions in C so i have no idea what subleq binary codes they compile to.
besides the very basic operations, i made everything with C algorithms
_________________ Operating system for SUBLEQ cpu architecture: http://users.atw.hu/gerigeri/DawnOS/download.html
|