Changeset 185 for branches/virtualcpu4/UDisassembler.pas
- Timestamp:
- May 1, 2019, 9:48:46 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/virtualcpu4/UDisassembler.pas
r184 r185 29 29 30 30 implementation 31 32 const33 SignText: array[TValueSign] of string = ('-', '', '+');34 35 function SignedIntToHex(Value: Int64; Digits: Byte): string;36 begin37 Result := SignText[Sign(Value)] + IntToHex(Abs(Value), Digits);38 end;39 31 40 32 { TDisassembler } … … 84 76 Data := ReadData; 85 77 Line.Opcode := Line.Opcode + ' ' + IntToHex(Data, BitWidthBytes[DataSize] * 2); 86 Line.Instruction := Line.Instruction + ' $' + IntToHex(Data, BitWidthBytes[DataSize] * 2);78 Line.Instruction := Line.Instruction + ' ' + IntToHexEx(Data, -1, '$'); 87 79 end; 88 80 prAddr: begin 89 81 Address := ReadAddress; 90 82 Line.Opcode := Line.Opcode + ' ' + IntToHex(Address, BitWidthBytes[AddrSize] * 2); 91 Line.Instruction := Line.Instruction + ' $' + IntToHex(Address, BitWidthBytes[AddrSize] * 2);83 Line.Instruction := Line.Instruction + ' ' + IntToHexEx(Address, -1, '$'); 92 84 end; 93 85 prAddrRel: begin 94 86 AddressRel := ReadAddressSigned; 95 Line.Opcode := Line.Opcode + ' ' + IntToHex (QWord(AddressRel), BitWidthBytes[AddrSize] * 2);96 Line.Instruction := Line.Instruction + ' $' + SignedIntToHex(AddressRel, BitWidthBytes[AddrSize] * 2);87 Line.Opcode := Line.Opcode + ' ' + IntToHexEx(QWord(AddressRel), BitWidthBytes[AddrSize] * 2); 88 Line.Instruction := Line.Instruction + ' ' + IntToHexEx(AddressRel, -1, '$'); 97 89 end; 98 90 end; … … 105 97 prData: begin 106 98 Data := ReadData; 107 Line.Opcode := Line.Opcode + ' ' + IntToHex (Data, BitWidthBytes[DataSize] * 2);108 Line.Instruction := Line.Instruction + ', $' + IntToHex(Data, BitWidthBytes[DataSize] * 2);99 Line.Opcode := Line.Opcode + ' ' + IntToHexEx(Data, BitWidthBytes[DataSize] * 2); 100 Line.Instruction := Line.Instruction + ', ' + IntToHexEx(Data, -1, '$'); 109 101 end; 110 102 prAddr: begin 111 103 Address := ReadAddress; 112 104 Line.Opcode := Line.Opcode + ' ' + IntToHex(Address, BitWidthBytes[AddrSize] * 2); 113 Line.Instruction := Line.Instruction + ', $' + IntToHex(Address, BitWidthBytes[AddrSize] * 2);105 Line.Instruction := Line.Instruction + ', ' + IntToHexEx(Address, -1, '$'); 114 106 end; 115 107 prAddrRel: begin 116 108 AddressRel := ReadAddressSigned; 117 Line.Opcode := Line.Opcode + ' ' + IntToHex( AddressRel, BitWidthBytes[AddrSize] * 2);118 Line.Instruction := Line.Instruction + ', $' + SignedIntToHex(AddressRel, BitWidthBytes[AddrSize] * 2);109 Line.Opcode := Line.Opcode + ' ' + IntToHex(QWord(AddressRel), BitWidthBytes[AddrSize] * 2); 110 Line.Instruction := Line.Instruction + ', ' + IntToHexEx(AddressRel, -1, '$'); 119 111 end; 120 112 end; … … 128 120 Data := ReadData; 129 121 Line.Opcode := Line.Opcode + ' ' + IntToHex(Data, BitWidthBytes[DataSize] * 2); 130 Line.Instruction := Line.Instruction + ', $' + IntToHex(Data, BitWidthBytes[DataSize] * 2);122 Line.Instruction := Line.Instruction + ', ' + IntToHexEx(Data, -1, '$'); 131 123 end; 132 124 prAddr: begin 133 125 Address := ReadAddress; 134 126 Line.Opcode := Line.Opcode + ' ' + IntToHex(Address, BitWidthBytes[AddrSize] * 2); 135 Line.Instruction := Line.Instruction + ', $' + IntToHex(Address, BitWidthBytes[AddrSize] * 2);127 Line.Instruction := Line.Instruction + ', ' + IntToHexEx(Address, -1, '$'); 136 128 end; 137 129 prAddrRel: begin 138 130 AddressRel := ReadAddressSigned; 139 131 Line.Opcode := Line.Opcode + ' ' + IntToHex(QWord(AddressRel), BitWidthBytes[AddrSize] * 2); 140 Line.Instruction := Line.Instruction + ', $' + SignedIntToHex(AddressRel, BitWidthBytes[AddrSize] * 2);132 Line.Instruction := Line.Instruction + ', ' + IntToHexEx(AddressRel, -1, '$'); 141 133 end; 142 134 end; 143 135 Output.Add(Line); 136 if not Prefix then begin 137 DataSize := DataSizeBase; 138 AddrSize := AddrSizeBase; 139 end; 144 140 end else begin 145 141 {Line := TDisassemblerLine.Create; … … 149 145 Output.Add(Line); 150 146 } 151 end;152 if not Prefix then begin153 DataSize := DataSizeBase;154 AddrSize := AddrSizeBase;155 147 end; 156 148 end;
Note:
See TracChangeset
for help on using the changeset viewer.