Changeset 11 for trunk/Disassembler.pas
- Timestamp:
- Apr 20, 2026, 11:55:57 PM (6 days ago)
- File:
-
- 1 edited
-
trunk/Disassembler.pas (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Disassembler.pas
r10 r11 16 16 Name: string; 17 17 Parameters: string; 18 Comment: string; 18 19 constructor Create; 19 20 procedure AddOpcode(Data: Byte); … … 41 42 end; 42 43 44 TComment = record 45 Address: Word; 46 Text: string; 47 end; 48 43 49 44 50 implementation 51 52 const 53 Comments: array[0..16] of TComment = ( 54 (Address: $6; Text: 'LETNL (Moves the cursor to the beginning of the next line.)'), 55 (Address: $c; Text: 'PRNTS (Display a space at the cursor position.)'), 56 (Address: $12; Text: 'PRNTS (Display a character.)'), 57 (Address: $15; Text: 'MSG (Displays a message.)'), 58 (Address: $30; Text: 'MELDY'), 59 (Address: $3e; Text: 'BELL'), 60 (Address: $41; Text: 'XTEMP (Sets the music tempo.)'), 61 (Address: $44; Text: 'MSTA (Generates a continuous sound of the specified frequency.)'), 62 (Address: $309; Text: 'Init 8253 counters.'), 63 (Address: $3da; Text: 'ASC (Loads the ASCII character.)'), 64 (Address: $3f9; Text: 'HEX (Converts the 8 data bits stored in the ACC into a hexadecimal number.)'), 65 (Address: $410; Text: 'HLHEX (Converts a string of 4 ASCII characters into a hexadecimal number and loads it in the HL register.)'), 66 (Address: $41f; Text: '2HEX (Converts a string of 2 ASCII characters into a hexadecimal number and loads it into the ACC.)'), 67 (Address: $73e; Text: 'Init 8255 PIO.'), 68 (Address: $e414; Text: 'Delay'), 69 (Address: $e800; Text: 'Cold start'), 70 (Address: $e813; Text: 'Base init.') 71 ); 72 73 function SearchComment(Address: Word): string; 74 var 75 I: Integer; 76 begin 77 I := 0; 78 while (I <= High(Comments)) and (Comments[I].Address <> Address) do Inc(I); 79 if I <= High(Comments) then Result := Comments[I].Text 80 else Result := ''; 81 end; 45 82 46 83 { TDecodedInstructions } … … 96 133 InstructionInfo: TInstructionInfo; 97 134 DecodedInstruction: TDecodedInstruction; 135 DestAddress: Longint; 98 136 begin 99 137 Memory.Position := 0; … … 180 218 end; 181 219 end; 220 221 DecodedInstruction.Comment := SearchComment(DecodedInstruction.Address); 222 if DecodedInstruction.Comment = '' then begin 223 if DecodedInstruction.Name = 'JP' then 224 if TryStrToInt('$' + DecodedInstruction.Parameters, DestAddress) then begin 225 DecodedInstruction.Comment := SearchComment(DestAddress); 226 if DecodedInstruction.Comment <> '' then DecodedInstruction.Comment := 'Jump to ' + DecodedInstruction.Comment; 227 end; 228 if DecodedInstruction.Name = 'CALL' then 229 if TryStrToInt('$' + DecodedInstruction.Parameters, DestAddress) then begin 230 DecodedInstruction.Comment := SearchComment(DestAddress); 231 if DecodedInstruction.Comment <> '' then DecodedInstruction.Comment := 'Call to ' + DecodedInstruction.Comment; 232 end; 233 end; 182 234 DecodedInstructions.Add(DecodedInstruction); 183 235 end;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/mzxemu/chrome/site/your_project_logo.png)