I'm in need of a little help.
Code: Select all
RotateHMKright ;bitwise rotate HMK array
rrf HMK+0 ,F ;a faster way thanx Potter :)
rrf HMK+1 ,F ;
rrf HMK+2 ,F ;went back to rotating right x 79
rrf HMK+3 ,F ;for rotating left to save ten words
rrf HMK+4 ,F ;
rrf HMK+5 ,F ;
rrf HMK+6 ,F ;
rrf HMK+7 ,F ;
rrf HMK+8 ,F ;
rrf HMK+9 ,F ;
bcf HMK+0 ,7 ;preclear MSB
btfsc status ,C ;check carry bit
bsf HMK+0 ,7 ;set MSB
return ;or return
The routine carries the right most bit to the left most bit of the next
byte, etc. so that if you rotated a 10 byte array 80 times you would end
up with the same values in each byte of the array as you started with,
and if you rotated right 79 times, you would have the same result as
rotating left only once.
I would be happy to find a way to do this in C for rthe PSP since it would
help me improve a lot of verbose routines that I have.
Cheers, Art.
ps. the rrf instructions weren't in an For...Next type loop because it had
to execute as fast as possible.