Saturday, 8 March 2008

Sign

Calculates the sign of location's b-field, returning -1, 0 or 1.
sign      jmz.b  done,           location
slt.b location, #1+CORESIZE/2
mov.ab #-1, location
seq.ab #-1, location
mov.ab #1, location
done

3 comments:

Roy said...

sign jmz.b done , location
div #1+CORESIZE/2 , location
sub.ab >location , location
done

Roy said...

The code above only works when the location is like this:

location dat 0 , 4001
sign jmz.b done , location
div #1+CORESIZE/2 , location
sub.ab >location , location
done
end sign

Else you would probably need one more line...

Roy said...

Adding one line will make the placement of location free.

sign jmz.b done , location
div #1+CORESIZE/2 , location
mul.ab #-2 , location
nop >location
done