Changeset 11
- Timestamp:
- Apr 20, 2026, 11:55:57 PM (6 days ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
Core.pas (modified) (3 diffs)
-
Disassembler.pas (modified) (4 diffs)
-
Forms/FormCpu.lfm (modified) (1 diff)
-
Forms/FormCpu.pas (modified) (1 diff)
-
Forms/FormDisassembler.lfm (modified) (2 diffs)
-
Forms/FormDisassembler.pas (modified) (5 diffs)
-
Z80/Z80.pas (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Core.pas
r6 r11 51 51 private 52 52 LastPc: Word; 53 procedure DoChangePC(Address: Word); 53 54 public 54 55 FormMain: TFormMain; … … 180 181 FormDisassembler := TFormDisassembler.Create(nil); 181 182 FormDisassembler.Disassembler.Memory := SharpMz800.MappedMemory; 183 FormDisassembler.OnChangePC := DoChangePC; 182 184 SharpMz800.OnMemoryMappingChange := FormDisassembler.Disassemble; 183 185 end; … … 234 236 end; 235 237 238 procedure TCore.DoChangePC(Address: Word); 239 begin 240 SharpMz800.Cpu.PC := Address; 241 end; 242 236 243 procedure TCore.UpdateDisassemblerPos; 237 244 begin -
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; -
trunk/Forms/FormCpu.lfm
r2 r11 1 1 object FormCpu: TFormCpu 2 2 Left = 834 3 Height = 4383 Height = 657 4 4 Top = 501 5 Width = 4765 Width = 274 6 6 Caption = 'CPU' 7 ClientHeight = 4388 ClientWidth = 4767 ClientHeight = 657 8 ClientWidth = 274 9 9 DesignTimePPI = 144 10 LCLVersion = ' 2.2.6.0'10 LCLVersion = '4.6.0.0' 11 11 object GroupBox1: TGroupBox 12 12 Left = 22 13 Height = 37013 Height = 546 14 14 Top = 22 15 15 Width = 230 16 16 Caption = 'Registers' 17 ClientHeight = 34317 ClientHeight = 519 18 18 ClientWidth = 228 19 19 TabOrder = 0 20 20 object ValueListEditor1: TValueListEditor 21 21 Left = 16 22 Height = 32322 Height = 499 23 23 Top = 5 24 24 Width = 192 25 FixedCols = 025 Anchors = [akTop, akLeft, akRight, akBottom] 26 26 RowCount = 2 27 27 TabOrder = 0 -
trunk/Forms/FormCpu.pas
r9 r11 35 35 ValueListEditor1.Values['PC'] := IntToHex(Cpu.PC, 4); 36 36 ValueListEditor1.Values['SP'] := IntToHex(Cpu.SP, 4); 37 ValueListEditor1.Values['IX'] := IntToHex(Cpu.IX, 4); 38 ValueListEditor1.Values['IY'] := IntToHex(Cpu.IY, 4); 39 ValueListEditor1.Values['R'] := IntToHex(Cpu.RegR, 2); 40 ValueListEditor1.Values['I'] := IntToHex(Cpu.RegI, 2); 41 ValueListEditor1.Values['IM'] := IntToStr(Cpu.InterruptMode); 42 ValueListEditor1.Values['EI'] := IntToStr(Byte(Cpu.InterruptEnabled)); 43 ValueListEditor1.Values['Cycles'] := IntToStr(Cpu.Cycles); 37 44 ValueListEditor1.Values['Ticks'] := IntToStr(Cpu.Ticks); 38 45 end; -
trunk/Forms/FormDisassembler.lfm
r5 r11 34 34 item 35 35 Caption = 'Parameters' 36 Width = 691 36 Width = 100 37 end 38 item 39 Caption = 'Comment' 40 Width = 591 37 41 end> 38 42 OwnerData = True 43 PopupMenu = PopupMenu1 39 44 ReadOnly = True 40 45 RowSelect = True … … 43 48 OnData = ListView1Data 44 49 end 50 object PopupMenu1: TPopupMenu 51 Left = 433 52 Top = 343 53 object MenuItemSetAddress: TMenuItem 54 Caption = 'Set PC to address' 55 OnClick = MenuItemSetAddressClick 56 end 57 end 45 58 end -
trunk/Forms/FormDisassembler.pas
r6 r11 5 5 uses 6 6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, 7 ExtCtrls, Disassembler;7 ExtCtrls, Menus, Disassembler; 8 8 9 9 type 10 TChangePCEvent = procedure (Address: Word) of object; 10 11 11 12 { TFormDisassembler } … … 13 14 TFormDisassembler = class(TForm) 14 15 ListView1: TListView; 16 MenuItemSetAddress: TMenuItem; 17 PopupMenu1: TPopupMenu; 15 18 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 16 19 procedure FormCreate(Sender: TObject); … … 18 21 procedure FormShow(Sender: TObject); 19 22 procedure ListView1Data(Sender: TObject; Item: TListItem); 23 procedure MenuItemSetAddressClick(Sender: TObject); 24 private 25 FOnChangePC: TChangePCEvent; 26 procedure DoChangePC(Address: Word); 20 27 public 21 28 Disassembler: TDisassembler; … … 23 30 procedure SelectAddress(Address: Word); 24 31 procedure ReloadList; 32 property OnChangePC: TChangePCEvent read FOnChangePC write FOnChangePC; 25 33 end; 26 34 … … 64 72 Item.SubItems.Add(Name); 65 73 Item.SubItems.Add(Parameters); 74 Item.SubItems.Add(Comment); 66 75 end; 67 76 end; 68 77 69 procedure TFormDisassembler.Disassemble; 78 procedure TFormDisassembler.MenuItemSetAddressClick(Sender: TObject); 79 begin 80 if Assigned(ListView1.Selected) then begin 81 DoChangePC(TDecodedInstruction(ListView1.Selected.Data).Address); 82 SelectAddress(TDecodedInstruction(ListView1.Selected.Data).Address); 83 end; 84 end; 85 86 procedure TFormDisassembler.Disassemble(Sender: TObject); 70 87 begin 71 88 Disassembler.Disassemble; 72 89 ReloadList; 90 end; 91 92 procedure TFormDisassembler.DoChangePC(Address: Word); 93 begin 94 if Assigned(FOnChangePC) then FOnChangePC(Address); 73 95 end; 74 96 -
trunk/Z80/Z80.pas
r10 r11 818 818 Memory: TMemory; 819 819 Ticks: Cardinal; 820 Cycles: Cardinal; 820 821 InterruptEnabled: Boolean; 821 822 InterruptMode: Byte; … … 851 852 Cpu.Step; 852 853 if Cpu.DebugMode <> dmNone then begin 853 if Cpu.DebugMode = dmStepIn then Terminate;854 if (Cpu.DebugMode = dmStopAddress) and (Cpu.DebugStopAddress = Cpu.PC) then854 if Cpu.DebugMode = dmStepIn then begin 855 Cpu.DebugMode := dmNone; 855 856 Terminate; 856 Cpu.DebugMode := dmNone; 857 end; 858 if (Cpu.DebugMode = dmStopAddress) and (Cpu.DebugStopAddress = Cpu.PC) then begin 859 Cpu.DebugMode := dmNone; 860 Terminate; 861 end; 862 if Cpu.DebugMode = dmStepOver then begin 863 Cpu.DebugMode := dmNone; 864 Terminate; 865 end; 857 866 end; 858 867 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)