Hello, I think these two functions will come in very handy to solving the "write longword bits" problem. ShiftLeft( Left, Right, Shift ) ShiftRight( Right, Left, Shift ) Shifting with extra inputs is what is required to solve it nicely. // Begin of Code *** program Project1; {$APPTYPE CONSOLE} { Skybuck presents ShiftLeft( Left, Right, Shift ) and ShiftRight( Right, Left, Shift ) version 0.01 created on 5 may 2008 by Skybuck Flying. Be carefull though, the shift parameter must be 0 to 31. } uses SysUtils; // make overloaded versions for easy coding // display in big endian. procedure WriteBitPattern( const ParaByte : byte ); overload; type TbitRange = 0..7; TbitSet = set of TbitRange; var vBit : TbitRange; begin for vBit:= 0 to 7 do begin if vBit in TbitSet(ParaByte) then begin write('1'); end else begin write('0'); end; end; end; procedure WriteBitPattern( const ParaWord : word ); overload; type TbitRange = 0..15; TbitSet = set of TbitRange; var vBit : TbitRange; begin for vBit:= 0 to 15 do begin if vBit in TbitSet(ParaWord) then begin write('1'); end else begin write('0'); end; end; end; procedure WriteBitPattern( const ParaLongWord : longword ); overload; type TbitRange = 0..31; TbitSet = set of TbitRange; var vBit : TbitRange; begin for vBit:= 0 to 31 do begin if vBit in TbitSet(ParaLongWord) then begin write('1'); end else begin write('0'); end; end; end; function ShiftLeft( Left : longword; Right : Longword; Shift : longword ) : longword; asm shld eax, edx, cl end; function ShiftRight( Right : longword; Left : longword; Shift : longword ) : longword; asm shrd eax, edx, cl end; procedure Main; var vLeft : longword; vRight : longword; vShift : longword; vResult : longword; begin writeln('program started'); for vShift := 0 to 31 do begin vLeft := 0; vRight := 1 + 0 + 8 + 0 + 32 + 2147483648; vResult := ShiftLeft( vLeft, vRight, vShift ); Writeln( 'ShiftLeft vLeft: ', vLeft, ' vRight: ', vRight, ' vResult: ', vResult ); WriteBitPattern( vLeft ); write( ' ' ); WriteBitPattern( vRight ); write( ' ' ); WriteBitPattern( vResult ); writeln; Writeln; end; for vShift := 0 to 31 do begin vLeft := 1 + 0 + 8 + 0 + 32 + 2147483648; vRight := 0; vResult := ShiftRight( vRight, vLeft, vShift ); Writeln( 'ShiftRight vRight: ', vRight, ' vLeft: ', vLeft, ' vResult: ', vResult ); WriteBitPattern( vRight ); write( ' ' ); WriteBitPattern( vLeft ); write( ' ' ); WriteBitPattern( vResult ); writeln; Writeln; end; writeln('program finished'); end; begin try Main; except on E:Exception do Writeln(E.Classname, ': ', E.Message); end; readln; end. // *** End of Code *** Bye, Skybuck.