delphi BYTE 转字符串

BYTE 转字符串

procedure TForm3.FormCreate(Sender: TObject);
begin
  Self.Paint;
end;

function ByteToHex(Src: Byte): String;
begin
  SetLength(Result, 2);
  asm
    MOV         EDI, [Result]
    MOV         EDI, [EDI]
    MOV         AL, Src
    MOV         AH, AL          // Save to AH
    SHR         AL, 4           // Output High 4 Bits
    ADD         AL, '0'
    CMP         AL, '9'
    JBE         @@OutCharLo
    ADD         AL, 'A'-'9'-1
@@OutCharLo:
    AND         AH, $f
    ADD         AH, '0'
    CMP         AH, '9'
    JBE         @@OutChar
    ADD         AH, 'A'-'9'-1
@@OutChar:
    STOSW
  end;
end;

你可能感兴趣的:(delphi BYTE 转字符串)