Category : Pascal Source Code
Archive   : ROTATE.ZIP
Filename : ROTATE.PAS

 
Output of file : ROTATE.PAS contained in archive : ROTATE.ZIP
Program Rotate;

(**************************************************************************

Written for John Mix by Bob Breeedlove.
Released to the public domain.
Compiled under turbo pascal 4.0.
Rotate bits in a byte.

**************************************************************************)


Var
Test,
Num, Rot : Byte;


Function RotateRight(i,r : Byte) : Byte;
Begin
Inline(
$8A/$8E/>R
/$8A/$AE/>I
/$D2/$CD { ror BYTE ch,cl}
/$88/$AE/>I { mov [>i [BP]],ch}
);
RotateRight := i;
end; { RotateRight }

FUNCTION RotateLeft(i,r : byte) : byte;
begin
Inline(
$8A/$8E/>R { mov cl,BYTE [>r [BP]]}
/$8A/$AE/>I { mov ch,BYTE [>i [BP]]}
/$D2/$C5 { rol BYTE ch,cl}
/$88/$AE/>I { mov [>i [BP]],ch}
);
RotateLeft := i;
end; { RotateLeft }

begin
writeLn('> ');
Num := 128; Rot := 6;
WriteLn(Num);
Test := RotateRight(Num,Rot);
writeln('R = ',Test);
WriteLn('L = ',RotateLeft(Test,Rot));
end.


  3 Responses to “Category : Pascal Source Code
Archive   : ROTATE.ZIP
Filename : ROTATE.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/